Changeset 11 for trunk/modules/MadGraphShowerPartonSelector.cc
- Timestamp:
- Sep 11, 2008, 1:41:12 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/MadGraphShowerPartonSelector.cc
r2 r11 35 35 void SetEtaMax(Double_t eta); 36 36 void InsertParticleID(Int_t pid); 37 void InsertAncestorID(Int_t pid); 37 void InsertExclAncestorID(Int_t pid); 38 void InsertInclAncestorID(Int_t pid); 38 39 void SetHadronizationInfo(Bool_t info); 39 40 … … 41 42 42 43 Bool_t hasBadAncestor(ExRootGenParticle *object); 44 Bool_t hasGoodAncestor(ExRootGenParticle *object); 43 45 44 46 Double_t fEtaMax; … … 47 49 48 50 set< Int_t > fParticleIDSet; 49 set< Int_t > fAncestorIDSet; 51 set< Int_t > fExclAncestorIDSet; 52 set< Int_t > fInclAncestorIDSet; 50 53 }; 51 54 … … 73 76 //------------------------------------------------------------------------------ 74 77 75 void MadGraphShowerPartonClassifier::InsertAncestorID(Int_t pid) 76 { 77 fAncestorIDSet.insert(pid); 78 void MadGraphShowerPartonClassifier::InsertExclAncestorID(Int_t pid) 79 { 80 fExclAncestorIDSet.insert(pid); 81 } 82 83 //------------------------------------------------------------------------------ 84 85 void MadGraphShowerPartonClassifier::InsertInclAncestorID(Int_t pid) 86 { 87 fInclAncestorIDSet.insert(pid); 78 88 } 79 89 … … 96 106 if(particle->PID == 21) return kFALSE; 97 107 108 // keep all particles if there is no pid in the list 109 if(fExclAncestorIDSet.empty()) 110 { 111 return kFALSE; 112 } 113 98 114 pidAbs = TMath::Abs(particle->PID); 99 115 100 116 // skip particles with pid included in list 101 itAncestorIDSet = f AncestorIDSet.find(pidAbs);102 103 if(itAncestorIDSet != f AncestorIDSet.end()) return kTRUE;117 itAncestorIDSet = fExclAncestorIDSet.find(pidAbs); 118 119 if(itAncestorIDSet != fExclAncestorIDSet.end()) return kTRUE; 104 120 if(particle->M2 > -1) return kFALSE; 105 121 … … 115 131 116 132 // skip particles with pid included in list 117 itAncestorIDSet = fAncestorIDSet.find(pidAbs); 118 119 if(itAncestorIDSet != fAncestorIDSet.end()) return kTRUE; 133 itAncestorIDSet = fExclAncestorIDSet.find(pidAbs); 134 135 if(itAncestorIDSet != fExclAncestorIDSet.end()) return kTRUE; 136 if(particle->M2 > -1) return kFALSE; 137 } 138 139 return kFALSE; 140 } 141 142 //------------------------------------------------------------------------------ 143 144 Bool_t MadGraphShowerPartonClassifier::hasGoodAncestor(ExRootGenParticle *object) 145 { 146 const int kMaxAncestors = 10; 147 Int_t i, pidAbs; 148 ExRootGenParticle *particle = object; 149 set< Int_t >::const_iterator itAncestorIDSet; 150 151 for(i = 0; i < kMaxAncestors && particle->Status != 3; ++i) 152 { 153 if(particle->M1 < 0) return kFALSE; 154 155 particle = static_cast<ExRootGenParticle*>(fBranchParticle->At(particle->M1)); 156 } 157 158 if(particle->PID == 21) return kFALSE; 159 160 // keep all particles if there is no pid in the list 161 if(fInclAncestorIDSet.empty()) 162 { 163 return kTRUE; 164 } 165 166 pidAbs = TMath::Abs(particle->PID); 167 168 // keep particles with pid included in list 169 itAncestorIDSet = fInclAncestorIDSet.find(pidAbs); 170 171 if(itAncestorIDSet != fInclAncestorIDSet.end()) return kTRUE; 172 if(particle->M2 > -1) return kFALSE; 173 174 for(i = 0; i < kMaxAncestors; ++i) 175 { 176 if(particle->M1 < 0) return kFALSE; 177 178 if(particle->PID == 21) return kFALSE; 179 180 particle = static_cast<ExRootGenParticle*>(fBranchParticle->At(particle->M1)); 181 182 pidAbs = TMath::Abs(particle->PID); 183 184 // keep particles with pid included in list 185 itAncestorIDSet = fInclAncestorIDSet.find(pidAbs); 186 187 if(itAncestorIDSet != fInclAncestorIDSet.end()) return kTRUE; 120 188 if(particle->M2 > -1) return kFALSE; 121 189 } … … 159 227 if(hasBadAncestor(particle)) return -1; 160 228 229 if(!hasGoodAncestor(particle)) return -1; 230 161 231 return 0; 162 232 } … … 214 284 { 215 285 pid = param[i].GetInt(); 216 fClassifier->InsertAncestorID(pid); 286 fClassifier->InsertExclAncestorID(pid); 287 } 288 289 // read ancestor IDs from configuration file and setup classifier 290 291 param = GetParam("IncludedAncestorIDs"); 292 sizeParam = param.GetSize(); 293 294 for(i = 0; i < sizeParam; ++i) 295 { 296 pid = param[i].GetInt(); 297 fClassifier->InsertInclAncestorID(pid); 217 298 } 218 299
Note:
See TracChangeset
for help on using the changeset viewer.