Changeset 341014c in git for modules/TrackCountingTauTagging.cc
- Timestamp:
- Feb 12, 2019, 9:29:17 PM (6 years ago)
- Branches:
- ImprovedOutputFile, Timing, llp, master
- Children:
- 6455202
- Parents:
- 45e58be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/TrackCountingTauTagging.cc
r45e58be r341014c 20 20 #include "classes/DelphesFormula.h" 21 21 22 #include "ExRootAnalysis/ExRootClassifier.h" 23 #include "ExRootAnalysis/ExRootFilter.h" 22 24 #include "ExRootAnalysis/ExRootResult.h" 23 #include "ExRootAnalysis/ExRootFilter.h" 24 #include "ExRootAnalysis/ExRootClassifier.h" 25 25 26 #include "TDatabasePDG.h" 27 #include "TFormula.h" 28 #include "TLorentzVector.h" 26 29 #include "TMath.h" 30 #include "TObjArray.h" 31 #include "TRandom3.h" 27 32 #include "TString.h" 28 #include "TFormula.h"29 #include "TRandom3.h"30 #include "TObjArray.h"31 #include "TDatabasePDG.h"32 #include "TLorentzVector.h"33 33 34 34 #include <algorithm> 35 #include <stdexcept>36 35 #include <iostream> 37 36 #include <sstream> 37 #include <stdexcept> 38 38 39 39 using namespace std; … … 44 44 { 45 45 public: 46 47 46 TrackCountingTauTaggingPartonClassifier(const TObjArray *array); 48 47 … … 67 66 Candidate *daughter1 = 0; 68 67 Candidate *daughter2 = 0; 69 68 70 69 const TLorentzVector &momentum = tau->Momentum; 71 70 Int_t pdgCode, i, j; … … 80 79 if(tau->D2 < tau->D1) return -1; 81 80 82 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 83 tau->D2 >= fParticleInputArray->GetEntriesFast()) 81 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 84 82 { 85 83 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 90 88 daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i)); 91 89 pdgCode = TMath::Abs(daughter1->PID); 92 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) return -1; 90 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) 91 return -1; 93 92 else if(pdgCode == 24) 94 93 { 95 if(daughter1->D1 < 0) return -1; 96 for(j = daughter1->D1; j <= daughter1->D2; ++j) 97 { 98 daughter2 = static_cast<Candidate*>(fParticleInputArray->At(j)); 99 pdgCode = TMath::Abs(daughter2->PID); 100 if(pdgCode == 11 || pdgCode == 13) return -1; 101 } 102 94 if(daughter1->D1 < 0) return -1; 95 for(j = daughter1->D1; j <= daughter1->D2; ++j) 96 { 97 daughter2 = static_cast<Candidate *>(fParticleInputArray->At(j)); 98 pdgCode = TMath::Abs(daughter2->PID); 99 if(pdgCode == 11 || pdgCode == 13) return -1; 100 } 103 101 } 104 102 } … … 125 123 void TrackCountingTauTagging::Init() 126 124 { 127 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;125 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 128 126 ExRootConfParam param; 129 127 DelphesFormula *formula; … … 135 133 fDeltaRTrack = GetDouble("DeltaRTrack", 0.2); 136 134 fTrackPTMin = GetDouble("TrackPTMin", 1.0); 137 135 138 136 // read efficiency formulas 139 137 param = GetParam("EfficiencyFormula"); … … 141 139 142 140 fEfficiencyMap.clear(); 143 for(i = 0; i < size /2; ++i)141 for(i = 0; i < size / 2; ++i) 144 142 { 145 143 formula = new DelphesFormula; 146 formula->Compile(param[i *2 + 1].GetString());147 148 fEfficiencyMap[param[i *2].GetInt()] = formula;144 formula->Compile(param[i * 2 + 1].GetString()); 145 146 fEfficiencyMap[param[i * 2].GetInt()] = formula; 149 147 } 150 148 … … 172 170 fTrackInputArray = ImportArray(GetString("TrackInputArray", "TrackMerger/tracks")); 173 171 fItTrackInputArray = fTrackInputArray->MakeIterator(); 174 172 175 173 fFilter = new ExRootFilter(fPartonInputArray); 176 174 … … 183 181 void TrackCountingTauTagging::Finish() 184 182 { 185 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;183 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 186 184 DelphesFormula *formula; 187 185 … … 207 205 Double_t pt, eta, phi, e; 208 206 TObjArray *tauArray; 209 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;207 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 210 208 DelphesFormula *formula; 211 209 Int_t pdgCode, charge, i, identifier; … … 232 230 e = jetMomentum.E(); 233 231 234 235 // loop over all input tracks 232 // loop over all input tracks 236 233 fItTrackInputArray->Reset(); 237 234 while((track = static_cast<Candidate *>(fItTrackInputArray->Next()))) 238 235 { 239 if((track->Momentum).Pt() < fTrackPTMin) continue; 240 if(jetMomentum.DeltaR(track->Momentum) <= fDeltaRTrack) { 241 identifier -= 1; 242 charge += track->Charge; 243 } 244 } 245 236 if((track->Momentum).Pt() < fTrackPTMin) continue; 237 if(jetMomentum.DeltaR(track->Momentum) <= fDeltaRTrack) 238 { 239 identifier -= 1; 240 charge += track->Charge; 241 } 242 } 243 246 244 // loop over all input taus 247 245 itTauArray.Reset(); … … 251 249 if(tau->D1 < 0) continue; 252 250 253 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 254 tau->D2 >= fParticleInputArray->GetEntriesFast()) 251 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 255 252 { 256 253 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 263 260 daughter = static_cast<Candidate *>(fParticleInputArray->At(i)); 264 261 if(TMath::Abs(daughter->PID) == 16) continue; 265 tauMomentum += daughter->Momentum; 262 tauMomentum += daughter->Momentum; 266 263 } 267 264 268 265 if(jetMomentum.DeltaR(tauMomentum) <= fDeltaR) 269 { 266 { 270 267 matchedTau = true; 271 268 pdgCode = 15; … … 273 270 } 274 271 if(matchedTau) 275 272 identifier *= -1; 276 273 // find an efficency formula 277 274 // If the identifier is larger than 2, set it to 2 (multiprong requires at least 2 tracks) 278 if (identifier > 2) 279 identifier = 2; 280 else if (identifier < -2) 281 identifier = -2; 282 283 275 if(identifier > 2) 276 identifier = 2; 277 else if(identifier < -2) 278 identifier = -2; 279 284 280 itEfficiencyMap = fEfficiencyMap.find(identifier); 285 281 if(itEfficiencyMap == fEfficiencyMap.end()) … … 293 289 // apply an efficency formula 294 290 jet->TauTag |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber; 295 296 291 297 292 // set tau charge 298 293 jet->Charge = charge;
Note:
See TracChangeset
for help on using the changeset viewer.