Fork me on GitHub

Changeset bc58cf5 in git for modules/MomentumSmearing.cc


Ignore:
Timestamp:
Aug 25, 2016, 4:33:41 PM (8 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
79d4123, b3bd4d2
Parents:
2264876
Message:

put LogNormal in MomentumSmearing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/MomentumSmearing.cc

    r2264876 rbc58cf5  
    109109
    110110    // apply smearing formula
    111     pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta, phi, e) * pt);
     111    //pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta, phi, e) * pt);
     112    pt = LogNormal(pt, fFormula->Eval(pt, eta, phi, e) * pt );
    112113   
    113     if(pt <= 0.0) continue;
     114    //if(pt <= 0.0) continue;
    114115
    115116    mother = candidate;
     
    124125  }
    125126}
     127//----------------------------------------------------------------
     128
     129Double_t MomentumSmearing::LogNormal(Double_t mean, Double_t sigma)
     130{
     131  Double_t a, b;
     132
     133  if(mean > 0.0)
     134  {
     135    b = TMath::Sqrt(TMath::Log((1.0 + (sigma*sigma)/(mean*mean))));
     136    a = TMath::Log(mean) - 0.5*b*b;
     137
     138    return TMath::Exp(a + b*gRandom->Gaus(0.0, 1.0));
     139  }
     140  else
     141  {
     142    return 0.0;
     143  }
     144}
     145
    126146
    127147//------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.