本文整理汇总了C++中TH2D::GetBinCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ TH2D::GetBinCenter方法的具体用法?C++ TH2D::GetBinCenter怎么用?C++ TH2D::GetBinCenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH2D
的用法示例。
在下文中一共展示了TH2D::GetBinCenter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExtractOutputHistos
//.........这里部分代码省略.........
hAllFound->Draw("same"); // MC pt distribution
}
/*
.L ~/ITSupgrade/BuildDetector/DetectorK.cxx+
// All NEW
DetectorK its("ALICE","ITS");
its.MakeAliceAllNew(0);
its.SetMaxRadiusOfSlowDetectors(0.01);
its.SolveViaBilloir(0);
TGraph *c = its.GetGraphRecoEfficiency(0,3,2);
c->Draw("C");
// Current
DetectorK its("ALICE","ITS");
its.MakeAliceCurrent(0,0);
its.SetMaxRadiusOfSlowDetectors(0.01);
its.SolveViaBilloir(0);
TGraph *c = its.GetGraphRecoEfficiency(0,4,2);
c->Draw("C");
*/
TCanvas *c3 = new TCanvas("c3","impact");//,200,10,900,900);
c3->Divide(2,1); c3->cd(1);
// Impact parameter
// Impact parameter resolution ---------------
h2Ddca->Draw("colz");
h2Ddca->FitSlicesY() ;
TH2D *dcaM = (TH2D*)gDirectory->Get("dca2D_1"); dcaM->Draw("same");
TH2D *dcaRMS = (TH2D*)gDirectory->Get("dca2D_2"); //dcaRMS->Draw();
TGraphErrors *d0 = new TGraphErrors();
for (Int_t ibin =1; ibin<=dcaRMS->GetXaxis()->GetNbins(); ibin++) {
d0->SetPoint( ibin-1,dcaRMS->GetBinCenter(ibin),dcaRMS->GetBinContent(ibin)*1e4); // microns
d0->SetPointError(ibin-1,0,dcaRMS->GetBinError(ibin)*1e4); // microns
}
d0->SetMarkerStyle(21);
d0->SetMaximum(200); d0->SetMinimum(0);
d0->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
d0->GetYaxis()->SetTitle("R-#phi Pointing Resolution (#mum)");
d0->SetName("dca"); d0->SetTitle("DCAvsPt");
c3->cd(1); h2Ddca->Draw("surf2");
c3->cd(2); d0->Draw("APE");
// PT RESOLUTION ------------
TCanvas *c4 = new TCanvas("c4","pt resolution");//,200,10,900,900);
c4->Divide(2,1); c4->cd(1);
// Impact parameter
h2Dpt->Draw("colz");
h2Dpt->FitSlicesY() ;
TH2D *dPtM = (TH2D*)gDirectory->Get("dPt2D_1"); dPtM->Draw("same");
TH2D *dPtRMS = (TH2D*)gDirectory->Get("dPt2D_2"); // dPtRMS->Draw("");
TGraphErrors *gPt = new TGraphErrors();
for (Int_t ibin =1; ibin<=dPtRMS->GetXaxis()->GetNbins(); ibin++) {
gPt->SetPoint( ibin-1,dPtRMS->GetBinCenter(ibin),dPtRMS->GetBinContent(ibin));
gPt->SetPointError(ibin-1,0,dPtRMS->GetBinError(ibin));
}
gPt->SetMarkerStyle(21);
gPt->SetMaximum(20); gPt->SetMinimum(0);
gPt->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
gPt->GetYaxis()->SetTitle("relative momentum resolution (%)");
gPt->SetName("dPt"); gPt->SetTitle("DPTvsPt");
c4->cd(1); h2Dpt->Draw("surf2");
c4->cd(2); gPt->Draw("APE");
// EXPORT --------
TFile f("histos.root","RECREATE");
hMultCount->Write();
hAllMC->Write();
hAllFound->Write();
hImperfect->Write();
hPerfect->Write();
hNoMCTrack->Write();
hPurity->Write();
hEff->Write();
hFake->Write();
hAnna->Write();
h2Ddca->Write();
d0->Write();
h2Dpt->Write();
gPt->Write();
f.Close();
return;
}
示例2: plotMerged
void plotMerged(Bool_t onlyPlot=0) {
gStyle->SetPalette(1);
TFile f("histoSum.root","UPDATE");
TH1F* hAllMC = f.Get("allMC");
TH1F* hAllFound= f.Get("allFound");
TH1F* hImperfect= f.Get("imperfect");
TH1F* hPerfect= f.Get("perfect");
TH1F* hNoMCTrack= f.Get("noMCtrack");
// have to be recalculated
TH1F* hPurity = f.Get("purity");
TH1F* hEff= f.Get("efficiency");
TH1F* hFake= f.Get("fake");
TH1F* hAnna= f.Get("annaEff");
TH2D* h2Ddca= f.Get("dca2D");
TGraphErrors *d0= f.Get("dca");
TH2D* h2Dpt= f.Get("dPt2D");
TGraphErrors *gPt= f.Get("dPt");
if (!onlyPlot) {
/* // Get Errors right
hAllMC->Sumw2();
hAllFound->Sumw2();
hPerfect->Sumw2();
hImperfect->Sumw2();
h2Dpt->Sumw2();
h2Ddca->Sumw2();
*/
// Efficiencies - and normalize to 100%
TF1 f1("f1","100+x*0",0.,1.e3);
hPurity->Divide(hPerfect,hAllFound,1,1,"b");
hPurity->Multiply(&f1);
hPurity->SetMarkerColor(kGreen);
hPurity->SetMarkerStyle(21);
hPurity->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hPurity->SetStats(0);
hPurity->GetYaxis()->SetRangeUser(0,100);
hPurity->SetTitle("Efficiency & Purity");
hEff->Divide(hPerfect,hAllMC,1,1,"b");
hEff->Multiply(&f1);
hEff->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hEff->SetMarkerColor(kBlue);
hEff->SetMarkerStyle(21);
hEff->SetStats(0);
hFake->Divide(hImperfect,hAllMC,1,1,"b");
hFake->Multiply(&f1);
hFake->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hFake->SetMarkerColor(kRed);
hFake->SetMarkerStyle(21);
hFake->SetStats(0);
hAnna->Divide(hAllFound,hAllMC,1,1,"b");
hAnna->Multiply(&f1);
hAnna->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hAnna->SetMarkerColor(kBlack);
hAnna->SetMarkerStyle(21);
hAnna->SetStats(0);
// Impact parameter resolution ---------------
TCanvas *c3 = new TCanvas("c3","impact");//,200,10,900,900);
c3->Divide(2,1); c3->cd(1);
h2Ddca->DrawCopy("colz");
h2Ddca->FitSlicesY() ;
TH2D *dcaM = (TH2D*)gDirectory->Get("dca2D_1"); dcaM->Draw("same");
TH2D *dcaRMS = (TH2D*)gDirectory->Get("dca2D_2"); //dcaRMS->Draw();
TGraphErrors *d0 = new TGraphErrors();
for (Int_t ibin =1; ibin<=dcaRMS->GetXaxis()->GetNbins(); ibin++) {
d0->SetPoint( ibin-1,dcaRMS->GetBinCenter(ibin),dcaRMS->GetBinContent(ibin)*1e4); // microns
d0->SetPointError(ibin-1,0,dcaRMS->GetBinError(ibin)*1e4); // microns
}
d0->SetMarkerStyle(21);
d0->SetMaximum(200); d0->SetMinimum(0);
d0->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
d0->GetYaxis()->SetTitle("R-#phi Pointing Resolution (#mum)");
d0->SetName("dca"); d0->SetTitle("DCAvsPt");
// c3->cd(1); h2Ddca->Draw("surf2");
c3->cd(2); d0->Draw("APE");
// PT RESOLUTION ------------
TCanvas *c4 = new TCanvas("c4","pt resolution");//,200,10,900,900);
c4->Divide(2,1); c4->cd(1);
h2Dpt->DrawCopy("colz");
h2Dpt->FitSlicesY() ;
TH2D *dPtM = (TH2D*)gDirectory->Get("dPt2D_1"); dPtM->Draw("same");
TH2D *dPtRMS = (TH2D*)gDirectory->Get("dPt2D_2"); // dPtRMS->Draw("");
TGraphErrors *gPt = new TGraphErrors();
//.........这里部分代码省略.........