CMS 3D CMS Logo

Pythia6PartonEGun.cc
Go to the documentation of this file.
1 
2 #include <iostream>
3 
4 #include "Pythia6PartonEGun.h"
5 
7 
10 
12 
14 
15 using namespace edm;
16 using namespace gen;
17 
18 Pythia6PartonEGun::Pythia6PartonEGun(const ParameterSet& pset) : Pythia6PartonGun(pset) {
19  // ParameterSet defpset ;
20  ParameterSet pgun_params = pset.getParameter<ParameterSet>("PGunParameters"); //, defpset ) ;
21  fMinEta = pgun_params.getParameter<double>("MinEta"); // ,-2.2);
22  fMaxEta = pgun_params.getParameter<double>("MaxEta"); // , 2.2);
23  fMinE = pgun_params.getParameter<double>("MinE"); // , 20.);
24  fMaxE = pgun_params.getParameter<double>("MaxE"); // , 420.);
25 }
26 
28 
29 void Pythia6PartonEGun::generateEvent(CLHEP::HepRandomEngine*) {
30  Pythia6Service::InstanceWrapper guard(fPy6Service); // grab Py6 instance
31 
32  // now actualy, start cooking up the event gun
33  //
34 
35  // 1st, primary vertex
36  //
37  HepMC::GenVertex* Vtx = new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
38 
39  // here re-create fEvt (memory)
40  //
41  fEvt = new HepMC::GenEvent();
42 
43  int ip = 1;
44 
45  int py6PID = HepPID::translatePDTtoPythia(fPartonID);
46  int dum = 0;
47  double ee = 0, the = 0, eta = 0;
48  double mass = pymass_(py6PID);
49 
50  // fill p(ip,5) (in PYJETS) with mass value right now,
51  // because the (hardcoded) mstu(10)=1 will make py1ent
52  // pick the mass from there
53  pyjets.p[4][ip - 1] = mass;
54 
55  double phi = (fMaxPhi - fMinPhi) * pyr_(&dum) + fMinPhi;
56  ee = (fMaxE - fMinE) * pyr_(&dum) + fMinE;
57  eta = (fMaxEta - fMinEta) * pyr_(&dum) + fMinEta;
58  the = 2. * atan(exp(-eta));
59 
60  py1ent_(ip, py6PID, ee, the, phi);
61 
62  double px = pyjets.p[0][ip - 1]; // pt*cos(phi) ;
63  double py = pyjets.p[1][ip - 1]; // pt*sin(phi) ;
64  double pz = pyjets.p[2][ip - 1]; // mom*cos(the) ;
65 
66  HepMC::FourVector p(px, py, pz, ee);
68  Part->suggest_barcode(ip);
69  Vtx->add_particle_out(Part);
70 
71  // now add anti-quark
72  ip = ip + 1;
73  HepMC::GenParticle* APart = addAntiParticle(ip, fPartonID, ee, eta, phi);
74  if (APart) {
75  Vtx->add_particle_out(APart);
76  } else {
77  // otherwise it should throw !
78  }
79 
80  // this should probably be configurable...
81  //
82  double qmax = 2. * ee;
83 
84  joinPartons(qmax);
85 
86  fEvt->add_vertex(Vtx);
87 
88  // run pythia
89  pyexec_();
90 
91  return;
92 }
93 
EDProducer.h
gen::pymass_
double pymass_(int &)
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
edm
HLT enums.
Definition: AlignableModifier.h:19
gen::pyr_
double pyr_(int *idummy)
Definition: Pythia6Service.cc:60
gen::Pythia6Gun::fEvt
HepMC::GenEvent * fEvt
Definition: Pythia6Gun.h:66
gen::Pythia6PartonGun
Definition: Pythia6PartonGun.h:19
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
gen::pyexec_
void pyexec_()
gen::py1ent_
void py1ent_(int &ip, int &kf, double &pe, double &the, double &phi)
MakerMacros.h
gen::Pythia6Gun::addAntiParticle
HepMC::GenParticle * addAntiParticle(int &, int &, double &, double &, double &)
Definition: Pythia6Gun.cc:198
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
PVValHelper::eta
Definition: PVValidationHelpers.h:69
gen::p
double p[5][pyjets_maxn]
Definition: Cascade2Hadronizer.cc:74
gen::Pythia6PartonEGun::generateEvent
void generateEvent(CLHEP::HepRandomEngine *) override
Definition: Pythia6PartonEGun.cc:29
Pythia6PartonEGun.h
gen::FortranInstance::InstanceWrapper
Definition: FortranInstance.h:54
gen
Definition: PythiaDecays.h:13
gen::Pythia6Gun::fMaxPhi
double fMaxPhi
Definition: Pythia6Gun.h:62
edm::ParameterSet
Definition: ParameterSet.h:36
gen::Pythia6PartonGun::joinPartons
void joinPartons(double qmax)
Definition: Pythia6PartonGun.cc:23
gen::Pythia6PartonEGun::~Pythia6PartonEGun
~Pythia6PartonEGun() override
Definition: Pythia6PartonEGun.cc:27
gen::Pythia6PartonEGun::fMaxE
double fMaxE
Definition: Pythia6PartonEGun.h:24
gen::Pythia6Gun::fMinPhi
double fMinPhi
Definition: Pythia6Gun.h:61
gen::Pythia6Gun::fPy6Service
Pythia6Service * fPy6Service
Definition: Pythia6Gun.h:56
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
gen::Pythia6PartonEGun::fMinE
double fMinE
Definition: Pythia6PartonEGun.h:23
gen::Pythia6PartonEGun::fMinEta
double fMinEta
Definition: Pythia6PartonEGun.h:21
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
gen::Pythia6PartonEGun::fMaxEta
double fMaxEta
Definition: Pythia6PartonEGun.h:22
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
EventSetup.h
Exception.h
HepMCProduct.h
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
gen::Pythia6PartonGun::fPartonID
int fPartonID
Definition: Pythia6PartonGun.h:29
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
gen::Pythia6PartonEGun
Definition: Pythia6PartonEGun.h:12