Changeset 341014c in git for modules/EnergySmearing.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/EnergySmearing.cc
r45e58be r341014c 17 17 */ 18 18 19 20 19 /** \class EnergySmearing 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 #include <algorithm> 47 #include <stdexcept> 45 #include <algorithm> 48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 87 86 88 87 void EnergySmearing::Finish() 89 { 88 { 90 89 if(fItInputArray) delete fItInputArray; 91 90 } … … 99 98 100 99 fItInputArray->Reset(); 101 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))100 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 102 101 { 103 102 const TLorentzVector &candidatePosition = candidate->Position; 104 103 const TLorentzVector &candidateMomentum = candidate->Momentum; 105 104 106 105 pt = candidatePosition.Pt(); 107 106 eta = candidatePosition.Eta(); 108 107 phi = candidatePosition.Phi(); 109 108 energy = candidateMomentum.E(); 110 109 111 110 // apply smearing formula 112 111 energy = gRandom->Gaus(energy, fFormula->Eval(pt, eta, phi, energy)); 113 112 114 113 if(energy <= 0.0) continue; 115 114 116 115 mother = candidate; 117 candidate = static_cast<Candidate *>(candidate->Clone());116 candidate = static_cast<Candidate *>(candidate->Clone()); 118 117 eta = candidateMomentum.Eta(); 119 118 phi = candidateMomentum.Phi(); 120 candidate->Momentum.SetPtEtaPhiE(energy /TMath::CosH(eta), eta, phi, energy);121 candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy) /candidateMomentum.E();119 candidate->Momentum.SetPtEtaPhiE(energy / TMath::CosH(eta), eta, phi, energy); 120 candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy) / candidateMomentum.E(); 122 121 candidate->AddCandidate(mother); 123 122 124 123 fOutputArray->Add(candidate); 125 124 }
Note:
See TracChangeset
for help on using the changeset viewer.