Changeset 341014c in git for modules/TauTagging.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/TauTagging.cc
r45e58be r341014c 17 17 */ 18 18 19 20 19 /** \class TauTagging 21 20 * … … 34 33 #include "classes/DelphesFormula.h" 35 34 35 #include "TDatabasePDG.h" 36 #include "TFormula.h" 37 #include "TLorentzVector.h" 36 38 #include "TMath.h" 39 #include "TObjArray.h" 40 #include "TRandom3.h" 37 41 #include "TString.h" 38 #include "TFormula.h"39 #include "TRandom3.h"40 #include "TObjArray.h"41 #include "TDatabasePDG.h"42 #include "TLorentzVector.h"43 42 44 43 #include <algorithm> 45 #include <stdexcept>46 44 #include <iostream> 47 45 #include <sstream> 46 #include <stdexcept> 48 47 49 48 using namespace std; 50 51 49 52 50 //------------------------------------------------------------------------------ … … 63 61 Candidate *daughter1 = 0; 64 62 Candidate *daughter2 = 0; 65 63 66 64 const TLorentzVector &momentum = tau->Momentum; 67 65 Int_t pdgCode, i, j; … … 76 74 if(tau->D2 < tau->D1) return -1; 77 75 78 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 79 tau->D2 >= fParticleInputArray->GetEntriesFast()) 76 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 80 77 { 81 78 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 86 83 daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i)); 87 84 pdgCode = TMath::Abs(daughter1->PID); 88 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) return -1; 85 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) 86 return -1; 89 87 else if(pdgCode == 24) 90 88 { 91 if(daughter1->D1 < 0) return -1; 92 for(j = daughter1->D1; j <= daughter1->D2; ++j) 93 { 94 daughter2 = static_cast<Candidate*>(fParticleInputArray->At(j)); 95 pdgCode = TMath::Abs(daughter2->PID); 96 if(pdgCode == 11 || pdgCode == 13) return -1; 97 } 98 89 if(daughter1->D1 < 0) return -1; 90 for(j = daughter1->D1; j <= daughter1->D2; ++j) 91 { 92 daughter2 = static_cast<Candidate *>(fParticleInputArray->At(j)); 93 pdgCode = TMath::Abs(daughter2->PID); 94 if(pdgCode == 11 || pdgCode == 13) return -1; 95 } 99 96 } 100 97 } … … 121 118 void TauTagging::Init() 122 119 { 123 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;120 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 124 121 ExRootConfParam param; 125 122 DelphesFormula *formula; … … 135 132 136 133 fEfficiencyMap.clear(); 137 for(i = 0; i < size /2; ++i)134 for(i = 0; i < size / 2; ++i) 138 135 { 139 136 formula = new DelphesFormula; 140 formula->Compile(param[i *2 + 1].GetString());141 142 fEfficiencyMap[param[i *2].GetInt()] = formula;137 formula->Compile(param[i * 2 + 1].GetString()); 138 139 fEfficiencyMap[param[i * 2].GetInt()] = formula; 143 140 } 144 141 … … 174 171 void TauTagging::Finish() 175 172 { 176 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;173 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 177 174 DelphesFormula *formula; 178 175 … … 197 194 Double_t pt, eta, phi, e, eff; 198 195 TObjArray *tauArray; 199 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;196 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 200 197 DelphesFormula *formula; 201 198 Int_t pdgCode, charge, i; … … 218 215 219 216 // loop over all input taus 220 if(tauArray){ 217 if(tauArray) 218 { 221 219 TIter itTauArray(tauArray); 222 220 while((tau = static_cast<Candidate *>(itTauArray.Next()))) … … 224 222 if(tau->D1 < 0) continue; 225 223 226 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 227 tau->D2 >= fParticleInputArray->GetEntriesFast()) 224 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 228 225 { 229 226 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 257 254 eff = formula->Eval(pt, eta, phi, e); 258 255 jet->TauTag |= (gRandom->Uniform() <= eff) << fBitNumber; 259 jet->TauWeight = eff; 256 jet->TauWeight = eff; 260 257 261 258 // set tau charge
Note:
See TracChangeset
for help on using the changeset viewer.