Changeset 36b4099 in git
- Timestamp:
- Feb 23, 2018, 6:12:11 PM (7 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 9c980d2
- Parents:
- 44dbbc1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/StatusPidFilter.cc
r44dbbc1 r36b4099 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" particle 79 // ID = 100 is a special case (internal generator ID's are 81-100) 80 // also, 101 and 102 are now used (by HepPID) for geantinos 81 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 52 108 53 109 //------------------------------------------------------------------------------ … … 117 173 if(pdgCode > 22 && pdgCode < 43) pass = kTRUE; 118 174 119 if(!pass || candidate->Momentum.Pt() < fPTMin) continue; 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 178 if (is_b_hadron) 179 pass = kTRUE; 180 181 // fPTMin not applied to b_hadrons to allow for b-enriched sample stitching 182 if(!pass || (candidate->Momentum.Pt() < fPTMin && !is_b_hadron) ) continue; 120 183 121 184 fOutputArray->Add(candidate);
Note:
See TracChangeset
for help on using the changeset viewer.