CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
heppy::FSRWeightAlgo Class Reference

#include <FSRWeightAlgo.h>

Public Member Functions

void addGenParticle (const reco::GenParticle &gen)
 
void clear ()
 
 FSRWeightAlgo ()
 
double weight () const
 
virtual ~FSRWeightAlgo ()
 

Private Member Functions

double alphaRatio (double) const
 

Private Attributes

std::vector< reco::GenParticlegenParticles_
 

Detailed Description

Definition at line 8 of file FSRWeightAlgo.h.

Constructor & Destructor Documentation

heppy::FSRWeightAlgo::FSRWeightAlgo ( )
inline

Definition at line 11 of file FSRWeightAlgo.h.

11 {}
virtual heppy::FSRWeightAlgo::~FSRWeightAlgo ( )
inlinevirtual

Definition at line 12 of file FSRWeightAlgo.h.

12 {}

Member Function Documentation

void heppy::FSRWeightAlgo::addGenParticle ( const reco::GenParticle gen)
inline

Definition at line 13 of file FSRWeightAlgo.h.

References genParticles_.

13 {genParticles_.push_back(gen);}
std::vector< reco::GenParticle > genParticles_
Definition: FSRWeightAlgo.h:20
double heppy::FSRWeightAlgo::alphaRatio ( double  pt) const
private

Definition at line 76 of file FSRWeightAlgo.cc.

References HLT_25ns14e33_v1_cff::A, funct::C, cmsBatch::log, and M_PI.

Referenced by weight().

76  {
77 
78  double pigaga = 0.;
79 
80  // Leptonic contribution (just one loop, precise at < 0.3% level)
81  const double alphapi = 1/137.036/M_PI;
82  const double mass_e = 0.0005;
83  const double mass_mu = 0.106;
84  const double mass_tau = 1.777;
85  const double mass_Z = 91.2;
86  if (pt>mass_e) pigaga += alphapi * (2*log(pt/mass_e)/3.-5./9.);
87  if (pt>mass_mu) pigaga += alphapi * (2*log(pt/mass_mu)/3.-5./9.);
88  if (pt>mass_tau) pigaga += alphapi * (2*log(pt/mass_tau)/3.-5./9.);
89 
90  // Hadronic vaccum contribution
91  // Using simple effective parametrization from Physics Letters B 513 (2001) 46.
92  // Top contribution neglected
93  double A = 0.;
94  double B = 0.;
95  double C = 0.;
96  if (pt<0.7) {
97  A = 0.0; B = 0.0023092; C = 3.9925370;
98  } else if (pt<2.0) {
99  A = 0.0; B = 0.0022333; C = 4.2191779;
100  } else if (pt<4.0) {
101  A = 0.0; B = 0.0024402; C = 3.2496684;
102  } else if (pt<10.0) {
103  A = 0.0; B = 0.0027340; C = 2.0995092;
104  } else if (pt<mass_Z) {
105  A = 0.0010485; B = 0.0029431; C = 1.0;
106  } else if (pt<10000.) {
107  A = 0.0012234; B = 0.0029237; C = 1.0;
108  } else {
109  A = 0.0016894; B = 0.0028984; C = 1.0;
110  }
111  pigaga += A + B*log(1.+C*pt*pt);
112 
113  // Done
114  return 1./(1.-pigaga);
115 }
#define M_PI
tuple log
Definition: cmsBatch.py:341
void heppy::FSRWeightAlgo::clear ( void  )
inline

Definition at line 14 of file FSRWeightAlgo.h.

References genParticles_.

14 {genParticles_.clear();}
std::vector< reco::GenParticle > genParticles_
Definition: FSRWeightAlgo.h:20
double heppy::FSRWeightAlgo::weight ( void  ) const

Definition at line 11 of file FSRWeightAlgo.cc.

References funct::abs(), alphaRatio(), funct::cos(), reco::CompositeRefCandidateT< D >::daughter(), reco::CompositeRefCandidateT< D >::daughterRef(), delta, reco::Candidate::energy(), reco::LeafCandidate::energy(), genParticles_, i, j, HLT_25ns14e33_v1_cff::leptonId, reco::Candidate::mass(), reco::LeafCandidate::mass(), reco::CompositeRefCandidateT< D >::mother(), reco::CompositeRefCandidateT< D >::numberOfDaughters(), reco::CompositeRefCandidateT< D >::numberOfMothers(), reco::Candidate::pdgId(), reco::LeafCandidate::pdgId(), reco::Candidate::phi(), reco::LeafCandidate::phi(), funct::pow(), funct::sin(), mathSSE::sqrt(), reco::LeafCandidate::status(), reco::Candidate::theta(), and reco::LeafCandidate::theta().

Referenced by cuy.ValElement::__init__(), cuy.additionElement::__init__(), cuy.superimposeElement::__init__(), and cuy.graphElement::__init__().

11  {
12 
13  double weight = 1.;
14 
15  unsigned int gensize = genParticles_.size();
16  for (unsigned int i = 0; i<gensize; ++i) {
17  const reco::GenParticle& lepton = genParticles_[i];
18  if (lepton.status()!=3) continue;
19  int leptonId = lepton.pdgId();
20  if (abs(leptonId)!=11 && abs(leptonId)!=13 && abs(leptonId)!=15) continue;
21  if (lepton.numberOfMothers()!=1) continue;
22  const reco::Candidate * boson = lepton.mother();
23  int bosonId = abs(boson->pdgId());
24  if (bosonId!=23 && bosonId!=24) continue;
25  double bosonMass = boson->mass();
26  double leptonMass = lepton.mass();
27  double leptonEnergy = lepton.energy();
28  double cosLeptonTheta = cos(lepton.theta());
29  double sinLeptonTheta = sin(lepton.theta());
30  double leptonPhi = lepton.phi();
31 
32  int trueKey = i;
33  if (lepton.numberOfDaughters()==0) {
34  continue;
35  } else if (lepton.numberOfDaughters()==1) {
36  int otherleptonKey = lepton.daughterRef(0).key();
37  const reco::GenParticle& otherlepton = genParticles_[otherleptonKey];
38  if (otherlepton.pdgId()!=leptonId) continue;
39  if (otherlepton.numberOfDaughters()<=1) continue;
40  trueKey = otherleptonKey;
41  }
42 
43  const reco::GenParticle& trueLepton = genParticles_[trueKey];
44  unsigned int nDaughters = trueLepton.numberOfDaughters();
45 
46  for (unsigned int j = 0; j<nDaughters; ++j) {
47  const reco::Candidate * photon = trueLepton.daughter(j);
48  if (photon->pdgId()!=22) continue;
49  double photonEnergy = photon->energy();
50  double cosPhotonTheta = cos(photon->theta());
51  double sinPhotonTheta = sin(photon->theta());
52  double photonPhi = photon->phi();
53  double costheta = sinLeptonTheta*sinPhotonTheta*cos(leptonPhi-photonPhi)
54  + cosLeptonTheta*cosPhotonTheta;
55  // Missing O(alpha) terms in soft-collinear approach
56  // Only for W, from hep-ph/0303260
57  if (bosonId==24) {
58  double betaLepton = sqrt(1-pow(leptonMass/leptonEnergy,2));
59  double delta = - 8*photonEnergy *(1-betaLepton*costheta)
60  / pow(bosonMass,3)
61  / (1-pow(leptonMass/bosonMass,2))
62  / (4-pow(leptonMass/bosonMass,2))
63  * leptonEnergy * (pow(leptonMass,2)/bosonMass+2*photonEnergy);
64  weight *= (1 + delta);
65  }
66  // Missing NLO QED orders in QED parton shower approach
67  // Change coupling scale from 0 to kT to estimate this effect
68  weight *= alphaRatio(photonEnergy*sqrt(1-pow(costheta,2)));
69  }
70  }
71 
72  return weight;
73 }
dbl * delta
Definition: mlp_gen.cc:36
int i
Definition: DBlmapReader.cc:9
virtual int pdgId() const
PDG identifier.
virtual double energy() const =0
energy
double weight() const
daughters::value_type daughterRef(size_type i) const
reference to daughter at given position
virtual int status() const
status word
virtual double mass() const =0
mass
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual double mass() const
mass
virtual double energy() const
energy
virtual double theta() const =0
momentum polar angle
virtual size_t numberOfMothers() const
number of mothers
T sqrt(T t)
Definition: SSEVec.h:48
virtual size_t numberOfDaughters() const
number of daughters
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
std::vector< reco::GenParticle > genParticles_
Definition: FSRWeightAlgo.h:20
virtual double theta() const
momentum polar angle
virtual int pdgId() const =0
PDG identifier.
double alphaRatio(double) const
virtual double phi() const
momentum azimuthal angle
virtual const Candidate * mother(size_type=0) const
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
virtual double phi() const =0
momentum azimuthal angle

Member Data Documentation

std::vector< reco::GenParticle > heppy::FSRWeightAlgo::genParticles_
private

Definition at line 20 of file FSRWeightAlgo.h.

Referenced by addGenParticle(), clear(), and weight().