22 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
26 #include "TDirectory.h"
31 #include "TProfile2D.h"
34 KFParticlePerformanceBase::KFParticlePerformanceBase():
35 fParteff(), fPVeff(), fPVeffMCReconstructable(), outfileName(), histodir(0), fNEvents(0), fStoreMCHistograms(1),
36 fStorePrimSecHistograms(1), fStoreZRHistograms(1),fHistoDir(0)
41 for(
int iFitQA=0; iFitQA<nFitQA; iFitQA++)
43 hFitDaughtersQA [iParticle][iFitQA] =
nullptr;
44 hFitQA [iParticle][iFitQA] =
nullptr;
45 hFitQANoConstraint [iParticle][iFitQA] =
nullptr;
46 hFitQAMassConstraint [iParticle][iFitQA] =
nullptr;
47 hFitQATopoConstraint [iParticle][iFitQA] =
nullptr;
48 hFitQATopoMassConstraint[iParticle][iFitQA] =
nullptr;
53 for(
int iQA=0; iQA<nDSToParticleQA; iQA++)
54 hDSToParticleQA[iParticle][iQA] =
nullptr;
56 for(
int iParameterSet=0; iParameterSet<nParametersSet; iParameterSet++)
60 for(
int iHisto=0; iHisto<nHistoPartParam; iHisto++)
62 hPartParam [iParameterSet][iParticle][iHisto] =
nullptr;
63 hPartParamPrimary [iParameterSet][iParticle][iHisto] =
nullptr;
64 hPartParamPrimaryMass [iParameterSet][iParticle][iHisto] =
nullptr;
65 hPartParamPrimaryTopo [iParameterSet][iParticle][iHisto] =
nullptr;
66 hPartParamPrimaryTopoMass[iParameterSet][iParticle][iHisto] =
nullptr;
67 hPartParamSecondary [iParameterSet][iParticle][iHisto] =
nullptr;
68 hPartParamSecondaryMass [iParameterSet][iParticle][iHisto] =
nullptr;
73 for(
int iParameterSet=0; iParameterSet<nParametersSet; iParameterSet++)
77 for(
int iHisto=0; iHisto<nHistoPartParam2D; iHisto++)
79 hPartParam2D [iParameterSet][iParticle][iHisto] =
nullptr;
80 hPartParam2DPrimary [iParameterSet][iParticle][iHisto] =
nullptr;
81 hPartParam2DPrimaryMass [iParameterSet][iParticle][iHisto] =
nullptr;
82 hPartParam2DPrimaryTopo [iParameterSet][iParticle][iHisto] =
nullptr;
83 hPartParam2DPrimaryTopoMass[iParameterSet][iParticle][iHisto] =
nullptr;
84 hPartParam2DSecondary [iParameterSet][iParticle][iHisto] =
nullptr;
85 hPartParam2DSecondaryMass [iParameterSet][iParticle][iHisto] =
nullptr;
91 for(
int iHisto=0; iHisto<nHistoPartParam3D; iHisto++)
92 hPartParam3D[0][iParticle][iHisto] =
nullptr;
95 for(
int iEffSet=0; iEffSet<3; iEffSet++)
96 for(
int iEff=0; iEff<nPartEfficiency; iEff++)
97 hPartEfficiency[iParticle][iEffSet][iEff] =
nullptr;
100 for(
int iEffSet=0; iEffSet<3; iEffSet++)
101 for(
int iEff=0; iEff<nPartEfficiency2D; iEff++)
102 hPartEfficiency2D[iParticle][iEffSet][iEff] =
nullptr;
104 for(
int iEffSet=0; iEffSet<2; iEffSet++)
105 for(
int iHistoPV=0; iHistoPV<nHistosPV; iHistoPV++)
106 hPVFitQa[iEffSet][iHistoPV] =
nullptr;
108 for(
int iEffSet1=0; iEffSet1<2; iEffSet1++)
109 for(
int iEffSet2=0; iEffSet2<2; iEffSet2++)
110 for(
int iHistoPV=0; iHistoPV<nHistosPV-1; iHistoPV++)
111 hPVFitQa2D[iEffSet1][iEffSet2][iHistoPV] =
nullptr;
113 for(
int iParam=0; iParam<nHistosPVParam; iParam++)
115 hPVParam [iParam] =
nullptr;
116 hPVParamGhost [iParam] =
nullptr;
117 hPVParamSignal[iParam] =
nullptr;
118 hPVParamPileup[iParam] =
nullptr;
119 hPVParamBG [iParam] =
nullptr;
122 for(
int iParam=0; iParam<nHistosPVParam2D; iParam++)
123 hPVParam2D[iParam] =
nullptr;
125 for(
int iFitQA=0; iFitQA<nFitPVTracksQA; iFitQA++)
126 hFitPVTracksQA[iFitQA] =
nullptr;
128 for(
int iTP=0; iTP<nHistosTP; iTP++)
129 hTrackParameters[iTP] =
nullptr;
131 for(
int iEffSet=0; iEffSet<4; iEffSet++)
132 for(
int iEff=0; iEff<nPVefficiency; iEff++)
133 hPVefficiency[iEffSet][iEff] =
nullptr;
136 void KFParticlePerformanceBase::CreateHistos(
std::string histoDir, TDirectory* outFile, std::map<int,bool> decays)
145 TDirectory *curdir = gDirectory;
149 if (histoDir !=
"") {
150 fHistoDir = outFile->mkdir( TString(histoDir) );
154 fHistoDir = TDirectory::CurrentDirectory();
157 gDirectory->mkdir(
"KFParticlesFinder");
158 gDirectory->cd(
"KFParticlesFinder");
159 histodir = gDirectory;
160 gDirectory->mkdir(
"Particles");
161 gDirectory->cd(
"Particles");
162 for(
int iPart=0; iPart<fParteff.nParticles; ++iPart)
164 if(!(decays.empty()) && (iPart < fParteff.fFirstStableParticleIndex || iPart > fParteff.fLastStableParticleIndex))
165 if(decays.find(fParteff.partPDG[iPart]) == decays.end())
continue;
167 gDirectory->mkdir(fParteff.partName[iPart].data());
168 gDirectory->cd(fParteff.partName[iPart].data());
170 if(fStoreMCHistograms)
173 TString pull =
"pull";
175 gDirectory->mkdir(
"DaughtersQA");
176 gDirectory->cd(
"DaughtersQA");
178 TString parName[nFitQA/2] = {
"X",
"Y",
"Z",
"Px",
"Py",
"Pz",
"E",
"M"};
180 float xMax[nFitQA/2] = {0.15,0.15,0.03,0.01,0.01,0.06,0.06,0.01};
183 for(
int iH=0; iH<nFitQA/2; iH++ ){
184 hFitDaughtersQA[iPart][iH] =
new TH1F((res+parName[iH]).
Data(),
185 (GetDirectoryPath()+res+parName[iH]).
Data(),
186 nBins, -xMax[iH],xMax[iH]);
187 hFitDaughtersQA[iPart][iH+8] =
new TH1F((pull+parName[iH]).
Data(),
188 (GetDirectoryPath()+pull+parName[iH]).
Data(),
192 gDirectory->cd(
"..");
194 gDirectory->mkdir(
"DSToParticleQA");
195 gDirectory->cd(
"DSToParticleQA");
197 TString parName[3] = {
"X",
"Y",
"Z"};
199 float xMax[3] = {0.5, 0.5, 2.};
201 for(
int iH=0; iH<3; iH++ ){
202 hDSToParticleQA[iPart][iH] =
new TH1F((res+parName[iH]).
Data(),
203 (GetDirectoryPath()+res+parName[iH]).
Data(),
204 nBins, -xMax[iH],xMax[iH]);
205 hDSToParticleQA[iPart][iH+3] =
new TH1F((pull+parName[iH]).
Data(),
206 (GetDirectoryPath()+pull+parName[iH]).
Data(),
210 hDSToParticleQA[iPart][6] =
new TH1F(
"r", (GetDirectoryPath()+TString(
"r")).
Data(), 1000, 0.0, 20.0);
212 gDirectory->cd(
"..");
214 CreateFitHistograms(hFitQA[iPart], iPart);
215 CreateEfficiencyHistograms(hPartEfficiency[iPart],hPartEfficiency2D[iPart]);
217 gDirectory->mkdir(
"Parameters");
218 gDirectory->cd(
"Parameters");
220 const bool drawZR = IsCollectZRHistogram(iPart);
221 CreateParameterHistograms(hPartParam[0], hPartParam2D[0], hPartParam3D[0], iPart, drawZR);
223 if(IsCollect3DHistogram(iPart))
225 gDirectory->mkdir(
"SignalReco");
226 gDirectory->cd(
"SignalReco");
228 CreateParameterHistograms(hPartParam[4], hPartParam2D[4], 0, iPart, drawZR);
230 gDirectory->cd(
"..");
231 gDirectory->mkdir(
"BGReco");
232 gDirectory->cd(
"BGReco");
234 CreateParameterHistograms(hPartParam[5], hPartParam2D[5], 0, iPart, drawZR);
236 gDirectory->cd(
"..");
239 if(fStoreMCHistograms)
241 gDirectory->mkdir(
"Signal");
242 gDirectory->cd(
"Signal");
244 CreateParameterHistograms(hPartParam[1], hPartParam2D[1], 0, iPart, drawZR);
246 gDirectory->cd(
"..");
247 gDirectory->mkdir(
"Background");
248 gDirectory->cd(
"Background");
250 CreateParameterHistograms(hPartParam[2], hPartParam2D[2], 0, iPart, drawZR);
252 gDirectory->cd(
"..");
253 gDirectory->mkdir(
"Ghost");
254 gDirectory->cd(
"Ghost");
256 CreateParameterHistograms(hPartParam[3], hPartParam2D[3], 0, iPart, drawZR);
258 gDirectory->cd(
"..");
259 gDirectory->mkdir(
"MCSignal");
260 gDirectory->cd(
"MCSignal");
262 CreateParameterHistograms(hPartParam[6], hPartParam2D[6], 0, iPart, drawZR);
264 gDirectory->cd(
"..");
267 bool plotPrimaryHistograms = abs(fParteff.partPDG[iPart]) == 310 ||
268 abs(fParteff.partPDG[iPart]) == 3122 ||
269 abs(fParteff.partPDG[iPart]) == 22 ||
270 abs(fParteff.partPDG[iPart]) == 111 ||
271 abs(fParteff.partPDG[iPart]) == 3312 ||
272 abs(fParteff.partPDG[iPart]) == 3334;
274 bool plotSecondaryHistograms = abs(fParteff.partPDG[iPart]) == 310 ||
275 abs(fParteff.partPDG[iPart]) == 3122 ||
276 abs(fParteff.partPDG[iPart]) == 22 ||
277 abs(fParteff.partPDG[iPart]) == 111;
279 if(fStorePrimSecHistograms && plotPrimaryHistograms)
281 gDirectory->mkdir(
"Primary");
282 gDirectory->cd(
"Primary");
284 CreateParameterSubfolder(
"NoConstraint (1C-Fit)", hPartParamPrimary, hPartParam2DPrimary, hFitQANoConstraint, iPart,
true);
285 CreateParameterSubfolder(
"MassConstraint (2C-Fit)", hPartParamPrimaryMass, hPartParam2DPrimaryMass, hFitQAMassConstraint, iPart,
true);
286 CreateParameterSubfolder(
"PVConstraint (3C-Fit)", hPartParamPrimaryTopo, hPartParam2DPrimaryTopo, hFitQATopoConstraint, iPart,
true);
287 CreateParameterSubfolder(
"PVMassConstraint (4C-Fit)", hPartParamPrimaryTopoMass, hPartParam2DPrimaryTopoMass, hFitQATopoMassConstraint, iPart,
true);
289 gDirectory->cd(
"..");
292 if(fStorePrimSecHistograms && plotSecondaryHistograms)
294 gDirectory->mkdir(
"Secondary");
295 gDirectory->cd(
"Secondary");
297 CreateParameterSubfolder(
"NoConstraint (1C-Fit)", hPartParamSecondary, hPartParam2DSecondary, 0, iPart,
true);
298 CreateParameterSubfolder(
"MassConstraint (2C-Fit)", hPartParamSecondaryMass, hPartParam2DSecondaryMass, 0, iPart,
true);
300 gDirectory->cd(
"..");
304 gDirectory->cd(
"..");
306 gDirectory->cd(
"..");
308 gDirectory->cd(
"..");
309 gDirectory->mkdir(
"PrimaryVertexQA");
310 gDirectory->cd(
"PrimaryVertexQA");
319 {
"PVResX",
"x_{rec}-x_{mc}, cm", 100, -0.1f, 0.1f},
320 {
"PVResY",
"y_{rec}-y_{mc}, cm", 100, -0.1f, 0.1f},
321 {
"PVResZ",
"z_{rec}-z_{mc}, cm", 100, -1.f, 1.f},
322 {
"PVPullX",
"Pull X", 100, -6.f, 6.f},
323 {
"PVPullY",
"Pull Y", 100, -6.f, 6.f},
324 {
"PVPullZ",
"Pull Z", 100, -6.f, 6.f},
325 {
"Lost",
"Lost tracks", 102, -0.01f, 1.01f}
328 TString parName[nHistosPVParam] = {
"x",
"y",
"z",
"r",
"Ntracks",
"Chi2",
"NDF",
"Chi2NDF",
"prob",
"PVpurity",
329 "ghostTr",
"triggerTr",
"pileupTr",
"bgTr",
"dzSamePV"};
330 TString parAxisName[nHistosPVParam] = {
"x [cm]",
"y [cm]",
"z [cm]",
"r [cm]",
"N tracks",
"Chi2",
"NDF",
"Chi2NDF",
"prob",
"purity",
331 "ghost tracks [%]",
"trigger tracks [%]",
"pileup tracks [%]",
"bg tracks [%]",
"dz [cm]"};
332 int nBins[nHistosPVParam] = {1000,1000,1000,1000,1001,10000,1001,10000,100,102,102,102,102,102,1000};
333 float xMin[nHistosPVParam] = {-1., -1., -10., 0, -0.5, 0., -0.5, 0., 0., -0.01, -0.01, -0.01, -0.01, -0.01, 0.};
334 float xMax[nHistosPVParam] = { 1., 1., 10., 10, 1000.5, 1000., 1000.5, 1000., 1., 1.01, 1.01, 1.01, 1.01, 1.01, 100.};
336 TString parName2D[nHistosPVParam2D] = {
"xy"};
337 TString parXAxisName2D[nHistosPVParam2D] = {
"x [cm]"};
338 TString parYAxisName2D[nHistosPVParam2D] = {
"y [cm]"};
339 int nBinsX2D[nHistosPVParam2D] = {1000};
340 float xMin2D[nHistosPVParam2D] = {-1.};
341 float xMax2D[nHistosPVParam2D] = { 1.};
342 int nBinsY2D[nHistosPVParam2D] = {1000};
343 float yMin2D[nHistosPVParam2D] = {-1.};
344 float yMax2D[nHistosPVParam2D] = { 1.};
346 for(
int iH=0; iH<nHistosPVParam; iH++)
348 hPVParam[iH] =
new TH1F(parName[iH].
Data(),(GetDirectoryPath()+parName[iH]).
Data(),
349 nBins[iH],xMin[iH],xMax[iH]);
350 hPVParam[iH]->GetXaxis()->SetTitle(parAxisName[iH].
Data());
353 for(
int iH=0; iH<nHistosPVParam2D; iH++)
355 hPVParam2D[iH] =
new TH2F(parName2D[iH].
Data(),(GetDirectoryPath()+parName2D[iH]).
Data(),
356 nBinsX2D[iH],xMin2D[iH],xMax2D[iH],
357 nBinsY2D[iH],yMin2D[iH],yMax2D[iH]);
358 hPVParam2D[iH]->GetXaxis()->SetTitle(parXAxisName2D[iH].
Data());
359 hPVParam2D[iH]->GetYaxis()->SetTitle(parYAxisName2D[iH].
Data());
360 hPVParam2D[iH]->GetYaxis()->SetTitleOffset(1.0);
363 gDirectory->mkdir(
"Efficiency");
364 gDirectory->cd(
"Efficiency");
366 TString effName[nPVefficiency] = {
"effVsNMCPVTracks",
"effVsNMCPV",
"effVsNMCTracks",
"effVsNPVTracks",
"effVsNPV",
"effVsNTracks"};
367 int nBinsEff[nPVefficiency] = { 100 , 100 , 100 , 100 , 100 , 1000 };
368 float xMinEff[nPVefficiency] = { 0., 0., 0., 0., 0., 0.};
369 float xMaxEff[nPVefficiency] = { 100., 100., 1000., 100., 100., 1000.};
371 gDirectory->mkdir(
"Signal");
372 gDirectory->cd(
"Signal");
374 for(
int iH=0; iH<nPVefficiency; iH++ ){
375 hPVefficiency[0][iH] =
new TProfile( effName[iH].
Data(), (GetDirectoryPath()+effName[iH]).
Data(), nBinsEff[iH], xMinEff[iH], xMaxEff[iH]);
378 gDirectory->cd(
"..");
380 gDirectory->mkdir(
"Pileup");
381 gDirectory->cd(
"Pileup");
383 for(
int iH=0; iH<nPVefficiency; iH++ ){
384 hPVefficiency[1][iH] =
new TProfile( effName[iH].
Data(), (GetDirectoryPath()+effName[iH].
Data()), nBinsEff[iH], xMinEff[iH], xMaxEff[iH]);
387 gDirectory->cd(
"..");
389 gDirectory->mkdir(
"Signal_MCReconstructable");
390 gDirectory->cd(
"Signal_MCReconstructable");
392 for(
int iH=0; iH<nPVefficiency; iH++ ){
393 hPVefficiency[2][iH] =
new TProfile( effName[iH].
Data(), (GetDirectoryPath()+effName[iH].
Data()), nBinsEff[iH], xMinEff[iH], xMaxEff[iH]);
396 gDirectory->cd(
"..");
398 gDirectory->mkdir(
"Pileup_MCReconstructable");
399 gDirectory->cd(
"Pileup_MCReconstructable");
401 for(
int iH=0; iH<nPVefficiency; iH++ ){
402 hPVefficiency[3][iH] =
new TProfile( effName[iH].
Data(), (GetDirectoryPath()+effName[iH].
Data()), nBinsEff[iH], xMinEff[iH], xMaxEff[iH]);
405 gDirectory->cd(
"..");
407 gDirectory->cd(
"..");
409 gDirectory->mkdir(
"PVTracksQA");
410 gDirectory->cd(
"PVTracksQA");
412 TString resTrPV =
"resTrPV";
413 TString pullTrPV =
"pullTrPV";
414 TString parNameTrPV[nFitPVTracksQA/2] = {
"X",
"Y",
"Z",
"Px",
"Py",
"Pz"};
416 float xMaxTrPV[nFitPVTracksQA/2] = {0.5,0.5,0.5,0.05,0.05,0.05};
418 for(
int iH=0; iH<nFitPVTracksQA/2; iH++ ){
419 hFitPVTracksQA[iH] =
new TH1F((resTrPV+parNameTrPV[iH]).
Data(),
420 (GetDirectoryPath()+resTrPV+parNameTrPV[iH]).
Data(),
421 nBinsTrPV, -xMaxTrPV[iH],xMaxTrPV[iH]);
422 hFitPVTracksQA[iH+nFitPVTracksQA/2] =
new TH1F((pullTrPV+parNameTrPV[iH]).
Data(),
423 (GetDirectoryPath()+pullTrPV+parNameTrPV[iH]).
Data(),
427 gDirectory->cd(
"..");
429 gDirectory->mkdir(
"Signal");
430 gDirectory->cd(
"Signal");
432 gDirectory->mkdir(
"FitQA");
433 gDirectory->cd(
"FitQA");
435 gDirectory->mkdir(
"FitQAvcNMCPVTracks");
436 gDirectory->cd(
"FitQAvcNMCPVTracks");
438 for(
int iHPV=0; iHPV<nHistosPV-1; ++iHPV){
439 hPVFitQa2D[0][0][iHPV] =
new TH2F(Table[iHPV].
name.Data(),(GetDirectoryPath()+Table[iHPV].title).
Data(),
441 Table[iHPV].n, Table[iHPV].l, Table[iHPV].r);
444 gDirectory->cd(
"..");
446 gDirectory->mkdir(
"FitQAvcNPVTracks");
447 gDirectory->cd(
"FitQAvcNPVTracks");
449 for(
int iHPV=0; iHPV<nHistosPV-1; ++iHPV){
450 hPVFitQa2D[0][1][iHPV] =
new TH2F(Table[iHPV].
name.Data(),(GetDirectoryPath()+Table[iHPV].title).
Data(),
452 Table[iHPV].n, Table[iHPV].l, Table[iHPV].r);
455 gDirectory->cd(
"..");
457 for(
int iHPV=0; iHPV<nHistosPV; ++iHPV){
458 hPVFitQa[0][iHPV] =
new TH1F(Table[iHPV].
name.Data(),(GetDirectoryPath()+Table[iHPV].title).
Data(),
459 Table[iHPV].n, Table[iHPV].l, Table[iHPV].r);
462 gDirectory->cd(
"..");
464 for(
int iH=0; iH<nHistosPVParam; iH++)
466 hPVParamSignal[iH] =
new TH1F((parName[iH]).
Data(),(GetDirectoryPath()+parName[iH]).
Data(),
467 nBins[iH],xMin[iH],xMax[iH]);
468 hPVParamSignal[iH]->GetXaxis()->SetTitle(parAxisName[iH].
Data());
471 gDirectory->cd(
"..");
473 gDirectory->mkdir(
"Pileup");
474 gDirectory->cd(
"Pileup");
476 gDirectory->mkdir(
"FitQA");
477 gDirectory->cd(
"FitQA");
479 gDirectory->mkdir(
"FitQAvcNMCPVTracks");
480 gDirectory->cd(
"FitQAvcNMCPVTracks");
482 for(
int iHPV=0; iHPV<nHistosPV-1; ++iHPV){
483 hPVFitQa2D[1][0][iHPV] =
new TH2F(Table[iHPV].
name.Data(),(GetDirectoryPath()+Table[iHPV].title).
Data(),
485 Table[iHPV].n, Table[iHPV].l, Table[iHPV].r);
488 gDirectory->cd(
"..");
490 gDirectory->mkdir(
"FitQAvcNPVTracks");
491 gDirectory->cd(
"FitQAvcNPVTracks");
493 for(
int iHPV=0; iHPV<nHistosPV-1; ++iHPV){
494 hPVFitQa2D[1][1][iHPV] =
new TH2F(Table[iHPV].
name.Data(),(GetDirectoryPath()+Table[iHPV].title).
Data(),
496 Table[iHPV].n, Table[iHPV].l, Table[iHPV].r);
499 gDirectory->cd(
"..");
501 for(
int iHPV=0; iHPV<nHistosPV; ++iHPV){
502 hPVFitQa[1][iHPV] =
new TH1F(Table[iHPV].
name.Data(),(GetDirectoryPath()+Table[iHPV].title).
Data(),
503 Table[iHPV].n, Table[iHPV].l, Table[iHPV].r);
506 gDirectory->cd(
"..");
508 for(
int iH=0; iH<nHistosPVParam; iH++)
510 hPVParamPileup[iH] =
new TH1F((parName[iH]).
Data(),(GetDirectoryPath()+parName[iH]).
Data(),
511 nBins[iH],xMin[iH],xMax[iH]);
512 hPVParamPileup[iH]->GetXaxis()->SetTitle(parAxisName[iH].
Data());
515 gDirectory->cd(
"..");
517 gDirectory->mkdir(
"Background");
518 gDirectory->cd(
"Background");
520 for(
int iH=0; iH<nHistosPVParam; iH++)
522 hPVParamBG[iH] =
new TH1F((parName[iH]).
Data(),(GetDirectoryPath()+parName[iH]).
Data(),
523 nBins[iH],xMin[iH],xMax[iH]);
524 hPVParamBG[iH]->GetXaxis()->SetTitle(parAxisName[iH].
Data());
527 gDirectory->cd(
"..");
529 gDirectory->mkdir(
"Ghost");
530 gDirectory->cd(
"Ghost");
532 for(
int iH=0; iH<nHistosPVParam; iH++)
534 hPVParamGhost[iH] =
new TH1F((parName[iH]).
Data(),(GetDirectoryPath()+parName[iH]).
Data(),
535 nBins[iH],xMin[iH],xMax[iH]);
536 hPVParamGhost[iH]->GetXaxis()->SetTitle(parAxisName[iH].
Data());
539 gDirectory->cd(
"..");
541 gDirectory->cd(
"..");
542 gDirectory->mkdir(
"TrackParameters");
543 gDirectory->cd(
"TrackParameters");
545 TString chi2Name =
"Chi2Prim";
548 TString chi2NamePart =
"Chi2Prim";
550 chi2NamePart += fParteff.partName[iPart].data();
551 hTrackParameters[iPart] =
new TH1F(chi2NamePart.Data(), (GetDirectoryPath()+chi2NamePart).
Data(), 1000, 0, 100);
555 hTrackParameters[KFPartEfficiencies::nParticles+1] =
new TH1F(
"Chi2Prim_prim", (GetDirectoryPath()+TString(
"Chi2Prim_prim")), 1000, 0, 100);
556 hTrackParameters[KFPartEfficiencies::nParticles+2] =
new TH1F(
"Chi2Prim_sec", (GetDirectoryPath()+TString(
"Chi2Prim_sec")), 1000, 0, 100);
557 hTrackParameters[KFPartEfficiencies::nParticles+3] =
new TH1F(
"Chi2Prim_ghost", (GetDirectoryPath()+TString(
"Chi2Prim_ghost")), 1000, 0, 100);
559 hTrackParameters[KFPartEfficiencies::nParticles+4] =
new TH1F(
"ProbPrim_total", (GetDirectoryPath()+TString(
"ProbPrim_total")), 10000, 0, 1);
560 hTrackParameters[KFPartEfficiencies::nParticles+5] =
new TH1F(
"ProbPrim_prim", (GetDirectoryPath()+TString(
"ProbPrim_prim")), 10000, 0, 1);
561 hTrackParameters[KFPartEfficiencies::nParticles+6] =
new TH1F(
"ProbPrim_sec", (GetDirectoryPath()+TString(
"ProbPrim_sec")), 10000, 0, 1);
562 hTrackParameters[KFPartEfficiencies::nParticles+7] =
new TH1F(
"ProbPrim_ghost", (GetDirectoryPath()+TString(
"ProbPrim_ghost")), 10000, 0, 1);
564 gDirectory->cd(
"..");
569 void KFParticlePerformanceBase::CreateFitHistograms(TH1F* histo[nFitQA],
int iPart)
576 TString pull =
"pull";
578 TString AxisNameResidual[nFitQA/2];
579 TString AxisNamePull[nFitQA/2];
581 AxisNameResidual[0] =
"Residual (x^{reco} - x^{mc}) [cm]";
582 AxisNameResidual[1] =
"Residual (y^{reco} - y^{mc}) [cm]";
583 AxisNameResidual[2] =
"Residual (z^{reco} - z^{mc}) [cm]";
584 AxisNameResidual[3] =
"Residual (P_{x}^{reco} - P_{x}^{mc}) [GeV/c]";
585 AxisNameResidual[4] =
"Residual (P_{y}^{reco} - P_{y}^{mc}) [GeV/c]";
586 AxisNameResidual[5] =
"Residual (P_{z}^{reco} - P_{z}^{mc}) [GeV/c]";
587 AxisNameResidual[6] =
"Residual (E^{reco} - E^{mc}) [GeV/c^{2}]";
588 AxisNameResidual[7] =
"Residual (M^{reco} - M^{mc}) [GeV/c^{2}]";
590 AxisNamePull[0] =
"Pull x";
591 AxisNamePull[1] =
"Pull y";
592 AxisNamePull[2] =
"Pull z";
593 AxisNamePull[3] =
"Pull P_{x}";
594 AxisNamePull[4] =
"Pull P_{y}";
595 AxisNamePull[5] =
"Pull P_{z}";
596 AxisNamePull[6] =
"Pull E";
597 AxisNamePull[7] =
"Pull M";
599 gDirectory->mkdir(
"FitQA");
600 gDirectory->cd(
"FitQA");
602 TString parName[nFitQA/2] = {
"X",
"Y",
"Z",
"Px",
"Py",
"Pz",
"E",
"M"};
604 float xMax[nFitQA/2] = {0.15,0.15,1.2,0.02,0.02,0.15,0.15,0.006};
605 float mult[nFitQA/2]={1.f,1.f,1.f,1.f,1.f,1.f,1.f,1.f};
606 if(iPart>63 && iPart<75)
607 for(
int iMult=3; iMult<nFitQA/2; iMult++)
609 if(iPart>45 && iPart<64)
612 for(
int iMult=0; iMult<3; iMult++)
614 for(
int iMult=3; iMult<nFitQA/2; iMult++)
618 for(
int iMult=3; iMult<nFitQA/2; iMult++)
624 if(iPart==44 || iPart==45)
629 for(
int iMult=3; iMult<nFitQA/2; iMult++)
633 for(
int iH=0; iH<nFitQA/2; iH++ )
635 histo[iH] =
new TH1F((res+parName[iH]).
Data(),
636 (GetDirectoryPath()+res+parName[iH]).
Data(),
637 nBins, -mult[iH]*xMax[iH],mult[iH]*xMax[iH]);
638 histo[iH]->GetXaxis()->SetTitle(AxisNameResidual[iH].
Data());
639 histo[iH+8] =
new TH1F((pull+parName[iH]).
Data(),
640 (GetDirectoryPath()+pull+parName[iH]).
Data(),
642 histo[iH+8]->GetXaxis()->SetTitle(AxisNamePull[iH+8].
Data());
645 gDirectory->cd(
"..");
648 void KFParticlePerformanceBase::CreateEfficiencyHistograms(TProfile* histo[3][nPartEfficiency], TProfile2D* histo2[3][nPartEfficiency2D])
654 gDirectory->mkdir(
"Efficiency");
655 gDirectory->cd(
"Efficiency");
657 TString partNameEff[nPartEfficiency] = {
"EffVsP",
"EffVsPt",
"EffVsY",
"EffVsZ",
"EffVsCT",
"EffVsDL",
"EffVsL",
"EffVsR",
"EffVsMt" };
658 TString partAxisNameEff[nPartEfficiency] = {
"p [GeV/c]",
"p_{t} [GeV/c]",
659 "y",
"z [cm]",
"Life time c#tau [cm]",
"Decay length [cm]",
660 "L [cm]",
"Rxy [cm]",
"m_{t} [GeV/c^{2}]"};
662 int nBinsEff[nPartEfficiency] = { 100 , 100 , 100 , 360 , 100 , 100 , 200 , 200 , 100 };
663 float xMinEff[nPartEfficiency] = { 0., 0., 0., -10., 0., 0., 0., 0. , 0.};
664 float xMaxEff[nPartEfficiency] = { 20., 5., 6., 80., 100., 100., 100., 50. , 4.};
666 int nBinsEff[nPartEfficiency] = { 100 , 100 , 30 , 100 , 100 , 100 , 100 , 100 , 100 };
667 float xMinEff[nPartEfficiency] = { 0., 0., -1.5, -10., 0., 0., 0., 0., 0. };
668 float xMaxEff[nPartEfficiency] = { 10., 10., 1.5, 10., 30., 5., 1., 1., 10. };
670 TString effTypeName[3] = {
"All particles",
671 "Reconstructable daughters",
672 "Reconstructed daughters"};
674 for(
int iEff=0; iEff<3; iEff++)
676 gDirectory->mkdir(effTypeName[iEff].
Data());
677 gDirectory->cd(effTypeName[iEff].
Data());
679 for(
int iH=0; iH<nPartEfficiency; iH++)
681 histo[iEff][iH] =
new TProfile( partNameEff[iH].
Data(), (GetDirectoryPath()+partAxisNameEff[iH]).
Data(), nBinsEff[iH], xMinEff[iH], xMaxEff[iH]);
682 histo[iEff][iH]->GetYaxis()->SetTitle(
"Efficiency");
683 histo[iEff][iH]->GetYaxis()->SetTitleOffset(1.0);
684 histo[iEff][iH]->GetXaxis()->SetTitle(partAxisNameEff[iH].
Data());
687 histo2[iEff][0] =
new TProfile2D(
"EffVsPtVsY", (GetDirectoryPath()+partAxisNameEff[2]+partAxisNameEff[1]).
Data(),
688 nBinsEff[2], xMinEff[2], xMaxEff[2], nBinsEff[1], xMinEff[1], xMaxEff[1]);
689 histo2[iEff][0]->GetZaxis()->SetTitle(
"Efficiency");
690 histo2[iEff][0]->GetXaxis()->SetTitle(partAxisNameEff[2].
Data());
691 histo2[iEff][0]->GetYaxis()->SetTitle(partAxisNameEff[1].
Data());
692 histo2[iEff][0]->GetYaxis()->SetTitleOffset(1.0);
694 histo2[iEff][1] =
new TProfile2D(
"EffVsMtVsY", (GetDirectoryPath()+partAxisNameEff[2]+partAxisNameEff[8]).
Data(),
695 nBinsEff[2], xMinEff[2], xMaxEff[2], nBinsEff[8], xMinEff[8], xMaxEff[8]);
696 histo2[iEff][1]->GetZaxis()->SetTitle(
"Efficiency");
697 histo2[iEff][1]->GetXaxis()->SetTitle(partAxisNameEff[2].
Data());
698 histo2[iEff][1]->GetYaxis()->SetTitle(partAxisNameEff[8].
Data());
699 histo2[iEff][1]->GetYaxis()->SetTitleOffset(1.0);
701 gDirectory->cd(
"..");
704 gDirectory->cd(
"..");
707 void KFParticlePerformanceBase::CreateParameterHistograms(TH1F* histoParameters[KFPartEfficiencies::nParticles][nHistoPartParam],
708 TH2F *histoParameters2D[KFPartEfficiencies::nParticles][nHistoPartParam2D],
709 TH3F *histoParameters3D[KFPartEfficiencies::nParticles][nHistoPartParam3D],
710 int iPart,
bool drawZR)
719 TString parName[nHistoPartParam] = {
"M",
"p",
"p_{t}",
"y",
"DecayL",
"c#tau",
"chi2ndf",
"prob",
"#theta",
"phi",
"X",
"Y",
"Z",
"R",
"L",
"l/dl",
"m_{t}",
"Multiplicity"};
720 TString parTitle[nHistoPartParam];
721 TString parName2D[nHistoPartParam2D] = {
"y-p_{t}",
"Z-R",
"Armenteros",
"y-m_{t}"};
722 TString parTitle2D[nHistoPartParam2D];
723 TString parName3D[nHistoPartParam3D] = {
"y-p_{t}-M",
"y-m_{t}-M",
"centrality-pt-M",
"centrality-y-M",
"centrality-mt-M",
"ct-pt-M"};
724 TString parTitle3D[nHistoPartParam3D];
725 for(
int iParam=0; iParam<nHistoPartParam; iParam++)
727 TString
path = GetDirectoryPath();
728 parTitle[iParam] = path + parName[iParam];
729 if(iParam<nHistoPartParam2D)
730 parTitle2D[iParam] = path + parName2D[iParam];
731 if(iParam<nHistoPartParam3D)
732 parTitle3D[iParam] = path + parName3D[iParam];
735 TString parAxisName[nHistoPartParam] = {
"m [GeV/c^{2}]",
"p [GeV/c]",
"p_{t} [GeV/c]",
736 "y",
"Decay length [cm]",
"Life time c#tau [cm]",
737 "chi2/ndf",
"prob",
"#theta [rad]",
738 "phi [rad]",
"x [cm]",
"y [cm]",
"z [cm]",
"Rxy [cm]",
"L [cm]",
"L/dL",
"m_{t} [GeV/c^{2}]",
"Multiplicity"};
740 int nBins[nHistoPartParam] = {1000,
757 fParteff.partMaxMult[iPart]+1};
758 float xMin[nHistoPartParam] = { fParteff.partMHistoMin[iPart],
776 float xMax[nHistoPartParam] = { fParteff.partMHistoMax[iPart],
793 float(fParteff.partMaxMult[iPart])+0.5f};
795 int nBins[nHistoPartParam] = {1000,
812 fParteff.partMaxMult[iPart]+1};
813 float xMin[nHistoPartParam] = { fParteff.partMHistoMin[iPart],
831 float xMax[nHistoPartParam] = { fParteff.partMHistoMax[iPart],
848 float(fParteff.partMaxMult[iPart])+0.5f};
851 xMin[10] =-50; xMin[11] =-50; xMin[12] =-100;
852 xMax[10] = 50; xMax[11] = 50; xMax[12] = 100; xMax[13] = 50; xMax[14] = 50;
855 for(
int iH=0; iH<nHistoPartParam; iH++)
857 histoParameters[iPart][iH] =
new TH1F(parName[iH].
Data(),parTitle[iH].
Data(),
858 nBins[iH],xMin[iH],xMax[iH]);
859 histoParameters[iPart][iH]->GetXaxis()->SetTitle(parAxisName[iH].
Data());
862 histoParameters2D[iPart][0] =
new TH2F(parName2D[0].
Data(),parTitle2D[0].
Data(),
863 nBins[3],xMin[3],xMax[3],
864 nBins[2],xMin[2],xMax[2]);
865 histoParameters2D[iPart][0]->GetXaxis()->SetTitle(
"y");
866 histoParameters2D[iPart][0]->GetYaxis()->SetTitle(
"p_{t} [GeV/c]");
867 histoParameters2D[iPart][0]->GetYaxis()->SetTitleOffset(1.0);
871 histoParameters2D[iPart][1] =
new TH2F(parName2D[1].
Data(),parTitle2D[1].
Data(),
872 nBins[12],xMin[12],xMax[12],
873 nBins[13],xMin[13],xMax[13]);
874 histoParameters2D[iPart][1]->GetXaxis()->SetTitle(
"Z [cm]");
875 histoParameters2D[iPart][1]->GetYaxis()->SetTitle(
"R [cm]");
876 histoParameters2D[iPart][1]->GetYaxis()->SetTitleOffset(1.0);
879 histoParameters2D[iPart][1] = NULL;
882 if(IsCollectArmenteros(iPart))
884 histoParameters2D[iPart][2] =
new TH2F(parName2D[2].
Data(),parTitle2D[2].
Data(),
887 histoParameters2D[iPart][2]->GetXaxis()->SetTitle(
"#alpha (p_{L}^{+}-p_{L}^{-})/(p_{L}^{+}+p_{L}^{-})");
888 histoParameters2D[iPart][2]->GetYaxis()->SetTitle(
"q_{t} [GeV/c]");
889 histoParameters2D[iPart][2]->GetYaxis()->SetTitleOffset(1.0);
892 histoParameters2D[iPart][2] = NULL;
894 histoParameters2D[iPart][3] =
new TH2F(parName2D[3].
Data(),parTitle2D[3].
Data(),
895 nBins[3],xMin[3], xMax[3],
896 nBins[16],xMin[16],xMax[16]);
897 histoParameters2D[iPart][3]->GetXaxis()->SetTitle(
"y");
898 histoParameters2D[iPart][3]->GetYaxis()->SetTitle(
"m_{t} [GeV/c]");
899 histoParameters2D[iPart][3]->GetYaxis()->SetTitleOffset(1.0);
902 if( histoParameters3D && IsCollect3DHistogram(iPart) )
904 histoParameters3D[iPart][0] =
new TH3F(parName3D[0].
Data(),parTitle3D[0].
Data(),
905 nBins[3],xMin[3],xMax[3],
906 nBins[2],xMin[2],xMax[2],
907 nBins[0],xMin[0],xMax[0]);
908 histoParameters3D[iPart][0]->GetXaxis()->SetTitle(
"y");
909 histoParameters3D[iPart][0]->GetYaxis()->SetTitle(
"p_{t} [GeV/c]");
910 histoParameters3D[iPart][0]->GetYaxis()->SetTitleOffset(1.0);
911 histoParameters3D[iPart][0]->GetZaxis()->SetTitle(
"M");
913 histoParameters3D[iPart][1] =
new TH3F(parName3D[1].
Data(),parTitle3D[1].
Data(),
914 nBins[3],xMin[3],xMax[3],
915 nBins[16],xMin[16],xMax[16],
916 nBins[0],xMin[0],xMax[0]);
917 histoParameters3D[iPart][1]->GetXaxis()->SetTitle(
"y");
918 histoParameters3D[iPart][1]->GetYaxis()->SetTitle(
"m_{t} [GeV/c]");
919 histoParameters3D[iPart][1]->GetYaxis()->SetTitleOffset(1.0);
920 histoParameters3D[iPart][1]->GetZaxis()->SetTitle(
"M");
922 int centralityHisto[3] = {2,3,16};
923 for(
int iCH = 0; iCH<3; iCH++)
925 histoParameters3D[iPart][2+iCH] =
new TH3F(parName3D[2+iCH].
Data(),parTitle3D[2+iCH].
Data(),
927 nBins[centralityHisto[iCH]],xMin[centralityHisto[iCH]],xMax[centralityHisto[iCH]],
928 nBins[0],xMin[0],xMax[0]);
929 histoParameters3D[iPart][2+iCH]->GetXaxis()->SetTitle(
"centrality bin");
930 histoParameters3D[iPart][2+iCH]->GetYaxis()->SetTitle(parAxisName[centralityHisto[iCH]]);
931 histoParameters3D[iPart][2+iCH]->GetYaxis()->SetTitleOffset(1.0);
932 histoParameters3D[iPart][2+iCH]->GetZaxis()->SetTitle(
"M");
935 histoParameters3D[iPart][5] =
new TH3F(parName3D[5].
Data(),parTitle3D[5].
Data(),
936 nBins[5],xMin[5],xMax[5],
937 nBins[2],xMin[2],xMax[2],
938 nBins[0],xMin[0],xMax[0]);
939 histoParameters3D[iPart][5]->GetXaxis()->SetTitle(
"c#tau [cm]");
940 histoParameters3D[iPart][5]->GetYaxis()->SetTitle(
"p_{t} [GeV/c]");
941 histoParameters3D[iPart][5]->GetYaxis()->SetTitleOffset(1.0);
942 histoParameters3D[iPart][5]->GetZaxis()->SetTitle(
"M");
944 else if(histoParameters3D)
946 histoParameters3D[iPart][0] = NULL;
947 histoParameters3D[iPart][1] = NULL;
948 for(
int iCH = 0; iCH<3; iCH++)
949 histoParameters3D[iPart][2+iCH] = NULL;
950 histoParameters3D[iPart][5] = NULL;
954 bool KFParticlePerformanceBase::IsCollectZRHistogram(
int iParticle)
const
957 return (abs(fParteff.partPDG[iParticle]) == 310 ||
958 abs(fParteff.partPDG[iParticle]) == 3122 ||
959 abs(fParteff.partPDG[iParticle]) == 3312 ||
960 abs(fParteff.partPDG[iParticle]) == 3334 ||
961 abs(fParteff.partPDG[iParticle]) == 22) && fStoreMCHistograms && fStoreZRHistograms;
964 bool KFParticlePerformanceBase::IsCollect3DHistogram(
int iParticle)
const
967 return abs(fParteff.partPDG[iParticle]) == 310 ||
968 abs(fParteff.partPDG[iParticle]) == 3122 ||
969 abs(fParteff.partPDG[iParticle]) == 3312 ||
970 abs(fParteff.partPDG[iParticle]) == 3334 ||
971 abs(fParteff.partPDG[iParticle]) == 3003 ||
972 abs(fParteff.partPDG[iParticle]) == 3103 ||
973 abs(fParteff.partPDG[iParticle]) == 3004 ||
974 abs(fParteff.partPDG[iParticle]) == 3005 ||
976 abs(fParteff.partPDG[iParticle]) == 7003112 ||
977 abs(fParteff.partPDG[iParticle]) == 7003222 ||
978 abs(fParteff.partPDG[iParticle]) == 7003312 ||
979 abs(fParteff.partPDG[iParticle]) == 8003222 ||
980 abs(fParteff.partPDG[iParticle]) == 9000321;
982 abs(fParteff.partPDG[iParticle]) == 421 ||
983 abs(fParteff.partPDG[iParticle]) == 429 ||
984 abs(fParteff.partPDG[iParticle]) == 426 ||
985 abs(fParteff.partPDG[iParticle]) == 411 ||
986 abs(fParteff.partPDG[iParticle]) == 431 ||
987 abs(fParteff.partPDG[iParticle]) == 4122 ||
988 abs(fParteff.partPDG[iParticle]) == 521 ||
989 abs(fParteff.partPDG[iParticle]) == 511;
993 bool KFParticlePerformanceBase::IsCollectArmenteros(
int iParticle)
const
996 return abs(fParteff.partPDG[iParticle]) == 310 ||
997 abs(fParteff.partPDG[iParticle]) == 3122 ||
998 abs(fParteff.partPDG[iParticle]) == 3312 ||
999 abs(fParteff.partPDG[iParticle]) == 3334 ||
1000 abs(fParteff.partPDG[iParticle]) == 22 ||
1001 abs(fParteff.partPDG[iParticle]) == 111 ||
1002 abs(fParteff.partPDG[iParticle]) == 3003 ||
1003 abs(fParteff.partPDG[iParticle]) == 3103 ||
1004 abs(fParteff.partPDG[iParticle]) == 3004 ||
1005 abs(fParteff.partPDG[iParticle]) == 3005 ||
1006 abs(fParteff.partPDG[iParticle]) == 3203 ||
1007 abs(fParteff.partPDG[iParticle]) == 3008 ||
1008 abs(fParteff.partPDG[iParticle]) == 3000 ||
1009 abs(fParteff.partPDG[iParticle]) == 333 ||
1011 abs(fParteff.partPDG[iParticle]) == 7003112 ||
1012 abs(fParteff.partPDG[iParticle]) == 7003222 ||
1013 abs(fParteff.partPDG[iParticle]) == 7003312 ||
1014 abs(fParteff.partPDG[iParticle]) == 8003222 ||
1015 abs(fParteff.partPDG[iParticle]) == 9000321;
1017 abs(fParteff.partPDG[iParticle]) == 421 ||
1018 abs(fParteff.partPDG[iParticle]) == 420 ||
1019 abs(fParteff.partPDG[iParticle]) == 426 ||
1020 abs(fParteff.partPDG[iParticle]) == 521 ||
1021 abs(fParteff.partPDG[iParticle]) == 511;
1025 void KFParticlePerformanceBase::CreateParameterSubfolder(TString folderName,
1026 TH1F* histoParameters[nParametersSet][KFPartEfficiencies::nParticles][nHistoPartParam],
1027 TH2F* histoParameters2D[nParametersSet][KFPartEfficiencies::nParticles][nHistoPartParam2D],
1028 TH1F* histoFit[KFPartEfficiencies::nParticles][nFitQA],
int iPart,
bool withWrongPVHypothesis)
1031 gDirectory->mkdir(folderName.Data());
1032 gDirectory->cd(folderName.Data());
1034 gDirectory->mkdir(
"Signal");
1035 gDirectory->cd(
"Signal");
1037 CreateParameterHistograms(histoParameters[1], histoParameters2D[1], 0, iPart);
1039 gDirectory->cd(
"..");
1040 if(withWrongPVHypothesis)
1042 gDirectory->mkdir(
"WrongPVHypothesis");
1043 gDirectory->cd(
"WrongPVHypothesis");
1045 CreateParameterHistograms(histoParameters[4], histoParameters2D[4], 0, iPart);
1047 gDirectory->cd(
"..");
1049 gDirectory->mkdir(
"Background");
1050 gDirectory->cd(
"Background");
1052 CreateParameterHistograms(histoParameters[2], histoParameters2D[2], 0, iPart);
1054 gDirectory->cd(
"..");
1055 gDirectory->mkdir(
"Ghost");
1056 gDirectory->cd(
"Ghost");
1058 CreateParameterHistograms(histoParameters[3], histoParameters2D[3], 0, iPart);
1060 gDirectory->cd(
"..");
1062 CreateParameterHistograms(histoParameters[0], histoParameters2D[0], 0, iPart);
1064 CreateFitHistograms(histoFit[iPart], iPart);
1066 gDirectory->cd(
"..");
1069 TString KFParticlePerformanceBase::GetDirectoryPath()
1072 TString path = gDirectory->GetPath();
1073 int fileNamePosition = path.Index(
"Finder/");
1074 path.Remove(0, fileNamePosition+7);
1075 path.ReplaceAll(
"Particles/",
"");
1076 path.ReplaceAll(
"/Parameters",
"");
1081 #endif //DO_TPCCATRACKER_EFF_PERFORMANCE