Changes in modules/TimeSmearing.cc [7939c6c:2b5ff2c] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/TimeSmearing.cc
r7939c6c r2b5ff2c 53 53 54 54 TimeSmearing::TimeSmearing() : 55 f ItInputArray(0)55 fFormula(0), fItInputArray(0) 56 56 { 57 fFormula = new DelphesFormula; 57 58 } 58 59 … … 60 61 61 62 TimeSmearing::~TimeSmearing() 62 { 63 { 64 if(fFormula) delete fFormula; 63 65 } 64 66 … … 69 71 // read resolution formula 70 72 71 f TimeResolution = GetDouble("TimeResolution", 1.);73 fFormula->Compile(GetString("TimeResolution", "1.0")); 72 74 73 75 // import input array … … 75 77 fInputArray = ImportArray(GetString("InputArray", "MuonMomentumSmearing/muons")); 76 78 fItInputArray = fInputArray->MakeIterator(); 79 77 80 // create output array 78 81 … … 92 95 { 93 96 Candidate *candidate, *mother; 94 Double_t ti, tf_smeared, tf; 95 Double_t pt, eta, phi, e, p, l; 96 Double_t sigma_t, beta_particle; 97 Double_t ti, tf_smeared, tf, timeResolution; 98 Double_t pt, eta, phi, e, d0, dz, ctgTheta; 97 99 98 100 99 101 const Double_t c_light = 2.99792458E8; 100 101 cout << " STARTINNNGG ---------->" << endl;102 102 103 103 fItInputArray->Reset(); … … 114 114 pt = candidateMomentum.Pt(); 115 115 e = candidateMomentum.E(); 116 p = candidateMomentum.P(); 117 beta_particle = p/e; 118 l = candidate->L; 116 d0 = candidate->D0; 117 dz = candidate->DZ; 118 ctgTheta = candidate->CtgTheta; 119 119 120 // apply smearing formula 121 122 timeResolution = fFormula->Eval(pt, eta, phi, e, d0, dz, ctgTheta); 123 if(fabs(candidate->Position.Eta())<fEtaMax) 124 { 125 tf_smeared = tf + timeResolution*gRandom->Gaus(0, 1); 126 } 127 else continue; 120 128 121 if(candidate->Charge != 0) 122 { 123 tf_smeared = tf + fTimeResolution*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); 128 candidate->Position.SetT(tf_smeared*1.0E3*c_light); 129 candidate->ErrorT = fTimeResolution*1.0E3*c_light; 130 fOutputArray->Add(candidate); 131 } 132 else 133 { 134 sigma_t = sqrt(pow(20,2) + pow(150,2)/e); 135 ti = sigma_t - l*1.0E3/(c_light*beta_particle); 136 candidate->InitialPosition.SetT(ti); 137 candidate->ErrorT = sigma_t*1.0E3*c_light; // Do we need to sum with 100 like in upside ? 138 fOutputArray->Add(candidate); 139 } 140 129 // double beta_particle = candidate->Momentum.P()/candidate->Momentum.E(); 130 // ti = tf_smeared - candidate->Ld*1.0E-3/(c_light*beta_particle); 131 132 mother = candidate; 133 candidate = static_cast<Candidate*>(candidate->Clone()); 134 candidate->AddCandidate(mother); 135 candidate->InitialPosition.SetT((100+ti)*1.0E3*c_light); 136 candidate->Position.SetT(tf_smeared*1.0E3*c_light); 137 candidate->ErrorT = timeResolution*1.0E3*c_light; 138 139 fOutputArray->Add(candidate); 141 140 } 142 141 }
Note:
See TracChangeset
for help on using the changeset viewer.