PandaRoot
KFPartEfficiencies Class Reference

#include <KFPartEfficiencies.h>

Inheritance diagram for KFPartEfficiencies:

Public Member Functions

 KFPartEfficiencies ()
 
virtual ~KFPartEfficiencies ()
 
int GetParticleIndex (int pdg)
 
virtual void AddCounter (TString shortname, TString name)
 
KFPartEfficienciesoperator+= (KFPartEfficiencies &a)
 
void CalcEff ()
 
void Inc (bool isReco, int nClones, TString name)
 
void IncReco (bool isGhost, bool isBg, TString name)
 
void PrintEff ()
 
void AddFromFile (TString fileName)
 

Public Attributes

int partPDG [nParticles]
 
TString partName [nParticles]
 
TString partTitle [nParticles]
 
vector< vector< int > > partDaughterPdg
 
float partMHistoMin [nParticles]
 
float partMHistoMax [nParticles]
 

Static Public Attributes

static const int nParticles = 48
 

Friends

std::fstream & operator<< (std::fstream &strm, KFPartEfficiencies &a)
 
std::fstream & operator>> (std::fstream &strm, KFPartEfficiencies &a)
 

Detailed Description

Definition at line 10 of file KFPartEfficiencies.h.

Constructor & Destructor Documentation

◆ KFPartEfficiencies()

KFPartEfficiencies::KFPartEfficiencies ( )
inline

Definition at line 12 of file KFPartEfficiencies.h.

References AddCounter(), nParticles, partDaughterPdg, partMHistoMax, partMHistoMin, partName, partPDG, and partTitle.

12  : names(), indices(), ratio_reco(), mc(), reco(), ratio_ghost(), ratio_bg(), ratio_clone(), ghost(), bg(), clone()
13  {
14  // add total efficiency
15  // AddCounter("piPlus" ,"PiPlus efficiency");
16  // AddCounter("piMinus" ,"PiMinus efficiency");
17  int mPartPDG[nParticles] = {
18  310, 3122, -3122, 3312, -3312, 3334, -3334, // strange meson and hyperons
19  313, -313, 323, -323, // K* resonances
20  3224, 3114, -3114, -3224, // sigma resonances
21  3124, -3124, // Lambda resonances
22  3324, -3324, 1003314, -1003314, // Xi resonances
23  1003334, -100334, // Omega resonances
24  3000, // exotics
25  333, 113, // vector mesons, hadron chanel
26  100113, 200113, // light vector mesons
27  22, // dielectrons
28  443, 100443, // J/Psi
29  421, -421, 100421, -100421, // D0
30  411, -411, // D+, D-
31  431, -431, // Ds+, Ds-
32  4122, -4122, // Lambdac
33  10421, -10421, 10411, -10411, 20411, -20411,
34  3001 // H->Lambda p pi
35  };
36  TString mPartName[nParticles] = {"ks",
37  "lambda",
38  "lambdab",
39  "xi-",
40  "xi+",
41  "omega-",
42  "omega+",
43  "k*0",
44  "k*0b",
45  "k*+",
46  "k*-",
47  "sigma*+",
48  "sigma*-",
49  "sigma*+b",
50  "sigma*-b",
51  "lambda*",
52  "lambda*b",
53  "xi*0",
54  "xi*0b",
55  "xi*-_{#Lambda,K}",
56  "xi*+_{#Lambda,K}",
57  "omega*-",
58  "omega*+",
59  "Hdb",
60  "phi_{KK}",
61  "rho_{#pi#pi}",
62  "rho_{ee}",
63  "rho_{#mu#mu}",
64  "gamma",
65  "J#Psi_ee",
66  "J#Psi_#mu#mu",
67  "D0",
68  "D0b",
69  "D0_4",
70  "D0b_4",
71  "D+",
72  "D-",
73  "Ds+",
74  "Ds-",
75  "lambdac",
76  "lambdacb",
77  "D*0",
78  "D*0b",
79  "D*+",
80  "D*-",
81  "D*+_4",
82  "D*-_4",
83  "H0"};
84  TString mPartTitle[nParticles] = {
85  "KShort ", // 0
86  "Lambda ", // 1
87  "Lambda b ", // 2
88  "Xi- ", // 3
89  "Xi+ ", // 4
90  "Omega- ", // 5
91  "Omega+ ", // 6
92  "K*0 ", // 7
93  "K*0 b ", // 8
94  "K*+ ", // 9
95  "K*- ", // 10
96  "Sigma*+ ", // 11
97  "Sigma*- ", // 12
98  "Sigma*+ b", // 13
99  "Sigma*- b", // 14
100  "Lambda* ", // 15
101  "Lambda* b", // 16
102  "Xi*0 ", // 17
103  "Xi*0 b ", // 18
104  "Xi*-_lk ", // 19
105  "Xi*+_lk ", // 20
106  "Omega*- ", // 21
107  "Omega*+ ", // 22
108  "Hdb ", // 23
109  "phi_kk ", // 24
110  "rho_pipi ", // 25
111  "rho_ee ", // 26
112  "rho_mm ", // 27
113  "gamma ", // 28
114  "JPsi_ee ", // 29
115  "JPsi_mm ", // 30
116  "D0 ", // 31
117  "D0b ", // 32
118  "D0_4 ", // 33
119  "D0b_4 ", // 34
120  "D+ ", // 35
121  "D- ", // 36
122  "Ds+ ", // 37
123  "Ds- ", // 38
124  "Lambdac ", // 39
125  "Lambdac b", // 40
126  "D*0 ", // 41
127  "D*0 b ", // 42
128  "D*+ ", // 43
129  "D*- ", // 44
130  "D*+_4 ", // 45
131  "D*-_4 ", // 46
132  "H0 " // 47
133  };
134 
135  float mPartMHistoMin[nParticles] = {0.3, 1., 1., 1., 1., 1., 1., 0.6, 0.6, 0.6, 0.6, 1., 1., 1., 1., 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.8, 1.8, 1.,
136  0.6, 0.1, 0.1, 0.1, 0., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.8, 1.8, 1.8, 1.8, 1.8, 1.8, 1.8, 1.8, 1.};
137  float mPartMHistoMax[nParticles] = {1.3, 2., 2., 3., 3., 3., 3., 2.6, 2.6, 2.6, 2.6, 3., 3., 3., 3., 3.4, 3.4, 3.4, 3.4, 3.4, 3.4, 3.8, 3.8, 3.,
138  1.6, 2.1, 2.1, 2.1, 3., 4., 4., 3., 3., 3., 3., 3., 3., 3., 3., 3.8, 3.8, 3.8, 3.8, 3.8, 3.8, 3.8, 3.8, 3.};
139  // set decay mode
140  partDaughterPdg.resize(nParticles);
141 
142  partDaughterPdg[0].push_back(211); // K0s -> pi+ pi-
143  partDaughterPdg[0].push_back(-211);
144 
145  partDaughterPdg[1].push_back(2212); // Lambda -> p pi-
146  partDaughterPdg[1].push_back(-211);
147 
148  partDaughterPdg[2].push_back(-2212); // Lambda_bar -> p- pi+
149  partDaughterPdg[2].push_back(211);
150 
151  partDaughterPdg[3].push_back(3122); // Ksi- -> Lambda pi-
152  partDaughterPdg[3].push_back(-211);
153 
154  partDaughterPdg[4].push_back(-3122); // Ksi+ -> Lambda_bar pi+
155  partDaughterPdg[4].push_back(211);
156 
157  partDaughterPdg[5].push_back(3122); // Omega- -> Lambda K-
158  partDaughterPdg[5].push_back(-321);
159 
160  partDaughterPdg[6].push_back(-3122); // Omega+ -> Lambda_bar K+
161  partDaughterPdg[6].push_back(321);
162 
163  partDaughterPdg[7].push_back(321); // K*0 -> K+ pi-
164  partDaughterPdg[7].push_back(-211);
165 
166  partDaughterPdg[8].push_back(-321); // K*0_bar -> K- pi+
167  partDaughterPdg[8].push_back(211);
168 
169  partDaughterPdg[9].push_back(310); // K*+ -> K0s pi+
170  partDaughterPdg[9].push_back(211);
171 
172  partDaughterPdg[10].push_back(310); // K*- -> K0s pi-
173  partDaughterPdg[10].push_back(-211);
174 
175  partDaughterPdg[11].push_back(3122); // Sigma+ -> Lambda pi+
176  partDaughterPdg[11].push_back(211);
177 
178  partDaughterPdg[12].push_back(3122); // Sigma- -> Lambda pi-
179  partDaughterPdg[12].push_back(-211);
180 
181  partDaughterPdg[13].push_back(-3122); // Sigma+_bar -> Lambda_bar pi+
182  partDaughterPdg[13].push_back(211);
183 
184  partDaughterPdg[14].push_back(-3122); // Sigma-_bar -> Lambda_bar pi-
185  partDaughterPdg[14].push_back(-211);
186 
187  partDaughterPdg[15].push_back(2212); // Lambda* -> p K-
188  partDaughterPdg[15].push_back(-321);
189 
190  partDaughterPdg[16].push_back(-2212); // Lambda*_bar -> p- K+
191  partDaughterPdg[16].push_back(321);
192 
193  partDaughterPdg[17].push_back(3312); // Xi*0 -> Xi- pi+
194  partDaughterPdg[17].push_back(211);
195 
196  partDaughterPdg[18].push_back(-3312); // Xi*0_bar -> Xi+ pi-
197  partDaughterPdg[18].push_back(-211);
198 
199  partDaughterPdg[19].push_back(3122); // Xi*- -> Lambda K-
200  partDaughterPdg[19].push_back(-321);
201 
202  partDaughterPdg[20].push_back(-3122); // Xi*+ -> Lambda_bar K+
203  partDaughterPdg[20].push_back(321);
204 
205  partDaughterPdg[21].push_back(3312); // Omega*- -> Xi- pi+ K-
206  partDaughterPdg[21].push_back(211);
207  partDaughterPdg[21].push_back(-321);
208 
209  partDaughterPdg[22].push_back(-3312); // Omega*- -> Xi+ pi- K+
210  partDaughterPdg[22].push_back(-211);
211  partDaughterPdg[22].push_back(321);
212 
213  partDaughterPdg[23].push_back(3122); // H-dibar -> Lambda Lambda
214  partDaughterPdg[23].push_back(3122);
215 
216  partDaughterPdg[24].push_back(321); // phi -> K+ K-
217  partDaughterPdg[24].push_back(-321);
218 
219  partDaughterPdg[25].push_back(211); // rho, omega, phi -> pi+ pi-
220  partDaughterPdg[25].push_back(-211);
221 
222  partDaughterPdg[26].push_back(11); // rho, omega, phi -> e+ e-
223  partDaughterPdg[26].push_back(-11);
224 
225  partDaughterPdg[27].push_back(13); // rho, omega, phi -> mu+ mu-
226  partDaughterPdg[27].push_back(-13);
227 
228  partDaughterPdg[28].push_back(11); // gamma -> e+ e-
229  partDaughterPdg[28].push_back(-11);
230 
231  partDaughterPdg[29].push_back(11); // JPsi -> e+ e-
232  partDaughterPdg[29].push_back(-11);
233 
234  partDaughterPdg[30].push_back(13); // JPsi -> mu+ mu-
235  partDaughterPdg[30].push_back(-13);
236 
237  partDaughterPdg[31].push_back(211); // D0 -> pi+ K-
238  partDaughterPdg[31].push_back(-321);
239 
240  partDaughterPdg[32].push_back(-211); // D0_bar -> K+ pi-
241  partDaughterPdg[32].push_back(321);
242 
243  partDaughterPdg[33].push_back(211); // D0 -> pi+ pi+ pi- K-
244  partDaughterPdg[33].push_back(211);
245  partDaughterPdg[33].push_back(-211);
246  partDaughterPdg[33].push_back(-321);
247 
248  partDaughterPdg[34].push_back(-211); // D0_bar -> pi- pi- pi+ K+
249  partDaughterPdg[34].push_back(-211);
250  partDaughterPdg[34].push_back(211);
251  partDaughterPdg[34].push_back(321);
252 
253  partDaughterPdg[35].push_back(-321); // D+ -> K- pi+ pi+
254  partDaughterPdg[35].push_back(211);
255  partDaughterPdg[35].push_back(211);
256 
257  partDaughterPdg[36].push_back(321); // D- -> K+ pi- pi-
258  partDaughterPdg[36].push_back(-211);
259  partDaughterPdg[36].push_back(-211);
260 
261  partDaughterPdg[37].push_back(-321); // Ds+ -> K- K+ pi+
262  partDaughterPdg[37].push_back(321);
263  partDaughterPdg[37].push_back(211);
264 
265  partDaughterPdg[38].push_back(321); // Ds- -> K+ K- pi-
266  partDaughterPdg[38].push_back(-321);
267  partDaughterPdg[38].push_back(-211);
268 
269  partDaughterPdg[39].push_back(211); // Lambdac -> pi+ K- p
270  partDaughterPdg[39].push_back(-321);
271  partDaughterPdg[39].push_back(2212);
272 
273  partDaughterPdg[40].push_back(-211); // Lambdac_bar -> pi- K+ p-
274  partDaughterPdg[40].push_back(321);
275  partDaughterPdg[40].push_back(-2212);
276 
277  partDaughterPdg[41].push_back(411); // D*0 -> D+ pi-
278  partDaughterPdg[41].push_back(-211);
279 
280  partDaughterPdg[42].push_back(-411); // D*0_bar -> D- pi+
281  partDaughterPdg[42].push_back(211);
282 
283  partDaughterPdg[43].push_back(421); // D*+ -> D0 pi+
284  partDaughterPdg[43].push_back(211);
285 
286  partDaughterPdg[44].push_back(-421); // D*- -> D0_bar pi-
287  partDaughterPdg[44].push_back(-211);
288 
289  partDaughterPdg[45].push_back(421); // D*+ -> D04 pi+
290  partDaughterPdg[45].push_back(211);
291 
292  partDaughterPdg[46].push_back(-421); // D*- -> D04_bar pi-
293  partDaughterPdg[46].push_back(-211);
294 
295  partDaughterPdg[47].push_back(3122); // H0-> Lambda pi- p
296  partDaughterPdg[47].push_back(-211);
297  partDaughterPdg[47].push_back(2212);
298 
299  for (int iP = 0; iP < nParticles; iP++) {
300  partPDG[iP] = mPartPDG[iP];
301  partName[iP] = mPartName[iP];
302  partTitle[iP] = mPartTitle[iP];
303  partMHistoMin[iP] = mPartMHistoMin[iP];
304  partMHistoMax[iP] = mPartMHistoMax[iP];
305  }
306 
307  for (int iP = 0; iP < nParticles; iP++) {
308  AddCounter(Form("%s", partName[iP].Data()), Form("%-*s", 14, partTitle[iP].Data()));
309  AddCounter(Form("%s_prim", partName[iP].Data()), Form("%s Prim", partTitle[iP].Data()));
310  AddCounter(Form("%s_sec", partName[iP].Data()), Form("%s Sec ", partTitle[iP].Data()));
311  }
312 
313  for (int iP = 0; iP < nParticles; iP++)
314  fPdgToIndex[mPartPDG[iP]] = iP;
315  }
vector< vector< int > > partDaughterPdg
float partMHistoMin[nParticles]
TString partTitle[nParticles]
TString partName[nParticles]
static const int nParticles
virtual void AddCounter(TString shortname, TString name)
int partPDG[nParticles]
float partMHistoMax[nParticles]

◆ ~KFPartEfficiencies()

virtual KFPartEfficiencies::~KFPartEfficiencies ( )
inlinevirtual

Definition at line 317 of file KFPartEfficiencies.h.

317 {};

Member Function Documentation

◆ AddCounter()

virtual void KFPartEfficiencies::AddCounter ( TString  shortname,
TString  name 
)
inlinevirtual

Definition at line 329 of file KFPartEfficiencies.h.

References TTracksCatCounters< T >::AddCounter().

Referenced by KFPartEfficiencies().

330  {
331  indices[shortname] = names.size();
332  names.push_back(name);
333 
334  ratio_reco.AddCounter();
335  mc.AddCounter();
336  reco.AddCounter();
337 
338  ratio_ghost.AddCounter();
339  ratio_bg.AddCounter();
340  ratio_clone.AddCounter();
341  ghost.AddCounter();
342  bg.AddCounter();
343  clone.AddCounter();
344  };

◆ AddFromFile()

void KFPartEfficiencies::AddFromFile ( TString  fileName)
inline

Definition at line 457 of file KFPartEfficiencies.h.

458  {
459  std::fstream file(fileName.Data(), fstream::in);
460  file >> *this;
461  }

◆ CalcEff()

void KFPartEfficiencies::CalcEff ( )
inline

Definition at line 356 of file KFPartEfficiencies.h.

357  {
358  ratio_reco = reco / mc;
359 
360  TTracksCatCounters<int> allReco = reco + ghost + bg;
361  ratio_ghost = ghost / allReco;
362  ratio_bg = bg / allReco;
363  ratio_clone = clone / allReco;
364  };

◆ GetParticleIndex()

int KFPartEfficiencies::GetParticleIndex ( int  pdg)
inline

Definition at line 319 of file KFPartEfficiencies.h.

320  {
321  std::map<int, int>::iterator it;
322  it = fPdgToIndex.find(pdg);
323  if (it != fPdgToIndex.end())
324  return it->second;
325  else
326  return -1;
327  }

◆ Inc()

void KFPartEfficiencies::Inc ( bool  isReco,
int  nClones,
TString  name 
)
inline

Definition at line 366 of file KFPartEfficiencies.h.

References TTracksCatCounters< T >::counters.

367  {
368  const int index = indices[name];
369 
370  mc.counters[index]++;
371  if (isReco)
372  reco.counters[index]++;
373  if (nClones > 0)
374  clone.counters[index] += nClones;
375  };

◆ IncReco()

void KFPartEfficiencies::IncReco ( bool  isGhost,
bool  isBg,
TString  name 
)
inline

Definition at line 377 of file KFPartEfficiencies.h.

References TTracksCatCounters< T >::counters.

378  {
379  const int index = indices[name];
380 
381  if (isGhost)
382  ghost.counters[index]++;
383  if (isBg)
384  bg.counters[index]++;
385  };

◆ operator+=()

KFPartEfficiencies& KFPartEfficiencies::operator+= ( KFPartEfficiencies a)
inline

Definition at line 346 of file KFPartEfficiencies.h.

347  {
348  mc += a.mc;
349  reco += a.reco;
350  ghost += a.ghost;
351  bg += a.bg;
352  clone += a.clone;
353  return *this;
354  };

◆ PrintEff()

void KFPartEfficiencies::PrintEff ( )
inline

Definition at line 387 of file KFPartEfficiencies.h.

References TTracksCatCounters< T >::counters, and TTracksCatCounters< T >::NCounters.

388  {
389 
390  // save original cout flags
391  std::ios_base::fmtflags coutFlags = cout.flags();
392 
393  std::cout.setf(ios::fixed);
394  std::cout.setf(ios::showpoint);
395  std::cout.precision(3);
396  std::cout << "Particle : "
397  << " Eff "
398  << " / "
399  << " Ghost "
400  << " / "
401  << "BackGr "
402  << " / "
403  << "N Ghost"
404  << " / "
405  << "N BackGr"
406  << " / "
407  << "N Reco "
408  << " / "
409  << "N Clone "
410  << " | "
411  << " N MC " << std::endl;
412 
413  int NCounters = mc.NCounters;
414  for (int iC = 0; iC < NCounters; iC++) {
415  std::cout << names[iC] << " : " << setw(6) << ratio_reco.counters[iC] << " / " << setw(6) << ratio_ghost.counters[iC] // particles w\o MCParticle
416  << " / " << setw(6) << ratio_bg.counters[iC] // particles with incorrect MCParticle
417  << " / " << setw(6) << ghost.counters[iC] << " / " << setw(7) << bg.counters[iC] << " / " << setw(6) << reco.counters[iC] << " / " << setw(7)
418  << clone.counters[iC] << " | " << setw(6) << mc.counters[iC] << std::endl;
419  }
420 
421  // restore original cout flags
422  cout.flags(coutFlags);
423  };

Friends And Related Function Documentation

◆ operator<<

std::fstream& operator<< ( std::fstream &  strm,
KFPartEfficiencies a 
)
friend

Definition at line 425 of file KFPartEfficiencies.h.

426  {
427 
428  strm << a.ratio_reco;
429  strm << a.mc;
430  strm << a.reco;
431  strm << a.ratio_ghost;
432  strm << a.ratio_bg;
433  strm << a.ratio_clone;
434  strm << a.ghost;
435  strm << a.bg;
436  strm << a.clone;
437 
438  return strm;
439  }

◆ operator>>

std::fstream& operator>> ( std::fstream &  strm,
KFPartEfficiencies a 
)
friend

Definition at line 441 of file KFPartEfficiencies.h.

442  {
443 
444  strm >> a.ratio_reco;
445  strm >> a.mc;
446  strm >> a.reco;
447  strm >> a.ratio_ghost;
448  strm >> a.ratio_bg;
449  strm >> a.ratio_clone;
450  strm >> a.ghost;
451  strm >> a.bg;
452  strm >> a.clone;
453 
454  return strm;
455  }

Member Data Documentation

◆ nParticles

const int KFPartEfficiencies::nParticles = 48
static

Definition at line 463 of file KFPartEfficiencies.h.

Referenced by KFPartEfficiencies().

◆ partDaughterPdg

vector<vector<int> > KFPartEfficiencies::partDaughterPdg

Definition at line 467 of file KFPartEfficiencies.h.

Referenced by KFPartEfficiencies().

◆ partMHistoMax

float KFPartEfficiencies::partMHistoMax[nParticles]

Definition at line 469 of file KFPartEfficiencies.h.

Referenced by KFPartEfficiencies().

◆ partMHistoMin

float KFPartEfficiencies::partMHistoMin[nParticles]

Definition at line 468 of file KFPartEfficiencies.h.

Referenced by KFPartEfficiencies().

◆ partName

TString KFPartEfficiencies::partName[nParticles]

Definition at line 465 of file KFPartEfficiencies.h.

Referenced by KFPartEfficiencies().

◆ partPDG

int KFPartEfficiencies::partPDG[nParticles]

Definition at line 464 of file KFPartEfficiencies.h.

Referenced by KFPartEfficiencies().

◆ partTitle

TString KFPartEfficiencies::partTitle[nParticles]

Definition at line 466 of file KFPartEfficiencies.h.

Referenced by KFPartEfficiencies().


The documentation for this class was generated from the following file: