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