Changes in modules/TimeSmearing.cc [04e2040:341014c] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/TimeSmearing.cc
r04e2040 r341014c 19 19 /** \class TimeSmearing 20 20 * 21 * Performs t imesmearing.21 * Performs transverse momentum resolution smearing. 22 22 * 23 * \author M. Selvaggi - CERN23 * \author P. Demin - UCL, Louvain-la-Neuve 24 24 * 25 25 */ … … 49 49 50 50 using namespace std; 51 51 52 //------------------------------------------------------------------------------ 52 53 53 54 TimeSmearing::TimeSmearing() : 54 fIt TrackInputArray(0), fResolutionFormula(0)55 fItInputArray(0) 55 56 { 56 fResolutionFormula = new DelphesFormula;57 57 } 58 58 … … 61 61 TimeSmearing::~TimeSmearing() 62 62 { 63 if(fResolutionFormula) delete fResolutionFormula;64 63 } 65 64 … … 70 69 // read resolution formula 71 70 72 // read time resolution formula in seconds73 fResolutionFormula->Compile(GetString("TimeResolution", "30e-12"));71 fTimeResolution = GetDouble("TimeResolution", 1.0E-10); 72 // import input array 74 73 75 // import track input array 76 fTrackInputArray = ImportArray(GetString("TrackInputArray", "MuonMomentumSmearing/muons")); 77 fItTrackInputArray = fTrackInputArray->MakeIterator(); 78 74 fInputArray = ImportArray(GetString("InputArray", "MuonMomentumSmearing/muons")); 75 fItInputArray = fInputArray->MakeIterator(); 79 76 80 77 // create output array 81 fOutputArray = ExportArray(GetString("OutputArray", "tracks")); 78 79 fOutputArray = ExportArray(GetString("OutputArray", "muons")); 82 80 } 83 81 … … 86 84 void TimeSmearing::Finish() 87 85 { 88 if(fIt TrackInputArray) delete fItTrackInputArray;86 if(fItInputArray) delete fItInputArray; 89 87 } 90 88 … … 94 92 { 95 93 Candidate *candidate, *mother; 96 Double_t tf_smeared, tf; 97 Double_t eta, energy; 98 Double_t timeResolution; 99 94 Double_t ti, tf_smeared, tf; 100 95 const Double_t c_light = 2.99792458E8; 101 96 102 fIt TrackInputArray->Reset();103 while((candidate = static_cast<Candidate *>(fIt TrackInputArray->Next())))97 fItInputArray->Reset(); 98 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 104 99 { 105 // converting to meters100 const TLorentzVector &candidateInitialPosition = candidate->InitialPosition; 106 101 const TLorentzVector &candidateFinalPosition = candidate->Position; 107 const TLorentzVector &candidateMomentum = candidate->Momentum;108 102 103 ti = candidateInitialPosition.T() * 1.0E-3 / c_light; 109 104 tf = candidateFinalPosition.T() * 1.0E-3 / c_light; 110 105 111 eta = candidateMomentum.Eta();112 energy = candidateMomentum.E();113 114 106 // apply smearing formula 115 timeResolution = fResolutionFormula->Eval(0.0, eta, 0.0, energy); 116 tf_smeared = gRandom->Gaus(tf, timeResolution); 107 tf_smeared = gRandom->Gaus(tf, fTimeResolution); 108 ti = ti + tf_smeared - tf; 109 tf = tf_smeared; 117 110 118 111 mother = candidate; 119 112 candidate = static_cast<Candidate *>(candidate->Clone()); 113 candidate->InitialPosition.SetT(ti * 1.0E3 * c_light); 114 candidate->Position.SetT(tf * 1.0E3 * c_light); 120 115 121 candidate->Position.SetT(tf_smeared * 1.0E3 * c_light); 122 candidate->ErrorT = timeResolution * 1.0E3 * c_light; 116 candidate->ErrorT = fTimeResolution * 1.0E3 * c_light; 123 117 124 118 candidate->AddCandidate(mother); 119 125 120 fOutputArray->Add(candidate); 126 121 } 127 122 } 123 124 //------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.