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 bool residualDecay ()
 
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::I_Pythia8 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 15 of file Py8InterfaceBase.cc.

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

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  maxEventsToPrint = ps.getUntrackedParameter<int>("maxEventsToPrint", 0);
31 
32 }
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 79 of file Py8InterfaceBase.cc.

References spr::find().

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

References i.

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

References geometryCSVtoXML::line.

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

Reimplemented in gen::Py8GunBase.

Definition at line 91 of file Py8InterfaceBase.cc.

92 {
93 
94 /*
95  Event* pythiaEvent = &(fMasterPtr->event);
96 
97  assert(fCurrentEventState);
98 
99  int NPartsBeforeDecays = pythiaEvent->size();
100  // int NPartsAfterDecays = event().get()->particles_size();
101  int NPartsAfterDecays = fCurrentEventState->particles_size();
102  int NewBarcode = NPartsAfterDecays;
103 
104  for ( int ipart=NPartsAfterDecays; ipart>NPartsBeforeDecays; ipart-- )
105  {
106 
107  // HepMC::GenParticle* part = event().get()->barcode_to_particle( ipart );
108  HepMC::GenParticle* part = fCurrentEventState->barcode_to_particle( ipart );
109 
110  if ( part->status() == 1 )
111  {
112  fDecayerPtr->event.reset();
113  Particle py8part( part->pdg_id(), 93, 0, 0, 0, 0, 0, 0,
114  part->momentum().x(),
115  part->momentum().y(),
116  part->momentum().z(),
117  part->momentum().t(),
118  part->generated_mass() );
119  HepMC::GenVertex* ProdVtx = part->production_vertex();
120  py8part.vProd( ProdVtx->position().x(), ProdVtx->position().y(),
121  ProdVtx->position().z(), ProdVtx->position().t() );
122  py8part.tau( (fDecayerPtr->particleData).tau0( part->pdg_id() ) );
123  fDecayerPtr->event.append( py8part );
124  int nentries = fDecayerPtr->event.size();
125  if ( !fDecayerPtr->event[nentries-1].mayDecay() ) continue;
126  fDecayerPtr->next();
127  int nentries1 = fDecayerPtr->event.size();
128  // --> fDecayerPtr->event.list(std::cout);
129  if ( nentries1 <= nentries ) continue; //same number of particles, no decays...
130 
131  part->set_status(2);
132 
133  Particle& py8daughter = fDecayerPtr->event[nentries]; // the 1st daughter
134  HepMC::GenVertex* DecVtx = new HepMC::GenVertex( HepMC::FourVector(py8daughter.xProd(),
135  py8daughter.yProd(),
136  py8daughter.zProd(),
137  py8daughter.tProd()) );
138 
139  DecVtx->add_particle_in( part ); // this will cleanup end_vertex if exists, replace with the new one
140  // I presume (vtx) barcode will be given automatically
141 
142  HepMC::FourVector pmom( py8daughter.px(), py8daughter.py(), py8daughter.pz(), py8daughter.e() );
143 
144  HepMC::GenParticle* daughter =
145  new HepMC::GenParticle( pmom, py8daughter.id(), 1 );
146 
147  NewBarcode++;
148  daughter->suggest_barcode( NewBarcode );
149  DecVtx->add_particle_out( daughter );
150 
151  for ( ipart=nentries+1; ipart<nentries1; ipart++ )
152  {
153  py8daughter = fDecayerPtr->event[ipart];
154  HepMC::FourVector pmomN( py8daughter.px(), py8daughter.py(), py8daughter.pz(), py8daughter.e() );
155  HepMC::GenParticle* daughterN =
156  new HepMC::GenParticle( pmomN, py8daughter.id(), 1 );
157  NewBarcode++;
158  daughterN->suggest_barcode( NewBarcode );
159  DecVtx->add_particle_out( daughterN );
160  }
161 
162  // event().get()->add_vertex( DecVtx );
163  fCurrentEventState->add_vertex( DecVtx );
164 
165  }
166  }
167 */
168  return true;
169 
170 }
void gen::Py8InterfaceBase::statistics ( )
virtual

Reimplemented in Pythia8Hadronizer, and gen::Py8GunBase.

Definition at line 173 of file Py8InterfaceBase.cc.

174 {
175 
176  fMasterGen->statistics();
177  return;
178 
179 }
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 45 of file Py8InterfaceBase.h.

Referenced by Pythia8Hadronizer::Pythia8Hadronizer().

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

Definition at line 53 of file Py8InterfaceBase.h.

Referenced by p8SetRandomEngine(), and randomEngine().

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