CMS 3D CMS Logo

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

#include <Pythia6PtGun.h>

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

Public Member Functions

 Pythia6PtGun (const edm::ParameterSet &)
 
virtual ~Pythia6PtGun ()
 
- Public Member Functions inherited from gen::Pythia6ParticleGun
 Pythia6ParticleGun (const edm::ParameterSet &)
 
virtual ~Pythia6ParticleGun ()
 
- 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 &)
 
virtual ~Pythia6Gun ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void generateEvent (CLHEP::HepRandomEngine *)
 
- 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::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)
 

Private Attributes

bool fAddAntiParticle
 
double fMaxEta
 
double fMaxPt
 
double fMinEta
 
double fMinPt
 

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)
 
- 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 Pythia6PtGun.h.

Constructor & Destructor Documentation

Pythia6PtGun::Pythia6PtGun ( const edm::ParameterSet pset)

Definition at line 18 of file Pythia6PtGun.cc.

References fAddAntiParticle, fMaxEta, fMaxPt, fMinEta, fMinPt, and edm::ParameterSet::getParameter().

18  :
19  Pythia6ParticleGun(pset)
20 {
21 
22  // ParameterSet defpset ;
23  ParameterSet pgun_params =
24  pset.getParameter<ParameterSet>("PGunParameters"); //, defpset ) ;
25  fMinEta = pgun_params.getParameter<double>("MinEta"); // ,-2.2);
26  fMaxEta = pgun_params.getParameter<double>("MaxEta"); // , 2.2);
27  fMinPt = pgun_params.getParameter<double>("MinPt"); // , 20.);
28  fMaxPt = pgun_params.getParameter<double>("MaxPt"); // , 420.);
29  fAddAntiParticle = pgun_params.getParameter<bool>("AddAntiParticle"); //, false) ;
30 
31 }
T getParameter(std::string const &) const
Pythia6ParticleGun(const edm::ParameterSet &)
Pythia6PtGun::~Pythia6PtGun ( )
virtual

Definition at line 33 of file Pythia6PtGun.cc.

34 {
35 }

Member Function Documentation

void Pythia6PtGun::generateEvent ( CLHEP::HepRandomEngine *  )
protectedvirtual

Implements gen::Pythia6Gun.

Definition at line 37 of file Pythia6PtGun.cc.

References gen::Pythia6Gun::addAntiParticle(), DEFINE_FWK_MODULE, PVValHelper::eta, JetChargeProducer_cfi::exp, fAddAntiParticle, gen::Pythia6Gun::fEvt, fMaxEta, gen::Pythia6Gun::fMaxPhi, fMaxPt, fMinEta, gen::Pythia6Gun::fMinPhi, fMinPt, gen::Pythia6ParticleGun::fPartIDs, gen::Pythia6Gun::fPy6Service, GenParticle::GenParticle, mps_fire::i, ResonanceBuilder::mass, gen::p, EgammaObjectsElectrons_cfi::particleID, EnergyCorrector::pt, gen::py1ent_(), gen::pyexec_(), gen::pymass_(), gen::pyr_(), funct::sin(), and mathSSE::sqrt().

38 {
39 
40  Pythia6Service::InstanceWrapper guard(fPy6Service); // grab Py6 instance
41 
42  // now actualy, start cooking up the event gun
43  //
44 
45  // 1st, primary vertex
46  //
47  HepMC::GenVertex* Vtx = new HepMC::GenVertex( HepMC::FourVector(0.,0.,0.));
48 
49  // here re-create fEvt (memory)
50  //
51  fEvt = new HepMC::GenEvent() ;
52 
53  int ip=1;
54  for ( size_t i=0; i<fPartIDs.size(); i++ )
55  {
56  int particleID = fPartIDs[i]; // this is PDG - need to convert to Py6 !!!
57  int py6PID = HepPID::translatePDTtoPythia( particleID );
58  int dum = 0;
59  double pt=0, mom=0, ee=0, the=0, eta=0;
60  double mass = pymass_(py6PID);
61 
62  // fill p(ip,5) (in PYJETS) with mass value right now,
63  // because the (hardcoded) mstu(10)=1 will make py1ent
64  // pick the mass from there
65  pyjets.p[4][ip-1]=mass;
66 
67  double phi = (fMaxPhi-fMinPhi)*pyr_(&dum)+fMinPhi;
68 
69  eta = (fMaxEta-fMinEta)*pyr_(&dum)+fMinEta;
70 
71  the = 2.*atan(exp(-eta));
72 
73  pt = (fMaxPt-fMinPt)*pyr_(&dum)+fMinPt;
74 
75  mom = pt/sin(the);
76  ee = sqrt(mom*mom+mass*mass);
77 
78  py1ent_(ip, py6PID, ee, the, phi);
79 
80  double px = pyjets.p[0][ip-1]; // pt*cos(phi) ;
81  double py = pyjets.p[1][ip-1]; // pt*sin(phi) ;
82  double pz = pyjets.p[2][ip-1]; // mom*cos(the) ;
83 
84  HepMC::FourVector p(px,py,pz,ee) ;
85  HepMC::GenParticle* Part =
86  new HepMC::GenParticle(p,particleID,1);
87  Part->suggest_barcode( ip ) ;
88  Vtx->add_particle_out(Part);
89 
91  {
92  ip = ip + 1;
93  HepMC::GenParticle* APart = addAntiParticle( ip, particleID, ee, eta, phi );
94  if ( APart ) Vtx->add_particle_out(APart) ;
95  }
96  ip++;
97  }
98 
99  fEvt->add_vertex(Vtx);
100 
101  // run pythia
102  pyexec_();
103 
104  return;
105 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
HepMC::GenParticle * addAntiParticle(int &, int &, double &, double &, double &)
Definition: Pythia6Gun.cc:244
HepMC::GenEvent * fEvt
Definition: Pythia6Gun.h:71
double p[5][pyjets_maxn]
double fMinPhi
Definition: Pythia6Gun.h:66
T sqrt(T t)
Definition: SSEVec.h:18
double pymass_(int &)
std::vector< int > fPartIDs
double fMaxPhi
Definition: Pythia6Gun.h:67
void py1ent_(int &ip, int &kf, double &pe, double &the, double &phi)
Pythia6Service * fPy6Service
Definition: Pythia6Gun.h:61
double pyr_(int *idummy)
void pyexec_()

Member Data Documentation

bool gen::Pythia6PtGun::fAddAntiParticle
private

Definition at line 30 of file Pythia6PtGun.h.

Referenced by generateEvent(), and Pythia6PtGun().

double gen::Pythia6PtGun::fMaxEta
private

Definition at line 27 of file Pythia6PtGun.h.

Referenced by generateEvent(), and Pythia6PtGun().

double gen::Pythia6PtGun::fMaxPt
private

Definition at line 29 of file Pythia6PtGun.h.

Referenced by generateEvent(), and Pythia6PtGun().

double gen::Pythia6PtGun::fMinEta
private

Definition at line 26 of file Pythia6PtGun.h.

Referenced by generateEvent(), and Pythia6PtGun().

double gen::Pythia6PtGun::fMinPt
private

Definition at line 28 of file Pythia6PtGun.h.

Referenced by generateEvent(), and Pythia6PtGun().