CMS 3D CMS Logo

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

Public Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 WeakEffectsWeightProducer (const edm::ParameterSet &pset)
 
 ~WeakEffectsWeightProducer () 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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 alphaQED (double q2)
 
double sigma0_qqbarll (unsigned int quark_type, double Q, double rho)
 

Private Attributes

edm::EDGetTokenT< reco::GenParticleCollectiongenParticlesToken_
 
double rhoParameter_
 

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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 6 of file WeakEffectsWeightProducer.cc.

Constructor & Destructor Documentation

WeakEffectsWeightProducer::WeakEffectsWeightProducer ( const edm::ParameterSet pset)

Definition at line 31 of file WeakEffectsWeightProducer.cc.

32  : // genParticlesToken_(consumes<reco::GenParticleCollection>(pset.getUntrackedParameter<edm::InputTag> ("GenParticlesTag", edm::InputTag("genParticles")))),
33  genParticlesToken_(consumes<reco::GenParticleCollection>(edm::InputTag("genParticles"))),
34  rhoParameter_(pset.getUntrackedParameter<double>("RhoParameter", 1.004)) {
35  produces<double>();
36 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesToken_
WeakEffectsWeightProducer::~WeakEffectsWeightProducer ( )
override

Definition at line 39 of file WeakEffectsWeightProducer.cc.

39 {}

Member Function Documentation

double WeakEffectsWeightProducer::alphaQED ( double  q2)
private

Definition at line 86 of file WeakEffectsWeightProducer.cc.

References dqm-mbProfile::log.

Referenced by sigma0_qqbarll().

86  {
87  double pigaga = -0.010449239475366825 - 0.0023228196282246765 * log(q2) - 0.0288 -
88  0.002980 * (log(q2 / 8464.) + 0.006307 * (q2 / 8464. - 1.));
89  return (1. / 137.0359895) / (1. + pigaga);
90 }
double q2[4]
Definition: TauolaWrapper.h:88
void WeakEffectsWeightProducer::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 42 of file WeakEffectsWeightProducer.cc.

42 {}
void WeakEffectsWeightProducer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 45 of file WeakEffectsWeightProducer.cc.

45 {}
void WeakEffectsWeightProducer::produce ( edm::Event iEvent,
const edm::EventSetup  
)
override

Definition at line 48 of file WeakEffectsWeightProducer.cc.

References funct::abs(), genParticles2HepMC_cfi::genParticles, genParticlesToken_, edm::Event::getByToken(), mps_fire::i, edm::EventBase::isRealData(), crabWrapper::key, reco::LeafCandidate::mass(), reco::CompositeRefCandidateT< D >::motherRef(), eostools::move(), reco::CompositeRefCandidateT< D >::numberOfMothers(), EgammaValidation_cff::pdgId, reco::LeafCandidate::pdgId(), edm::Event::put(), class-composition::Q, rhoParameter_, sigma0_qqbarll(), mps_update::status, reco::LeafCandidate::status(), and mps_merge::weight.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

48  {
49  if (iEvent.isRealData())
50  return;
51 
53  iEvent.getByToken(genParticlesToken_, genParticles);
54  unsigned int gensize = genParticles->size();
55 
56  std::unique_ptr<double> weight(new double);
57 
58  // Set default weight
59  (*weight) = 1.;
60 
61  // Only DY implemented for the time being
62  for (unsigned int i = 0; i < gensize; ++i) {
63  const reco::GenParticle& part = (*genParticles)[i];
64  int status = part.status();
65  if (status != 3)
66  break;
67  int id = part.pdgId();
68  if (id != 23)
69  continue;
70  double Q = part.mass();
71  unsigned int nmothers = part.numberOfMothers();
72  if (nmothers <= 0)
73  continue;
74  size_t key = part.motherRef(0).key();
75  unsigned int quark_id = abs((*genParticles)[key].pdgId());
76  if (quark_id > 0 && quark_id < 6) {
77  (*weight) *= sigma0_qqbarll(quark_id, Q, rhoParameter_) / sigma0_qqbarll(quark_id, Q, 1.0);
78  }
79  break;
80  }
81 
82  //printf(" \t >>>>> WeakEffectsWeightProducer: Final weight = %f\n", (*weight));
83  iEvent.put(std::move(weight));
84 }
int pdgId() const final
PDG identifier.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
size_t numberOfMothers() const override
number of mothers
Definition: weight.py:1
double sigma0_qqbarll(unsigned int quark_type, double Q, double rho)
bool isRealData() const
Definition: EventBase.h:62
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
daughters::value_type motherRef(size_type i=0) const
reference to mother at given position
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesToken_
part
Definition: HCALResponse.h:20
int status() const final
status word
def move(src, dest)
Definition: eostools.py:511
double mass() const final
mass
double WeakEffectsWeightProducer::sigma0_qqbarll ( unsigned int  quark_type,
double  Q,
double  rho 
)
private

Definition at line 92 of file WeakEffectsWeightProducer.cc.

References alphaQED(), DEFINE_FWK_MODULE, makePileupJSON::denom, dqm-mbProfile::log, M_PI, MZ, funct::pow(), class-composition::Q, and mathSSE::sqrt().

Referenced by produce().

92  {
93  double MZ = 91.188;
94  double GZ = 2.495;
95  double sin2eff = 0.232;
96 
97  double vl = -0.5 + 2. * sin2eff;
98  double al = -0.5;
99 
100  double qq = 0.;
101  double vq = 0.;
102  double aq = 0.;
103  double alphaW = 2.7e-3 * pow(log(Q * Q / 80.4 / 80.4), 2);
104  double alphaZ = 2.7e-3 * pow(log(Q * Q / MZ / MZ), 2);
105  double sudakov_factor = 1.;
106  if (quark_id % 2 == 1) {
107  qq = -1. / 3.;
108  vq = -0.5 - 2. * qq * sin2eff;
109  aq = -0.5;
110  sudakov_factor = 1 + (-2.139 + 0.864) * alphaW - 0.385 * alphaZ;
111  } else {
112  qq = 2. / 3.;
113  vq = 0.5 - 2. * qq * sin2eff;
114  aq = 0.5;
115  sudakov_factor = 1 + (-3.423 + 1.807) * alphaW - 0.557 * alphaZ;
116  }
117 
118  double alfarn = alphaQED(Q * Q);
119  double zcoupl = sqrt(2.) * 1.166389e-5 * MZ * MZ / 4. / M_PI;
120  double gll = zcoupl * MZ / 3. * (vl * vl + al * al);
121  double gdd = zcoupl * MZ / 3. * (vq * vq + aq * aq);
122  double denom = (Q * Q - MZ * MZ) * (Q * Q - MZ * MZ) + pow(Q, 4) * GZ * GZ / MZ / MZ;
123  double qed = M_PI * qq * qq * alfarn * alfarn / Q / Q;
124  double zint = rho * 2 * M_PI * zcoupl * alfarn * qq * vq * vl * (Q * Q - MZ * MZ) / denom;
125  double zonly = rho * rho * 9. * M_PI * gll * gdd / MZ / MZ * Q * Q / denom;
126 
127  return (qed + zint + zonly) * sudakov_factor;
128 }
#define MZ
T sqrt(T t)
Definition: SSEVec.h:19
#define M_PI
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30

Member Data Documentation

edm::EDGetTokenT<reco::GenParticleCollection> WeakEffectsWeightProducer::genParticlesToken_
private

Definition at line 15 of file WeakEffectsWeightProducer.cc.

Referenced by produce().

double WeakEffectsWeightProducer::rhoParameter_
private

Definition at line 16 of file WeakEffectsWeightProducer.cc.

Referenced by produce().