CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
gen::Pythia6EGun Class Reference

#include <Pythia6EGun.h>

Inheritance diagram for gen::Pythia6EGun:
gen::Pythia6ParticleGun gen::Pythia6Gun edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 Pythia6EGun (const edm::ParameterSet &)
 
 ~Pythia6EGun () override
 
- Public Member Functions inherited from gen::Pythia6ParticleGun
 Pythia6ParticleGun (const edm::ParameterSet &)
 
 ~Pythia6ParticleGun () override
 
- Public Member Functions inherited from gen::Pythia6Gun
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 Pythia6Gun (const edm::ParameterSet &)
 
 ~Pythia6Gun () 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)
 

Protected Member Functions

void generateEvent (CLHEP::HepRandomEngine *) override
 
- Protected Member Functions inherited from gen::Pythia6Gun
HepMC::GenParticle * addAntiParticle (int &, int &, double &, double &, double &)
 
void attachPy6DecaysToGenEvent ()
 
void loadEvent (edm::Event &)
 
- 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)
 

Private Attributes

bool fAddAntiParticle
 
double fMaxE
 
double fMaxEta
 
double fMinE
 
double fMinEta
 

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 Attributes inherited from gen::Pythia6ParticleGun
std::vector< int > fPartIDs
 
- Protected Attributes inherited from gen::Pythia6Gun
HepMC::GenEventfEvt
 
bool fHepMCVerbosity
 
int fMaxEventsToPrint
 
double fMaxPhi
 
double fMinPhi
 
std::vector< int > fPartIDs
 
Pythia6ServicefPy6Service
 
int fPylistVerbosity
 

Detailed Description

Definition at line 12 of file Pythia6EGun.h.

Constructor & Destructor Documentation

◆ Pythia6EGun()

Pythia6EGun::Pythia6EGun ( const edm::ParameterSet pset)

Definition at line 18 of file Pythia6EGun.cc.

19  // ParameterSet defpset ;
20  ParameterSet pgun_params = pset.getParameter<ParameterSet>("PGunParameters"); // , defpset ) ;
21  fMinEta = pgun_params.getParameter<double>("MinEta"); // ,-2.2);
22  fMaxEta = pgun_params.getParameter<double>("MaxEta"); // , 2.2);
23  fMinE = pgun_params.getParameter<double>("MinE"); // , 0.);
24  fMaxE = pgun_params.getParameter<double>("MaxE"); // , 0.);
25  fAddAntiParticle = pgun_params.getParameter<bool>("AddAntiParticle"); //, false) ;
26 }

References fAddAntiParticle, fMaxE, fMaxEta, fMinE, fMinEta, edm::ParameterSet::getParameter(), and muonDTDigis_cfi::pset.

◆ ~Pythia6EGun()

Pythia6EGun::~Pythia6EGun ( )
override

Definition at line 28 of file Pythia6EGun.cc.

28 {}

Member Function Documentation

◆ generateEvent()

void Pythia6EGun::generateEvent ( CLHEP::HepRandomEngine *  )
overrideprotectedvirtual

Implements gen::Pythia6Gun.

Definition at line 30 of file Pythia6EGun.cc.

30  {
31  Pythia6Service::InstanceWrapper guard(fPy6Service); // grab Py6 instance
32 
33  // now actualy, start cooking up the event gun
34  //
35 
36  // 1st, primary vertex
37  //
38  HepMC::GenVertex* Vtx = new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
39 
40  // here re-create fEvt (memory)
41  //
42  fEvt = new HepMC::GenEvent();
43 
44  int ip = 1;
45  for (size_t i = 0; i < fPartIDs.size(); i++) {
46  int particleID = fPartIDs[i]; // this is PDG - need to convert to Py6 !!!
47  int py6PID = HepPID::translatePDTtoPythia(particleID);
48  int dum = 0;
49  double ee = 0, the = 0, eta = 0;
50  double mass = pymass_(particleID);
51 
52  // fill p(ip,5) (in PYJETS) with mass value right now,
53  // because the (hardcoded) mstu(10)=1 will make py1ent
54  // pick the mass from there
55  pyjets.p[4][ip - 1] = mass;
56 
57  double phi = (fMaxPhi - fMinPhi) * pyr_(&dum) + fMinPhi;
58  ee = (fMaxE - fMinE) * pyr_(&dum) + fMinE;
59  eta = (fMaxEta - fMinEta) * pyr_(&dum) + fMinEta;
60  the = 2. * atan(exp(-eta));
61 
62  py1ent_(ip, py6PID, ee, the, phi);
63 
64  double px = pyjets.p[0][ip - 1]; // pt*cos(phi) ;
65  double py = pyjets.p[1][ip - 1]; // pt*sin(phi) ;
66  double pz = pyjets.p[2][ip - 1]; // mom*cos(the) ;
67 
68  HepMC::FourVector p(px, py, pz, ee);
70  Part->suggest_barcode(ip);
71  Vtx->add_particle_out(Part);
72 
73  if (fAddAntiParticle) {
74  ip = ip + 1;
76  if (APart)
77  Vtx->add_particle_out(APart);
78  }
79  ip++;
80  }
81 
82  fEvt->add_vertex(Vtx);
83 
84  // run pythia
85  pyexec_();
86 
87  return;
88 }

References gen::Pythia6Gun::addAntiParticle(), PVValHelper::eta, JetChargeProducer_cfi::exp, fAddAntiParticle, gen::Pythia6Gun::fEvt, fMaxE, fMaxEta, gen::Pythia6Gun::fMaxPhi, fMinE, fMinEta, gen::Pythia6Gun::fMinPhi, gen::Pythia6ParticleGun::fPartIDs, gen::Pythia6Gun::fPy6Service, GenParticle::GenParticle, mps_fire::i, EgHLTOffHistBins_cfi::mass, gen::p, EgammaObjectsElectrons_cfi::particleID, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, gen::py1ent_(), gen::pyexec_(), gen::pymass_(), and gen::pyr_().

Member Data Documentation

◆ fAddAntiParticle

bool gen::Pythia6EGun::fAddAntiParticle
private

Definition at line 26 of file Pythia6EGun.h.

Referenced by generateEvent(), and Pythia6EGun().

◆ fMaxE

double gen::Pythia6EGun::fMaxE
private

Definition at line 25 of file Pythia6EGun.h.

Referenced by generateEvent(), and Pythia6EGun().

◆ fMaxEta

double gen::Pythia6EGun::fMaxEta
private

Definition at line 23 of file Pythia6EGun.h.

Referenced by generateEvent(), and Pythia6EGun().

◆ fMinE

double gen::Pythia6EGun::fMinE
private

Definition at line 24 of file Pythia6EGun.h.

Referenced by generateEvent(), and Pythia6EGun().

◆ fMinEta

double gen::Pythia6EGun::fMinEta
private

Definition at line 22 of file Pythia6EGun.h.

Referenced by generateEvent(), and Pythia6EGun().

gen::Pythia6EGun::fMaxEta
double fMaxEta
Definition: Pythia6EGun.h:23
mps_fire.i
i
Definition: mps_fire.py:428
gen::pymass_
double pymass_(int &)
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
gen::pyr_
double pyr_(int *idummy)
Definition: Pythia6Service.cc:60
gen::Pythia6Gun::fEvt
HepMC::GenEvent * fEvt
Definition: Pythia6Gun.h:66
gen::Pythia6ParticleGun::Pythia6ParticleGun
Pythia6ParticleGun(const edm::ParameterSet &)
Definition: Pythia6ParticleGun.cc:20
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
gen::pyexec_
void pyexec_()
gen::py1ent_
void py1ent_(int &ip, int &kf, double &pe, double &the, double &phi)
EgammaObjectsElectrons_cfi.particleID
particleID
Definition: EgammaObjectsElectrons_cfi.py:4
gen::Pythia6Gun::addAntiParticle
HepMC::GenParticle * addAntiParticle(int &, int &, double &, double &, double &)
Definition: Pythia6Gun.cc:198
PVValHelper::eta
Definition: PVValidationHelpers.h:69
gen::p
double p[5][pyjets_maxn]
Definition: Cascade2Hadronizer.cc:76
gen::Pythia6EGun::fAddAntiParticle
bool fAddAntiParticle
Definition: Pythia6EGun.h:26
gen::Pythia6EGun::fMinE
double fMinE
Definition: Pythia6EGun.h:24
gen::Pythia6Gun::fMaxPhi
double fMaxPhi
Definition: Pythia6Gun.h:62
gen::Pythia6ParticleGun::fPartIDs
std::vector< int > fPartIDs
Definition: Pythia6ParticleGun.h:36
edm::ParameterSet
Definition: ParameterSet.h:47
gen::Pythia6Gun::fMinPhi
double fMinPhi
Definition: Pythia6Gun.h:61
gen::Pythia6Gun::fPy6Service
Pythia6Service * fPy6Service
Definition: Pythia6Gun.h:56
gen::Pythia6EGun::fMinEta
double fMinEta
Definition: Pythia6EGun.h:22
DDAxes::phi
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
gen::Pythia6EGun::fMaxE
double fMaxE
Definition: Pythia6EGun.h:25
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27