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

virtual void beginJob () override
 
virtual void endJob () override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 WeakEffectsWeightProducer (const edm::ParameterSet &pset)
 
virtual ~WeakEffectsWeightProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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
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)
 
- 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 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.

31  :
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 {
36  produces<double>();
37 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesToken_
WeakEffectsWeightProducer::~WeakEffectsWeightProducer ( )
virtual

Definition at line 40 of file WeakEffectsWeightProducer.cc.

40 {}

Member Function Documentation

double WeakEffectsWeightProducer::alphaQED ( double  q2)
private

Definition at line 86 of file WeakEffectsWeightProducer.cc.

References cmsBatch::log.

Referenced by sigma0_qqbarll().

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

Reimplemented from edm::EDProducer.

Definition at line 43 of file WeakEffectsWeightProducer.cc.

43  {
44 }
void WeakEffectsWeightProducer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 47 of file WeakEffectsWeightProducer.cc.

47  {
48 }
void WeakEffectsWeightProducer::produce ( edm::Event iEvent,
const edm::EventSetup  
)
overridevirtual

Definition at line 51 of file WeakEffectsWeightProducer.cc.

References funct::abs(), GenHFHadronMatcher_cfi::genParticles, genParticlesToken_, edm::Event::getByToken(), i, edm::EventBase::isRealData(), crabWrapper::key, reco::LeafCandidate::mass(), reco::CompositeRefCandidateT< D >::motherRef(), eostools::move(), reco::CompositeRefCandidateT< D >::numberOfMothers(), cosmictrackingParticleSelector_cfi::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().

51  {
52  if (iEvent.isRealData()) return;
53 
55  iEvent.getByToken(genParticlesToken_, genParticles);
56  unsigned int gensize = genParticles->size();
57 
58  std::unique_ptr<double> weight (new double);
59 
60  // Set default weight
61  (*weight) = 1.;
62 
63  // Only DY implemented for the time being
64  for(unsigned int i = 0; i<gensize; ++i) {
65  const reco::GenParticle& part = (*genParticles)[i];
66  int status = part.status();
67  if (status!=3) break;
68  int id = part.pdgId();
69  if (id!=23) continue;
70  double Q = part.mass();
71  unsigned int nmothers = part.numberOfMothers();
72  if (nmothers<=0) continue;
73  size_t key = part.motherRef(0).key();
74  unsigned int quark_id = abs((*genParticles)[key].pdgId());
75  if (quark_id>0 && quark_id<6) {
76  (*weight) *= sigma0_qqbarll(quark_id, Q, rhoParameter_)
77  / 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 i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
virtual double mass() const final
mass
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
Definition: weight.py:1
virtual int status() const final
status word
double sigma0_qqbarll(unsigned int quark_type, double Q, double rho)
bool isRealData() const
Definition: EventBase.h:62
virtual size_t numberOfMothers() const
number of mothers
virtual int pdgId() const final
PDG identifier.
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
def move(src, dest)
Definition: eostools.py:510
double WeakEffectsWeightProducer::sigma0_qqbarll ( unsigned int  quark_type,
double  Q,
double  rho 
)
private

Definition at line 91 of file WeakEffectsWeightProducer.cc.

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

Referenced by produce().

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

Member Data Documentation

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

Definition at line 14 of file WeakEffectsWeightProducer.cc.

Referenced by produce().

double WeakEffectsWeightProducer::rhoParameter_
private

Definition at line 15 of file WeakEffectsWeightProducer.cc.

Referenced by produce().