CMS 3D CMS Logo

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

#include <Pythia6JetGun.h>

Inheritance diagram for gen::Pythia6JetGun:
gen::Pythia6ParticleGun gen::Pythia6Gun edm::one::EDProducer< edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 Pythia6JetGun (const edm::ParameterSet &)
 
 ~Pythia6JetGun () 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 endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
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::one::EDProducer< edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDProducerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Private Attributes

double fMaxE
 
double fMaxEta
 
double fMaxP
 
double fMinE
 
double fMinEta
 
double fMinP
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 Pythia6JetGun.h.

Constructor & Destructor Documentation

◆ Pythia6JetGun()

Pythia6JetGun::Pythia6JetGun ( const edm::ParameterSet pset)

Definition at line 17 of file Pythia6JetGun.cc.

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

18  : Pythia6ParticleGun(pset), fMinEta(0.), fMaxEta(0.), fMinE(0.), fMaxE(0.), fMinP(0.), fMaxP(0.) {
19  ParameterSet pgun_params = pset.getParameter<ParameterSet>("PGunParameters");
20  fMinEta = pgun_params.getParameter<double>("MinEta");
21  fMaxEta = pgun_params.getParameter<double>("MaxEta");
22  fMinE = pgun_params.getParameter<double>("MinE");
23  fMaxE = pgun_params.getParameter<double>("MaxE");
24  fMinP = pgun_params.getParameter<double>("MinP");
25  fMaxP = pgun_params.getParameter<double>("MaxP");
26 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
Pythia6ParticleGun(const edm::ParameterSet &)

◆ ~Pythia6JetGun()

Pythia6JetGun::~Pythia6JetGun ( )
override

Definition at line 28 of file Pythia6JetGun.cc.

28 {}

Member Function Documentation

◆ generateEvent()

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

Implements gen::Pythia6Gun.

Definition at line 30 of file Pythia6JetGun.cc.

References funct::cos(), PVValHelper::eta, JetChargeProducer_cfi::exp, gen::Pythia6Gun::fEvt, dqmdumpme::first, fMaxE, fMaxEta, fMaxP, gen::Pythia6Gun::fMaxPhi, fMinE, fMinEta, fMinP, gen::Pythia6Gun::fMinPhi, gen::Pythia6ParticleGun::fPartIDs, gen::Pythia6Gun::fPy6Service, GenParticle::GenParticle, mps_fire::i, dqmdumpme::last, M_PI, EgHLTOffHistBins_cfi::mass, gen::p, EgammaObjectsElectrons_cfi::particleID, gen::py1ent_(), gen::pyexec_(), gen::pymass_(), gen::pyr_(), gen::pyrobo_(), funct::sin(), and mathSSE::sqrt().

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  double totPx = 0.;
46  double totPy = 0.;
47  double totPz = 0.;
48  double totE = 0.;
49  double totM = 0.;
50  double phi, eta, the, ee, pp;
51  int dum = 0;
52  for (size_t i = 0; i < fPartIDs.size(); i++) {
53  int particleID = fPartIDs[i]; // this is PDG - need to convert to Py6 !!!
54  int py6PID = HepPID::translatePDTtoPythia(particleID);
55 
56  // internal numbers
57  //
58  phi = 2. * M_PI * pyr_(&dum);
59  the = std::acos(-1. + 2. * pyr_(&dum));
60 
61  // from input
62  //
63  ee = (fMaxE - fMinE) * pyr_(&dum) + fMinE;
64 
65  // fill p(ip,5) (in PYJETS) with mass value right now,
66  // because the (hardcoded) mstu(10)=1 will make py1ent
67  // pick the mass from there
68  double mass = pymass_(py6PID);
69  pyjets.p[4][ip - 1] = mass;
70 
71  // add entry to py6
72  //
73  py1ent_(ip, py6PID, ee, the, phi);
74 
75  // values for computing total mass
76  //
77  totPx += pyjets.p[0][ip - 1];
78  totPy += pyjets.p[1][ip - 1];
79  totPz += pyjets.p[2][ip - 1];
80  totE += pyjets.p[3][ip - 1];
81 
82  ip++;
83 
84  } // end forming up py6 record of the jet
85 
86  // compute total mass
87  //
88  totM = std::sqrt(totE * totE - (totPx * totPx + totPy * totPy + totPz * totPz));
89 
90  //now the boost (from input params)
91  //
92  pp = (fMaxP - fMinP) * pyr_(&dum) + fMinP;
93  ee = std::sqrt(totM * totM + pp * pp);
94 
95  //the boost direction (from input params)
96  //
97  phi = (fMaxPhi - fMinPhi) * pyr_(&dum) + fMinPhi;
98  eta = (fMaxEta - fMinEta) * pyr_(&dum) + fMinEta;
99  the = 2. * atan(exp(-eta));
100 
101  double betaX = pp / ee * std::sin(the) * std::cos(phi);
102  double betaY = pp / ee * std::sin(the) * std::sin(phi);
103  double betaZ = pp / ee * std::cos(the);
104 
105  // boost all particles
106  // the first 2 params (-1) tell to boost all (fisrt-to-last),
107  // and the next 2 params (0.) tell no rotation
108  //
109  int first = -1, last = -1;
110  double rothe = 0, rophi = 0.;
111 
112  pyrobo_(first, last, rothe, rophi, betaX, betaY, betaZ);
113 
114  // event should be formed from boosted record !!!
115  // that's why additional loop
116  //
117  for (int i = 0; i < pyjets.n; i++) {
118  HepMC::FourVector p(pyjets.p[0][i], pyjets.p[1][i], pyjets.p[2][i], pyjets.p[3][i]);
119  HepMC::GenParticle* Part = new HepMC::GenParticle(p, HepPID::translatePythiatoPDT(pyjets.k[1][i]), 1);
120  Part->suggest_barcode(i + 1);
121  Vtx->add_particle_out(Part);
122  }
123  fEvt->add_vertex(Vtx);
124 
125  // run pythia
126  pyexec_();
127 
128  return;
129 }
double pyr_(int *idummy)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
HepMC::GenEvent * fEvt
Definition: Pythia6Gun.h:68
double p[5][pyjets_maxn]
double fMinPhi
Definition: Pythia6Gun.h:63
T sqrt(T t)
Definition: SSEVec.h:23
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double pymass_(int &)
std::vector< int > fPartIDs
#define M_PI
double fMaxPhi
Definition: Pythia6Gun.h:64
void py1ent_(int &ip, int &kf, double &pe, double &the, double &phi)
Pythia6Service * fPy6Service
Definition: Pythia6Gun.h:58
void pyrobo_(int &, int &, double &, double &, double &, double &, double &)
void pyexec_()

Member Data Documentation

◆ fMaxE

double gen::Pythia6JetGun::fMaxE
private

Definition at line 25 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().

◆ fMaxEta

double gen::Pythia6JetGun::fMaxEta
private

Definition at line 23 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().

◆ fMaxP

double gen::Pythia6JetGun::fMaxP
private

Definition at line 27 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().

◆ fMinE

double gen::Pythia6JetGun::fMinE
private

Definition at line 24 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().

◆ fMinEta

double gen::Pythia6JetGun::fMinEta
private

Definition at line 22 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().

◆ fMinP

double gen::Pythia6JetGun::fMinP
private

Definition at line 26 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().