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 | Protected Attributes | Private Attributes
gen::Py8GunBase Class Reference

#include <Py8GunBase.h>

Inheritance diagram for gen::Py8GunBase:
gen::Py8InterfaceBase gen::Py8EGun gen::Py8JetGun gen::Py8PtGun

Public Member Functions

void finalizeEvent ()
 
edm::EventgetEDMEvent () const
 
HepMC::GenEvent * getGenEvent ()
 
GenEventInfoProductgetGenEventInfo ()
 
GenRunInfoProductgetGenRunInfo ()
 
bool initializeForInternalPartons ()
 
 Py8GunBase (edm::ParameterSet const &ps)
 
void resetEvent (HepMC::GenEvent *event)
 
void resetEventInfo (GenEventInfoProduct *eventInfo)
 
virtual bool residualDecay ()
 
virtual bool select (HepMC::GenEvent *) const
 
void setEDMEvent (edm::Event &event)
 
void statistics ()
 
 ~Py8GunBase ()
 
- Public Member Functions inherited from gen::Py8InterfaceBase
virtual const char * classname () const =0
 
bool decay ()
 
bool declareSpecialSettings (const std::vector< std::string > &)
 
bool declareStableParticles (const std::vector< int > &)
 
virtual bool generatePartonsAndHadronize ()=0
 
 Py8InterfaceBase (edm::ParameterSet const &ps)
 
bool readSettings (int)
 
 ~Py8InterfaceBase ()
 

Protected Member Functions

std::auto_ptr< HepMC::GenEvent > & event ()
 
std::auto_ptr
< GenEventInfoProduct > & 
eventInfo ()
 
GenRunInfoProductrunInfo ()
 

Protected Attributes

double fMaxPhi
 
double fMinPhi
 
std::vector< int > fPartIDs
 
- Protected Attributes inherited from gen::Py8InterfaceBase
std::auto_ptr< Pythia8::Pythia > fDecayer
 
std::auto_ptr< Pythia8::Pythia > fMasterGen
 
ParameterCollector fParameters
 
unsigned int maxEventsToPrint
 
bool pythiaHepMCVerbosity
 
unsigned int pythiaPylistVerbosity
 
HepMC::Pythia8ToHepMC toHepMC
 

Private Attributes

edm::EventedmEvent_
 
std::auto_ptr< HepMC::GenEvent > genEvent_
 
std::auto_ptr
< GenEventInfoProduct
genEventInfo_
 
GenRunInfoProduct genRunInfo_
 

Detailed Description

Definition at line 35 of file Py8GunBase.h.

Constructor & Destructor Documentation

gen::Py8GunBase::Py8GunBase ( edm::ParameterSet const &  ps)

Definition at line 7 of file Py8GunBase.cc.

References fMaxPhi, fMinPhi, fPartIDs, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), runInfo(), GenRunInfoProduct::setExternalXSecLO(), GenRunInfoProduct::setExternalXSecNLO(), and GenRunInfoProduct::setFilterEfficiency().

8  : Py8InterfaceBase(ps)
9 {
10 
12  ps.getUntrackedParameter<double>("filterEfficiency", -1.) );
14  GenRunInfoProduct::XSec(ps.getUntrackedParameter<double>("crossSection", -1.)) );
16  GenRunInfoProduct::XSec(ps.getUntrackedParameter<double>("crossSectionNLO", -1.)) );
17 
18 
19  // PGun specs
20  //
21  edm::ParameterSet pgun_params =
22  ps.getParameter<edm::ParameterSet>("PGunParameters");
23 
24  // although there's the method ParameterSet::empty(),
25  // it looks like it's NOT even necessary to check if it is,
26  // before trying to extract parameters - if it is empty,
27  // the default values seem to be taken
28  //
29  fPartIDs = pgun_params.getParameter< std::vector<int> >("ParticleID");
30  fMinPhi = pgun_params.getParameter<double>("MinPhi"); // ,-3.14159265358979323846);
31  fMaxPhi = pgun_params.getParameter<double>("MaxPhi"); // , 3.14159265358979323846);
32 
33 }
T getParameter(std::string const &) const
void setFilterEfficiency(double effic)
double fMinPhi
Definition: Py8GunBase.h:66
Py8InterfaceBase(edm::ParameterSet const &ps)
std::vector< int > fPartIDs
Definition: Py8GunBase.h:65
double fMaxPhi
Definition: Py8GunBase.h:67
void setExternalXSecNLO(const XSec &xsec)
GenRunInfoProduct & runInfo()
Definition: Py8GunBase.h:59
void setExternalXSecLO(const XSec &xsec)
gen::Py8GunBase::~Py8GunBase ( )
inline

Definition at line 38 of file Py8GunBase.h.

38 {}

Member Function Documentation

std::auto_ptr<HepMC::GenEvent>& gen::Py8GunBase::event ( )
inlineprotected
std::auto_ptr<GenEventInfoProduct>& gen::Py8GunBase::eventInfo ( )
inlineprotected

Definition at line 61 of file Py8GunBase.h.

References genEventInfo_.

61 { return genEventInfo_; }
std::auto_ptr< GenEventInfoProduct > genEventInfo_
Definition: Py8GunBase.h:72
void gen::Py8GunBase::finalizeEvent ( )
virtual

Implements gen::Py8InterfaceBase.

Definition at line 134 of file Py8GunBase.cc.

References gather_cfg::cout, event(), gen::Py8InterfaceBase::fMasterGen, gen::Py8InterfaceBase::maxEventsToPrint, gen::Py8InterfaceBase::pythiaHepMCVerbosity, and gen::Py8InterfaceBase::pythiaPylistVerbosity.

135 {
136 
137 
138 // FIXME !!!
139 
140  //******** Verbosity ********
141 
142  if (maxEventsToPrint > 0 &&
144  {
147  {
148  fMasterGen->info.list(std::cout);
149  fMasterGen->event.list(std::cout);
150  }
151 
153  {
154  std::cout << "Event process = "
155  << fMasterGen->info.code() << "\n"
156  << "----------------------" << std::endl;
157  event()->print();
158  }
159  }
160 
161  return;
162 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
unsigned int pythiaPylistVerbosity
std::auto_ptr< HepMC::GenEvent > & event()
Definition: Py8GunBase.h:60
unsigned int maxEventsToPrint
tuple cout
Definition: gather_cfg.py:121
edm::Event& gen::Py8GunBase::getEDMEvent ( ) const
inline

Definition at line 50 of file Py8GunBase.h.

References edmEvent_.

50 { return *edmEvent_; }
edm::Event * edmEvent_
Definition: Py8GunBase.h:74
HepMC::GenEvent* gen::Py8GunBase::getGenEvent ( )
inline

Definition at line 42 of file Py8GunBase.h.

References genEvent_.

42 { return genEvent_.release(); }
std::auto_ptr< HepMC::GenEvent > genEvent_
Definition: Py8GunBase.h:71
GenEventInfoProduct* gen::Py8GunBase::getGenEventInfo ( )
inline

Definition at line 43 of file Py8GunBase.h.

References genEventInfo_.

43 { return genEventInfo_.release(); }
std::auto_ptr< GenEventInfoProduct > genEventInfo_
Definition: Py8GunBase.h:72
GenRunInfoProduct& gen::Py8GunBase::getGenRunInfo ( )
inline

Definition at line 41 of file Py8GunBase.h.

References genRunInfo_.

41 { return genRunInfo_; }
GenRunInfoProduct genRunInfo_
Definition: Py8GunBase.h:70
bool gen::Py8GunBase::initializeForInternalPartons ( )
virtual

Implements gen::Py8InterfaceBase.

Definition at line 37 of file Py8GunBase.cc.

References gen::Py8InterfaceBase::fDecayer, and gen::Py8InterfaceBase::fMasterGen.

38 {
39 
40  // NO MATTER what was this setting below, override it before init
41  // - this is essencial for the PGun mode
42 
43  // Key requirement: switch off ProcessLevel, and thereby also PartonLevel.
44  fMasterGen->readString("ProcessLevel:all = off");
45  fMasterGen->readString("ProcessLevel::resonanceDecays=on");
46  fMasterGen->init();
47 
48  // init decayer
49  fDecayer->readString("ProcessLevel:all = off"); // Same trick!
50  fDecayer->readString("ProcessLevel::resonanceDecays=on");
51  fDecayer->init();
52 
53  return true;
54 
55 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< Pythia8::Pythia > fDecayer
void gen::Py8GunBase::resetEvent ( HepMC::GenEvent *  event)
inline

Definition at line 45 of file Py8GunBase.h.

References genEvent_.

45 { genEvent_.reset(event); }
std::auto_ptr< HepMC::GenEvent > genEvent_
Definition: Py8GunBase.h:71
std::auto_ptr< HepMC::GenEvent > & event()
Definition: Py8GunBase.h:60
void gen::Py8GunBase::resetEventInfo ( GenEventInfoProduct eventInfo)
inline

Definition at line 46 of file Py8GunBase.h.

References genEventInfo_.

46 { genEventInfo_.reset(eventInfo); }
std::auto_ptr< GenEventInfoProduct > genEventInfo_
Definition: Py8GunBase.h:72
bool gen::Py8GunBase::residualDecay ( )
virtual

Definition at line 57 of file Py8GunBase.cc.

References event(), gen::Py8InterfaceBase::fDecayer, gen::Py8InterfaceBase::fMasterGen, and configurableAnalysis::GenParticle.

58 {
59 
60  Event* pythiaEvent = &(fMasterGen->event);
61 
62  int NPartsBeforeDecays = pythiaEvent->size()-1; // do NOT count the very 1st "system" particle
63  // in Pythia8::Event record; it does NOT even
64  // get translated by the HepMCInterface to the
65  // HepMC::GenEvent record !!!
66  int NPartsAfterDecays = event().get()->particles_size();
67  int NewBarcode = NPartsAfterDecays;
68 
69  for ( int ipart=NPartsAfterDecays; ipart>NPartsBeforeDecays; ipart-- )
70  {
71 
72  HepMC::GenParticle* part = event().get()->barcode_to_particle( ipart );
73 
74  if ( part->status() == 1 )
75  {
76  fDecayer->event.reset();
77  Particle py8part( part->pdg_id(), 93, 0, 0, 0, 0, 0, 0,
78  part->momentum().x(),
79  part->momentum().y(),
80  part->momentum().z(),
81  part->momentum().t(),
82  part->generated_mass() );
83  HepMC::GenVertex* ProdVtx = part->production_vertex();
84  py8part.vProd( ProdVtx->position().x(), ProdVtx->position().y(),
85  ProdVtx->position().z(), ProdVtx->position().t() );
86  py8part.tau( (fDecayer->particleData).tau0( part->pdg_id() ) );
87  fDecayer->event.append( py8part );
88  int nentries = fDecayer->event.size();
89  if ( !fDecayer->event[nentries-1].mayDecay() ) continue;
90  fDecayer->next();
91  int nentries1 = fDecayer->event.size();
92  if ( nentries1 <= nentries ) continue; //same number of particles, no decays...
93 
94  part->set_status(2);
95 
96  Particle& py8daughter = fDecayer->event[nentries]; // the 1st daughter
97  HepMC::GenVertex* DecVtx = new HepMC::GenVertex( HepMC::FourVector(py8daughter.xProd(),
98  py8daughter.yProd(),
99  py8daughter.zProd(),
100  py8daughter.tProd()) );
101 
102  DecVtx->add_particle_in( part ); // this will cleanup end_vertex if exists, replace with the new one
103  // I presume (vtx) barcode will be given automatically
104 
105  HepMC::FourVector pmom( py8daughter.px(), py8daughter.py(), py8daughter.pz(), py8daughter.e() );
106 
107  HepMC::GenParticle* daughter =
108  new HepMC::GenParticle( pmom, py8daughter.id(), 1 );
109 
110  NewBarcode++;
111  daughter->suggest_barcode( NewBarcode );
112  DecVtx->add_particle_out( daughter );
113 
114  for ( int ipart1=nentries+1; ipart1<nentries1; ipart1++ )
115  {
116  py8daughter = fDecayer->event[ipart1];
117  HepMC::FourVector pmomN( py8daughter.px(), py8daughter.py(), py8daughter.pz(), py8daughter.e() );
118  HepMC::GenParticle* daughterN =
119  new HepMC::GenParticle( pmomN, py8daughter.id(), 1 );
120  NewBarcode++;
121  daughterN->suggest_barcode( NewBarcode );
122  DecVtx->add_particle_out( daughterN );
123  }
124 
125  event().get()->add_vertex( DecVtx );
126 
127  }
128  }
129 
130  return true;
131 
132 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< HepMC::GenEvent > & event()
Definition: Py8GunBase.h:60
part
Definition: HCALResponse.h:21
std::auto_ptr< Pythia8::Pythia > fDecayer
GenRunInfoProduct& gen::Py8GunBase::runInfo ( )
inlineprotected

Definition at line 59 of file Py8GunBase.h.

References genRunInfo_.

Referenced by Py8GunBase(), and statistics().

59 { return genRunInfo_; }
GenRunInfoProduct genRunInfo_
Definition: Py8GunBase.h:70
virtual bool gen::Py8GunBase::select ( HepMC::GenEvent *  ) const
inlinevirtual

Definition at line 51 of file Py8GunBase.h.

51 { return true;}
void gen::Py8GunBase::setEDMEvent ( edm::Event event)
inline

Definition at line 49 of file Py8GunBase.h.

References edmEvent_, and event().

49 { edmEvent_ = &event; }
edm::Event * edmEvent_
Definition: Py8GunBase.h:74
std::auto_ptr< HepMC::GenEvent > & event()
Definition: Py8GunBase.h:60
void gen::Py8GunBase::statistics ( )
virtual

Reimplemented from gen::Py8InterfaceBase.

Definition at line 164 of file Py8GunBase.cc.

References gen::Py8InterfaceBase::fMasterGen, runInfo(), and GenRunInfoProduct::setInternalXSec().

165 {
166 
167  fMasterGen->stat();
168 
169  double xsec = fMasterGen->info.sigmaGen(); // cross section in mb
170  xsec *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
171  runInfo().setInternalXSec(xsec);
172  return;
173 
174 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
void setInternalXSec(const XSec &xsec)
GenRunInfoProduct & runInfo()
Definition: Py8GunBase.h:59

Member Data Documentation

edm::Event* gen::Py8GunBase::edmEvent_
private

Definition at line 74 of file Py8GunBase.h.

Referenced by getEDMEvent(), and setEDMEvent().

double gen::Py8GunBase::fMaxPhi
protected
double gen::Py8GunBase::fMinPhi
protected
std::vector<int> gen::Py8GunBase::fPartIDs
protected
std::auto_ptr<HepMC::GenEvent> gen::Py8GunBase::genEvent_
private

Definition at line 71 of file Py8GunBase.h.

Referenced by event(), getGenEvent(), and resetEvent().

std::auto_ptr<GenEventInfoProduct> gen::Py8GunBase::genEventInfo_
private

Definition at line 72 of file Py8GunBase.h.

Referenced by eventInfo(), getGenEventInfo(), and resetEventInfo().

GenRunInfoProduct gen::Py8GunBase::genRunInfo_
private

Definition at line 70 of file Py8GunBase.h.

Referenced by getGenRunInfo(), and runInfo().