CMS 3D CMS Logo

FML3PtSmearer Class Reference

Class to deal with the 'smearing' of the L3 muon transverse momentum. More...

#include <FastSimulation/ParamL3MuonProducer/interface/FML3PtSmearer.h>

List of all members.

Public Member Functions

 FML3PtSmearer (const RandomEngine *engine)
 Constructor.
math::XYZTLorentzVector smear (math::XYZTLorentzVector simP4, math::XYZVector recP3) const
 smear the transverse momentum of a reco::Muon
 ~FML3PtSmearer ()
 Destructor.

Private Member Functions

double error (double thePt, double theEta) const
 smear the transverse momentum of a SimplL3MuGMTCand
double funShift (double x) const
double funSigma (double eta, double pt) const
double funSigmaEta (double x) const
double funSigmaPt (double x) const
double shift (double thePt, double theEta) const

Private Attributes

const RandomEnginerandom

Static Private Attributes

static double MuonMassSquared_ = 0.10565837*0.10565837


Detailed Description

Class to deal with the 'smearing' of the L3 muon transverse momentum.

The output momentum is generated according to the probablility that a MC generated muon with the same pt leads to that momentum value in the GMT.

Author:
Andrea Perrotta Date: 25/05/2007

Definition at line 20 of file FML3PtSmearer.h.


Constructor & Destructor Documentation

FML3PtSmearer::FML3PtSmearer ( const RandomEngine engine  ) 

Constructor.

Definition at line 13 of file FML3PtSmearer.cc.

00014   : random(engine)
00015 { }

FML3PtSmearer::~FML3PtSmearer (  ) 

Destructor.

Definition at line 17 of file FML3PtSmearer.cc.

00017 {}


Member Function Documentation

double FML3PtSmearer::error ( double  thePt,
double  theEta 
) const [private]

smear the transverse momentum of a SimplL3MuGMTCand

Definition at line 54 of file FML3PtSmearer.cc.

References funSigma().

Referenced by smear().

00054                                                              {
00055   return funSigma(fabs(theEta),thePt)/thePt;
00056 }

double FML3PtSmearer::funShift ( double  x  )  const [private]

Definition at line 62 of file FML3PtSmearer.cc.

Referenced by shift().

00062                                              {
00063   if      (x<1.305) return 7.90897e-04;
00064   else if (x<1.82 ) return 9.52662e-02-1.12262e-01*x+3.05410e-02*x*x;
00065   else              return -7.9e-03;
00066   }

double FML3PtSmearer::funSigma ( double  eta,
double  pt 
) const [private]

Definition at line 68 of file FML3PtSmearer.cc.

References funSigmaEta(), and funSigmaPt().

Referenced by error().

00068                                                            {
00069   double sigma = funSigmaPt(pt) * funSigmaEta(eta);
00070   return sigma;
00071 }

double FML3PtSmearer::funSigmaEta ( double  x  )  const [private]

Definition at line 78 of file FML3PtSmearer.cc.

References funct::exp().

Referenced by funSigma().

00078                                                 {
00079   if (x<0.94) return 2.27603e-02+1.23995e-06*exp(9.30755*x);
00080   else        return 2.99467e-02+1.86770e-05*exp(3.52319*x);
00081 }

double FML3PtSmearer::funSigmaPt ( double  x  )  const [private]

Definition at line 73 of file FML3PtSmearer.cc.

Referenced by funSigma().

00073                                                {
00074   if (x<444.) return 3.13349e-01+2.77853e-03*x+4.94289e-06*x*x-9.63359e-09*x*x*x;
00075   else        return 9.26294e-01+1.64896e-03*x;
00076 }

double FML3PtSmearer::shift ( double  thePt,
double  theEta 
) const [private]

Definition at line 58 of file FML3PtSmearer.cc.

References funShift().

Referenced by smear().

00058                                                              {
00059   return funShift(fabs(theEta));
00060 }

math::XYZTLorentzVector FML3PtSmearer::smear ( math::XYZTLorentzVector  simP4,
math::XYZVector  recP3 
) const

smear the transverse momentum of a reco::Muon

Definition at line 19 of file FML3PtSmearer.cc.

References error(), RandomEngine::gaussShoot(), MuonMassSquared_, random, shift(), and funct::sqrt().

Referenced by ParamL3MuonProducer::produce().

00019                                                                                                   {
00020   double ptSim = std::sqrt(simP4.perp2());
00021   double invPtSim;
00022   if (ptSim>0.) invPtSim = 1./ptSim; 
00023   else { 
00024     // Better if we throw an exception here...
00025     simP4.SetPx(recP3.X());
00026     simP4.SetPy(recP3.Y());
00027     simP4.SetPz(recP3.Z());
00028     double muonEnergy=std::sqrt(simP4.P()*simP4.P()+MuonMassSquared_);
00029     simP4.SetE(muonEnergy);
00030     return simP4;
00031   }
00032   double etaSim = simP4.eta();
00033   double invPtNew = random->gaussShoot(invPtSim,error(ptSim,etaSim));
00034   invPtNew /= ( 1. + shift(ptSim,etaSim)*invPtNew);
00035   if (invPtNew>0.) {
00036     double invPtRec = std::sqrt(recP3.perp2());
00037     if (invPtRec>0) invPtRec = 1./invPtRec; else invPtRec=invPtSim;
00038     simP4.SetPx(recP3.x()*invPtRec/invPtNew);
00039     simP4.SetPy(recP3.y()*invPtRec/invPtNew);
00040     simP4.SetPz(recP3.z()*invPtRec/invPtNew);
00041     double muonEnergy=std::sqrt(simP4.P()*simP4.P()+MuonMassSquared_);
00042     simP4.SetE(muonEnergy);
00043   }
00044   else { 
00045     simP4.SetPx(recP3.x());
00046     simP4.SetPy(recP3.y());
00047     simP4.SetPz(recP3.z());
00048     double muonEnergy=std::sqrt(simP4.P()*simP4.P()+MuonMassSquared_);
00049     simP4.SetE(muonEnergy);
00050   }
00051   return simP4;
00052 }


Member Data Documentation

double FML3PtSmearer::MuonMassSquared_ = 0.10565837*0.10565837 [static, private]

Definition at line 35 of file FML3PtSmearer.h.

Referenced by smear().

const RandomEngine* FML3PtSmearer::random [private]

Definition at line 37 of file FML3PtSmearer.h.

Referenced by smear().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:59 2009 for CMSSW by  doxygen 1.5.4