CMS 3D CMS Logo

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

#include <Pythia6PtYDistGun.h>

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

Public Member Functions

 Pythia6PtYDistGun (const edm::ParameterSet &)
 
 ~Pythia6PtYDistGun () 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
 
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)
 

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
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)
 

Private Attributes

PtYDistributorfPtYGenerator
 

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 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 14 of file Pythia6PtYDistGun.h.

Constructor & Destructor Documentation

Pythia6PtYDistGun::Pythia6PtYDistGun ( const edm::ParameterSet pset)

Definition at line 19 of file Pythia6PtYDistGun.cc.

References fPtYGenerator, and edm::ParameterSet::getParameter().

19  : Pythia6ParticleGun(pset), fPtYGenerator(nullptr) {
20  ParameterSet pgun_params = pset.getParameter<ParameterSet>("PGunParameters");
21 
22  fPtYGenerator = new PtYDistributor(pgun_params.getParameter<FileInPath>("kinematicsFile"),
23  pgun_params.getParameter<double>("MaxPt"),
24  pgun_params.getParameter<double>("MinPt"),
25  pgun_params.getParameter<double>("MaxY"),
26  pgun_params.getParameter<double>("MinY"),
27  pgun_params.getParameter<int>("PtBinning"),
28  pgun_params.getParameter<int>("YBinning"));
29 }
T getParameter(std::string const &) const
Pythia6ParticleGun(const edm::ParameterSet &)
PtYDistributor * fPtYGenerator
Pythia6PtYDistGun::~Pythia6PtYDistGun ( )
override

Definition at line 31 of file Pythia6PtYDistGun.cc.

References fPtYGenerator.

31  {
32  if (fPtYGenerator)
33  delete fPtYGenerator;
34 }
PtYDistributor * fPtYGenerator

Member Function Documentation

void Pythia6PtYDistGun::generateEvent ( CLHEP::HepRandomEngine *  engine)
overrideprotectedvirtual

Implements gen::Pythia6Gun.

Definition at line 36 of file Pythia6PtYDistGun.cc.

References DEFINE_FWK_MODULE, JetChargeProducer_cfi::exp, gen::Pythia6Gun::fEvt, gen::PtYDistributor::firePt(), gen::PtYDistributor::fireY(), gen::Pythia6Gun::fMaxPhi, gen::Pythia6Gun::fMinPhi, gen::Pythia6ParticleGun::fPartIDs, fPtYGenerator, gen::Pythia6Gun::fPy6Service, GenParticle::GenParticle, mps_fire::i, M_PI, EgHLTOffHistBins_cfi::mass, gen::p, EgammaObjectsElectrons_cfi::particleID, DiDispStaMuonMonitor_cfi::pt, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, gen::py1ent_(), gen::pyexec_(), gen::pymass_(), gen::pyr_(), and mathSSE::sqrt().

36  {
37  Pythia6Service::InstanceWrapper guard(fPy6Service); // grab Py6 instance
38 
39  // now actualy, start cooking up the event gun
40  //
41 
42  // 1st, primary vertex
43  //
44  HepMC::GenVertex* Vtx = new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
45 
46  // here re-create fEvt (memory)
47  //
48  fEvt = new HepMC::GenEvent();
49 
50  int ip = 1;
51 
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  int dum = 0;
57  double pt = 0, y = 0, u = 0, ee = 0, the = 0;
58 
59  pt = fPtYGenerator->firePt(engine);
60  y = fPtYGenerator->fireY(engine);
61  u = exp(y);
62 
63  double mass = pymass_(py6PID);
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  pyjets.p[4][ip - 1] = mass;
69 
70  ee = 0.5 * std::sqrt(mass * mass + pt * pt) * (u * u + 1) / u;
71 
72  double pz = std::sqrt(ee * ee - pt * pt - mass * mass);
73  if (y < 0.)
74  pz *= -1;
75 
76  double phi = (fMaxPhi - fMinPhi) * pyr_(&dum) + fMinPhi;
77 
78  the = atan(pt / pz);
79  if (pz < 0.)
80  the += M_PI;
81 
82  py1ent_(ip, py6PID, ee, the, phi);
83 
84  /*
85  double px = pt*cos(phi) ;
86  double py = pt*sin(phi) ;
87 */
88  double px = pyjets.p[0][ip - 1]; // pt*cos(phi) ;
89  double py = pyjets.p[1][ip - 1]; // pt*sin(phi) ;
90  pz = pyjets.p[2][ip - 1]; // mom*cos(the) ;
91 
92  HepMC::FourVector p(px, py, pz, ee);
93  HepMC::GenParticle* Part = new HepMC::GenParticle(p, particleID, 1);
94  Part->suggest_barcode(ip);
95  Vtx->add_particle_out(Part);
96 
97  ip++;
98  }
99 
100  fEvt->add_vertex(Vtx);
101 
102  // run pythia
103  pyexec_();
104 
105  return;
106 }
HepMC::GenEvent * fEvt
Definition: Pythia6Gun.h:66
double firePt(CLHEP::HepRandomEngine *)
double fireY(CLHEP::HepRandomEngine *)
double p[5][pyjets_maxn]
PtYDistributor * fPtYGenerator
double fMinPhi
Definition: Pythia6Gun.h:61
T sqrt(T t)
Definition: SSEVec.h:19
double pymass_(int &)
std::vector< int > fPartIDs
#define M_PI
double fMaxPhi
Definition: Pythia6Gun.h:62
void py1ent_(int &ip, int &kf, double &pe, double &the, double &phi)
Pythia6Service * fPy6Service
Definition: Pythia6Gun.h:56
double pyr_(int *idummy)
void pyexec_()

Member Data Documentation

PtYDistributor* gen::Pythia6PtYDistGun::fPtYGenerator
private

Definition at line 23 of file Pythia6PtYDistGun.h.

Referenced by generateEvent(), Pythia6PtYDistGun(), and ~Pythia6PtYDistGun().