Changeset 21eab4f in git for modules/MomentumSmearing.cc
- Timestamp:
- Aug 26, 2016, 5:17:14 PM (8 years ago)
- Parents:
- ec5e04b (diff), 94cacb6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- AlexandreMertens <alexandre.mertens@…> (08/26/16 17:17:14)
- git-committer:
- GitHub <noreply@…> (08/26/16 17:17:14)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/MomentumSmearing.cc
rec5e04b r21eab4f 96 96 { 97 97 Candidate *candidate, *mother; 98 Double_t pt, eta, phi, e ;98 Double_t pt, eta, phi, e, res; 99 99 100 100 fItInputArray->Reset(); … … 107 107 pt = candidateMomentum.Pt(); 108 108 e = candidateMomentum.E(); 109 res = fFormula->Eval(pt, eta, phi, e); 110 111 // apply smearing formula 112 //pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta, phi, e) * pt); 113 114 res = ( res > 1.0 ) ? 1.0 : res; 109 115 110 // apply smearing formula 111 pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta, phi, e) * pt); 116 pt = LogNormal(pt, res * pt ); 112 117 113 if(pt <= 0.0) continue;118 //if(pt <= 0.0) continue; 114 119 115 120 mother = candidate; … … 118 123 phi = candidateMomentum.Phi(); 119 124 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt*TMath::CosH(eta)); 120 candidate->TrackResolution = fFormula->Eval(pt, eta, phi, e); 125 //candidate->TrackResolution = fFormula->Eval(pt, eta, phi, e); 126 candidate->TrackResolution = res; 121 127 candidate->AddCandidate(mother); 122 128 … … 124 130 } 125 131 } 132 //---------------------------------------------------------------- 133 134 Double_t MomentumSmearing::LogNormal(Double_t mean, Double_t sigma) 135 { 136 Double_t a, b; 137 138 if(mean > 0.0) 139 { 140 b = TMath::Sqrt(TMath::Log((1.0 + (sigma*sigma)/(mean*mean)))); 141 a = TMath::Log(mean) - 0.5*b*b; 142 143 return TMath::Exp(a + b*gRandom->Gaus(0.0, 1.0)); 144 } 145 else 146 { 147 return 0.0; 148 } 149 } 150 126 151 127 152 //------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.