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::vector< std::string > evtgenUserFiles
 
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, evtgenUserFiles, edm::ParameterSet::exists(), fDecayer, fMasterGen, fParameters, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), maxEventsToPrint, GenerateHcalLaserBadRunList::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  if ( ps.exists( "evtgenUserFile" ) )
51  evtgenUserFiles = ps.getParameter< std::vector<std::string> >("evtgenUserFile");
52 
53  }
54 
55 }
ParameterCollector fParameters
std::auto_ptr< Pythia8::Pythia > fMasterGen
HepMC::IO_AsciiParticles * ascii_io
std::vector< std::string > evtgenUserFiles
P8RndmEngine p8RndmEngine_
EvtGenDecays * evtgenDecays
unsigned int pythiaPylistVerbosity
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 118 of file Py8InterfaceBase.cc.

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

118  {
119  for ( unsigned int iss=0; iss<settings.size(); iss++ ){
120  if ( settings[iss].find("QED-brem-off") != std::string::npos ){
121  fMasterGen->readString( "TimeShower:QEDshowerByL=off" );
122  }
123  else{
124  size_t fnd1 = settings[iss].find("Pythia8:");
125  if ( fnd1 != std::string::npos ){
126  std::string value = settings[iss].substr (fnd1+8);
127  fDecayer->readString(value);
128  }
129  }
130  }
131  return true;
132 }
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 85 of file Py8InterfaceBase.cc.

References fMasterGen, and i.

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

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

58 {
59 
61  line != fParameters.end(); ++line )
62  {
63  if (line->find("Random:") != std::string::npos)
64  throw cms::Exception("PythiaError") << "Attempted to set random number "
65  "using Pythia commands. Please use " "the RandomNumberGeneratorService."
66  << std::endl;
67 
68  if (!fMasterGen->readString(*line)) throw cms::Exception("PythiaError")
69  << "Pythia 8 did not accept \""
70  << *line << "\"." << std::endl;
71 
72  if (line->find("ParticleDecays:") != std::string::npos) {
73 
74  if (!fDecayer->readString(*line)) throw cms::Exception("PythiaError")
75  << "Pythia 8 Decayer did not accept \""
76  << *line << "\"." << std::endl;
77  }
78 
79  }
80 
81  return true;
82 
83 }
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 135 of file Py8InterfaceBase.cc.

References fMasterGen.

136 {
137 
138  fMasterGen->stat();
139  return;
140 
141 }
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::vector<std::string> gen::Py8InterfaceBase::evtgenUserFiles
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 66 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