FairRoot/PandaRoot
PndPidListMaker.cxx
Go to the documentation of this file.
1 #include "PndPidListMaker.h"
2 
3 #include <string>
4 
5 #include "RhoBase/RhoCandidate.h"
6 #include "RhoBase/RhoCandList.h"
8 
10 {
11  Init();
12 }
13 
15 {
16  SetBaseList(l);
17  Init();
18 }
19 
21 {
23 }
24 
26 {
27  // init the selectors;
30 
31  // **** pid selectors for generic list creation
32  //
38 
39  // initialize Known Names
40  std::vector<std::string> pNames;
41  std::vector<std::string> critNames;
42 
43  pNames.push_back("Electron");
44  pNames.push_back("Muon");
45  pNames.push_back("Pion");
46  pNames.push_back("Kaon");
47  pNames.push_back("Proton");
48 
49  critNames.push_back("VeryLoose");
50  critNames.push_back("Loose");
51  critNames.push_back("Tight");
52  critNames.push_back("VeryTight");
53  critNames.push_back("Best"); //
54  critNames.push_back("All"); //
55 
56  fListNames.clear();
57 
58  for (unsigned int i=0; i<pNames.size(); i++) {
59  for (unsigned int j=0; j<critNames.size(); j++) {
60  fListNames.push_back(pNames[i]+critNames[j]);
61  fListNames.push_back(pNames[i]+critNames[j]+"Plus");
62  fListNames.push_back(pNames[i]+critNames[j]+"Minus");
63  }
64  }
65 }
66 
68 {
69  fBaseList=l;
70 }
71 
72 bool PndPidListMaker::FillList(RhoCandList& l, std::string listkey)
73 {
74  //RhoCandidate *tc;
75  l.Cleanup();
76 
77  if (listkey=="Charged") {
78  l=fBaseList;
79  return true;
80  }
81 
82  if (listkey=="Plus") {
84  return true;
85  }
86 
87  if (listkey=="Minus") {
89  return true;
90  }
91 
92  bool listExists=false;
93  int i=0, n=fListNames.size();
94 
95  while (i<n && !listExists) { listExists=(listkey==fListNames[i++]); }
96 
97  if (!listExists) { return false; }
98 
99  --i;
100 
101  //int ptype=i/12; // particle type: 0=electron, ..., 4=proton
102  //int ctype=(i%12)/3; // criterion: 0=veryLoose,..., 3=veryTight
103  //int select_chrg=(i%3); // select charge: 0=all, 1=plus, 2=minus
104 
105  int ptype=i/18; // particle type: 0=electron, ..., 4=proton
106  int ctype=(i%18)/3; // criterion: 0=veryLoose,..., 3=veryTight, 4=Best, 5=all
107  int select_chrg=(i%3); // select charge: 0=all, 1=plus, 2=minus
108 
109  RhoParticleSelectorBase* pidSel=NULL;
110 
111  if (select_chrg==1) {
113  } else if (select_chrg==2) {
115  }
116 
117  switch (ptype) {
118  case 0:
119  pidSel = eSel;
120  break;
121  case 1:
122  pidSel = muSel;
123  break;
124  case 2:
125  pidSel = piSel;
126  break;
127  case 3:
128  pidSel = kSel;
129  break;
130  case 4:
131  pidSel = pSel;
132  break;
133  }
134  if (NULL==pidSel) { return false; }
135 
136  switch (ctype) {
137  case 0:
138  pidSel->SetCriterion(veryLoose);
139  break;
140  case 1:
141  pidSel->SetCriterion(loose);
142  break;
143  case 2:
144  pidSel->SetCriterion(tight);
145  break;
146  case 3:
147  pidSel->SetCriterion(veryTight);
148  break;
149  case 4:
150  pidSel->SetCriterion(best);
151  break; //
152  case 5:
153  pidSel->SetCriterion(all);
154  break; //
155  }
156 
157  if (select_chrg>0) {
158  l.Select(pidSel);
159  } else {
160  l.Select(fBaseList,pidSel);
161  }
162 
163  return true;
164 }
void Cleanup()
Definition: RhoCandList.cxx:62
Int_t i
Definition: run_full.C:25
RhoMinusParticleSelector * minusSel
int n
RhoSimplePionSelector * piSel
void SetBaseList(RhoCandList &l)
RhoPlusParticleSelector * plusSel
void Select(RhoParticleSelectorBase *pidmgr)
RhoCandList fBaseList
virtual void SetCriterion(const char *crit)
bool FillList(RhoCandList &l, std::string listkey="All")
RhoSimpleProtonSelector * pSel
RhoSimpleKaonSelector * kSel
RhoSimpleMuonSelector * muSel
std::vector< std::string > fListNames
virtual ~PndPidListMaker()
RhoSimpleElectronSelector * eSel