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::Pythia6JetGun Class Reference

#include <Pythia6JetGun.h>

Inheritance diagram for gen::Pythia6JetGun:
gen::Pythia6ParticleGun gen::Pythia6Gun edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 Pythia6JetGun (const edm::ParameterSet &)
 
virtual ~Pythia6JetGun ()
 
- Public Member Functions inherited from gen::Pythia6ParticleGun
 Pythia6ParticleGun (const edm::ParameterSet &)
 
virtual ~Pythia6ParticleGun ()
 
- Public Member Functions inherited from gen::Pythia6Gun
void beginJob ()
 
void beginRun (edm::Run &, edm::EventSetup const &)
 
void endJob ()
 
void endRun (edm::Run &, edm::EventSetup const &)
 
void produce (edm::Event &, const edm::EventSetup &)
 
 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 &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Private Attributes

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

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 8 of file Pythia6JetGun.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file Pythia6JetGun.cc.

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

18  :
19  Pythia6ParticleGun(pset),
20  fMinEta(0.), fMaxEta(0.),
21  fMinE(0.), fMaxE(0.),
22  fMinP(0.), fMaxP(0.)
23 {
24 
25  ParameterSet pgun_params =
26  pset.getParameter<ParameterSet>("PGunParameters");
27  fMinEta = pgun_params.getParameter<double>("MinEta");
28  fMaxEta = pgun_params.getParameter<double>("MaxEta");
29  fMinE = pgun_params.getParameter<double>("MinE");
30  fMaxE = pgun_params.getParameter<double>("MaxE");
31  fMinP = pgun_params.getParameter<double>("MinP");
32  fMaxP = pgun_params.getParameter<double>("MaxP");
33 
34 }
T getParameter(std::string const &) const
Pythia6ParticleGun(const edm::ParameterSet &)
Pythia6JetGun::~Pythia6JetGun ( )
virtual

Definition at line 36 of file Pythia6JetGun.cc.

37 {
38 }

Member Function Documentation

void Pythia6JetGun::generateEvent ( )
protectedvirtual

Implements gen::Pythia6Gun.

Definition at line 40 of file Pythia6JetGun.cc.

References funct::cos(), eta(), create_public_lumi_plots::exp, gen::Pythia6Gun::fEvt, first, fMaxE, fMaxEta, fMaxP, gen::Pythia6Gun::fMaxPhi, fMinE, fMinEta, fMinP, gen::Pythia6Gun::fMinPhi, gen::Pythia6ParticleGun::fPartIDs, gen::Pythia6Gun::fPy6Service, configurableAnalysis::GenParticle, i, prof2calltree::last, M_PI, scaleCards::mass, gen::p, phi, createTree::pp, gen::py1ent_(), gen::pyexec_(), gen::pymass_(), gen::pyr_(), gen::pyrobo_(), funct::sin(), and mathSSE::sqrt().

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

Member Data Documentation

double gen::Pythia6JetGun::fMaxE
private

Definition at line 25 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().

double gen::Pythia6JetGun::fMaxEta
private

Definition at line 23 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().

double gen::Pythia6JetGun::fMaxP
private

Definition at line 27 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().

double gen::Pythia6JetGun::fMinE
private

Definition at line 24 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().

double gen::Pythia6JetGun::fMinEta
private

Definition at line 22 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().

double gen::Pythia6JetGun::fMinP
private

Definition at line 26 of file Pythia6JetGun.h.

Referenced by generateEvent(), and Pythia6JetGun().