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

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

P8RndmEngine p8RndmEngine_
 

Detailed Description

Definition at line 19 of file Py8InterfaceBase.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file Py8InterfaceBase.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), step1_ZMM_7Tev::maxEventsToPrint, step1_ZMM_7Tev::pythiaHepMCVerbosity, and step1_ZMM_7Tev::pythiaPylistVerbosity.

11 {
12  fMasterGen.reset(new Pythia);
13  fDecayer.reset(new Pythia);
14 
15  fMasterGen->readString("Next:numberShowEvent = 0");
16  fDecayer->readString("Next:numberShowEvent = 0");
17 
18  fMasterGen->setRndmEnginePtr( &p8RndmEngine_ );
19  fDecayer->setRndmEnginePtr( &p8RndmEngine_ );
20 
21  fParameters = ps.getParameter<edm::ParameterSet>("PythiaParameters");
22 
23  pythiaPylistVerbosity = ps.getUntrackedParameter<int>("pythiaPylistVerbosity", 0);
24  pythiaHepMCVerbosity = ps.getUntrackedParameter<bool>("pythiaHepMCVerbosity", false);
25  maxEventsToPrint = ps.getUntrackedParameter<int>("maxEventsToPrint", 0);
26 
27 }
ParameterCollector fParameters
std::auto_ptr< Pythia8::Pythia > fMasterGen
P8RndmEngine p8RndmEngine_
unsigned int pythiaPylistVerbosity
unsigned int maxEventsToPrint
std::auto_ptr< Pythia8::Pythia > fDecayer
gen::Py8InterfaceBase::~Py8InterfaceBase ( )
inline

Definition at line 24 of file Py8InterfaceBase.h.

24 {}

Member Function Documentation

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

Definition at line 27 of file Py8InterfaceBase.h.

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

Definition at line 82 of file Py8InterfaceBase.cc.

References spr::find().

83 {
84 
85  for ( unsigned int iss=0; iss<settings.size(); iss++ )
86  {
87  if ( settings[iss].find("QED-brem-off") == std::string::npos ) continue;
88  fMasterGen->readString( "TimeShower:QEDshowerByL=off" );
89  }
90 
91  return true;
92 }
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 49 of file Py8InterfaceBase.cc.

References i.

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

References geometryCSVtoXML::line.

30 {
31 
33  line != fParameters.end(); ++line )
34  {
35  if (line->find("Random:") != std::string::npos)
36  throw cms::Exception("PythiaError") << "Attempted to set random number "
37  "using Pythia commands. Please use " "the RandomNumberGeneratorService."
38  << std::endl;
39 
40  if (!fMasterGen->readString(*line)) throw cms::Exception("PythiaError")
41  << "Pythia 8 did not accept \""
42  << *line << "\"." << std::endl;
43  }
44 
45  return true;
46 
47 }
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 95 of file Py8InterfaceBase.cc.

96 {
97 
98  fMasterGen->statistics();
99  return;
100 
101 }
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 44 of file Py8InterfaceBase.h.

Referenced by Pythia8Hadronizer::Pythia8Hadronizer().

unsigned int gen::Py8InterfaceBase::maxEventsToPrint
protected
P8RndmEngine gen::Py8InterfaceBase::p8RndmEngine_
private

Definition at line 52 of file Py8InterfaceBase.h.

Referenced by p8SetRandomEngine(), and randomEngine().

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