9 Int_t fShowStation1 = 0;
10 Int_t fShowStation2 = 4;
11 Int_t nofStations = 6;
13 TFile*
inFile =
new TFile(inFileName.Data());
14 TH1F* fhMCAllVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hMCAllVsP");
15 TH1F* fhMCAccVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hMCAccVsP");
16 TH1F* fhMCPrimVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hMCPrimVsP");
17 TH1F* fhMCSecVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hMCSecVsP");
18 TH1F* fhMCRefVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hMCRefVsP");
19 TH1F* fhRecoAccVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hRecoAccVsP");
20 TH1F* fhRecoPrimVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hRecoPrimVsP");
21 TH1F* fhRecoSecVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hRecoSecVsP");
22 TH1F* fhRecoRefVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hRecoRefVsP");
24 TH1F* fhEffAccVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffAccVsP");
25 TH1F* fhEffPrimVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffPrimVsP");
26 TH1F* fhEffSecVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffSecVsP");
27 TH1F* fhEffRefVsP = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffRefVsP");
28 TH1F* fhEffAccVsT = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffAccVsT");
29 TH1F* fhEffPrimVsT = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffPrimVsT");
30 TH1F* fhEffSecVsT = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffSecVsT");
31 TH1F* fhEffRefVsT = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffRefVsT");
32 TH1F* fhEffAccVsN = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffAccVsN");
33 TH1F* fhEffPrimVsN = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffPrimVsN");
34 TH1F* fhEffSecVsN = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffSecVsN");
35 TH1F* fhEffRefVsN = (TH1F*)inFile->Get(
"GemTrackFinderQA/hEffRefVsN");
37 TH2F* fhMomResAccVsP = (TH2F*)inFile->Get(
"GemTrackFinderQA/hMomResAccVsP");
38 TH2F* fhMomResPrimVsP = (TH2F*)inFile->Get(
"GemTrackFinderQA/hMomResPrimVsP");
39 TH2F* fhMomResSecVsP = (TH2F*)inFile->Get(
"GemTrackFinderQA/hMomResSecVsP");
40 TH2F* fhMomResRefVsP = (TH2F*)inFile->Get(
"GemTrackFinderQA/hMomResRefVsP");
41 TH2F* fhMomResAccVsT = (TH2F*)inFile->Get(
"GemTrackFinderQA/hMomResAccVsT");
42 TH2F* fhMomResPrimVsT = (TH2F*)inFile->Get(
"GemTrackFinderQA/hMomResPrimVsT");
43 TH2F* fhMomResSecVsT = (TH2F*)inFile->Get(
"GemTrackFinderQA/hMomResSecVsT");
44 TH2F* fhMomResRefVsT = (TH2F*)inFile->Get(
"GemTrackFinderQA/hMomResRefVsT");
46 TH1F* fhNofMCTracksPerEvent = (TH1F*)inFile->Get(
"GemTrackFinderQA/hNofMCTracksPerEvent");
48 TH1F* fhNofHitsPerRecoTrack = (TH1F*)inFile->Get(
"GemTrackFinderQA/hNofHitsPerRecoTrack");
49 TH1F* fhNofCorrHitsPerRecoTrack = (TH1F*)inFile->Get(
"GemTrackFinderQA/hNofCorrHitsPerRecoTrack");
50 TH1F* fhNofNoTrHitsPerRecoTrack = (TH1F*)inFile->Get(
"GemTrackFinderQA/hNofNoTrHitsPerRecoTrack");
51 TH1F* fhNofOthTHitsPerRecoTrack = (TH1F*)inFile->Get(
"GemTrackFinderQA/hNofOthTHitsPerRecoTrack");
52 TH1F* fhNofHitsPerGhost = (TH1F*)inFile->Get(
"GemTrackFinderQA/hNofHitsPerGhost");
53 TH1F* fhNofHitsPerClone = (TH1F*)inFile->Get(
"GemTrackFinderQA/hNofHitsPerClone");
55 TCanvas* recoCanvas =
new TCanvas(
"GemTrackFinderQACanvas",
"Gem Track Finder QA",10,10,1200,800);
58 recoPad[0] =
new TPad(
"titlePad",
"Title pad" ,0.00,0.90,1.00,1.00);
59 recoPad[1] =
new TPad(
"efficiencyPPad",
"Efficiency P pad" ,0.00,0.45,0.33,0.90);
60 recoPad[2] =
new TPad(
"efficiencyTPad",
"Efficiency T pad" ,0.33,0.45,0.67,0.90);
61 recoPad[3] =
new TPad(
"efficiencyNPad",
"Efficiency N pad" ,0.67,0.45,1.00,0.90);
63 recoPad[4] =
new TPad(
"resolutionPad",
"Momentum resolution pad" ,0.00,0.00,0.33,0.45);
65 recoPad[5] =
new TPad(
"hitsOfTrackPad",
"Hits of track pad" ,0.33,0.00,0.67,0.45);
66 recoPad[6] =
new TPad(
"summaryPad",
"Summary pad" ,0.67,0.00,1.00,0.45);
68 for ( Int_t ipad = 0 ; ipad < 7 ; ipad++ ) {
69 recoPad[ipad]->SetFillColor(0);
70 recoPad[ipad]->SetBorderMode(0);
71 recoPad[ipad]->Draw();
75 TLegend* brp =
new TLegend(0.1,0.1,0.9,0.9,
"Gem Track Finder QA");
76 brp->SetTextAlign(22);
77 brp->SetTextSize(0.6);
79 brp->SetBorderSize(0);
87 fhEffAccVsP->SetAxisRange(0.,110.,
"Y");
88 fhEffAccVsP->SetLineWidth(2);
89 fhEffAccVsP->SetLineColor(1);
90 fhEffAccVsP->SetTitle(
"Efficiency vs momentum");
91 fhEffAccVsP->GetYaxis()->SetTitle(
"efficiency [%]");
92 fhEffAccVsP->Draw(
"pe");
93 fhEffPrimVsP->SetLineWidth(2);
94 fhEffPrimVsP->SetLineColor(2);
95 fhEffPrimVsP->Draw(
"pesame");
96 fhEffRefVsP->SetLineWidth(2);
97 fhEffRefVsP->SetLineColor(6);
98 fhEffRefVsP->Draw(
"pesame");
99 fhEffSecVsP->SetLineWidth(2);
100 fhEffSecVsP->SetLineColor(4);
101 fhEffSecVsP->Draw(
"pesame");
102 TLegend* effLeg =
new TLegend(0.2,0.15,0.5,0.3);
103 effLeg->SetBorderSize(0);
104 effLeg->SetFillColor(0);
105 effLeg->AddEntry(fhEffRefVsP,
"reference",
"pl");
106 effLeg->AddEntry(fhEffPrimVsP,
"primaries",
"pl");
107 effLeg->AddEntry(fhEffAccVsP,
"all" ,
"pl");
108 effLeg->AddEntry(fhEffSecVsP,
"secondaries" ,
"pl");
110 TLine* oneLine =
new TLine(0.0,100.0,10.0,100.0);
111 oneLine->SetLineStyle(2);
113 recoPad[1]->Update();
118 fhEffAccVsT->SetAxisRange(0.,110.,
"Y");
119 fhEffAccVsT->SetLineWidth(2);
120 fhEffAccVsT->SetLineColor(1);
121 fhEffAccVsT->SetTitle(
"Efficiency vs theta");
122 fhEffAccVsT->GetYaxis()->SetTitle(
"efficiency [%]");
123 fhEffAccVsT->Draw(
"pe");
124 fhEffPrimVsT->SetAxisRange(0.,110.,
"Y");
125 fhEffPrimVsT->SetLineWidth(2);
126 fhEffPrimVsT->SetLineColor(2);
127 fhEffPrimVsT->Draw(
"pesame");
128 fhEffRefVsT->SetLineWidth(2);
129 fhEffRefVsT->SetLineColor(6);
130 fhEffRefVsT->Draw(
"pesame");
131 fhEffSecVsT->SetLineWidth(2);
132 fhEffSecVsT->SetLineColor(4);
133 fhEffSecVsT->Draw(
"pesame");
134 TLegend* effLeg =
new TLegend(0.6,0.4,0.9,0.6);
135 effLeg->SetBorderSize(0);
136 effLeg->SetFillColor(0);
137 effLeg->AddEntry(fhEffRefVsT,
"reference",
"pl");
138 effLeg->AddEntry(fhEffPrimVsT,
"primaries",
"pl");
139 effLeg->AddEntry(fhEffAccVsT,
"all" ,
"pl");
140 effLeg->AddEntry(fhEffSecVsT,
"secondaries" ,
"pl");
142 TLine* oneLine =
new TLine(0.0,100.0,40.0,100.0);
143 oneLine->SetLineStyle(2);
145 recoPad[2]->Update();
150 Int_t lastNotEmptyBin = fhEffAccVsN->GetNbinsX();
151 while ( fhEffAccVsN->GetBinContent(lastNotEmptyBin) == 0 )
153 fhEffAccVsN->SetAxisRange(-0.5,1.2*lastNotEmptyBin,
"X");
154 fhEffAccVsN->SetAxisRange(0.,110.,
"Y");
155 fhEffAccVsN->SetLineWidth(2);
156 fhEffAccVsN->SetLineColor(1);
157 fhEffAccVsN->SetTitle(
"Efficiency vs nof points");
158 fhEffAccVsN->GetYaxis()->SetTitle(
"efficiency [%]");
159 fhEffAccVsN->Draw(
"pe");
160 fhEffPrimVsN->SetAxisRange(0.,110.,
"Y");
161 fhEffPrimVsN->SetLineWidth(2);
162 fhEffPrimVsN->SetLineColor(2);
163 fhEffPrimVsN->Draw(
"pesame");
164 fhEffRefVsN->SetLineWidth(2);
165 fhEffRefVsN->SetLineColor(6);
166 fhEffRefVsN->Draw(
"pesame");
167 fhEffSecVsN->SetLineWidth(2);
168 fhEffSecVsN->SetLineColor(4);
169 fhEffSecVsN->Draw(
"pesame");
170 TLegend* effLeg =
new TLegend(0.1,0.7,0.4,0.9);
171 effLeg->SetBorderSize(0);
172 effLeg->SetFillColor(0);
173 effLeg->AddEntry(fhEffRefVsN,
"reference",
"pl");
174 effLeg->AddEntry(fhEffPrimVsN,
"primaries",
"pl");
175 effLeg->AddEntry(fhEffAccVsN,
"all" ,
"pl");
176 effLeg->AddEntry(fhEffSecVsN,
"secondaries" ,
"pl");
178 TLine* oneLine =
new TLine(0.0,100.0,40.0,100.0);
179 oneLine->SetLineStyle(2);
181 recoPad[1]->Update();
184 fhMomResPrimVsP->SetAxisRange(-10.,10.,
"Y");
185 fhMomResPrimVsP->GetYaxis()->SetTitle(
"#delta{p}/p [%]");
186 fhMomResPrimVsP->Draw(
"cont0");
187 TH1F* fhLowBand =
new TH1F(
"fhLowBand",
"Low Band",
188 fhMomResPrimVsP->GetXaxis()->GetNbins(),
189 fhMomResPrimVsP->GetXaxis()->GetXmin(),
190 fhMomResPrimVsP->GetXaxis()->GetXmax());
191 TH1F* fhHigBand =
new TH1F(
"fhHigBand",
"Hig Band",
192 fhMomResPrimVsP->GetXaxis()->GetNbins(),
193 fhMomResPrimVsP->GetXaxis()->GetXmin(),
194 fhMomResPrimVsP->GetXaxis()->GetXmax());
195 TH1F* fhMomResB =
new TH1F(
"fhMomResB",
"Momentum resolution",
196 fhMomResPrimVsP->GetXaxis()->GetNbins(),
197 fhMomResPrimVsP->GetXaxis()->GetXmin(),
198 fhMomResPrimVsP->GetXaxis()->GetXmax());
199 for ( Int_t ibin = fhMomResPrimVsP->GetXaxis()->GetNbins() ; ibin > 1 ; ibin-- ) {
200 TF1* gausFit =
new TF1(
"gausFit",
"gaus");
201 TH1F* tempProjY = (TH1F*)fhMomResPrimVsP->ProjectionY(
"tempProjY",ibin,ibin);
202 tempProjY->Fit(
"gausFit",
"QN",
"",-5.,5.);
203 fhLowBand->SetBinContent(ibin,gausFit->GetParameter(1)-gausFit->GetParameter(2));
204 fhLowBand->SetBinError(ibin,0.01);
205 fhHigBand->SetBinContent(ibin,gausFit->GetParameter(1)+gausFit->GetParameter(2));
206 fhHigBand->SetBinError(ibin,0.01);
207 fhMomResB->SetBinContent(ibin,gausFit->GetParameter(2));
208 fhMomResB->SetBinError(ibin,0.01);
210 fhLowBand->SetLineWidth(2);
211 fhHigBand->SetLineWidth(2);
212 fhLowBand->Draw(
"Psame");
213 fhHigBand->Draw(
"Psame");
214 fhMomResB->SetLineWidth(2);
215 fhMomResB->SetLineColor(2);
216 fhMomResB->Draw(
"Csame");
217 recoPad[4]->Update();
247 Int_t lastNotEmptyBin = fhNofHitsPerRecoTrack->GetNbinsX();
248 while ( fhNofHitsPerRecoTrack->GetBinContent(lastNotEmptyBin) == 0 )
251 fhNofHitsPerRecoTrack->SetAxisRange(-0.5,1.2*lastNotEmptyBin,
"X");
252 fhNofHitsPerRecoTrack->Draw();
253 fhNofCorrHitsPerRecoTrack->SetLineColor(3);
254 fhNofCorrHitsPerRecoTrack->Draw(
"same");
255 fhNofNoTrHitsPerRecoTrack->SetLineColor(4);
256 fhNofNoTrHitsPerRecoTrack->Draw(
"same");
257 fhNofOthTHitsPerRecoTrack->SetLineColor(2);
258 fhNofOthTHitsPerRecoTrack->Draw(
"same");
259 TLegend* nhptLeg =
new TLegend(0.25,0.65,0.6,0.85);
260 nhptLeg->SetBorderSize(0);
261 nhptLeg->SetFillColor(0);
262 nhptLeg->AddEntry(fhNofHitsPerRecoTrack,
"all hits",
"l");
263 nhptLeg->AddEntry(fhNofCorrHitsPerRecoTrack,
"mc(hit)=mc(track)",
"l");
264 nhptLeg->AddEntry(fhNofNoTrHitsPerRecoTrack,
"mc(hit)=-1",
"l");
265 nhptLeg->AddEntry(fhNofOthTHitsPerRecoTrack,
"mc(hit)=mc(!track)",
"l");
267 recoPad[5]->Update();
269 Int_t fNofEvents = fhNofMCTracksPerEvent->GetEntries();
270 Int_t fNofMCAll = fhMCAllVsP ->Integral();
271 Int_t fNofMCAcc = fhMCAccVsP ->Integral();
272 Int_t fNofMCPrim = fhMCPrimVsP ->Integral();
273 Int_t fNofMCRef = fhMCRefVsP ->Integral(fhMCPrimVsP->FindBin(0.5),fhMCPrimVsP->GetNbinsX());
274 Int_t fNofMCSec = fhMCSecVsP ->Integral();
275 Int_t fNofRecoAcc = fhRecoAccVsP ->Integral();
276 Int_t fNofRecoPrim = fhRecoPrimVsP->Integral();
277 Int_t fNofRecoRef = fhRecoRefVsP->Integral(fhRecoPrimVsP->FindBin(0.5),fhRecoPrimVsP->GetNbinsX());
278 Int_t fNofRecoSec = fhRecoSecVsP ->Integral();
279 Int_t fNofRecoGhosts = fhNofHitsPerGhost->Integral();
280 Int_t fNofRecoClones = fhNofHitsPerClone->Integral();
290 TPaveText* printoutPave =
new TPaveText(0.0,0.0,1.0,1.0);
291 printoutPave->SetTextAlign(23);
292 printoutPave->SetBorderSize(0);
293 printoutPave->SetFillColor(0);
294 printoutPave->AddText(Form(
"%i events",fNofEvents));
295 printoutPave->AddText(Form(
"%i MC tracks",fNofMCAll));
296 printoutPave->AddText(
"Tracking efficiencies:");
297 printoutPave->AddText(Form(
"all = %2.2f%% ( %d / %d )" ,effAcc ,fNofRecoAcc ,fNofMCAcc));
298 printoutPave->AddText(Form(
"prim = %2.2f%% ( %d / %d )",effPrim,fNofRecoPrim,fNofMCPrim));
299 printoutPave->AddText(Form(
"ref = %2.2f%% ( %d / %d )" ,effRef ,fNofRecoRef ,fNofMCRef));
300 printoutPave->AddText(Form(
"sec = %2.2f%% ( %d / %d )" ,effSec ,fNofRecoSec ,fNofMCSec));
301 printoutPave->AddText(Form(
"%i ghosts, %2.5f /event, %2.5f /MC tr.",fNofRecoGhosts,ghPerEv,ghPerTr));
302 printoutPave->AddText(Form(
"%i clones, %2.5f /event, %2.5f /MC tr.",fNofRecoClones,clPerEv,clPerTr));
303 printoutPave->Draw();
305 recoPad[6]->Update();
306 cout <<
"-------------------- PndGemTrackFinderQA : Summary ------------------" << endl;
307 cout <<
" Events: " << setw(10) << fNofEvents << endl;
308 cout <<
" MC Tracks: " << setw(10) << fNofMCAll << endl;
309 cout <<
" reconstruable: " << setw(10) << fNofMCAcc <<
" reconstructed: " << setw(10) << fNofRecoAcc <<
" >>>> " << effAcc <<
"%" << endl;
310 cout <<
" primaries : " << setw(10) << fNofMCPrim <<
" reconstructed: " << setw(10) << fNofRecoPrim <<
" >>>> " << effPrim <<
"%" << endl;
311 cout <<
" reference : " << setw(10) << fNofMCRef <<
" reconstructed: " << setw(10) << fNofRecoRef <<
" >>>> " << effRef <<
"%" << endl;
312 cout <<
" secondaries : " << setw(10) << fNofMCSec <<
" reconstructed: " << setw(10) << fNofRecoSec <<
" >>>> " << effSec <<
"%" << endl;
313 cout <<
" ghosts : " << setw(10) << fNofRecoGhosts <<
" >>> " << setw(10) << ghPerEv <<
" per event >>> " << setw(10) << ghPerTr <<
" per MC Track" << endl;
314 cout <<
" clones : " << setw(10) << fNofRecoClones <<
" >>> " << setw(10) << clPerEv <<
" per event >>> " << setw(10) << clPerTr <<
" per MC Track" << endl;
315 cout <<
"---------------------------------------------------------------------" << endl;
int draw_qa_track_finding(TString inFileName)