Changeset 11 for trunk/modules/MadGraphPartonSelector.cc
- Timestamp:
- Sep 11, 2008, 1:41:12 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/MadGraphPartonSelector.cc
r2 r11 33 33 34 34 void InsertParticleID(Int_t pid); 35 void InsertAncestorID(Int_t pid); 35 void InsertExclAncestorID(Int_t pid); 36 void InsertInclAncestorID(Int_t pid); 36 37 37 38 private: 38 39 39 40 Bool_t hasBadAncestor(ExRootGenParticle *object); 41 Bool_t hasGoodAncestor(ExRootGenParticle *object); 40 42 41 43 TClonesArray *fBranchParticle; 42 44 43 45 set< Int_t > fParticleIDSet; 44 set< Int_t > fAncestorIDSet; 46 set< Int_t > fExclAncestorIDSet; 47 set< Int_t > fInclAncestorIDSet; 45 48 }; 46 49 … … 61 64 //------------------------------------------------------------------------------ 62 65 63 void MadGraphPartonClassifier::InsertAncestorID(Int_t pid) 64 { 65 fAncestorIDSet.insert(pid); 66 void MadGraphPartonClassifier::InsertExclAncestorID(Int_t pid) 67 { 68 fExclAncestorIDSet.insert(pid); 69 } 70 71 //------------------------------------------------------------------------------ 72 73 void MadGraphPartonClassifier::InsertInclAncestorID(Int_t pid) 74 { 75 fInclAncestorIDSet.insert(pid); 66 76 } 67 77 … … 76 86 set< Int_t >::const_iterator itParticleIDSet; 77 87 88 // keep all particles if there is no pid in the list 89 if(fExclAncestorIDSet.empty()) 90 { 91 return kFALSE; 92 } 93 78 94 for(i = 0; i < kMaxAncestors; ++i) 79 95 { … … 90 106 91 107 // skip particles with pid included in list 92 itAncestorIDSet = fAncestorIDSet.find(pidAbs); 93 94 if(itAncestorIDSet != fAncestorIDSet.end()) return kTRUE; 108 itAncestorIDSet = fExclAncestorIDSet.find(pidAbs); 109 110 if(itAncestorIDSet != fExclAncestorIDSet.end()) return kTRUE; 111 } 112 113 return kFALSE; 114 } 115 116 //------------------------------------------------------------------------------ 117 118 Bool_t MadGraphPartonClassifier::hasGoodAncestor(ExRootGenParticle *object) 119 { 120 const int kMaxAncestors = 10; 121 Int_t i, pidAbs; 122 ExRootGenParticle *particle = object; 123 set< Int_t >::const_iterator itAncestorIDSet; 124 set< Int_t >::const_iterator itParticleIDSet; 125 126 // keep all particles if there is no pid in the list 127 if(fInclAncestorIDSet.empty()) 128 { 129 return kTRUE; 130 } 131 132 for(i = 0; i < kMaxAncestors; ++i) 133 { 134 135 if(particle->M1 < 0 || particle->M2 > -1) return kFALSE; 136 137 // if(particle->PID == 21) return kFALSE; 138 139 particle = static_cast<ExRootGenParticle*>(fBranchParticle->At(particle->M1)); 140 141 if(particle->PID == 21) return kFALSE; 142 143 pidAbs = TMath::Abs(particle->PID); 144 145 // keep particles with pid included in list 146 itAncestorIDSet = fInclAncestorIDSet.find(pidAbs); 147 148 if(itAncestorIDSet != fInclAncestorIDSet.end()) return kTRUE; 95 149 } 96 150 … … 145 199 if(hasBadAncestor(particle)) return -1; 146 200 201 if(!hasGoodAncestor(particle)) return -1; 202 147 203 return 0; 148 204 } … … 197 253 { 198 254 pid = param[i].GetInt(); 199 fClassifier->InsertAncestorID(pid); 255 fClassifier->InsertExclAncestorID(pid); 256 } 257 258 // read ancestor IDs from configuration file and setup classifier 259 260 param = GetParam("IncludedAncestorIDs"); 261 sizeParam = param.GetSize(); 262 263 for(i = 0; i < sizeParam; ++i) 264 { 265 pid = param[i].GetInt(); 266 fClassifier->InsertInclAncestorID(pid); 200 267 } 201 268 … … 209 276 210 277 void MadGraphPartonSelector::Finish() 211 { 278 { 212 279 if(fFilter) delete fFilter; 213 280 if(fClassifier) delete fClassifier;
Note:
See TracChangeset
for help on using the changeset viewer.