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 Attributes
Pythia8Hadronizer Class Reference
Inheritance diagram for Pythia8Hadronizer:
gen::BaseHadronizer gen::Py8InterfaceBase

Public Member Functions

const char * classname () const
 
void finalizeEvent ()
 
bool generatePartonsAndHadronize ()
 
bool hadronize ()
 
bool initializeForExternalPartons ()
 
bool initializeForInternalPartons ()
 
 Pythia8Hadronizer (const edm::ParameterSet &params)
 
virtual bool residualDecay ()
 
void statistics ()
 
 ~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)
 
 ~BaseHadronizer ()
 
- Public Member Functions inherited from gen::Py8InterfaceBase
bool decay ()
 
bool declareSpecialSettings (const std::vector< std::string > &)
 
bool declareStableParticles (const std::vector< int > &)
 
 Py8InterfaceBase (edm::ParameterSet const &ps)
 
bool readSettings (int)
 
 ~Py8InterfaceBase ()
 

Private Types

enum  { PP, PPbar, ElectronPositron }
 

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
 
PowhegHooks * fEmissionVetoHook
 
EmissionVetoHook1fEmissionVetoHook1
 
int fInitialState
 
JetMatchingHookfJetMatchingHook
 
Pythia8::JetMatchingMadgraph * fJetMatchingPy8InternalHook
 
Pythia8::amcnlo_unitarised_interface * fMergingHook
 
UserHooks * fReweightPtHatRapUserHook
 
UserHooks * fReweightRapUserHook
 
UserHooks * fReweightUserHook
 
std::auto_ptr< LHAupLesHoucheslhaUP
 
string LHEInputFileName
 
int nFSRveto
 
int NHooks
 
int nISRveto
 
int nME
 
int nMEFiltered
 
std::string slhafile_
 

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 49 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, 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, fEmissionVetoHook1, fInitialState, fJetMatchingHook, gen::Py8InterfaceBase::fMasterGen, gen::Py8InterfaceBase::fParameters, fReweightPtHatRapUserHook, fReweightRapUserHook, fReweightUserHook, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), geometryCSVtoXML::line, NHooks, PP, PPbar, and slhafile_.

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

Definition at line 286 of file Pythia8Hadronizer.cc.

References fEmissionVetoHook, and fEmissionVetoHook1.

287 {
288 // do we need to delete UserHooks/JetMatchingHook here ???
291 }
EmissionVetoHook1 * fEmissionVetoHook1
PowhegHooks * fEmissionVetoHook

Member Function Documentation

const char* Pythia8Hadronizer::classname ( ) const
inlinevirtual

Implements gen::Py8InterfaceBase.

Definition at line 68 of file Pythia8Hadronizer.cc.

68 { return "Pythia8Hadronizer"; }
void Pythia8Hadronizer::finalizeEvent ( )
virtual

Implements gen::Py8InterfaceBase.

Definition at line 614 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.

615 {
616  bool lhe = lheEvent() != 0;
617 
618  // now create the GenEventInfo product from the GenEvent and fill
619  // the missing pieces
620  eventInfo().reset( new GenEventInfoProduct( event().get() ) );
621 
622  // in pythia pthat is used to subdivide samples into different bins
623  // in LHE mode the binning is done by the external ME generator
624  // which is likely not pthat, so only filling it for Py6 internal mode
625  if (!lhe) {
626  eventInfo()->setBinningValues(std::vector<double>(1, fMasterGen->info.pTHat()));
627  }
628 
629  eventInfo()->setDJR(DJR);
630  eventInfo()->setNMEPartons(nME);
631  eventInfo()->setNMEPartonsFiltered(nMEFiltered);
632 
633  //******** Verbosity ********
634 
635  if (maxEventsToPrint > 0 &&
638  if (pythiaPylistVerbosity) {
639  fMasterGen->info.list(std::cout);
640  fMasterGen->event.list(std::cout);
641  }
642 
643  if (pythiaHepMCVerbosity) {
644  std::cout << "Event process = "
645  << fMasterGen->info.code() << "\n"
646  << "----------------------" << std::endl;
647  event()->print();
648  }
649  }
650 }
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 ( )
virtual

Implements gen::Py8InterfaceBase.

Definition at line 462 of file Pythia8Hadronizer.cc.

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

463 {
464 
465  if (!fMasterGen->next()) return false;
466 
467  event().reset(new HepMC::GenEvent);
468  return toHepMC.fill_next_event( *(fMasterGen.get()), event().get());
469 
470 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< HepMC::GenEvent > & event()
HepMC::Pythia8ToHepMC toHepMC
bool Pythia8Hadronizer::hadronize ( )

Definition at line 473 of file Pythia8Hadronizer.cc.

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

474 {
475  DJR.resize(0);
476  nME = -1;
477  nMEFiltered = -1;
478  if(LHEInputFileName == string()) lhaUP->loadEvent(lheEvent());
479 
480  if ( fJetMatchingHook )
481  {
484  }
485 
486  bool py8next = fMasterGen->next();
487 
488  double mergeweight = fMasterGen.get()->info.mergingWeightNLO();
489  if (fMergingHook) {
490  mergeweight *= fMergingHook->getNormFactor();
491  }
492 
493 
494  //protect against 0-weight from ckkw or similar
495  if (!py8next || std::abs(mergeweight)==0.)
496  {
497  lheEvent()->count( lhef::LHERunInfo::kSelected, 1.0, mergeweight );
498  event().reset();
499  return false;
500  }
501 
503  const std::vector<double> djrmatch = fJetMatchingPy8InternalHook->GetDJR();
504  //cap size of djr vector to save storage space (keep only up to first 6 elements)
505  unsigned int ndjr = std::min(djrmatch.size(), std::vector<double>::size_type(6));
506  for (unsigned int idjr=0; idjr<ndjr; ++idjr) {
507  DJR.push_back(djrmatch[idjr]);
508  }
509 
510  nME=fJetMatchingPy8InternalHook->nMEpartons().first;
511  nMEFiltered=fJetMatchingPy8InternalHook->nMEpartons().second;
512  }
513 
514  // update LHE matching statistics
515  //
516  lheEvent()->count( lhef::LHERunInfo::kAccepted, 1.0, mergeweight );
517 
518  event().reset(new HepMC::GenEvent);
519  bool py8hepmc = toHepMC.fill_next_event( *(fMasterGen.get()), event().get());
520  if (!py8hepmc) {
521  return false;
522  }
523 
524  //add ckkw/umeps/unlops merging weight
525  if (mergeweight!=1.) {
526  event()->weights()[0] *= mergeweight;
527  }
528 
529  if (fEmissionVetoHook) {
530  nISRveto += fEmissionVetoHook->getNISRveto();
531  nFSRveto += fEmissionVetoHook->getNFSRveto();
532  }
533 
534  return true;
535 
536 
537 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
#define abs(x)
Definition: mlp_lapack.h:159
Pythia8::JetMatchingMadgraph * fJetMatchingPy8InternalHook
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
Definition: LHEEvent.cc:207
#define min(a, b)
Definition: mlp_lapack.h:161
uint16_t size_type
PowhegHooks * fEmissionVetoHook
void beforeHadronization(lhef::LHEEvent *lhee)
std::auto_ptr< HepMC::GenEvent > & event()
std::auto_ptr< LHAupLesHouches > lhaUP
lhef::LHEEvent * lheEvent()
Pythia8::amcnlo_unitarised_interface * fMergingHook
JetMatchingHook * fJetMatchingHook
vector< float > DJR
void resetMatchingStatus()
HepMC::Pythia8ToHepMC toHepMC
bool Pythia8Hadronizer::initializeForExternalPartons ( )

Definition at line 350 of file Pythia8Hadronizer.cc.

References edm::errors::Configuration, edm::hlt::Exception, gen::Py8InterfaceBase::fDecayer, fEmissionVetoHook, fEmissionVetoHook1, fJetMatchingHook, fJetMatchingPy8InternalHook, gen::Py8InterfaceBase::fMasterGen, fMergingHook, JetMatchingHook::init(), lhaUP, LHEInputFileName, gen::BaseHadronizer::lheRunInfo(), gen::Py8InterfaceBase::pythiaPylistVerbosity, and ntuplemaker::status.

351 {
352 
353  edm::LogInfo("Pythia8Interface") << "Initializing for external partons";
354 
355  bool status = true;
356 
357  if((fMasterGen->settings.mode("POWHEG:veto") > 0 || fMasterGen->settings.mode("POWHEG:MPIveto") > 0) && !fEmissionVetoHook) {
358 
360  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
361  <<" Attempt to turn on PowhegHooks by pythia8 settings but there are incompatible hooks on \n Incompatible are : jetMatching, emissionVeto1 \n";
362 
363  fEmissionVetoHook = new PowhegHooks();
364 
365  edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook from pythia8 code";
366  fMasterGen->setUserHooksPtr(fEmissionVetoHook);
367 
368  }
369 
370  //adapted from main89.cc in pythia8 examples
371  bool internalMatching = fMasterGen->settings.flag("JetMatching:merge");
372  bool internalMerging = !(fMasterGen->settings.word("Merging:Process").compare("void")==0);
373 
374  if (internalMatching && internalMerging) {
375  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
376  <<" Only one jet matching/merging scheme can be used at a time. \n";
377  }
378 
379  if (internalMatching && !fJetMatchingPy8InternalHook) {
380  fJetMatchingPy8InternalHook = new Pythia8::JetMatchingMadgraph;
381  fMasterGen->setUserHooksPtr(fJetMatchingPy8InternalHook);
382  }
383 
384  if (internalMerging && !fMergingHook) {
385  int scheme = ( fMasterGen->settings.flag("Merging:doUMEPSTree")
386  || fMasterGen->settings.flag("Merging:doUMEPSSubt")) ?
387  1 :
388  ( ( fMasterGen->settings.flag("Merging:doUNLOPSTree")
389  || fMasterGen->settings.flag("Merging:doUNLOPSSubt")
390  || fMasterGen->settings.flag("Merging:doUNLOPSLoop")
391  || fMasterGen->settings.flag("Merging:doUNLOPSSubtNLO")) ?
392  2 :
393  0 );
394  fMergingHook = new Pythia8::amcnlo_unitarised_interface(scheme);
395  fMasterGen->setUserHooksPtr(fMergingHook);
396  }
397 
398 
399  if(LHEInputFileName != string()) {
400 
401  edm::LogInfo("Pythia8Interface") << "Initialize direct pythia8 reading from LHE file "
402  << LHEInputFileName;
403  edm::LogInfo("Pythia8Interface") << "Some LHE information can be not stored";
404  //fMasterGen->init(LHEInputFileName);
405  fMasterGen->settings.mode("Beams:frameType", 4);
406  fMasterGen->settings.word("Beams:LHEF", LHEInputFileName);
407  status &= fMasterGen->init();
408 
409  } else {
410 
411  lhaUP.reset(new LHAupLesHouches());
412  lhaUP->setScalesFromLHEF(fMasterGen->settings.flag("Beams:setProductionScalesFromLHEF"));
413  lhaUP->loadRunInfo(lheRunInfo());
414 
415  if ( fJetMatchingHook )
416  {
418  }
419 
420  //fMasterGen->init(lhaUP.get());
421  fMasterGen->settings.mode("Beams:frameType", 5);
422  fMasterGen->setLHAupPtr(lhaUP.get());
423  status &= fMasterGen->init();
424  }
425 
426  if ( pythiaPylistVerbosity > 10 )
427  {
428  if ( pythiaPylistVerbosity == 11 || pythiaPylistVerbosity == 13 )
429  fMasterGen->settings.listAll();
430  if ( pythiaPylistVerbosity == 12 || pythiaPylistVerbosity == 13 )
431  fMasterGen->particleData.listAll();
432  }
433 
434  // init decayer
435  //fDecayer->readString("ProcessLevel:all = off"); // trick
436  //fDecayer->readString("ProcessLevel::resonanceDecays=on");
437  fDecayer->settings.flag("ProcessLevel:all", false ); // trick
438  fDecayer->settings.flag("ProcessLevel:resonanceDecays", true );
439  status &= fDecayer->init();
440 
441  return status;
442 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
EmissionVetoHook1 * fEmissionVetoHook1
Pythia8::JetMatchingMadgraph * fJetMatchingPy8InternalHook
PowhegHooks * fEmissionVetoHook
std::auto_ptr< LHAupLesHouches > lhaUP
unsigned int pythiaPylistVerbosity
lhef::LHERunInfo * lheRunInfo()
void init(lhef::LHERunInfo *runInfo)
Pythia8::amcnlo_unitarised_interface * fMergingHook
JetMatchingHook * fJetMatchingHook
std::auto_ptr< Pythia8::Pythia > fDecayer
tuple status
Definition: ntuplemaker.py:245
bool Pythia8Hadronizer::initializeForInternalPartons ( )
virtual

Implements gen::Py8InterfaceBase.

Definition at line 293 of file Pythia8Hadronizer.cc.

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

294 {
295 
296  bool status = true;
297 
298  if ( fInitialState == PP ) // default
299  {
300  //fMasterGen->init(2212, 2212, comEnergy);
301  fMasterGen->settings.mode("Beams:idA", 2212);
302  fMasterGen->settings.mode("Beams:idB", 2212);
303  fMasterGen->settings.parm("Beams:eCM", comEnergy);
304  status &= fMasterGen->init();
305  }
306  else if ( fInitialState == PPbar )
307  {
308  //fMasterGen->init(2212, -2212, comEnergy);
309  fMasterGen->settings.mode("Beams:idA", 2212);
310  fMasterGen->settings.mode("Beams:idB", -2212);
311  fMasterGen->settings.parm("Beams:eCM", comEnergy);
312  status &= fMasterGen->init();
313  }
314  else if ( fInitialState == ElectronPositron )
315  {
316  //fMasterGen->init(11, -11, comEnergy);
317  fMasterGen->settings.mode("Beams:idA", 11);
318  fMasterGen->settings.mode("Beams:idB", -11);
319  fMasterGen->settings.parm("Beams:eCM", comEnergy);
320  status &= fMasterGen->init();
321  }
322  else
323  {
324  // throw on unknown initial state !
325  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
326  <<" UNKNOWN INITIAL STATE. \n The allowed initial states are: PP, PPbar, ElectronPositron \n";
327  }
328 
329  fMasterGen->settings.listChanged();
330 
331  if ( pythiaPylistVerbosity > 10 )
332  {
333  if ( pythiaPylistVerbosity == 11 || pythiaPylistVerbosity == 13 )
334  fMasterGen->settings.listAll();
335  if ( pythiaPylistVerbosity == 12 || pythiaPylistVerbosity == 13 )
336  fMasterGen->particleData.listAll();
337  }
338 
339  // init decayer
340  //fDecayer->readString("ProcessLevel:all = off"); // trick
341  //fDecayer->readString("ProcessLevel::resonanceDecays=on");
342  fDecayer->settings.flag("ProcessLevel:all", false ); // trick
343  fDecayer->settings.flag("ProcessLevel:resonanceDecays", true );
344  status &= fDecayer->init();
345 
346  return status;
347 }
double comEnergy
Center-of-Mass energy.
std::auto_ptr< Pythia8::Pythia > fMasterGen
unsigned int pythiaPylistVerbosity
std::auto_ptr< Pythia8::Pythia > fDecayer
tuple status
Definition: ntuplemaker.py:245
bool Pythia8Hadronizer::residualDecay ( )
virtual

Definition at line 540 of file Pythia8Hadronizer.cc.

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

541 {
542 
543  Event* pythiaEvent = &(fMasterGen->event);
544 
545  int NPartsBeforeDecays = pythiaEvent->size();
546  int NPartsAfterDecays = event().get()->particles_size();
547  int NewBarcode = NPartsAfterDecays;
548 
549  for ( int ipart=NPartsAfterDecays; ipart>NPartsBeforeDecays; ipart-- )
550  {
551 
552  HepMC::GenParticle* part = event().get()->barcode_to_particle( ipart );
553 
554  if ( part->status() == 1 )
555  {
556  fDecayer->event.reset();
557  Particle py8part( part->pdg_id(), 93, 0, 0, 0, 0, 0, 0,
558  part->momentum().x(),
559  part->momentum().y(),
560  part->momentum().z(),
561  part->momentum().t(),
562  part->generated_mass() );
563  HepMC::GenVertex* ProdVtx = part->production_vertex();
564  py8part.vProd( ProdVtx->position().x(), ProdVtx->position().y(),
565  ProdVtx->position().z(), ProdVtx->position().t() );
566  py8part.tau( (fDecayer->particleData).tau0( part->pdg_id() ) );
567  fDecayer->event.append( py8part );
568  int nentries = fDecayer->event.size();
569  if ( !fDecayer->event[nentries-1].mayDecay() ) continue;
570  fDecayer->next();
571  int nentries1 = fDecayer->event.size();
572  if ( nentries1 <= nentries ) continue; //same number of particles, no decays...
573 
574  part->set_status(2);
575 
576  Particle& py8daughter = fDecayer->event[nentries]; // the 1st daughter
577  HepMC::GenVertex* DecVtx = new HepMC::GenVertex( HepMC::FourVector(py8daughter.xProd(),
578  py8daughter.yProd(),
579  py8daughter.zProd(),
580  py8daughter.tProd()) );
581 
582  DecVtx->add_particle_in( part ); // this will cleanup end_vertex if exists, replace with the new one
583  // I presume (vtx) barcode will be given automatically
584 
585  HepMC::FourVector pmom( py8daughter.px(), py8daughter.py(), py8daughter.pz(), py8daughter.e() );
586 
587  HepMC::GenParticle* daughter =
588  new HepMC::GenParticle( pmom, py8daughter.id(), 1 );
589 
590  NewBarcode++;
591  daughter->suggest_barcode( NewBarcode );
592  DecVtx->add_particle_out( daughter );
593 
594  for ( int ipart1=nentries+1; ipart1<nentries1; ipart1++ )
595  {
596  py8daughter = fDecayer->event[ipart1];
597  HepMC::FourVector pmomN( py8daughter.px(), py8daughter.py(), py8daughter.pz(), py8daughter.e() );
598  HepMC::GenParticle* daughterN =
599  new HepMC::GenParticle( pmomN, py8daughter.id(), 1 );
600  NewBarcode++;
601  daughterN->suggest_barcode( NewBarcode );
602  DecVtx->add_particle_out( daughterN );
603  }
604 
605  event().get()->add_vertex( DecVtx );
606 
607  }
608  }
609  return true;
610 
611 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< HepMC::GenEvent > & event()
part
Definition: HCALResponse.h:21
std::auto_ptr< Pythia8::Pythia > fDecayer
void Pythia8Hadronizer::statistics ( )
virtual

Reimplemented from gen::Py8InterfaceBase.

Definition at line 445 of file Pythia8Hadronizer.cc.

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

446 {
447  fMasterGen->stat();
448 
449  if(fEmissionVetoHook) {
450  edm::LogPrint("Pythia8Interface") << "\n"
451  << "Number of ISR vetoed = " << nISRveto;
452  edm::LogPrint("Pythia8Interface")
453  << "Number of FSR vetoed = " << nFSRveto;
454  }
455 
456  double xsec = fMasterGen->info.sigmaGen(); // cross section in mb
457  xsec *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
458  runInfo().setInternalXSec(xsec);
459 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
void setInternalXSec(const XSec &xsec)
PowhegHooks * fEmissionVetoHook
GenRunInfoProduct & runInfo()

Member Data Documentation

double Pythia8Hadronizer::comEnergy
private

Center-of-Mass energy.

Definition at line 73 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons().

vector<float> Pythia8Hadronizer::DJR
private

Definition at line 112 of file Pythia8Hadronizer.cc.

Referenced by finalizeEvent(), and hadronize().

int Pythia8Hadronizer::EV1_emittedMode
private

Definition at line 106 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_maxVetoCount
private

Definition at line 103 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

bool Pythia8Hadronizer::EV1_MPIvetoOn
private

Definition at line 108 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_nFinal
private

Definition at line 101 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pTdefMode
private

Definition at line 107 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pTempMode
private

Definition at line 105 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pThardMode
private

Definition at line 104 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

bool Pythia8Hadronizer::EV1_vetoOn
private

Definition at line 102 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

double Pythia8Hadronizer::fBeam1PZ
private

Definition at line 81 of file Pythia8Hadronizer.cc.

double Pythia8Hadronizer::fBeam2PZ
private

Definition at line 82 of file Pythia8Hadronizer.cc.

PowhegHooks* Pythia8Hadronizer::fEmissionVetoHook
private
EmissionVetoHook1* Pythia8Hadronizer::fEmissionVetoHook1
private
int Pythia8Hadronizer::fInitialState
private

Definition at line 79 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons(), and Pythia8Hadronizer().

JetMatchingHook* Pythia8Hadronizer::fJetMatchingHook
private

Definition at line 92 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), initializeForExternalPartons(), and Pythia8Hadronizer().

Pythia8::JetMatchingMadgraph* Pythia8Hadronizer::fJetMatchingPy8InternalHook
private

Definition at line 93 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

Pythia8::amcnlo_unitarised_interface* Pythia8Hadronizer::fMergingHook
private

Definition at line 94 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

UserHooks* Pythia8Hadronizer::fReweightPtHatRapUserHook
private

Definition at line 88 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

UserHooks* Pythia8Hadronizer::fReweightRapUserHook
private

Definition at line 87 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

UserHooks* Pythia8Hadronizer::fReweightUserHook
private

Definition at line 86 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

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

Definition at line 76 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

string Pythia8Hadronizer::LHEInputFileName
private

Definition at line 75 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

int Pythia8Hadronizer::nFSRveto
private

Definition at line 117 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and statistics().

int Pythia8Hadronizer::NHooks
private

Definition at line 119 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::nISRveto
private

Definition at line 116 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and statistics().

int Pythia8Hadronizer::nME
private

Definition at line 113 of file Pythia8Hadronizer.cc.

Referenced by finalizeEvent(), and hadronize().

int Pythia8Hadronizer::nMEFiltered
private

Definition at line 114 of file Pythia8Hadronizer.cc.

Referenced by finalizeEvent(), and hadronize().

std::string Pythia8Hadronizer::slhafile_
private

Definition at line 110 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().