Changeset 341014c in git for modules/MomentumSmearing.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/MomentumSmearing.cc
r45e58be r341014c 17 17 */ 18 18 19 20 19 /** \class MomentumSmearing 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; … … 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; … … 108 107 e = candidateMomentum.E(); 109 108 res = fFormula->Eval(pt, eta, phi, e); 110 109 111 110 // apply smearing formula 112 111 //pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta, phi, e) * pt); 113 114 res = ( res > 1.0 ) ? 1.0 : res;115 112 116 pt = LogNormal(pt, res * pt ); 117 113 res = (res > 1.0) ? 1.0 : res; 114 115 pt = LogNormal(pt, res * pt); 116 118 117 //if(pt <= 0.0) continue; 119 118 120 119 mother = candidate; 121 candidate = static_cast<Candidate *>(candidate->Clone());120 candidate = static_cast<Candidate *>(candidate->Clone()); 122 121 eta = candidateMomentum.Eta(); 123 122 phi = candidateMomentum.Phi(); 124 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt *TMath::CosH(eta));123 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt * TMath::CosH(eta)); 125 124 //candidate->TrackResolution = fFormula->Eval(pt, eta, phi, e); 126 125 candidate->TrackResolution = res; 127 126 candidate->AddCandidate(mother); 128 127 129 128 fOutputArray->Add(candidate); 130 129 } … … 138 137 if(mean > 0.0) 139 138 { 140 b = TMath::Sqrt(TMath::Log((1.0 + (sigma *sigma)/(mean*mean))));141 a = TMath::Log(mean) - 0.5 *b*b;139 b = TMath::Sqrt(TMath::Log((1.0 + (sigma * sigma) / (mean * mean)))); 140 a = TMath::Log(mean) - 0.5 * b * b; 142 141 143 return TMath::Exp(a + b *gRandom->Gaus(0.0, 1.0));142 return TMath::Exp(a + b * gRandom->Gaus(0.0, 1.0)); 144 143 } 145 144 else … … 149 148 } 150 149 151 152 150 //------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.