CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FSRWeightProducer Class Reference
Inheritance diagram for FSRWeightProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 FSRWeightProducer (const edm::ParameterSet &)
 
 ~FSRWeightProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

double alphaRatio (double)
 
void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< reco::GenParticleCollectiongenToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 20 of file FSRWeightProducer.cc.

Constructor & Destructor Documentation

◆ FSRWeightProducer()

FSRWeightProducer::FSRWeightProducer ( const edm::ParameterSet pset)
explicit

Definition at line 35 of file FSRWeightProducer.cc.

35  {
36  genToken_ = consumes<reco::GenParticleCollection>(
37  pset.getUntrackedParameter<edm::InputTag>("GenTag", edm::InputTag("genParticles")));
38 
39  produces<double>();
40 }

References genToken_, and muonDTDigis_cfi::pset.

◆ ~FSRWeightProducer()

FSRWeightProducer::~FSRWeightProducer ( )
override

Definition at line 43 of file FSRWeightProducer.cc.

43 {}

Member Function Documentation

◆ alphaRatio()

double FSRWeightProducer::alphaRatio ( double  pt)
private

Definition at line 128 of file FSRWeightProducer.cc.

128  {
129  double pigaga = 0.;
130 
131  // Leptonic contribution (just one loop, precise at < 0.3% level)
132  const double alphapi = 1 / 137.036 / M_PI;
133  const double mass_e = 0.0005;
134  const double mass_mu = 0.106;
135  const double mass_tau = 1.777;
136  const double mass_Z = 91.2;
137  if (pt > mass_e)
138  pigaga += alphapi * (2 * log(pt / mass_e) / 3. - 5. / 9.);
139  if (pt > mass_mu)
140  pigaga += alphapi * (2 * log(pt / mass_mu) / 3. - 5. / 9.);
141  if (pt > mass_tau)
142  pigaga += alphapi * (2 * log(pt / mass_tau) / 3. - 5. / 9.);
143 
144  // Hadronic vaccum contribution
145  // Using simple effective parametrization from Physics Letters B 513 (2001) 46.
146  // Top contribution neglected
147  double A = 0.;
148  double B = 0.;
149  double C = 0.;
150  if (pt < 0.7) {
151  A = 0.0;
152  B = 0.0023092;
153  C = 3.9925370;
154  } else if (pt < 2.0) {
155  A = 0.0;
156  B = 0.0022333;
157  C = 4.2191779;
158  } else if (pt < 4.0) {
159  A = 0.0;
160  B = 0.0024402;
161  C = 3.2496684;
162  } else if (pt < 10.0) {
163  A = 0.0;
164  B = 0.0027340;
165  C = 2.0995092;
166  } else if (pt < mass_Z) {
167  A = 0.0010485;
168  B = 0.0029431;
169  C = 1.0;
170  } else if (pt < 10000.) {
171  A = 0.0012234;
172  B = 0.0029237;
173  C = 1.0;
174  } else {
175  A = 0.0016894;
176  B = 0.0028984;
177  C = 1.0;
178  }
179  pigaga += A + B * log(1. + C * pt * pt);
180 
181  // Done
182  return 1. / (1. - pigaga);
183 }

References TtFullHadDaughter::B, gen::C, dqm-mbProfile::log, M_PI, and DiDispStaMuonMonitor_cfi::pt.

Referenced by produce().

◆ beginJob()

void FSRWeightProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 46 of file FSRWeightProducer.cc.

46 {}

◆ endJob()

void FSRWeightProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 49 of file FSRWeightProducer.cc.

49 {}

◆ produce()

void FSRWeightProducer::produce ( edm::Event iEvent,
const edm::EventSetup  
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 52 of file FSRWeightProducer.cc.

52  {
53  if (iEvent.isRealData())
54  return;
55 
57  iEvent.getByToken(genToken_, genParticles);
58 
59  std::unique_ptr<double> weight(new double);
60 
61  // Set a default weight to start with
62  (*weight) = 1.;
63 
64  unsigned int gensize = genParticles->size();
65  for (unsigned int i = 0; i < gensize; ++i) {
66  const reco::GenParticle& lepton = (*genParticles)[i];
67  if (lepton.status() != 3)
68  continue;
69  int leptonId = lepton.pdgId();
70  if (abs(leptonId) != 11 && abs(leptonId) != 13 && abs(leptonId) != 15)
71  continue;
72  if (lepton.numberOfMothers() != 1)
73  continue;
74  const reco::Candidate* boson = lepton.mother();
75  int bosonId = abs(boson->pdgId());
76  if (bosonId != 23 && bosonId != 24)
77  continue;
78  double bosonMass = boson->mass();
79  double leptonMass = lepton.mass();
80  double leptonEnergy = lepton.energy();
81  double cosLeptonTheta = cos(lepton.theta());
82  double sinLeptonTheta = sin(lepton.theta());
83  double leptonPhi = lepton.phi();
84 
85  int trueKey = i;
86  if (lepton.numberOfDaughters() == 0) {
87  continue;
88  } else if (lepton.numberOfDaughters() == 1) {
89  int otherleptonKey = lepton.daughterRef(0).key();
90  const reco::GenParticle& otherlepton = (*genParticles)[otherleptonKey];
91  if (otherlepton.pdgId() != leptonId)
92  continue;
93  if (otherlepton.numberOfDaughters() <= 1)
94  continue;
95  trueKey = otherleptonKey;
96  }
97 
98  const reco::GenParticle& trueLepton = (*genParticles)[trueKey];
99  unsigned int nDaughters = trueLepton.numberOfDaughters();
100 
101  for (unsigned int j = 0; j < nDaughters; ++j) {
102  const reco::Candidate* photon = trueLepton.daughter(j);
103  if (photon->pdgId() != 22)
104  continue;
105  double photonEnergy = photon->energy();
106  double cosPhotonTheta = cos(photon->theta());
107  double sinPhotonTheta = sin(photon->theta());
108  double photonPhi = photon->phi();
109  double costheta = sinLeptonTheta * sinPhotonTheta * cos(leptonPhi - photonPhi) + cosLeptonTheta * cosPhotonTheta;
110  // Missing O(alpha) terms in soft-collinear approach
111  // Only for W, from hep-ph/0303260
112  if (bosonId == 24) {
113  double betaLepton = sqrt(1 - pow(leptonMass / leptonEnergy, 2));
114  double delta = -8 * photonEnergy * (1 - betaLepton * costheta) / pow(bosonMass, 3) /
115  (1 - pow(leptonMass / bosonMass, 2)) / (4 - pow(leptonMass / bosonMass, 2)) * leptonEnergy *
116  (pow(leptonMass, 2) / bosonMass + 2 * photonEnergy);
117  (*weight) *= (1 + delta);
118  }
119  // Missing NLO QED orders in QED parton shower approach
120  // Change coupling scale from 0 to kT to estimate this effect
121  (*weight) *= alphaRatio(photonEnergy * sqrt(1 - pow(costheta, 2)));
122  }
123  }
124 
125  iEvent.put(std::move(weight));
126 }

References funct::abs(), alphaRatio(), funct::cos(), reco::CompositeRefCandidateT< D >::daughter(), reco::CompositeRefCandidateT< D >::daughterRef(), dumpMFGeometry_cfg::delta, reco::LeafCandidate::energy(), genParticles2HepMC_cfi::genParticles, genToken_, mps_fire::i, iEvent, dqmiolumiharvest::j, HLT_FULL_cff::leptonId, reco::Candidate::mass(), reco::LeafCandidate::mass(), reco::CompositeRefCandidateT< D >::mother(), eostools::move(), reco::CompositeRefCandidateT< D >::numberOfDaughters(), reco::CompositeRefCandidateT< D >::numberOfMothers(), reco::Candidate::pdgId(), reco::LeafCandidate::pdgId(), reco::LeafCandidate::phi(), muons2muons_cfi::photon, MaterialEffects_cfi::photonEnergy, HLTObjectMonitor_cfi::photonPhi, funct::pow(), funct::sin(), mathSSE::sqrt(), reco::LeafCandidate::status(), reco::LeafCandidate::theta(), and mps_merge::weight.

Member Data Documentation

◆ genToken_

edm::EDGetTokenT<reco::GenParticleCollection> FSRWeightProducer::genToken_
private

Definition at line 31 of file FSRWeightProducer.cc.

Referenced by FSRWeightProducer(), and produce().

muons2muons_cfi.photon
photon
Definition: muons2muons_cfi.py:28
mps_fire.i
i
Definition: mps_fire.py:428
reco::CompositeRefCandidateT::numberOfDaughters
size_t numberOfDaughters() const override
number of daughters
genParticles2HepMC_cfi.genParticles
genParticles
Definition: genParticles2HepMC_cfi.py:4
FSRWeightProducer::genToken_
edm::EDGetTokenT< reco::GenParticleCollection > genToken_
Definition: FSRWeightProducer.cc:31
reco::LeafCandidate::status
int status() const final
status word
Definition: LeafCandidate.h:180
reco::GenParticle
Definition: GenParticle.h:21
reco::Candidate::mass
virtual double mass() const =0
mass
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
reco::CompositeRefCandidateT::daughterRef
daughters::value_type daughterRef(size_type i) const
reference to daughter at given position
Definition: CompositeRefCandidateT.h:69
reco::CompositeRefCandidateT::mother
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode)
mps_merge.weight
weight
Definition: mps_merge.py:88
reco::CompositeRefCandidateT::numberOfMothers
size_t numberOfMothers() const override
number of mothers
FSRWeightProducer::alphaRatio
double alphaRatio(double)
Definition: FSRWeightProducer.cc:128
edm::Handle< reco::GenParticleCollection >
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::LeafCandidate::theta
double theta() const final
momentum polar angle
Definition: LeafCandidate.h:150
reco::LeafCandidate::mass
double mass() const final
mass
Definition: LeafCandidate.h:131
reco::LeafCandidate::pdgId
int pdgId() const final
PDG identifier.
Definition: LeafCandidate.h:176
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
A
iEvent
int iEvent
Definition: GenABIO.cc:224
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
reco::Candidate::pdgId
virtual int pdgId() const =0
PDG identifier.
reco::Candidate
Definition: Candidate.h:27
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
eostools.move
def move(src, dest)
Definition: eostools.py:511
HLT_FULL_cff.leptonId
leptonId
Definition: HLT_FULL_cff.py:53052
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
gen::C
C
Definition: PomwigHadronizer.cc:78
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
reco::CompositeRefCandidateT::daughter
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
HLTObjectMonitor_cfi.photonPhi
photonPhi
Definition: HLTObjectMonitor_cfi.py:72
MaterialEffects_cfi.photonEnergy
photonEnergy
Definition: MaterialEffects_cfi.py:26
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::InputTag
Definition: InputTag.h:15
weight
Definition: weight.py:1
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27