Changes in / [193c0693:44dbbc1] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/StatusPidFilter.cc
r193c0693 r44dbbc1 50 50 51 51 using namespace std; 52 53 namespace {54 // integer power (faster than TMath::Pow() + cast to integer)55 int ipow(int base, int exp)56 {57 int result = 1;58 while (exp)59 {60 if (exp & 1)61 result *= base;62 exp >>= 1;63 base *= base;64 }65 66 return result;67 }68 69 // standalone function to extract the i-th digit from a number (counting from 0 = rightmost, etc..)70 int digit(int val, int i)71 {72 int y = ipow(10,i);73 int z = val/y;74 int val2 = val / (y * 10);75 return (z - val2*10);76 }77 78 // return the first two digits if this is a "fundamental" particle79 // ID = 100 is a special case (internal generator ID's are 81-100)80 // also, 101 and 102 are now used (by HepPID) for geantinos81 int fundamentalID(int pdgCode)82 {83 pdgCode = abs(pdgCode);84 if( ( digit(pdgCode, 9) == 1 ) && ( digit(pdgCode, 8) == 0 ) ) { return 0; }85 if( digit(pdgCode, 2) == 0 && digit(pdgCode, 3) == 0) {86 return pdgCode%10000;87 } else if( pdgCode <= 102 ) {88 return pdgCode;89 } else {90 return 0;91 }92 }93 94 bool hasBottom(int pdgCode)95 {96 if ( (pdgCode/10000000) > 0)97 return false;98 if (pdgCode <= 100)99 return false;100 if (fundamentalID(pdgCode) <= 100 && fundamentalID(pdgCode) > 0)101 return false;102 if( digit(pdgCode, 3) == 5 || digit(pdgCode, 2) == 5 || digit(pdgCode, 1) == 5 )103 return true;104 return false;105 }106 }107 108 52 109 53 //------------------------------------------------------------------------------ … … 173 117 if(pdgCode > 22 && pdgCode < 43) pass = kTRUE; 174 118 175 // logic ported from HepPDF: http://lcgapp.cern.ch/project/simu/HepPDT/HepPDT.2.05.02/html/ParticleID_8cc-source.html#l00081 176 bool is_b_hadron = hasBottom(pdgCode); 177 bool is_b_quark = (pdgCode == 5); 178 179 if (is_b_hadron) 180 pass = kTRUE; 181 182 // fPTMin not applied to b_hadrons / b_quarks to allow for b-enriched sample stitching 183 if(!pass || (candidate->Momentum.Pt() < fPTMin && !(is_b_hadron || is_b_quark)) ) continue; 119 if(!pass || candidate->Momentum.Pt() < fPTMin) continue; 184 120 185 121 fOutputArray->Add(candidate);
Note:
See TracChangeset
for help on using the changeset viewer.