- Timestamp:
- Jan 26, 2020, 4:52:03 PM (5 years ago)
- Branches:
- Timing
- Children:
- f59b36de
- Parents:
- c7e90d8
- Location:
- modules
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/TimeSmearing.cc
rc7e90d8 r9e3f2fb 53 53 54 54 TimeSmearing::TimeSmearing() : 55 fItInputArray(0), f Formula(0)55 fItInputArray(0), fResolutionFormula(0) 56 56 { 57 f Formula = new DelphesFormula;57 fResolutionFormula = new DelphesFormula; 58 58 } 59 59 … … 61 61 62 62 TimeSmearing::~TimeSmearing() 63 { 64 if(f Formula) delete fFormula;63 { 64 if(fResolutionFormula) delete fResolutionFormula; 65 65 } 66 66 … … 69 69 void TimeSmearing::Init() 70 70 { 71 // read resolution formula72 f Formula->Compile(GetString("TimeResolution", "0.001"));71 // read time resolution formula in seconds 72 fResolutionFormula->Compile(GetString("TimeResolution", "30e-12")); 73 73 74 74 // import input array 75 fEtaMax = GetDouble("EtaMax", 6.); 76 fInputArray = ImportArray(GetString("InputArray", "MuonMomentumSmearing/muons")); 75 fInputArray = ImportArray(GetString("InputArray", "TrackMerger/tracks")); 77 76 fItInputArray = fInputArray->MakeIterator(); 77 78 78 // create output array 79 80 fOutputArray = ExportArray(GetString("OutputArray", "muons")); 79 fOutputArray = ExportArray(GetString("OutputArray", "tracks")); 81 80 } 82 81 … … 93 92 { 94 93 Candidate *candidate, *mother; 95 Double_t ti, tf_smeared, tf; 96 Double_t pt, eta, phi, e, p, l; 97 Double_t beta_particle; 94 Double_t ti,ti_smeared, tf, tf_smeared, dt; 95 Double_t eta, energy; 98 96 Double_t timeResolution; 99 97 … … 104 102 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 105 103 { 104 const TLorentzVector &candidatePosition = candidate->Position; 105 const TLorentzVector &candidateMomentum = candidate->Momentum; 106 107 // convert mm in seconds 106 108 ti = candidate->InitialPosition.T()*1.0E-3/c_light; 107 109 tf = candidate->Position.T()*1.0E-3/c_light; 108 109 // dummy, only need to properly call TFormula 110 const TLorentzVector &candidatePosition = candidate->Position; 111 const TLorentzVector &candidateMomentum = candidate->Momentum; 110 112 111 eta = candidatePosition.Eta(); 113 phi = candidatePosition.Phi(); 114 pt = candidateMomentum.Pt(); 115 e = candidateMomentum.E(); 116 p = candidateMomentum.P(); 117 beta_particle = p/e; 118 l = candidate->L; 119 timeResolution = fFormula->Eval(e); 120 112 energy = candidateMomentum.E(); 113 timeResolution = fResolutionFormula->Eval(0.0, eta, 0.0, energy); 114 115 dt = timeResolution*gRandom->Gaus(0, 1); 116 tf_smeared = tf + dt; 117 ti_smeared = ti + dt; 118 mother = candidate; 119 candidate = static_cast<Candidate*>(candidate->Clone()); 120 candidate->AddCandidate(mother); 121 122 candidate->Position.SetT(tf_smeared*1.0E3*c_light); 123 candidate->ErrorT = timeResolution*1.0E3*c_light; 124 125 // treating charged and neutral differently: 126 // for charged we smear the time after propagation, and put a dummy value for time at Vertex 127 // since the correct value will be computed after Vertexing4D 121 128 if(candidate->Charge != 0) 122 { 123 tf_smeared = tf + timeResolution*gRandom->Gaus(0, 1); 124 mother = candidate; 125 candidate = static_cast<Candidate*>(candidate->Clone()); // I am not sure that we need these lines !!! 126 candidate->AddCandidate(mother); 127 candidate->InitialPosition.SetT((100+ti)*1.0E3*c_light); // Dummy Value, correct value will be computed by VertexFinderDA4D 128 candidate->Position.SetT(tf_smeared*1.0E3*c_light); 129 candidate->ErrorT = timeResolution*1.0E3*c_light; 130 fOutputArray->Add(candidate); 131 } 129 // Dummy Value, correct value will be computed by VertexFinderDA4D 130 candidate->InitialPosition.SetT((100+ti)*1.0E3*c_light); 132 131 else 133 { 134 ti = timeResolution - l*1.0E3/(c_light*beta_particle); 135 candidate->InitialPosition.SetT(ti); 136 candidate->ErrorT = timeResolution*1.0E3*c_light; // Do we need to sum with 100 like in upside ? 137 fOutputArray->Add(candidate); 138 } 139 132 candidate->InitialPosition.SetT(ti_smeared*1.0E3*c_light); 133 134 fOutputArray->Add(candidate); 135 140 136 } 141 137 } -
modules/TimeSmearing.h
rc7e90d8 r9e3f2fb 22 22 /** \class TimeSmearing 23 23 * 24 * Performs t ransverse timesmearing.24 * Performs time of flight smearing. 25 25 * 26 26 * \author Michele Selvaggi - UCL, Louvain-la-Neuve … … 45 45 46 46 private: 47 DelphesFormula *fFormula;48 Double_t fEtaMax;49 47 48 DelphesFormula *fResolutionFormula; 49 50 50 TIterator *fItInputArray; //! 51 51
Note:
See TracChangeset
for help on using the changeset viewer.