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...
 
vector< float > DJR
 
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
 
JetMatchingMadgraphfJetMatchingPy8InternalHook
 
UserHooks * fReweightPtHatRapUserHook
 
UserHooks * fReweightRapUserHook
 
UserHooks * fReweightUserHook
 
SetNumberOfPartonsDynamicallyfSetNumberOfPartonsDynamicallyHook
 
std::auto_ptr< LHAupLesHoucheslhaUP
 
string LHEInputFileName
 
int nME
 
int nMEFiltered
 
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 55 of file Pythia8Hadronizer.cc.

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

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

Definition at line 130 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, fJetMatchingPy8InternalHook, gen::Py8InterfaceBase::fMasterGen, gen::Py8InterfaceBase::fParameters, fReweightPtHatRapUserHook, fReweightRapUserHook, fReweightUserHook, fSetNumberOfPartonsDynamicallyHook, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), geometryCSVtoXML::line, PP, PPbar, slhafile_, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 309 of file Pythia8Hadronizer.cc.

References fEmissionVetoHook, and fEmissionVetoHook1.

310 {
311 // do we need to delete UserHooks/JetMatchingHook here ???
312 
315 }
EmissionVetoHook1 * fEmissionVetoHook1
EmissionVetoHook * fEmissionVetoHook

Member Function Documentation

const char* Pythia8Hadronizer::classname ( ) const
inlineoverridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 74 of file Pythia8Hadronizer.cc.

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

Reimplemented from gen::BaseHadronizer.

Definition at line 78 of file Pythia8Hadronizer.cc.

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

Reimplemented from gen::BaseHadronizer.

Definition at line 79 of file Pythia8Hadronizer.cc.

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

Implements gen::Py8InterfaceBase.

Definition at line 584 of file Pythia8Hadronizer.cc.

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

585 {
586  bool lhe = lheEvent() != 0;
587 
588  // now create the GenEventInfo product from the GenEvent and fill
589  // the missing pieces
590  eventInfo().reset( new GenEventInfoProduct( event().get() ) );
591 
592  // in pythia pthat is used to subdivide samples into different bins
593  // in LHE mode the binning is done by the external ME generator
594  // which is likely not pthat, so only filling it for Py6 internal mode
595  if (!lhe) {
596  eventInfo()->setBinningValues(std::vector<double>(1, fMasterGen->info.pTHat()));
597  }
598 
599  eventInfo()->setDJR(DJR);
600  eventInfo()->setNMEPartons(nME);
601  eventInfo()->setNMEPartonsFiltered(nMEFiltered);
602 
603  //******** Verbosity ********
604 
605  if (maxEventsToPrint > 0 &&
608  if (pythiaPylistVerbosity) {
609  fMasterGen->info.list(std::cout);
610  fMasterGen->event.list(std::cout);
611  }
612 
613  if (pythiaHepMCVerbosity) {
614  std::cout << "Event process = "
615  << fMasterGen->info.code() << "\n"
616  << "----------------------" << std::endl;
617  event()->print();
618  }
619  }
620 }
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
vector< float > DJR
tuple cout
Definition: gather_cfg.py:121
bool Pythia8Hadronizer::generatePartonsAndHadronize ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 441 of file Pythia8Hadronizer.cc.

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

442 {
443 
444  if (!fMasterGen->next()) return false;
445 
446  event().reset(new HepMC::GenEvent);
447  return toHepMC.fill_next_event( *(fMasterGen.get()), event().get());
448 
449 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< HepMC::GenEvent > & event()
HepMC::Pythia8ToHepMC toHepMC
bool Pythia8Hadronizer::hadronize ( )

Definition at line 452 of file Pythia8Hadronizer.cc.

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

453 {
454  DJR.resize(0);
455  nME = -1;
456  nMEFiltered = -1;
457  if(LHEInputFileName == string()) lhaUP->loadEvent(lheEvent());
458 
459  if ( fJetMatchingHook )
460  {
463  }
464 
465  bool py8next = fMasterGen->next();
466 
467  double mergeweight = fMasterGen.get()->info.mergingWeight();
468 
469  //protect against 0-weight from ckkw or similar
470  if (!py8next || mergeweight<=0.)
471  {
473  event().reset();
474  return false;
475  }
476 
478  const std::vector<double> djrmatch = fJetMatchingPy8InternalHook->GetDJR();
479  //cap size of djr vector to save storage space (keep only up to first 6 elements)
480  unsigned int ndjr = std::min(djrmatch.size(), std::vector<double>::size_type(6));
481  for (unsigned int idjr=0; idjr<ndjr; ++idjr) {
482  DJR.push_back(djrmatch[idjr]);
483  }
484 
485  nME=fJetMatchingPy8InternalHook->nMEPartons()[0];
486  nMEFiltered=fJetMatchingPy8InternalHook->nMEPartons()[1];
487  }
488 
489  // update LHE matching statistics
490  //
492 
493  event().reset(new HepMC::GenEvent);
494  bool py8hepmc = toHepMC.fill_next_event( *(fMasterGen.get()), event().get());
495  if (!py8hepmc) {
496  return false;
497  }
498 
499  //add ckkw merging weight
500  if (mergeweight!=1.) {
501  event()->weights().push_back(mergeweight);
502  }
503 
504  return true;
505 
506 
507 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
Definition: LHEEvent.cc:207
uint16_t size_type
virtual void beforeHadronization(lhef::LHEEvent *lhee)
std::auto_ptr< HepMC::GenEvent > & event()
std::auto_ptr< LHAupLesHouches > lhaUP
lhef::LHEEvent * lheEvent()
JetMatchingMadgraph * fJetMatchingPy8InternalHook
JetMatchingHook * fJetMatchingHook
vector< float > DJR
void resetMatchingStatus()
HepMC::Pythia8ToHepMC toHepMC
bool Pythia8Hadronizer::initializeForExternalPartons ( )

Definition at line 360 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(), getDQMSummary::iter, lhaUP, LHEInputFileName, gen::BaseHadronizer::lheRunInfo(), NULL, dbtoconf::out, gen::Py8InterfaceBase::pythiaPylistVerbosity, python.multivaluedict::remove(), slhafile_, AlCaHLTBitMon_QueryRunRegistry::string, and estimatePileup_makeJSON::trunc.

361 {
362 
363  std::cout << "Initializing for external partons" << std::endl;
364 
365  if(LHEInputFileName != string()) {
366 
367  std::cout << std::endl;
368  std::cout << "LHE Input File Name = " << LHEInputFileName << std::endl;
369  std::cout << std::endl;
371 
372  } else {
373 
374  lhaUP.reset(new LHAupLesHouches());
375  lhaUP->loadRunInfo(lheRunInfo());
376 
377  if ( fJetMatchingHook )
378  {
380  }
381 
382  //pythia 8 doesn't currently support reading SLHA table from lhe header in memory
383  //so dump it to a temp file and set the appropriate pythia parameters to read it
384  std::vector<std::string> slha = lheRunInfo()->findHeader("slha");
385  const char *fname = std::tmpnam(NULL);
386  //read slha header from lhe only if header is present AND no slha header was specified
387  //for manual loading.
388  bool doslha = !slha.empty() && slhafile_.empty();
389 
390  if (doslha) {
391  std::ofstream file(fname, std::fstream::out | std::fstream::trunc);
393  for(std::vector<std::string>::const_iterator iter = slha.begin();
394  iter != slha.end(); ++iter) {
395  file << *iter;
396  }
397  file.close();
398 
399  std::string lhareadcmd = "SLHA:readFrom = 2";
400  std::string lhafilecmd = std::string("SLHA:file = ") + std::string(fname);
401 
402  fMasterGen->readString(lhareadcmd);
403  fMasterGen->readString(lhafilecmd);
404  }
405 
406  fMasterGen->init(lhaUP.get());
407 
408  if (doslha) {
409  std::remove( fname );
410  }
411 
412  }
413 
414  if ( pythiaPylistVerbosity > 10 )
415  {
416  if ( pythiaPylistVerbosity == 11 || pythiaPylistVerbosity == 13 )
417  fMasterGen->settings.listAll();
418  if ( pythiaPylistVerbosity == 12 || pythiaPylistVerbosity == 13 )
419  fMasterGen->particleData.listAll();
420  }
421 
422  // init decayer
423  fDecayer->readString("ProcessLevel:all = off"); // trick
424  fDecayer->readString("ProcessLevel::resonanceDecays=on");
425  fDecayer->init();
426 
427  return true;
428 }
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 317 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.

318 {
319 
320  // pythiaEvent = &pythia->event;
321 
322  if ( fInitialState == PP ) // default
323  {
324  fMasterGen->init(2212, 2212, comEnergy);
325  }
326  else if ( fInitialState == PPbar )
327  {
328  fMasterGen->init(2212, -2212, comEnergy);
329  }
330  else if ( fInitialState == ElectronPositron )
331  {
332  fMasterGen->init(11, -11, comEnergy);
333  }
334  else
335  {
336  // throw on unknown initial state !
337  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
338  <<" UNKNOWN INITIAL STATE. \n The allowed initial states are: PP, PPbar, ElectronPositron \n";
339  }
340 
341  fMasterGen->settings.listChanged();
342 
343  if ( pythiaPylistVerbosity > 10 )
344  {
345  if ( pythiaPylistVerbosity == 11 || pythiaPylistVerbosity == 13 )
346  fMasterGen->settings.listAll();
347  if ( pythiaPylistVerbosity == 12 || pythiaPylistVerbosity == 13 )
348  fMasterGen->particleData.listAll();
349  }
350 
351  // init decayer
352  fDecayer->readString("ProcessLevel:all = off"); // trick
353  fDecayer->readString("ProcessLevel::resonanceDecays=on");
354  fDecayer->init();
355 
356  return true;
357 }
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 510 of file Pythia8Hadronizer.cc.

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

511 {
512 
513  Event* pythiaEvent = &(fMasterGen->event);
514 
515  int NPartsBeforeDecays = pythiaEvent->size();
516  int NPartsAfterDecays = event().get()->particles_size();
517  int NewBarcode = NPartsAfterDecays;
518 
519  for ( int ipart=NPartsAfterDecays; ipart>NPartsBeforeDecays; ipart-- )
520  {
521 
522  HepMC::GenParticle* part = event().get()->barcode_to_particle( ipart );
523 
524  if ( part->status() == 1 )
525  {
526  fDecayer->event.reset();
527  Particle py8part( part->pdg_id(), 93, 0, 0, 0, 0, 0, 0,
528  part->momentum().x(),
529  part->momentum().y(),
530  part->momentum().z(),
531  part->momentum().t(),
532  part->generated_mass() );
533  HepMC::GenVertex* ProdVtx = part->production_vertex();
534  py8part.vProd( ProdVtx->position().x(), ProdVtx->position().y(),
535  ProdVtx->position().z(), ProdVtx->position().t() );
536  py8part.tau( (fDecayer->particleData).tau0( part->pdg_id() ) );
537  fDecayer->event.append( py8part );
538  int nentries = fDecayer->event.size();
539  if ( !fDecayer->event[nentries-1].mayDecay() ) continue;
540  fDecayer->next();
541  int nentries1 = fDecayer->event.size();
542  if ( nentries1 <= nentries ) continue; //same number of particles, no decays...
543 
544  part->set_status(2);
545 
546  Particle& py8daughter = fDecayer->event[nentries]; // the 1st daughter
547  HepMC::GenVertex* DecVtx = new HepMC::GenVertex( HepMC::FourVector(py8daughter.xProd(),
548  py8daughter.yProd(),
549  py8daughter.zProd(),
550  py8daughter.tProd()) );
551 
552  DecVtx->add_particle_in( part ); // this will cleanup end_vertex if exists, replace with the new one
553  // I presume (vtx) barcode will be given automatically
554 
555  HepMC::FourVector pmom( py8daughter.px(), py8daughter.py(), py8daughter.pz(), py8daughter.e() );
556 
557  HepMC::GenParticle* daughter =
558  new HepMC::GenParticle( pmom, py8daughter.id(), 1 );
559 
560  NewBarcode++;
561  daughter->suggest_barcode( NewBarcode );
562  DecVtx->add_particle_out( daughter );
563 
564  for ( int ipart1=nentries+1; ipart1<nentries1; ipart1++ )
565  {
566  py8daughter = fDecayer->event[ipart1];
567  HepMC::FourVector pmomN( py8daughter.px(), py8daughter.py(), py8daughter.pz(), py8daughter.e() );
568  HepMC::GenParticle* daughterN =
569  new HepMC::GenParticle( pmomN, py8daughter.id(), 1 );
570  NewBarcode++;
571  daughterN->suggest_barcode( NewBarcode );
572  DecVtx->add_particle_out( daughterN );
573  }
574 
575  event().get()->add_vertex( DecVtx );
576 
577  }
578  }
579  return true;
580 
581 }
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 431 of file Pythia8Hadronizer.cc.

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

432 {
433  fMasterGen->statistics();
434 
435  double xsec = fMasterGen->info.sigmaGen(); // cross section in mb
436  xsec *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
437  runInfo().setInternalXSec(xsec);
438 }
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 82 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons().

vector<float> Pythia8Hadronizer::DJR
private

Definition at line 123 of file Pythia8Hadronizer.cc.

Referenced by finalizeEvent(), and hadronize().

int Pythia8Hadronizer::EV1_emittedMode
private

Definition at line 115 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_maxVetoCount
private

Definition at line 112 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

bool Pythia8Hadronizer::EV1_MPIvetoOn
private

Definition at line 117 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_nFinal
private

Definition at line 110 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pTdefMode
private

Definition at line 116 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pTempMode
private

Definition at line 114 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pThardMode
private

Definition at line 113 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

bool Pythia8Hadronizer::EV1_vetoOn
private

Definition at line 111 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

double Pythia8Hadronizer::fBeam1PZ
private

Definition at line 90 of file Pythia8Hadronizer.cc.

double Pythia8Hadronizer::fBeam2PZ
private

Definition at line 91 of file Pythia8Hadronizer.cc.

EmissionVetoHook* Pythia8Hadronizer::fEmissionVetoHook
private

Definition at line 107 of file Pythia8Hadronizer.cc.

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

EmissionVetoHook1* Pythia8Hadronizer::fEmissionVetoHook1
private

Definition at line 108 of file Pythia8Hadronizer.cc.

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

int Pythia8Hadronizer::fInitialState
private

Definition at line 88 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons(), and Pythia8Hadronizer().

JetMatchingHook* Pythia8Hadronizer::fJetMatchingHook
private
JetMatchingMadgraph* Pythia8Hadronizer::fJetMatchingPy8InternalHook
private

Definition at line 102 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and Pythia8Hadronizer().

UserHooks* Pythia8Hadronizer::fReweightPtHatRapUserHook
private

Definition at line 97 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

UserHooks* Pythia8Hadronizer::fReweightRapUserHook
private

Definition at line 96 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

UserHooks* Pythia8Hadronizer::fReweightUserHook
private

Definition at line 95 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

SetNumberOfPartonsDynamically* Pythia8Hadronizer::fSetNumberOfPartonsDynamicallyHook
private

Definition at line 103 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

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

Definition at line 85 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

string Pythia8Hadronizer::LHEInputFileName
private

Definition at line 84 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

int Pythia8Hadronizer::nME
private

Definition at line 124 of file Pythia8Hadronizer.cc.

Referenced by finalizeEvent(), and hadronize().

int Pythia8Hadronizer::nMEFiltered
private

Definition at line 125 of file Pythia8Hadronizer.cc.

Referenced by finalizeEvent(), and hadronize().

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

Definition at line 119 of file Pythia8Hadronizer.cc.

std::string Pythia8Hadronizer::slhafile_
private

Definition at line 121 of file Pythia8Hadronizer.cc.

Referenced by initializeForExternalPartons(), and Pythia8Hadronizer().