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
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
 
 Py8InterfaceBase (edm::ParameterSet const &ps)
 
bool readSettings (int)
 
virtual void statistics ()
 
 ~Py8InterfaceBase ()
 

Protected Attributes

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
 

Detailed Description

Definition at line 14 of file Py8InterfaceBase.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file Py8InterfaceBase.cc.

References gen::getEngineReference(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), PYTHIA6_MinBias_2360GeV_cff_py_GEN_FASTSIM::maxEventsToPrint, PYTHIA6_MinBias_2360GeV_cff_py_GEN_FASTSIM::pythiaHepMCVerbosity, PYTHIA6_MinBias_2360GeV_cff_py_GEN_FASTSIM::pythiaPylistVerbosity, and randomEngine.

13 {
14 
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  // RandomP8* RP8 = new RandomP8();
24  fMasterGen->setRndmEnginePtr( new RandomP8() );
25  fDecayer->setRndmEnginePtr( new RandomP8() );
26 
27  fParameters = ps.getParameter<edm::ParameterSet>("PythiaParameters");
28 
29  pythiaPylistVerbosity = ps.getUntrackedParameter<int>("pythiaPylistVerbosity", 0);
30  pythiaHepMCVerbosity = ps.getUntrackedParameter<bool>("pythiaHepMCVerbosity", false);
31  maxEventsToPrint = ps.getUntrackedParameter<int>("maxEventsToPrint", 0);
32 
33 }
ParameterCollector fParameters
std::auto_ptr< Pythia8::Pythia > fMasterGen
CLHEP::HepRandomEngine * randomEngine
Definition: PYR.cc:4
CLHEP::HepRandomEngine & getEngineReference()
unsigned int pythiaPylistVerbosity
unsigned int maxEventsToPrint
std::auto_ptr< Pythia8::Pythia > fDecayer
gen::Py8InterfaceBase::~Py8InterfaceBase ( )
inline

Definition at line 19 of file Py8InterfaceBase.h.

19 {}

Member Function Documentation

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

Definition at line 22 of file Py8InterfaceBase.h.

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

Definition at line 88 of file Py8InterfaceBase.cc.

References spr::find().

89 {
90 
91  for ( unsigned int iss=0; iss<settings.size(); iss++ )
92  {
93  if ( settings[iss].find("QED-brem-off") == std::string::npos ) continue;
94  fMasterGen->readString( "TimeShower:QEDshowerByL=off" );
95  }
96 
97  return true;
98 }
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
bool gen::Py8InterfaceBase::declareStableParticles ( const std::vector< int > &  pdgIds)

Definition at line 55 of file Py8InterfaceBase.cc.

References i.

56 {
57 
58  for ( size_t i=0; i<pdgIds.size(); i++ )
59  {
60  // FIXME: need to double check if PID's are the same in Py6 & Py8,
61  // because the HepPDT translation tool is actually for **Py6**
62  //
63  // well, actually it looks like Py8 operates in PDT id's rather than Py6's
64  //
65 // int PyID = HepPID::translatePDTtoPythia( pdgIds[i] );
66  int PyID = pdgIds[i];
67  std::ostringstream pyCard ;
68  pyCard << PyID <<":mayDecay=false";
69 
70  if ( fMasterGen->particleData.isParticle( PyID ) ) {
71  fMasterGen->readString( pyCard.str() );
72  } else {
73 
74  edm::LogWarning("DataNotUnderstood") << "Pythia8 does not "
75  << "recognize particle id = "
76  << PyID << std::endl;
77  }
78  // alternative:
79  // set the 2nd input argument warn=false
80  // - this way Py8 will NOT print warnings about unknown particle code(s)
81  // fMasterPtr->readString( pyCard.str(), false )
82  }
83 
84  return true;
85 
86 }
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.

bool gen::Py8InterfaceBase::readSettings ( int  )

Definition at line 35 of file Py8InterfaceBase.cc.

References geometryCSVtoXML::line.

36 {
37 
39  line != fParameters.end(); ++line )
40  {
41  if (line->find("Random:") != std::string::npos)
42  throw cms::Exception("PythiaError") << "Attempted to set random number "
43  "using Pythia commands. Please use " "the RandomNumberGeneratorService."
44  << std::endl;
45 
46  if (!fMasterGen->readString(*line)) throw cms::Exception("PythiaError")
47  << "Pythia 8 did not accept \""
48  << *line << "\"." << std::endl;
49  }
50 
51  return true;
52 
53 }
ParameterCollector fParameters
std::auto_ptr< Pythia8::Pythia > fMasterGen
const_iterator end() const
const_iterator begin() const
void gen::Py8InterfaceBase::statistics ( )
virtual

Reimplemented in Pythia8Hadronizer, and gen::Py8GunBase.

Definition at line 101 of file Py8InterfaceBase.cc.

102 {
103 
104  fMasterGen->stat();
105  return;
106 
107 }
std::auto_ptr< Pythia8::Pythia > fMasterGen

Member Data Documentation

std::auto_ptr<Pythia8::Pythia> gen::Py8InterfaceBase::fDecayer
protected
std::auto_ptr<Pythia8::Pythia> gen::Py8InterfaceBase::fMasterGen
protected
ParameterCollector gen::Py8InterfaceBase::fParameters
protected

Definition at line 36 of file Py8InterfaceBase.h.

Referenced by Pythia8Hadronizer::Pythia8Hadronizer().

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