Changeset 341014c in git for modules/TaggingParticlesSkimmer.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/TaggingParticlesSkimmer.cc
r45e58be r341014c 35 35 #include "classes/DelphesFormula.h" 36 36 37 #include "ExRootAnalysis/ExRootClassifier.h" 38 #include "ExRootAnalysis/ExRootFilter.h" 37 39 #include "ExRootAnalysis/ExRootResult.h" 38 #include "ExRootAnalysis/ExRootFilter.h"39 #include "ExRootAnalysis/ExRootClassifier.h"40 40 41 #include "TDatabasePDG.h" 42 #include "TFormula.h" 43 #include "TLorentzVector.h" 41 44 #include "TMath.h" 45 #include "TObjArray.h" 46 #include "TRandom3.h" 42 47 #include "TString.h" 43 #include "TFormula.h"44 #include "TRandom3.h"45 #include "TObjArray.h"46 #include "TDatabasePDG.h"47 #include "TLorentzVector.h"48 48 49 49 #include <algorithm> 50 #include <stdexcept>51 50 #include <iostream> 52 51 #include <sstream> 52 #include <stdexcept> 53 53 54 54 using namespace std; 55 56 55 57 56 //------------------------------------------------------------------------------ … … 72 71 void TaggingParticlesSkimmer::Init() 73 72 { 74 73 75 74 fPTMin = GetDouble("PTMin", 15.0); 76 75 fEtaMax = GetDouble("EtaMax", 2.5); 77 76 78 77 // import input array 79 78 fPartonInputArray = ImportArray(GetString("PartonInputArray", "Delphes/partons")); 80 79 fItPartonInputArray = fPartonInputArray->MakeIterator(); 81 80 82 81 fParticleInputArray = ImportArray(GetString("ParticleInputArray", "Delphes/allParticles")); 83 82 84 85 83 fClassifier = new TauTaggingPartonClassifier(fParticleInputArray); 86 84 fClassifier->fPTMin = GetDouble("PTMin", 15.0); 87 85 fClassifier->fEtaMax = GetDouble("EtaMax", 2.5); 88 86 89 90 87 fFilter = new ExRootFilter(fPartonInputArray); 91 88 … … 97 94 98 95 void TaggingParticlesSkimmer::Finish() 99 { 96 { 100 97 if(fItPartonInputArray) delete fItPartonInputArray; 101 98 if(fFilter) delete fFilter; … … 127 124 if(tau->D1 < 0) continue; 128 125 129 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 130 tau->D2 >= fParticleInputArray->GetEntriesFast()) 126 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 131 127 { 132 128 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 134 130 135 131 tauMomentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0); 136 132 137 133 for(i = tau->D1; i <= tau->D2; ++i) 138 134 { … … 141 137 tauMomentum += daughter->Momentum; 142 138 } 143 144 candidate = static_cast<Candidate*>(tau->Clone());145 candidate->Momentum = tauMomentum;146 139 147 148 fOutputArray->Add(candidate);140 candidate = static_cast<Candidate *>(tau->Clone()); 141 candidate->Momentum = tauMomentum; 149 142 143 fOutputArray->Add(candidate); 150 144 } 151 145 152 146 // then add all other partons (except tau's to avoid double counting) 153 147 154 148 fItPartonInputArray->Reset(); 155 while((candidate = static_cast<Candidate *>(fItPartonInputArray->Next())))149 while((candidate = static_cast<Candidate *>(fItPartonInputArray->Next()))) 156 150 { 157 151 pdgCode = TMath::Abs(candidate->PID); 158 152 if(pdgCode == 15) continue; 159 153 160 154 pt = candidate->Momentum.Pt(); 161 155 if(pt < fPTMin) continue; 162 156 163 157 eta = TMath::Abs(candidate->Momentum.Eta()); 164 158 if(eta > fEtaMax) continue; 165 159 166 160 fOutputArray->Add(candidate); 167 161 } 168 169 170 162 } 171
Note:
See TracChangeset
for help on using the changeset viewer.