CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 &)
 
virtual ~Pythia6PtYDistGun ()
 
- Public Member Functions inherited from gen::Pythia6ParticleGun
 Pythia6ParticleGun (const edm::ParameterSet &)
 
virtual ~Pythia6ParticleGun ()
 
- Public Member Functions inherited from gen::Pythia6Gun
void beginJob () 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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void generateEvent ()
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

PtYDistributorfPtYGenerator
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::GenEvent * fEvt
 
bool fHepMCVerbosity
 
int fMaxEventsToPrint
 
double fMaxPhi
 
double fMinPhi
 
std::vector< int > fPartIDs
 
Pythia6ServicefPy6Service
 
int fPylistVerbosity
 

Detailed Description

Definition at line 12 of file Pythia6PtYDistGun.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file Pythia6PtYDistGun.cc.

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

21  :
23 {
24 
25  ParameterSet pgun_params =
26  pset.getParameter<ParameterSet>("PGunParameters");
27 
28  fPtYGenerator = new PtYDistributor( pgun_params.getParameter<FileInPath>("kinematicsFile"),
30  pgun_params.getParameter<double>("MaxPt"),
31  pgun_params.getParameter<double>("MinPt"),
32  pgun_params.getParameter<double>("MaxY"),
33  pgun_params.getParameter<double>("MinY"),
34  pgun_params.getParameter<int>("PtBinning"),
35  pgun_params.getParameter<int>("YBinning") );
36 }
T getParameter(std::string const &) const
Pythia6ParticleGun(const edm::ParameterSet &)
CLHEP::HepRandomEngine & getEngineReference()
PtYDistributor * fPtYGenerator
Pythia6PtYDistGun::~Pythia6PtYDistGun ( )
virtual

Definition at line 38 of file Pythia6PtYDistGun.cc.

References fPtYGenerator.

39 {
40  if ( fPtYGenerator ) delete fPtYGenerator;
41 }
PtYDistributor * fPtYGenerator

Member Function Documentation

void Pythia6PtYDistGun::generateEvent ( )
protectedvirtual

Implements gen::Pythia6Gun.

Definition at line 43 of file Pythia6PtYDistGun.cc.

References create_public_lumi_plots::exp, gen::Pythia6Gun::fEvt, gen::PtYDistributor::firePt(), gen::PtYDistributor::fireY(), gen::Pythia6Gun::fMaxPhi, gen::Pythia6Gun::fMinPhi, gen::Pythia6ParticleGun::fPartIDs, fPtYGenerator, gen::Pythia6Gun::fPy6Service, configurableAnalysis::GenParticle, i, M_PI, gen::p, phi, gen::py1ent_(), gen::pyexec_(), gen::pymass_(), gen::pyr_(), mathSSE::sqrt(), and detailsBasic3DVector::y.

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

Member Data Documentation

PtYDistributor* gen::Pythia6PtYDistGun::fPtYGenerator
private

Definition at line 26 of file Pythia6PtYDistGun.h.

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