CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

FML3PtSmearer Class Reference

#include <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.

  : random(engine)
{ }
FML3PtSmearer::~FML3PtSmearer ( )

Destructor.

Definition at line 17 of file FML3PtSmearer.cc.

{}

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().

                                                             {
  return funSigma(fabs(theEta),thePt)/thePt;
}
double FML3PtSmearer::funShift ( double  x) const [private]

Definition at line 62 of file FML3PtSmearer.cc.

References ExpressReco_HICollisions_FallBack::x.

Referenced by shift().

                                             {
  if      (x<1.305) return 7.90897e-04;
  else if (x<1.82 ) return 9.52662e-02-1.12262e-01*x+3.05410e-02*x*x;
  else              return -7.9e-03;
  }
double FML3PtSmearer::funSigma ( double  eta,
double  pt 
) const [private]

Definition at line 68 of file FML3PtSmearer.cc.

References funSigmaEta(), funSigmaPt(), and ExpressReco_HICollisions_FallBack::sigma.

Referenced by error().

                                                           {
  double sigma = funSigmaPt(pt) * funSigmaEta(eta);
  return sigma;
}
double FML3PtSmearer::funSigmaEta ( double  x) const [private]

Definition at line 78 of file FML3PtSmearer.cc.

References funct::exp().

Referenced by funSigma().

                                                {
  if (x<0.94) return 2.27603e-02+1.23995e-06*exp(9.30755*x);
  else        return 2.99467e-02+1.86770e-05*exp(3.52319*x);
}
double FML3PtSmearer::funSigmaPt ( double  x) const [private]

Definition at line 73 of file FML3PtSmearer.cc.

References ExpressReco_HICollisions_FallBack::x.

Referenced by funSigma().

                                               {
  if (x<444.) return 3.13349e-01+2.77853e-03*x+4.94289e-06*x*x-9.63359e-09*x*x*x;
  else        return 9.26294e-01+1.64896e-03*x;
}
double FML3PtSmearer::shift ( double  thePt,
double  theEta 
) const [private]

Definition at line 58 of file FML3PtSmearer.cc.

References funShift().

Referenced by smear().

                                                             {
  return funShift(fabs(theEta));
}
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 mathSSE::sqrt().

Referenced by ParamL3MuonProducer::produce().

                                                                                                  {
  double ptSim = std::sqrt(simP4.perp2());
  double invPtSim;
  if (ptSim>0.) invPtSim = 1./ptSim; 
  else { 
    // Better if we throw an exception here...
    simP4.SetPx(recP3.X());
    simP4.SetPy(recP3.Y());
    simP4.SetPz(recP3.Z());
    double muonEnergy=std::sqrt(simP4.P()*simP4.P()+MuonMassSquared_);
    simP4.SetE(muonEnergy);
    return simP4;
  }
  double etaSim = simP4.eta();
  double invPtNew = random->gaussShoot(invPtSim,error(ptSim,etaSim));
  invPtNew /= ( 1. + shift(ptSim,etaSim)*invPtNew);
  if (invPtNew>0.) {
    double invPtRec = std::sqrt(recP3.perp2());
    if (invPtRec>0) invPtRec = 1./invPtRec; else invPtRec=invPtSim;
    simP4.SetPx(recP3.x()*invPtRec/invPtNew);
    simP4.SetPy(recP3.y()*invPtRec/invPtNew);
    simP4.SetPz(recP3.z()*invPtRec/invPtNew);
    double muonEnergy=std::sqrt(simP4.P()*simP4.P()+MuonMassSquared_);
    simP4.SetE(muonEnergy);
  }
  else { 
    simP4.SetPx(recP3.x());
    simP4.SetPy(recP3.y());
    simP4.SetPz(recP3.z());
    double muonEnergy=std::sqrt(simP4.P()*simP4.P()+MuonMassSquared_);
    simP4.SetE(muonEnergy);
  }
  return simP4;
}

Member Data Documentation

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

Definition at line 35 of file FML3PtSmearer.h.

Referenced by smear().

Definition at line 37 of file FML3PtSmearer.h.

Referenced by smear().