test
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 Attributes | Private Attributes
gen::Py8InterfaceBase Class Referenceabstract

#include <Py8InterfaceBase.h>

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

Public Member Functions

virtual const char * classname () const =0
 
bool decay ()
 
bool declareSpecialSettings (const std::vector< std::string > &)
 
bool declareStableParticles (const std::vector< int > &)
 
virtual void finalizeEvent ()=0
 
virtual bool generatePartonsAndHadronize ()=0
 
virtual bool initializeForInternalPartons ()=0
 
void p8SetRandomEngine (CLHEP::HepRandomEngine *v)
 
 Py8InterfaceBase (edm::ParameterSet const &ps)
 
P8RndmEnginerandomEngine ()
 
bool readSettings (int)
 
virtual void statistics ()
 
 ~Py8InterfaceBase ()
 

Protected Attributes

HepMC::IO_AsciiParticles * ascii_io
 
EvtGenDecays * evtgenDecays
 
std::string evtgenDecFile
 
std::string evtgenPdlFile
 
std::auto_ptr< Pythia8::Pythia > fDecayer
 
std::auto_ptr< Pythia8::Pythia > fMasterGen
 
ParameterCollector fParameters
 
unsigned int maxEventsToPrint
 
bool pythiaHepMCVerbosity
 
bool pythiaHepMCVerbosityParticles
 
unsigned int pythiaPylistVerbosity
 
HepMC::Pythia8ToHepMC toHepMC
 
bool useEvtGen
 

Private Attributes

P8RndmEngine p8RndmEngine_
 

Detailed Description

Definition at line 23 of file Py8InterfaceBase.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file Py8InterfaceBase.cc.

References ascii_io, evtgenDecFile, evtgenPdlFile, edm::ParameterSet::exists(), fDecayer, fMasterGen, fParameters, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), maxEventsToPrint, dbtoconf::out, p8RndmEngine_, pythiaHepMCVerbosity, pythiaHepMCVerbosityParticles, pythiaPylistVerbosity, AlCaHLTBitMon_QueryRunRegistry::string, and useEvtGen.

14  :
15 useEvtGen(false), evtgenDecays(0)
16 {
17  fMasterGen.reset(new Pythia);
18  fDecayer.reset(new Pythia);
19 
20  fMasterGen->readString("Next:numberShowEvent = 0");
21  fDecayer->readString("Next:numberShowEvent = 0");
22 
23  fMasterGen->setRndmEnginePtr( &p8RndmEngine_ );
24  fDecayer->setRndmEnginePtr( &p8RndmEngine_ );
25 
26  fParameters = ps.getParameter<edm::ParameterSet>("PythiaParameters");
27 
28  pythiaPylistVerbosity = ps.getUntrackedParameter<int>("pythiaPylistVerbosity", 0);
29  pythiaHepMCVerbosity = ps.getUntrackedParameter<bool>("pythiaHepMCVerbosity", false);
30  pythiaHepMCVerbosityParticles = ps.getUntrackedParameter<bool>("pythiaHepMCVerbosityParticles", false);
31  maxEventsToPrint = ps.getUntrackedParameter<int>("maxEventsToPrint", 0);
32 
33  if(pythiaHepMCVerbosityParticles)
34  ascii_io = new HepMC::IO_AsciiParticles("cout", std::ios::out);
35 
36  if ( ps.exists("useEvtGenPlugin") ) {
37 
38  useEvtGen = true;
39 
40  string evtgenpath(getenv("EVTGENDATA"));
41  evtgenDecFile = evtgenpath + string("/DECAY_2010.DEC");
42  evtgenPdlFile = evtgenpath + string("/evt.pdl");
43 
44  if ( ps.exists( "evtgenDecFile" ) )
45  evtgenDecFile = ps.getParameter<string>("evtgenDecFile");
46 
47  if ( ps.exists( "evtgenPdlFile" ) )
48  evtgenPdlFile = ps.getParameter<string>("evtgenPdlFile");
49 
50  }
51 
52 }
ParameterCollector fParameters
std::auto_ptr< Pythia8::Pythia > fMasterGen
HepMC::IO_AsciiParticles * ascii_io
P8RndmEngine p8RndmEngine_
EvtGenDecays * evtgenDecays
unsigned int pythiaPylistVerbosity
tuple out
Definition: dbtoconf.py:99
unsigned int maxEventsToPrint
std::auto_ptr< Pythia8::Pythia > fDecayer
gen::Py8InterfaceBase::~Py8InterfaceBase ( )
inline

Definition at line 28 of file Py8InterfaceBase.h.

28 {}

Member Function Documentation

virtual const char* gen::Py8InterfaceBase::classname ( ) const
pure virtual
bool gen::Py8InterfaceBase::decay ( )
inline

Definition at line 31 of file Py8InterfaceBase.h.

31 { return true; } // NOT used - let's call it "design imperfection"
bool gen::Py8InterfaceBase::declareSpecialSettings ( const std::vector< std::string > &  settings)

Definition at line 115 of file Py8InterfaceBase.cc.

References fDecayer, spr::find(), fMasterGen, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

115  {
116  for ( unsigned int iss=0; iss<settings.size(); iss++ ){
117  if ( settings[iss].find("QED-brem-off") != std::string::npos ){
118  fMasterGen->readString( "TimeShower:QEDshowerByL=off" );
119  }
120  else{
121  size_t fnd1 = settings[iss].find("Pythia8:");
122  if ( fnd1 != std::string::npos ){
123  std::string value = settings[iss].substr (fnd1+8);
124  fDecayer->readString(value);
125  }
126  }
127  }
128  return true;
129 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::auto_ptr< Pythia8::Pythia > fDecayer
bool gen::Py8InterfaceBase::declareStableParticles ( const std::vector< int > &  pdgIds)

Definition at line 82 of file Py8InterfaceBase.cc.

References fMasterGen, and i.

83 {
84 
85  for ( size_t i=0; i<pdgIds.size(); i++ )
86  {
87  // FIXME: need to double check if PID's are the same in Py6 & Py8,
88  // because the HepPDT translation tool is actually for **Py6**
89  //
90  // well, actually it looks like Py8 operates in PDT id's rather than Py6's
91  //
92 // int PyID = HepPID::translatePDTtoPythia( pdgIds[i] );
93  int PyID = pdgIds[i];
94  std::ostringstream pyCard ;
95  pyCard << PyID <<":mayDecay=false";
96 
97  if ( fMasterGen->particleData.isParticle( PyID ) ) {
98  fMasterGen->readString( pyCard.str() );
99  } else {
100 
101  edm::LogWarning("DataNotUnderstood") << "Pythia8 does not "
102  << "recognize particle id = "
103  << PyID << std::endl;
104  }
105  // alternative:
106  // set the 2nd input argument warn=false
107  // - this way Py8 will NOT print warnings about unknown particle code(s)
108  // fMasterPtr->readString( pyCard.str(), false )
109  }
110 
111  return true;
112 
113 }
int i
Definition: DBlmapReader.cc:9
std::auto_ptr< Pythia8::Pythia > fMasterGen
virtual void gen::Py8InterfaceBase::finalizeEvent ( )
pure virtual

Implemented in Pythia8Hadronizer, and gen::Py8GunBase.

virtual bool gen::Py8InterfaceBase::generatePartonsAndHadronize ( )
pure virtual
virtual bool gen::Py8InterfaceBase::initializeForInternalPartons ( )
pure virtual

Implemented in Pythia8Hadronizer, and gen::Py8GunBase.

void gen::Py8InterfaceBase::p8SetRandomEngine ( CLHEP::HepRandomEngine *  v)
inline

Definition at line 40 of file Py8InterfaceBase.h.

References p8RndmEngine_, and gen::P8RndmEngine::setRandomEngine().

Referenced by gen::Py8GunBase::setRandomEngine().

double v[5][pyjets_maxn]
void setRandomEngine(CLHEP::HepRandomEngine *v)
Definition: P8RndmEngine.h:35
P8RndmEngine p8RndmEngine_
P8RndmEngine& gen::Py8InterfaceBase::randomEngine ( )
inline
bool gen::Py8InterfaceBase::readSettings ( int  )

Definition at line 54 of file Py8InterfaceBase.cc.

References gen::ParameterCollector::begin(), gen::ParameterCollector::end(), fDecayer, fMasterGen, fParameters, and geometryCSVtoXML::line.

55 {
56 
58  line != fParameters.end(); ++line )
59  {
60  if (line->find("Random:") != std::string::npos)
61  throw cms::Exception("PythiaError") << "Attempted to set random number "
62  "using Pythia commands. Please use " "the RandomNumberGeneratorService."
63  << std::endl;
64 
65  if (!fMasterGen->readString(*line)) throw cms::Exception("PythiaError")
66  << "Pythia 8 did not accept \""
67  << *line << "\"." << std::endl;
68 
69  if (line->find("ParticleDecays:") != std::string::npos) {
70 
71  if (!fDecayer->readString(*line)) throw cms::Exception("PythiaError")
72  << "Pythia 8 Decayer did not accept \""
73  << *line << "\"." << std::endl;
74  }
75 
76  }
77 
78  return true;
79 
80 }
ParameterCollector fParameters
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< Pythia8::Pythia > fDecayer
const_iterator end() const
const_iterator begin() const
void gen::Py8InterfaceBase::statistics ( )
virtual

Reimplemented in Pythia8Hadronizer, and gen::Py8GunBase.

Definition at line 132 of file Py8InterfaceBase.cc.

References fMasterGen.

133 {
134 
135  fMasterGen->stat();
136  return;
137 
138 }
std::auto_ptr< Pythia8::Pythia > fMasterGen

Member Data Documentation

HepMC::IO_AsciiParticles* gen::Py8InterfaceBase::ascii_io
protected
EvtGenDecays* gen::Py8InterfaceBase::evtgenDecays
protected
std::string gen::Py8InterfaceBase::evtgenDecFile
protected
std::string gen::Py8InterfaceBase::evtgenPdlFile
protected
std::auto_ptr<Pythia8::Pythia> gen::Py8InterfaceBase::fDecayer
protected
std::auto_ptr<Pythia8::Pythia> gen::Py8InterfaceBase::fMasterGen
protected
ParameterCollector gen::Py8InterfaceBase::fParameters
protected
unsigned int gen::Py8InterfaceBase::maxEventsToPrint
protected
P8RndmEngine gen::Py8InterfaceBase::p8RndmEngine_
private

Definition at line 65 of file Py8InterfaceBase.h.

Referenced by p8SetRandomEngine(), Py8InterfaceBase(), and randomEngine().

bool gen::Py8InterfaceBase::pythiaHepMCVerbosity
protected
bool gen::Py8InterfaceBase::pythiaHepMCVerbosityParticles
protected
unsigned int gen::Py8InterfaceBase::pythiaPylistVerbosity
protected
HepMC::Pythia8ToHepMC gen::Py8InterfaceBase::toHepMC
protected
bool gen::Py8InterfaceBase::useEvtGen
protected