BmnRoot
Loading...
Searching...
No Matches
CbmKFPartEfficiencies.h
Go to the documentation of this file.
1#ifndef CbmKFPartEfficiencies_H
2#define CbmKFPartEfficiencies_H
3
4#include "TNamed.h"
5#include "CbmL1Counters.h"
6
7class CbmKFPartEfficiencies: public TNamed
8{
9 public:
10
13 names(),
14 indices(),
15 fPdgToIndex(),
16 ratio_reco(),
17 mc(),
18 reco(),
19 ratio_ghost(),
20 ratio_bg(),
21 ratio_clone(),
22 ghost(),
23 bg(),
24 clone()
25 {
26 // add total efficiency
27 // AddCounter("piPlus" ,"PiPlus efficiency");
28 // AddCounter("piMinus" ,"PiMinus efficiency");
29 int mPartPDG[nParticles] = {310,3122,-3122,3312,-3312,3322,-3322,3334,-3334,3212,-3212,3222,-3222, //strange meson and hyperons
30 313,-313,323,-323, //K* resonances
31 3224,3114,-3114,-3224, 3214, -3214,//sigma resonances
32 3124,-3124, //Lambda resonances
33 3324, -3324, 1003314, -1003314, 3314, -3314, //Xi resonances
34 1003334, -1003334, //Omega resonances
35 3000, //exotics
36 333,113, //vector mesons, hadron chanel
37 100113, 200113, //light vector mesons
38 22, //dielectrons
39 111,221, //pi0, eta
40 443,100443, // J/Psi
41 421,-421,100421,-100421, //D0
42 411,-411, //D+, D-
43 431,-431, //Ds+, Ds-
44 4122,-4122, //Lambdac
45 10421, -10421, 10411, -10411, 20411, -20411,
46 3001 //H->Lambda p pi
47 };
48 TString mPartName[nParticles] = {"ks","lambda","lambdab","xi-","xi+","xi0","xi0b","omega-","omega+","#Sigma^0","#Sigma^0b", "#Sigma^+", "#Sigma^+b",
49 "k*0","k*0b","k*+","k*-",
50 "sigma*+","sigma*-","sigma*+b","sigma*-b","sigma*0","sigma*0b",
51 "lambda*","lambda*b",
52 "xi*0", "xi*0b", "xi*-_{#Lambda,K}", "xi*+_{#Lambda,K}", "xi*-_{#xi-,#pi0}", "xi*+_{#xi+,#pi0}",
53 "omega*-","omega*+",
54 "Hdb",
55 "phi_{KK}", "rho_{#pi#pi}",
56 "rho_{ee}", "rho_{#mu#mu}",
57 "gamma",
58 "#pi^{0}","eta",
59 "J#Psi_ee","J#Psi_#mu#mu",
60 "D0","D0b","D0_4","D0b_4",
61 "D+","D-",
62 "Ds+","Ds-",
63 "lambdac", "lambdacb",
64 "D*0", "D*0b", "D*+", "D*-", "D*+_4", "D*-_4",
65 "H0"
66 };
67 TString mPartTitle[nParticles] = {"KShort ", //0
68 "Lambda ", //1
69 "Lambda b ", //2
70 "Xi- ", //3
71 "Xi+ ", //4
72 "Xi0 ", //5
73 "Xi0 b ", //6
74 "Omega- ", //7
75 "Omega+ ", //8
76 "Sigma0 ", //9
77 "Sigma0 b ", //10
78 "Sigma+ ", //11
79 "Sigma+ b ", //12
80 "K*0 ", //13
81 "K*0 b ", //14
82 "K*+ ", //15
83 "K*- ", //16
84 "Sigma*+ ", //17
85 "Sigma*- ", //18
86 "Sigma*+ b", //19
87 "Sigma*- b", //20
88 "Sigma*0 ", //21
89 "Sigma*0 b", //22
90 "Lambda* ", //23
91 "Lambda* b", //24
92 "Xi*0 ", //25
93 "Xi*0 b ", //26
94 "Xi*-_lk ", //27
95 "Xi*+_lk ", //28
96 "Xi*-_XiPi", //29
97 "Xi*+_XiPi", //30
98 "Omega*- ", //31
99 "Omega*+ ", //32
100 "Hdb ", //33
101 "phi_kk ", //34
102 "rho_pipi ", //35
103 "rho_ee ", //36
104 "rho_mm ", //37
105 "gamma ", //38
106 "Pi0 ", //39
107 "eta ", //40
108 "JPsi_ee ", //41
109 "JPsi_mm ", //42
110 "D0 ", //43
111 "D0b ", //44
112 "D0_4 ", //45
113 "D0b_4 ", //46
114 "D+ ", //47
115 "D- ", //48
116 "Ds+ ", //49
117 "Ds- ", //50
118 "Lambdac ", //51
119 "Lambdac b", //52
120 "D*0 ", //53
121 "D*0 b ", //54
122 "D*+ ", //55
123 "D*- ", //56
124 "D*+_4 ", //57
125 "D*-_4 ", //58
126 "H0 " //59
127 };
128
129 float mPartMHistoMin[nParticles] = {0.3, 1., 1., 1., 1., 1., 1.,1.,1.,1.,1.,1.,1.,
130 0.6, 0.6, 0.6, 0.6,
131 1.,1.,1.,1.,1.,1.,
132 1.4, 1.4,
133 1.4, 1.4, 1.4, 1.4, 1.4, 1.4,
134 1.8,1.8,
135 1.,
136 0.6, 0.1,
137 0.1, 0.1,
138 0.,
139 0.,0.,
140 1.,1.,
141 1.,1.,1.,1.,
142 1.,1.,
143 1.,1.,
144 1.8,1.8,
145 1.8,1.8,1.8,1.8,1.8,1.8,
146 1.};
147 float mPartMHistoMax[nParticles] = {1.3, 2., 2., 3., 3., 3., 3., 3., 3.,3.,3.,3.,3.,
148 2.6, 2.6, 2.6, 2.6,
149 3., 3., 3., 3.,3.,3.,
150 3.4, 3.4,
151 3.4, 3.4, 3.4, 3.4, 3.4, 3.4,
152 3.8, 3.8,
153 3.,
154 1.6, 2.1,
155 2.1, 2.1,
156 3.,
157 3.,3.,
158 4.,4.,
159 3.,3.,3.,3.,
160 3.,3.,
161 3.,3.,
162 3.8,3.8,
163 3.8,3.8,3.8,3.8,3.8,3.8,
164 3.};
165 //set decay mode
167
168 partDaughterPdg[ 0].push_back( 211); //K0s -> pi+ pi-
169 partDaughterPdg[ 0].push_back( -211);
170
171 partDaughterPdg[ 1].push_back( 2212); //Lambda -> p pi-
172 partDaughterPdg[ 1].push_back( -211);
173
174 partDaughterPdg[ 2].push_back(-2212); //Lambda_bar -> p- pi+
175 partDaughterPdg[ 2].push_back( 211);
176
177 partDaughterPdg[ 3].push_back( 3122); //Xi- -> Lambda pi-
178 partDaughterPdg[ 3].push_back( -211);
179
180 partDaughterPdg[ 4].push_back(-3122); //Xi+ -> Lambda_bar pi+
181 partDaughterPdg[ 4].push_back( 211);
182
183 partDaughterPdg[ 5].push_back( 3122); //Xi0 -> Lambda pi0
184 partDaughterPdg[ 5].push_back( 111);
185
186 partDaughterPdg[ 6].push_back(-3122); //Xi0_bar -> Lambda_bar pi0
187 partDaughterPdg[ 6].push_back( 111);
188
189 partDaughterPdg[ 7].push_back( 3122); //Omega- -> Lambda K-
190 partDaughterPdg[ 7].push_back( -321);
191
192 partDaughterPdg[ 8].push_back(-3122); //Omega+ -> Lambda_bar K+
193 partDaughterPdg[ 8].push_back( 321);
194
195 partDaughterPdg[ 9].push_back( 22); //Sigma0 -> Lambda Gamma
196 partDaughterPdg[ 9].push_back( 3122);
197
198 partDaughterPdg[10].push_back( 22); //Sigma0_bar -> Lambda_bar Gamma
199 partDaughterPdg[10].push_back(-3122);
200
201 partDaughterPdg[11].push_back( 111); //Sigma+ -> p pi0
202 partDaughterPdg[11].push_back( 2212);
203
204 partDaughterPdg[12].push_back( 111); //Sigma+_bar -> p- pi0
205 partDaughterPdg[12].push_back(-2212);
206
207 partDaughterPdg[13].push_back( 321); //K*0 -> K+ pi-
208 partDaughterPdg[13].push_back( -211);
209
210 partDaughterPdg[14].push_back( -321); //K*0_bar -> K- pi+
211 partDaughterPdg[14].push_back( 211);
212
213 partDaughterPdg[15].push_back( 310); //K*+ -> K0s pi+
214 partDaughterPdg[15].push_back( 211);
215
216 partDaughterPdg[16].push_back( 310); //K*- -> K0s pi-
217 partDaughterPdg[16].push_back( -211);
218
219 partDaughterPdg[17].push_back( 3122); //Sigma+ -> Lambda pi+
220 partDaughterPdg[17].push_back( 211);
221
222 partDaughterPdg[18].push_back( 3122); //Sigma- -> Lambda pi-
223 partDaughterPdg[18].push_back( -211);
224
225 partDaughterPdg[19].push_back(-3122); //Sigma+_bar -> Lambda_bar pi+
226 partDaughterPdg[19].push_back( 211);
227
228 partDaughterPdg[20].push_back(-3122); //Sigma-_bar -> Lambda_bar pi-
229 partDaughterPdg[20].push_back( -211);
230
231 partDaughterPdg[21].push_back( 3122); //Sigma*0 -> Lambda pi0
232 partDaughterPdg[21].push_back( 111);
233
234 partDaughterPdg[22].push_back(-3122); //Sigma*0_bar -> Lambda_bar pi0
235 partDaughterPdg[22].push_back( 111);
236
237 partDaughterPdg[23].push_back( 2212); //Lambda* -> p K-
238 partDaughterPdg[23].push_back( -321);
239
240 partDaughterPdg[24].push_back(-2212); //Lambda*_bar -> p- K+
241 partDaughterPdg[24].push_back( 321);
242
243 partDaughterPdg[25].push_back( 3312); //Xi*0 -> Xi- pi+
244 partDaughterPdg[25].push_back( 211);
245
246 partDaughterPdg[26].push_back(-3312); //Xi*0_bar -> Xi+ pi-
247 partDaughterPdg[26].push_back( -211);
248
249 partDaughterPdg[27].push_back( 3122); //Xi*- -> Lambda K-
250 partDaughterPdg[27].push_back( -321);
251
252 partDaughterPdg[28].push_back(-3122); //Xi*+ -> Lambda_bar K+
253 partDaughterPdg[28].push_back( 321);
254
255 partDaughterPdg[29].push_back( 3312); //Xi*- -> Xi- pi0
256 partDaughterPdg[29].push_back( 111);
257
258 partDaughterPdg[30].push_back(-3312); //Xi*+ -> Xi+ pi0
259 partDaughterPdg[30].push_back( 111);
260
261 partDaughterPdg[31].push_back( 3312); //Omega*- -> Xi- pi+ K-
262 partDaughterPdg[31].push_back( 211);
263 partDaughterPdg[31].push_back( -321);
264
265 partDaughterPdg[32].push_back(-3312); //Omega*- -> Xi+ pi- K+
266 partDaughterPdg[32].push_back( -211);
267 partDaughterPdg[32].push_back( 321);
268
269 partDaughterPdg[33].push_back( 3122); //H-dibar -> Lambda Lambda
270 partDaughterPdg[33].push_back( 3122);
271
272 partDaughterPdg[34].push_back( 321); //phi -> K+ K-
273 partDaughterPdg[34].push_back( -321);
274
275 partDaughterPdg[35].push_back( 211); //rho, omega, phi -> pi+ pi-
276 partDaughterPdg[35].push_back( -211);
277
278 partDaughterPdg[36].push_back( 11); //rho, omega, phi -> e+ e-
279 partDaughterPdg[36].push_back( -11);
280
281 partDaughterPdg[37].push_back( 13); //rho, omega, phi -> mu+ mu-
282 partDaughterPdg[37].push_back( -13);
283
284 partDaughterPdg[38].push_back( 11); //gamma -> e+ e-
285 partDaughterPdg[38].push_back( -11);
286
287 partDaughterPdg[39].push_back( 22); //pi0 -> gamma gamma
288 partDaughterPdg[39].push_back( 22);
289
290 partDaughterPdg[40].push_back( 111); //eta -> pi0 pi0
291 partDaughterPdg[40].push_back( 111);
292 partDaughterPdg[40].push_back( 111);
293
294 partDaughterPdg[41].push_back( 11); //JPsi -> e+ e-
295 partDaughterPdg[41].push_back( -11);
296
297 partDaughterPdg[42].push_back( 13); //JPsi -> mu+ mu-
298 partDaughterPdg[42].push_back( -13);
299
300 partDaughterPdg[43].push_back( 211); //D0 -> pi+ K-
301 partDaughterPdg[43].push_back( -321);
302
303 partDaughterPdg[44].push_back( -211); //D0_bar -> K+ pi-
304 partDaughterPdg[44].push_back( 321);
305
306 partDaughterPdg[45].push_back( 211); //D0 -> pi+ pi+ pi- K-
307 partDaughterPdg[45].push_back( 211);
308 partDaughterPdg[45].push_back( -211);
309 partDaughterPdg[45].push_back( -321);
310
311 partDaughterPdg[46].push_back( -211); //D0_bar -> pi- pi- pi+ K+
312 partDaughterPdg[46].push_back( -211);
313 partDaughterPdg[46].push_back( 211);
314 partDaughterPdg[46].push_back( 321);
315
316 partDaughterPdg[47].push_back( -321); //D+ -> K- pi+ pi+
317 partDaughterPdg[47].push_back( 211);
318 partDaughterPdg[47].push_back( 211);
319
320 partDaughterPdg[48].push_back( 321); //D- -> K+ pi- pi-
321 partDaughterPdg[48].push_back( -211);
322 partDaughterPdg[48].push_back( -211);
323
324 partDaughterPdg[49].push_back( -321); //Ds+ -> K- K+ pi+
325 partDaughterPdg[49].push_back( 321);
326 partDaughterPdg[49].push_back( 211);
327
328 partDaughterPdg[50].push_back( 321); //Ds- -> K+ K- pi-
329 partDaughterPdg[50].push_back( -321);
330 partDaughterPdg[50].push_back( -211);
331
332 partDaughterPdg[51].push_back( 211); //Lambdac -> pi+ K- p
333 partDaughterPdg[51].push_back( -321);
334 partDaughterPdg[51].push_back( 2212);
335
336 partDaughterPdg[52].push_back( -211); //Lambdac_bar -> pi- K+ p-
337 partDaughterPdg[52].push_back( 321);
338 partDaughterPdg[52].push_back(-2212);
339
340 partDaughterPdg[53].push_back( 411); //D*0 -> D+ pi-
341 partDaughterPdg[53].push_back( -211);
342
343 partDaughterPdg[54].push_back( -411); //D*0_bar -> D- pi+
344 partDaughterPdg[54].push_back( 211);
345
346 partDaughterPdg[55].push_back( 421); //D*+ -> D0 pi+
347 partDaughterPdg[55].push_back( 211);
348
349 partDaughterPdg[56].push_back( -421); //D*- -> D0_bar pi-
350 partDaughterPdg[56].push_back( -211);
351
352 partDaughterPdg[57].push_back( 421); //D*+ -> D04 pi+
353 partDaughterPdg[57].push_back( 211);
354
355 partDaughterPdg[58].push_back( -421); //D*- -> D04_bar pi-
356 partDaughterPdg[58].push_back( -211);
357
358 partDaughterPdg[59].push_back( 3122); //H0-> Lambda pi- p
359 partDaughterPdg[59].push_back( -211);
360 partDaughterPdg[59].push_back( 2212);
361
362 for(int iP=0; iP<nParticles; iP++)
363 {
364 partPDG[iP] = mPartPDG[iP];
365 partName[iP] = mPartName[iP];
366 partTitle[iP] = mPartTitle[iP];
367 partMHistoMin[iP] = mPartMHistoMin[iP];
368 partMHistoMax[iP] = mPartMHistoMax[iP];
369 }
370
371 for(int iP=0; iP<nParticles; iP++)
372 {
373 AddCounter(Form("%s",partName[iP].Data()), Form("%-*s",14,partTitle[iP].Data()));
374 AddCounter(Form("%s_prim",partName[iP].Data()), Form("%s Prim",partTitle[iP].Data()));
375 AddCounter(Form("%s_sec",partName[iP].Data()), Form("%s Sec ",partTitle[iP].Data()));
376 }
377
378 for(int iP=0; iP<nParticles; iP++)
379 fPdgToIndex[mPartPDG[iP]] = iP;
380 }
381
383
384 int GetParticleIndex(int pdg)
385 {
386 std::map<int, int>::iterator it;
387 it=fPdgToIndex.find(pdg);
388 if(it != fPdgToIndex.end()) return it->second;
389 else return -1;
390 }
391
392 virtual void AddCounter(TString shortname, TString name){
393 indices[shortname] = names.size();
394 names.push_back(name);
395
396 ratio_reco.AddCounter();
397 mc.AddCounter();
398 reco.AddCounter();
399
400 ratio_ghost.AddCounter();
401 ratio_bg.AddCounter();
402 ratio_clone.AddCounter();
403 ghost.AddCounter();
404 bg.AddCounter();
405 clone.AddCounter();
406 };
407
409 mc += a.mc; reco += a.reco;
410 ghost += a.ghost; bg += a.bg; clone += a.clone;
411 return *this;
412 };
413
414 void CalcEff(){
415 ratio_reco = reco/mc;
416
417 TL1TracksCatCounters<int> allReco = reco + ghost + bg;
418 ratio_ghost = ghost/allReco;
419 ratio_bg = bg/allReco;
420 ratio_clone = clone/allReco;
421 };
422
423
424 void Inc(bool isReco, int nClones, TString name)
425 {
426 const int index = indices[name];
427
428 mc.counters[index]++;
429 if (isReco) reco.counters[index]++;
430 if(nClones > 0)
431 clone.counters[index] += nClones;
432 };
433
434 void IncReco(bool isGhost, bool isBg, TString name){
435 const int index = indices[name];
436
437 if (isGhost) ghost. counters[index]++;
438 if (isBg) bg.counters[index]++;
439 };
440
441 void PrintEff(){
442 std::cout.setf(ios::fixed);
443 std::cout.setf(ios::showpoint);
444 std::cout.precision(3);
445 std::cout << "Particle : "
446 << " Eff "
447 <<" / "<< " Ghost "
448 <<" / "<< "BackGr "
449 <<" / "<< "N Ghost"
450 <<" / "<< "N BackGr"
451 <<" / "<< "N Reco "
452 <<" / "<< "N Clone "
453 <<" | "<< " N MC " << std::endl;
454
455 int NCounters = mc.NCounters;
456 for (int iC = 0; iC < NCounters; iC++){
457 std::cout << names[iC]
458 << " : " << setw(6) << ratio_reco.counters[iC]
459 << " / " << setw(6) << ratio_ghost.counters[iC] // particles w\o MCParticle
460 << " / " << setw(6) << ratio_bg.counters[iC] // particles with incorrect MCParticle
461 << " / " << setw(6) << ghost.counters[iC]
462 << " / " << setw(7) << bg.counters[iC]
463 << " / " << setw(6) << reco.counters[iC]
464 << " / " << setw(7) << clone.counters[iC]
465 << " | " << setw(6) << mc.counters[iC] << std::endl;
466 }
467 };
468
469 friend std::fstream & operator<<(std::fstream &strm, CbmKFPartEfficiencies &a) {
470
471 strm << a.ratio_reco;
472 strm << a.mc;
473 strm << a.reco;
474 strm << a.ratio_ghost;
475 strm << a.ratio_bg;
476 strm << a.ratio_clone;
477 strm << a.ghost;
478 strm << a.bg;
479 strm << a.clone;
480
481 return strm;
482 }
483
484 friend std::fstream & operator>>(std::fstream &strm, CbmKFPartEfficiencies &a){
485
486 strm >> a.ratio_reco;
487 strm >> a.mc;
488 strm >> a.reco;
489 strm >> a.ratio_ghost;
490 strm >> a.ratio_bg;
491 strm >> a.ratio_clone;
492 strm >> a.ghost;
493 strm >> a.bg;
494 strm >> a.clone;
495
496 return strm;
497 }
498
499 void AddFromFile(TString fileName)
500 {
501 std::fstream file(fileName.Data(),fstream::in);
502 file >> *this;
503 }
504
505 static const int nParticles = 60;
509 vector<vector<int> > partDaughterPdg;
512
514
515 private:
516 vector<TString> names; // names counters indexed by index of counter
517 map<TString, int> indices; // indices of counters indexed by a counter shortname
518
519 map<int, int> fPdgToIndex;
520
522
525
529
531 TL1TracksCatCounters<int> bg; // background
532 TL1TracksCatCounters<int> clone; // background
533};
534
535#endif
float partMHistoMin[nParticles]
vector< vector< int > > partDaughterPdg
void Inc(bool isReco, int nClones, TString name)
CbmKFPartEfficiencies & operator+=(CbmKFPartEfficiencies &a)
friend std::fstream & operator<<(std::fstream &strm, CbmKFPartEfficiencies &a)
TString partTitle[nParticles]
float partMHistoMax[nParticles]
ClassDef(CbmKFPartEfficiencies, 1)
virtual void AddCounter(TString shortname, TString name)
void IncReco(bool isGhost, bool isBg, TString name)
TString partName[nParticles]
friend std::fstream & operator>>(std::fstream &strm, CbmKFPartEfficiencies &a)
void AddFromFile(TString fileName)
counters used for efficiency calculation