CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
Pythia8Hadronizer Class Reference
Inheritance diagram for Pythia8Hadronizer:
gen::BaseHadronizer gen::Py8InterfaceBase

Public Member Functions

const char * classname () const override
 
void finalizeEvent () override
 
bool generatePartonsAndHadronize () override
 
bool hadronize ()
 
bool initializeForExternalPartons ()
 
bool initializeForInternalPartons () override
 
 Pythia8Hadronizer (const edm::ParameterSet &params)
 
virtual bool residualDecay ()
 
void statistics () override
 
 ~Pythia8Hadronizer ()
 
- Public Member Functions inherited from gen::BaseHadronizer
 BaseHadronizer (edm::ParameterSet const &ps)
 
edm::EventgetEDMEvent () const
 
HepMC::GenEvent * getGenEvent ()
 
GenEventInfoProductgetGenEventInfo ()
 
GenRunInfoProductgetGenRunInfo ()
 
const boost::shared_ptr
< lhef::LHERunInfo > & 
getLHERunInfo () const
 
void resetEvent (HepMC::GenEvent *event)
 
void resetEventInfo (GenEventInfoProduct *eventInfo)
 
virtual bool select (HepMC::GenEvent *) const
 
void setEDMEvent (edm::Event &event)
 
void setLHEEvent (lhef::LHEEvent *event)
 
void setLHERunInfo (lhef::LHERunInfo *runInfo)
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
std::vector< std::string > const & sharedResources () const
 
 ~BaseHadronizer ()
 
- Public Member Functions inherited from gen::Py8InterfaceBase
bool decay ()
 
bool declareSpecialSettings (const std::vector< std::string > &)
 
bool declareStableParticles (const std::vector< int > &)
 
void p8SetRandomEngine (CLHEP::HepRandomEngine *v)
 
 Py8InterfaceBase (edm::ParameterSet const &ps)
 
P8RndmEnginerandomEngine ()
 
bool readSettings (int)
 
 ~Py8InterfaceBase ()
 

Private Types

enum  { PP, PPbar, ElectronPositron }
 

Private Member Functions

virtual void doSetRandomEngine (CLHEP::HepRandomEngine *v) override
 
virtual std::vector
< std::string > const & 
doSharedResources () const override
 

Private Attributes

double comEnergy
 Center-of-Mass energy. More...
 
int EV1_emittedMode
 
int EV1_maxVetoCount
 
bool EV1_MPIvetoOn
 
int EV1_nFinal
 
int EV1_pTdefMode
 
int EV1_pTempMode
 
int EV1_pThardMode
 
bool EV1_vetoOn
 
double fBeam1PZ
 
double fBeam2PZ
 
EmissionVetoHookfEmissionVetoHook
 
EmissionVetoHook1fEmissionVetoHook1
 
int fInitialState
 
JetMatchingHookfJetMatchingHook
 
UserHooks * fReweightPtHatRapUserHook
 
UserHooks * fReweightRapUserHook
 
UserHooks * fReweightUserHook
 
std::auto_ptr< LHAupLesHoucheslhaUP
 
string LHEInputFileName
 
std::string slhafile_
 

Static Private Attributes

static const std::vector
< std::string > 
p8SharedResources = { edm::SharedResourceNames::kPythia8 }
 

Additional Inherited Members

- Protected Member Functions inherited from gen::BaseHadronizer
std::auto_ptr< HepMC::GenEvent > & event ()
 
std::auto_ptr
< GenEventInfoProduct > & 
eventInfo ()
 
lhef::LHEEventlheEvent ()
 
lhef::LHERunInfolheRunInfo ()
 
GenRunInfoProductrunInfo ()
 
- Protected Attributes inherited from gen::Py8InterfaceBase
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 54 of file Pythia8Hadronizer.cc.

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

Pythia8Hadronizer::Pythia8Hadronizer ( const edm::ParameterSet params)

Definition at line 123 of file Pythia8Hadronizer.cc.

References gen::ParameterCollector::begin(), edm::errors::Configuration, gather_cfg::cout, ElectronPositron, gen::ParameterCollector::end(), EV1_emittedMode, EV1_maxVetoCount, EV1_MPIvetoOn, EV1_nFinal, EV1_pTdefMode, EV1_pTempMode, EV1_pThardMode, EV1_vetoOn, edm::hlt::Exception, edm::ParameterSet::exists(), python.connectstrParser::f1, fEmissionVetoHook, fEmissionVetoHook1, fInitialState, fJetMatchingHook, gen::Py8InterfaceBase::fMasterGen, gen::Py8InterfaceBase::fParameters, fReweightPtHatRapUserHook, fReweightRapUserHook, fReweightUserHook, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), geometryCSVtoXML::line, PP, PPbar, slhafile_, and AlCaHLTBitMon_QueryRunRegistry::string.

123  :
124  BaseHadronizer(params), Py8InterfaceBase(params),
125  comEnergy(params.getParameter<double>("comEnergy")),
126  LHEInputFileName(params.getUntrackedParameter<string>("LHEInputFileName","")),
127  fInitialState(PP),
129  fJetMatchingHook(0),
131 {
132 
133  // J.Y.: the following 3 parameters are hacked "for a reason"
134  //
135  if ( params.exists( "PPbarInitialState" ) )
136  {
137  if ( fInitialState == PP )
138  {
140  edm::LogImportant("GeneratorInterface|Pythia8Interface")
141  << "Pythia8 will be initialized for PROTON-ANTIPROTON INITIAL STATE. "
142  << "This is a user-request change from the DEFAULT PROTON-PROTON initial state.";
143  }
144  else
145  {
146  // probably need to throw on attempt to override ?
147  }
148  }
149  else if ( params.exists( "ElectronPositronInitialState" ) )
150  {
151  if ( fInitialState == PP )
152  {
154  edm::LogInfo("GeneratorInterface|Pythia8Interface")
155  << "Pythia8 will be initialized for ELECTRON-POSITRON INITIAL STATE. "
156  << "This is a user-request change from the DEFAULT PROTON-PROTON initial state.";
157  }
158  else
159  {
160  // probably need to throw on attempt to override ?
161  }
162  }
163  else if ( params.exists( "ElectronProtonInitialState" ) || params.exists( "PositronProtonInitialState" ) )
164  {
165  // throw on unknown initial state !
166  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
167  <<" UNKNOWN INITIAL STATE. \n The allowed initial states are: PP, PPbar, ElectronPositron \n";
168  }
169 
170  if( params.exists( "SLHAFileForPythia8" ) ) {
171  std::string slhafilenameshort = params.getParameter<string>("SLHAFileForPythia8");
172  edm::FileInPath f1( slhafilenameshort );
173  slhafile_ = f1.fullPath();
174  std::string pythiacommandslha = std::string("SLHA:file = ") + slhafile_;
175  fMasterGen->readString(pythiacommandslha);
177  line != fParameters.end(); ++line ) {
178  if (line->find("SLHA:file") != std::string::npos)
179  throw cms::Exception("PythiaError") << "Attempted to set SLHA file name twice, "
180  << "using Pythia8 card SLHA:file and Pythia8Interface card SLHAFileForPythia8"
181  << std::endl;
182  }
183  }
184 
185  // Reweight user hook
186  //
187  if( params.exists( "reweightGen" ) )
189  if( params.exists( "reweightGenRap" ) )
190  {
191  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenRap";
192  edm::ParameterSet rgrParams =
193  params.getParameter<edm::ParameterSet>("reweightGenRap");
195  new RapReweightUserHook(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
196  rgrParams.getParameter<double>("yLabPower"),
197  rgrParams.getParameter<std::string>("yCMSigmaFunc"),
198  rgrParams.getParameter<double>("yCMPower"),
199  rgrParams.getParameter<double>("pTHatMin"),
200  rgrParams.getParameter<double>("pTHatMax"));
201  edm::LogInfo("Pythia8Interface") << "End setup for reweightGenRap";
202  }
203  if( params.exists( "reweightGenPtHatRap" ) )
204  {
205  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenPtHatRap";
206  edm::ParameterSet rgrParams =
207  params.getParameter<edm::ParameterSet>("reweightGenPtHatRap");
209  new PtHatRapReweightUserHook(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
210  rgrParams.getParameter<double>("yLabPower"),
211  rgrParams.getParameter<std::string>("yCMSigmaFunc"),
212  rgrParams.getParameter<double>("yCMPower"),
213  rgrParams.getParameter<double>("pTHatMin"),
214  rgrParams.getParameter<double>("pTHatMax"));
215  edm::LogInfo("Pythia8Interface") << "End setup for reweightGenPtHatRap";
216  }
217 
218  if( params.exists( "useUserHook" ) )
219  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
220  <<" Obsolete parameter: useUserHook \n Please use the actual one instead \n";
221 
222  // PS matching prototype
223  //
224  if ( params.exists("jetMatching") )
225  {
226  edm::ParameterSet jmParams =
227  params.getUntrackedParameter<edm::ParameterSet>("jetMatching");
228  std::string scheme = jmParams.getParameter<std::string>("scheme");
229  if ( scheme == "Madgraph" || scheme == "MadgraphFastJet" )
230  {
231  fJetMatchingHook = new JetMatchingHook( jmParams, &fMasterGen->info );
232  }
233  }
234 
235  // Emission vetos
236  //
237  if ( params.exists("emissionVeto") )
238  {
240  }
241 
242  if ( params.exists("emissionVeto1") )
243  {
244  EV1_nFinal = -1;
245  if(params.exists("EV1_nFinal")) EV1_nFinal = params.getParameter<int>("EV1_nFinal");
246  EV1_vetoOn = true;
247  if(params.exists("EV1_vetoOn")) EV1_vetoOn = params.getParameter<bool>("EV1_vetoOn");
248  EV1_maxVetoCount = 10;
249  if(params.exists("EV1_maxVetoCount")) EV1_maxVetoCount = params.getParameter<int>("EV1_maxVetoCount");
250  EV1_pThardMode = 1;
251  if(params.exists("EV1_pThardMode")) EV1_pThardMode = params.getParameter<int>("EV1_pThardMode");
252  EV1_pTempMode = 0;
253  if(params.exists("EV1_pTempMode")) EV1_pTempMode = params.getParameter<int>("EV1_pTempMode");
254  if(EV1_pTempMode > 2 || EV1_pTempMode < 0)
255  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
256  <<" Wrong value for EV1_pTempMode code\n";
257  EV1_emittedMode = 0;
258  if(params.exists("EV1_emittedMode")) EV1_emittedMode = params.getParameter<int>("EV1_emittedMode");
259  EV1_pTdefMode = 1;
260  if(params.exists("EV1_pTdefMode")) EV1_pTdefMode = params.getParameter<int>("EV1_pTdefMode");
261  EV1_MPIvetoOn = false;
262  if(params.exists("EV1_MPIvetoOn")) EV1_MPIvetoOn = params.getParameter<bool>("EV1_MPIvetoOn");
266  }
267 
268  int NHooks=0;
269  if(fReweightUserHook) NHooks++;
270  if(fReweightRapUserHook) NHooks++;
271  if(fReweightPtHatRapUserHook) NHooks++;
272  if(fJetMatchingHook) NHooks++;
273  if(fEmissionVetoHook) NHooks++;
274  if(fEmissionVetoHook1) NHooks++;
275  if(NHooks > 1)
276  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
277  <<" Too many User Hooks. \n Please choose one from: reweightGen, reweightGenRap, reweightGenPtHatRap, jetMatching, emissionVeto, emissionVeto1 \n";
278  if(fReweightUserHook) fMasterGen->setUserHooksPtr(fReweightUserHook);
281  if(fJetMatchingHook) fMasterGen->setUserHooksPtr(fJetMatchingHook);
283  std::cout << "Turning on Emission Veto Hook";
284  if(fEmissionVetoHook1) std::cout << " 1";
285  std::cout << std::endl;
286  if(fEmissionVetoHook) fMasterGen->setUserHooksPtr(fEmissionVetoHook);
287  if(fEmissionVetoHook1) fMasterGen->setUserHooksPtr(fEmissionVetoHook1);
288  }
289 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ParameterCollector fParameters
double comEnergy
Center-of-Mass energy.
std::auto_ptr< Pythia8::Pythia > fMasterGen
EmissionVetoHook1 * fEmissionVetoHook1
UserHooks * fReweightUserHook
EmissionVetoHook * fEmissionVetoHook
BaseHadronizer(edm::ParameterSet const &ps)
bool exists(std::string const &parameterName) const
checks if a parameter exists
Py8InterfaceBase(edm::ParameterSet const &ps)
UserHooks * fReweightPtHatRapUserHook
UserHooks * fReweightRapUserHook
JetMatchingHook * fJetMatchingHook
const_iterator end() const
const_iterator begin() const
tuple cout
Definition: gather_cfg.py:121
Pythia8Hadronizer::~Pythia8Hadronizer ( )

Definition at line 292 of file Pythia8Hadronizer.cc.

References fEmissionVetoHook, and fEmissionVetoHook1.

293 {
294 // do we need to delete UserHooks/JetMatchingHook here ???
295 
298 }
EmissionVetoHook1 * fEmissionVetoHook1
EmissionVetoHook * fEmissionVetoHook

Member Function Documentation

const char* Pythia8Hadronizer::classname ( ) const
inlineoverridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 73 of file Pythia8Hadronizer.cc.

73 { return "Pythia8Hadronizer"; }
virtual void Pythia8Hadronizer::doSetRandomEngine ( CLHEP::HepRandomEngine *  v)
inlineoverrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 77 of file Pythia8Hadronizer.cc.

77 { p8SetRandomEngine(v); }
void p8SetRandomEngine(CLHEP::HepRandomEngine *v)
virtual std::vector<std::string> const& Pythia8Hadronizer::doSharedResources ( ) const
inlineoverrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 78 of file Pythia8Hadronizer.cc.

78 { return p8SharedResources; }
static const std::vector< std::string > p8SharedResources
void Pythia8Hadronizer::finalizeEvent ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 538 of file Pythia8Hadronizer.cc.

References gather_cfg::cout, gen::BaseHadronizer::event(), gen::BaseHadronizer::eventInfo(), gen::Py8InterfaceBase::fMasterGen, gen::BaseHadronizer::lheEvent(), gen::Py8InterfaceBase::maxEventsToPrint, gen::Py8InterfaceBase::pythiaHepMCVerbosity, and gen::Py8InterfaceBase::pythiaPylistVerbosity.

539 {
540  bool lhe = lheEvent() != 0;
541 
542  // now create the GenEventInfo product from the GenEvent and fill
543  // the missing pieces
544  eventInfo().reset( new GenEventInfoProduct( event().get() ) );
545 
546  // in pythia pthat is used to subdivide samples into different bins
547  // in LHE mode the binning is done by the external ME generator
548  // which is likely not pthat, so only filling it for Py6 internal mode
549  if (!lhe) {
550  eventInfo()->setBinningValues(std::vector<double>(1, fMasterGen->info.pTHat()));
551  }
552 
553  //******** Verbosity ********
554 
555  if (maxEventsToPrint > 0 &&
558  if (pythiaPylistVerbosity) {
559  fMasterGen->info.list(std::cout);
560  fMasterGen->event.list(std::cout);
561  }
562 
563  if (pythiaHepMCVerbosity) {
564  std::cout << "Event process = "
565  << fMasterGen->info.code() << "\n"
566  << "----------------------" << std::endl;
567  event()->print();
568  }
569  }
570 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< HepMC::GenEvent > & event()
lhef::LHEEvent * lheEvent()
unsigned int pythiaPylistVerbosity
std::auto_ptr< GenEventInfoProduct > & eventInfo()
unsigned int maxEventsToPrint
tuple cout
Definition: gather_cfg.py:121
bool Pythia8Hadronizer::generatePartonsAndHadronize ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 424 of file Pythia8Hadronizer.cc.

References gen::BaseHadronizer::event(), gen::Py8InterfaceBase::fMasterGen, and gen::Py8InterfaceBase::toHepMC.

425 {
426 
427  if (!fMasterGen->next()) return false;
428 
429  event().reset(new HepMC::GenEvent);
430  return toHepMC.fill_next_event( *(fMasterGen.get()), event().get());
431 
432 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< HepMC::GenEvent > & event()
HepMC::Pythia8ToHepMC toHepMC
bool Pythia8Hadronizer::hadronize ( )

Definition at line 435 of file Pythia8Hadronizer.cc.

References JetMatchingHook::beforeHadronization(), lhef::LHEEvent::count(), gen::BaseHadronizer::event(), fJetMatchingHook, gen::Py8InterfaceBase::fMasterGen, lhef::LHERunInfo::kAccepted, lhef::LHERunInfo::kSelected, lhaUP, gen::BaseHadronizer::lheEvent(), LHEInputFileName, JetMatchingHook::resetMatchingStatus(), and gen::Py8InterfaceBase::toHepMC.

436 {
437  if(LHEInputFileName == string()) lhaUP->loadEvent(lheEvent());
438 
439  if ( fJetMatchingHook )
440  {
443  }
444 
445  bool py8next = fMasterGen->next();
446 
447  if (!py8next)
448  {
450  event().reset();
451  return false;
452  }
453 
454  // update LHE matching statistics
455  //
457 
458  event().reset(new HepMC::GenEvent);
459  return toHepMC.fill_next_event( *(fMasterGen.get()), event().get());
460 
461 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
Definition: LHEEvent.cc:203
virtual void beforeHadronization(lhef::LHEEvent *lhee)
std::auto_ptr< HepMC::GenEvent > & event()
std::auto_ptr< LHAupLesHouches > lhaUP
lhef::LHEEvent * lheEvent()
JetMatchingHook * fJetMatchingHook
void resetMatchingStatus()
HepMC::Pythia8ToHepMC toHepMC
bool Pythia8Hadronizer::initializeForExternalPartons ( )

Definition at line 343 of file Pythia8Hadronizer.cc.

References createPayload::block, gather_cfg::cout, gen::Py8InterfaceBase::fDecayer, mergeVDriftHistosByStation::file, lhef::LHERunInfo::findHeader(), fJetMatchingHook, gen::Py8InterfaceBase::fMasterGen, alignmentValidation::fname, JetMatchingHook::init(), lhaUP, LHEInputFileName, gen::BaseHadronizer::lheRunInfo(), NULL, dbtoconf::out, gen::Py8InterfaceBase::pythiaPylistVerbosity, python.multivaluedict::remove(), slhafile_, AlCaHLTBitMon_QueryRunRegistry::string, and estimatePileup_makeJSON::trunc.

344 {
345 
346  std::cout << "Initializing for external partons" << std::endl;
347 
348  if(LHEInputFileName != string()) {
349 
350  std::cout << std::endl;
351  std::cout << "LHE Input File Name = " << LHEInputFileName << std::endl;
352  std::cout << std::endl;
354 
355  } else {
356 
357  lhaUP.reset(new LHAupLesHouches());
358  lhaUP->loadRunInfo(lheRunInfo());
359 
360  if ( fJetMatchingHook )
361  {
363  }
364 
365  //pythia 8 doesn't currently support reading SLHA table from lhe header in memory
366  //so dump it to a temp file and set the appropriate pythia parameters to read it
367  std::vector<std::string> slha = lheRunInfo()->findHeader("slha");
368  const char *fname = std::tmpnam(NULL);
369  //read slha header from lhe only if header is present AND no slha header was specified
370  //for manual loading.
371  bool doslha = !slha.empty() && slhafile_.empty();
372 
373  if (doslha) {
374  std::ofstream file(fname, std::fstream::out | std::fstream::trunc);
376  for(std::vector<std::string>::const_iterator iter = slha.begin();
377  iter != slha.end(); ++iter) {
378  file << *iter;
379  }
380  file.close();
381 
382  std::string lhareadcmd = "SLHA:readFrom = 2";
383  std::string lhafilecmd = std::string("SLHA:file = ") + std::string(fname);
384 
385  fMasterGen->readString(lhareadcmd);
386  fMasterGen->readString(lhafilecmd);
387  }
388 
389  fMasterGen->init(lhaUP.get());
390 
391  if (doslha) {
392  std::remove( fname );
393  }
394 
395  }
396 
397  if ( pythiaPylistVerbosity > 10 )
398  {
399  if ( pythiaPylistVerbosity == 11 || pythiaPylistVerbosity == 13 )
400  fMasterGen->settings.listAll();
401  if ( pythiaPylistVerbosity == 12 || pythiaPylistVerbosity == 13 )
402  fMasterGen->particleData.listAll();
403  }
404 
405  // init decayer
406  fDecayer->readString("ProcessLevel:all = off"); // trick
407  fDecayer->readString("ProcessLevel::resonanceDecays=on");
408  fDecayer->init();
409 
410  return true;
411 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
#define NULL
Definition: scimark2.h:8
std::auto_ptr< LHAupLesHouches > lhaUP
unsigned int pythiaPylistVerbosity
lhef::LHERunInfo * lheRunInfo()
tuple out
Definition: dbtoconf.py:99
virtual void init(lhef::LHERunInfo *runInfo)
JetMatchingHook * fJetMatchingHook
std::auto_ptr< Pythia8::Pythia > fDecayer
string fname
main script
tuple cout
Definition: gather_cfg.py:121
std::vector< std::string > findHeader(const std::string &tag) const
Definition: LHERunInfo.cc:390
bool Pythia8Hadronizer::initializeForInternalPartons ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 300 of file Pythia8Hadronizer.cc.

References comEnergy, edm::errors::Configuration, ElectronPositron, edm::hlt::Exception, gen::Py8InterfaceBase::fDecayer, fInitialState, gen::Py8InterfaceBase::fMasterGen, PP, PPbar, and gen::Py8InterfaceBase::pythiaPylistVerbosity.

301 {
302 
303  // pythiaEvent = &pythia->event;
304 
305  if ( fInitialState == PP ) // default
306  {
307  fMasterGen->init(2212, 2212, comEnergy);
308  }
309  else if ( fInitialState == PPbar )
310  {
311  fMasterGen->init(2212, -2212, comEnergy);
312  }
313  else if ( fInitialState == ElectronPositron )
314  {
315  fMasterGen->init(11, -11, comEnergy);
316  }
317  else
318  {
319  // throw on unknown initial state !
320  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
321  <<" UNKNOWN INITIAL STATE. \n The allowed initial states are: PP, PPbar, ElectronPositron \n";
322  }
323 
324  fMasterGen->settings.listChanged();
325 
326  if ( pythiaPylistVerbosity > 10 )
327  {
328  if ( pythiaPylistVerbosity == 11 || pythiaPylistVerbosity == 13 )
329  fMasterGen->settings.listAll();
330  if ( pythiaPylistVerbosity == 12 || pythiaPylistVerbosity == 13 )
331  fMasterGen->particleData.listAll();
332  }
333 
334  // init decayer
335  fDecayer->readString("ProcessLevel:all = off"); // trick
336  fDecayer->readString("ProcessLevel::resonanceDecays=on");
337  fDecayer->init();
338 
339  return true;
340 }
double comEnergy
Center-of-Mass energy.
std::auto_ptr< Pythia8::Pythia > fMasterGen
unsigned int pythiaPylistVerbosity
std::auto_ptr< Pythia8::Pythia > fDecayer
bool Pythia8Hadronizer::residualDecay ( )
virtual

Definition at line 464 of file Pythia8Hadronizer.cc.

References gen::BaseHadronizer::event(), gen::Py8InterfaceBase::fDecayer, gen::Py8InterfaceBase::fMasterGen, and configurableAnalysis::GenParticle.

465 {
466 
467  Event* pythiaEvent = &(fMasterGen->event);
468 
469  int NPartsBeforeDecays = pythiaEvent->size();
470  int NPartsAfterDecays = event().get()->particles_size();
471  int NewBarcode = NPartsAfterDecays;
472 
473  for ( int ipart=NPartsAfterDecays; ipart>NPartsBeforeDecays; ipart-- )
474  {
475 
476  HepMC::GenParticle* part = event().get()->barcode_to_particle( ipart );
477 
478  if ( part->status() == 1 )
479  {
480  fDecayer->event.reset();
481  Particle py8part( part->pdg_id(), 93, 0, 0, 0, 0, 0, 0,
482  part->momentum().x(),
483  part->momentum().y(),
484  part->momentum().z(),
485  part->momentum().t(),
486  part->generated_mass() );
487  HepMC::GenVertex* ProdVtx = part->production_vertex();
488  py8part.vProd( ProdVtx->position().x(), ProdVtx->position().y(),
489  ProdVtx->position().z(), ProdVtx->position().t() );
490  py8part.tau( (fDecayer->particleData).tau0( part->pdg_id() ) );
491  fDecayer->event.append( py8part );
492  int nentries = fDecayer->event.size();
493  if ( !fDecayer->event[nentries-1].mayDecay() ) continue;
494  fDecayer->next();
495  int nentries1 = fDecayer->event.size();
496  if ( nentries1 <= nentries ) continue; //same number of particles, no decays...
497 
498  part->set_status(2);
499 
500  Particle& py8daughter = fDecayer->event[nentries]; // the 1st daughter
501  HepMC::GenVertex* DecVtx = new HepMC::GenVertex( HepMC::FourVector(py8daughter.xProd(),
502  py8daughter.yProd(),
503  py8daughter.zProd(),
504  py8daughter.tProd()) );
505 
506  DecVtx->add_particle_in( part ); // this will cleanup end_vertex if exists, replace with the new one
507  // I presume (vtx) barcode will be given automatically
508 
509  HepMC::FourVector pmom( py8daughter.px(), py8daughter.py(), py8daughter.pz(), py8daughter.e() );
510 
511  HepMC::GenParticle* daughter =
512  new HepMC::GenParticle( pmom, py8daughter.id(), 1 );
513 
514  NewBarcode++;
515  daughter->suggest_barcode( NewBarcode );
516  DecVtx->add_particle_out( daughter );
517 
518  for ( int ipart1=nentries+1; ipart1<nentries1; ipart1++ )
519  {
520  py8daughter = fDecayer->event[ipart1];
521  HepMC::FourVector pmomN( py8daughter.px(), py8daughter.py(), py8daughter.pz(), py8daughter.e() );
522  HepMC::GenParticle* daughterN =
523  new HepMC::GenParticle( pmomN, py8daughter.id(), 1 );
524  NewBarcode++;
525  daughterN->suggest_barcode( NewBarcode );
526  DecVtx->add_particle_out( daughterN );
527  }
528 
529  event().get()->add_vertex( DecVtx );
530 
531  }
532  }
533  return true;
534 
535 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< HepMC::GenEvent > & event()
part
Definition: HCALResponse.h:20
std::auto_ptr< Pythia8::Pythia > fDecayer
void Pythia8Hadronizer::statistics ( )
overridevirtual

Reimplemented from gen::Py8InterfaceBase.

Definition at line 414 of file Pythia8Hadronizer.cc.

References gen::Py8InterfaceBase::fMasterGen, gen::BaseHadronizer::runInfo(), and GenRunInfoProduct::setInternalXSec().

415 {
416  fMasterGen->statistics();
417 
418  double xsec = fMasterGen->info.sigmaGen(); // cross section in mb
419  xsec *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
420  runInfo().setInternalXSec(xsec);
421 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
void setInternalXSec(const XSec &xsec)
GenRunInfoProduct & runInfo()

Member Data Documentation

double Pythia8Hadronizer::comEnergy
private

Center-of-Mass energy.

Definition at line 81 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons().

int Pythia8Hadronizer::EV1_emittedMode
private

Definition at line 112 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_maxVetoCount
private

Definition at line 109 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

bool Pythia8Hadronizer::EV1_MPIvetoOn
private

Definition at line 114 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_nFinal
private

Definition at line 107 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pTdefMode
private

Definition at line 113 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pTempMode
private

Definition at line 111 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pThardMode
private

Definition at line 110 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

bool Pythia8Hadronizer::EV1_vetoOn
private

Definition at line 108 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

double Pythia8Hadronizer::fBeam1PZ
private

Definition at line 89 of file Pythia8Hadronizer.cc.

double Pythia8Hadronizer::fBeam2PZ
private

Definition at line 90 of file Pythia8Hadronizer.cc.

EmissionVetoHook* Pythia8Hadronizer::fEmissionVetoHook
private

Definition at line 104 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer(), and ~Pythia8Hadronizer().

EmissionVetoHook1* Pythia8Hadronizer::fEmissionVetoHook1
private

Definition at line 105 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer(), and ~Pythia8Hadronizer().

int Pythia8Hadronizer::fInitialState
private

Definition at line 87 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons(), and Pythia8Hadronizer().

JetMatchingHook* Pythia8Hadronizer::fJetMatchingHook
private
UserHooks* Pythia8Hadronizer::fReweightPtHatRapUserHook
private

Definition at line 96 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

UserHooks* Pythia8Hadronizer::fReweightRapUserHook
private

Definition at line 95 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

UserHooks* Pythia8Hadronizer::fReweightUserHook
private

Definition at line 94 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

std::auto_ptr<LHAupLesHouches> Pythia8Hadronizer::lhaUP
private

Definition at line 84 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

string Pythia8Hadronizer::LHEInputFileName
private

Definition at line 83 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

const std::vector< std::string > Pythia8Hadronizer::p8SharedResources = { edm::SharedResourceNames::kPythia8 }
staticprivate

Definition at line 116 of file Pythia8Hadronizer.cc.

std::string Pythia8Hadronizer::slhafile_
private

Definition at line 118 of file Pythia8Hadronizer.cc.

Referenced by initializeForExternalPartons(), and Pythia8Hadronizer().