CMS 3D CMS Logo

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::Py8InterfaceBase gen::BaseHadronizer

Public Member Functions

const char * classname () const override
 
void finalizeEvent () override
 
bool generatePartonsAndHadronize () override
 
std::unique_ptr< GenLumiInfoHeadergetGenLumiInfoHeader () const override
 
bool hadronize ()
 
bool initializeForExternalPartons ()
 
bool initializeForInternalPartons () override
 
 Pythia8Hadronizer (const edm::ParameterSet &params)
 
virtual bool residualDecay ()
 
void statistics () override
 
 ~Pythia8Hadronizer () override
 
- Public Member Functions inherited from gen::Py8InterfaceBase
bool decay ()
 
bool declareSpecialSettings (const std::vector< std::string > &)
 
bool declareStableParticles (const std::vector< int > &)
 
void makeTmpSLHA (const std::string &)
 
void p8SetRandomEngine (CLHEP::HepRandomEngine *v)
 
 Py8InterfaceBase (edm::ParameterSet const &ps)
 
P8RndmEnginerandomEngine ()
 
bool readSettings (int)
 
 ~Py8InterfaceBase () override
 
- Public Member Functions inherited from gen::BaseHadronizer
 BaseHadronizer (edm::ParameterSet const &ps)
 
void cleanLHE ()
 
void generateLHE (edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine, unsigned int ncpu)
 
edm::EventgetEDMEvent () const
 
std::unique_ptr< HepMC::GenEventgetGenEvent ()
 
std::unique_ptr< GenEventInfoProductgetGenEventInfo ()
 
GenRunInfoProductgetGenRunInfo ()
 
std::unique_ptr< lhef::LHEEventgetLHEEvent ()
 
const std::shared_ptr< lhef::LHERunInfo > & getLHERunInfo () const
 
const std::string & gridpackPath () const
 
int randomIndex () const
 
const std::string & randomInitConfigDescription () const
 
void randomizeIndex (edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine)
 
void resetEvent (std::unique_ptr< HepMC::GenEvent > event)
 
void resetEventInfo (std::unique_ptr< GenEventInfoProduct > eventInfo)
 
virtual bool select (HepMC::GenEvent *) const
 
void setEDMEvent (edm::Event &event)
 
void setLHEEvent (std::unique_ptr< lhef::LHEEvent > event)
 
void setLHERunInfo (std::unique_ptr< lhef::LHERunInfo > runInfo)
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
std::vector< std::string > const & sharedResources () const
 
virtual ~BaseHadronizer () noexcept(false)
 

Private Types

enum  { PP, PPbar, ElectronPositron }
 

Private Member Functions

void doSetRandomEngine (CLHEP::HepRandomEngine *v) override
 
const std::vector< std::string > & 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_nFinalMode
 
int EV1_pTdefMode
 
int EV1_pTempMode
 
int EV1_pThardMode
 
int EV1_QEDvetoMode
 
bool EV1_vetoOn
 
double fBeam1PZ
 
double fBeam2PZ
 
std::shared_ptr< BiasedTauDecayerfBiasedTauDecayer
 
std::shared_ptr< PowhegHooks > fEmissionVetoHook
 
std::shared_ptr< EmissionVetoHook1fEmissionVetoHook1
 
int fInitialState
 
std::shared_ptr< JetMatchingHookfJetMatchingHook
 
std::shared_ptr< Pythia8::JetMatchingMadgraph > fJetMatchingPy8InternalHook
 
std::shared_ptr< Pythia8::amcnlo_unitarised_interface > fMergingHook
 
std::shared_ptr< PowhegHooksBB4LfPowhegHooksBB4L
 
std::shared_ptr< PowhegResHookfPowhegResHook
 
std::shared_ptr< PTFilterHookfPTFilterHook
 
std::shared_ptr< ResonanceDecayFilterHookfResonanceDecayFilterHook
 
std::shared_ptr< UserHooks > fReweightEmpUserHook
 
std::shared_ptr< UserHooks > fReweightPtHatRapUserHook
 
std::shared_ptr< UserHooks > fReweightRapUserHook
 
std::shared_ptr< UserHooks > fReweightUserHook
 
std::shared_ptr< UserHooksVector > fUserHooksVector
 
std::shared_ptr< LHAupLesHoucheslhaUP
 
std::string LHEInputFileName
 
int nFSRveto
 
int nISRveto
 
int nME
 
int nMEFiltered
 
bool UserHooksSet
 

Static Private Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from gen::BaseHadronizer
std::unique_ptr< HepMC::GenEvent > & event ()
 
std::unique_ptr< GenEventInfoProduct > & eventInfo ()
 
lhef::LHEEventlheEvent ()
 
lhef::LHERunInfolheRunInfo ()
 
GenRunInfoProductrunInfo ()
 
- Protected Attributes inherited from gen::Py8InterfaceBase
HepMC::IO_AsciiParticles * ascii_io
 
std::shared_ptr< Pythia8::EvtGenDecays > evtgenDecays
 
std::string evtgenDecFile
 
std::string evtgenPdlFile
 
std::vector< std::string > evtgenUserFiles
 
std::unique_ptr< Pythia8::Pythia > fDecayer
 
std::unique_ptr< Pythia8::Pythia > fMasterGen
 
edm::ParameterSet fParameters
 
unsigned int maxEventsToPrint
 
bool pythiaHepMCVerbosity
 
bool pythiaHepMCVerbosityParticles
 
unsigned int pythiaPylistVerbosity
 
std::string slhafile_
 
HepMC::Pythia8ToHepMC toHepMC
 
bool useEvtGen
 
- Protected Attributes inherited from gen::BaseHadronizer
std::string lheFile_
 
int randomIndex_
 

Detailed Description

Definition at line 76 of file Pythia8Hadronizer.cc.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
PP 
PPbar 
ElectronPositron 

Definition at line 107 of file Pythia8Hadronizer.cc.

Constructor & Destructor Documentation

◆ Pythia8Hadronizer()

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

Definition at line 171 of file Pythia8Hadronizer.cc.

173  comEnergy(params.getParameter<double>("comEnergy")),
174  LHEInputFileName(params.getUntrackedParameter<std::string>("LHEInputFileName", "")),
175  fInitialState(PP),
176  UserHooksSet(false),
177  nME(-1),
178  nMEFiltered(-1),
179  nISRveto(0),
180  nFSRveto(0) {
181  // J.Y.: the following 3 parameters are hacked "for a reason"
182  //
183  if (params.exists("PPbarInitialState")) {
184  if (fInitialState == PP) {
186  edm::LogImportant("GeneratorInterface|Pythia8Interface")
187  << "Pythia8 will be initialized for PROTON-ANTIPROTON INITIAL STATE. "
188  << "This is a user-request change from the DEFAULT PROTON-PROTON initial state.";
189  } else {
190  // probably need to throw on attempt to override ?
191  }
192  } else if (params.exists("ElectronPositronInitialState")) {
193  if (fInitialState == PP) {
195  edm::LogInfo("GeneratorInterface|Pythia8Interface")
196  << "Pythia8 will be initialized for ELECTRON-POSITRON INITIAL STATE. "
197  << "This is a user-request change from the DEFAULT PROTON-PROTON initial state.";
198  } else {
199  // probably need to throw on attempt to override ?
200  }
201  } else if (params.exists("ElectronProtonInitialState") || params.exists("PositronProtonInitialState")) {
202  // throw on unknown initial state !
203  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface")
204  << " UNKNOWN INITIAL STATE. \n The allowed initial states are: PP, PPbar, ElectronPositron \n";
205  }
206 
207  // Reweight user hook
208  //
209  if (params.exists("reweightGen")) {
210  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGen";
211  edm::ParameterSet rgParams = params.getParameter<edm::ParameterSet>("reweightGen");
212  fReweightUserHook.reset(
213  new PtHatReweightUserHook(rgParams.getParameter<double>("pTRef"), rgParams.getParameter<double>("power")));
214  edm::LogInfo("Pythia8Interface") << "End setup for reweightGen";
215  }
216  if (params.exists("reweightGenEmp")) {
217  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenEmp";
218  edm::ParameterSet rgeParams = params.getParameter<edm::ParameterSet>("reweightGenEmp");
219 
220  std::string tuneName = "";
221  if (rgeParams.exists("tune"))
222  tuneName = rgeParams.getParameter<std::string>("tune");
223  fReweightEmpUserHook.reset(new PtHatEmpReweightUserHook(tuneName));
224  edm::LogInfo("Pythia8Interface") << "End setup for reweightGenEmp";
225  }
226  if (params.exists("reweightGenRap")) {
227  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenRap";
228  edm::ParameterSet rgrParams = params.getParameter<edm::ParameterSet>("reweightGenRap");
229  fReweightRapUserHook.reset(new RapReweightUserHook(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
230  rgrParams.getParameter<double>("yLabPower"),
231  rgrParams.getParameter<std::string>("yCMSigmaFunc"),
232  rgrParams.getParameter<double>("yCMPower"),
233  rgrParams.getParameter<double>("pTHatMin"),
234  rgrParams.getParameter<double>("pTHatMax")));
235  edm::LogInfo("Pythia8Interface") << "End setup for reweightGenRap";
236  }
237  if (params.exists("reweightGenPtHatRap")) {
238  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenPtHatRap";
239  edm::ParameterSet rgrParams = params.getParameter<edm::ParameterSet>("reweightGenPtHatRap");
240  fReweightPtHatRapUserHook.reset(new PtHatRapReweightUserHook(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
241  rgrParams.getParameter<double>("yLabPower"),
242  rgrParams.getParameter<std::string>("yCMSigmaFunc"),
243  rgrParams.getParameter<double>("yCMPower"),
244  rgrParams.getParameter<double>("pTHatMin"),
245  rgrParams.getParameter<double>("pTHatMax")));
246  edm::LogInfo("Pythia8Interface") << "End setup for reweightGenPtHatRap";
247  }
248 
249  if (params.exists("useUserHook"))
250  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface")
251  << " Obsolete parameter: useUserHook \n Please use the actual one instead \n";
252 
253  // PS matching prototype
254  //
255  if (params.exists("jetMatching")) {
256  edm::ParameterSet jmParams = params.getUntrackedParameter<edm::ParameterSet>("jetMatching");
257  std::string scheme = jmParams.getParameter<std::string>("scheme");
258  if (scheme == "Madgraph" || scheme == "MadgraphFastJet") {
259  fJetMatchingHook.reset(new JetMatchingHook(jmParams, &fMasterGen->info));
260  }
261  }
262 
263  // Pythia8Interface emission veto
264  //
265  if (params.exists("emissionVeto1")) {
266  EV1_nFinal = -1;
267  if (params.exists("EV1_nFinal"))
268  EV1_nFinal = params.getParameter<int>("EV1_nFinal");
269  EV1_vetoOn = true;
270  if (params.exists("EV1_vetoOn"))
271  EV1_vetoOn = params.getParameter<bool>("EV1_vetoOn");
272  EV1_maxVetoCount = 10;
273  if (params.exists("EV1_maxVetoCount"))
274  EV1_maxVetoCount = params.getParameter<int>("EV1_maxVetoCount");
275  EV1_pThardMode = 1;
276  if (params.exists("EV1_pThardMode"))
277  EV1_pThardMode = params.getParameter<int>("EV1_pThardMode");
278  EV1_pTempMode = 0;
279  if (params.exists("EV1_pTempMode"))
280  EV1_pTempMode = params.getParameter<int>("EV1_pTempMode");
281  if (EV1_pTempMode > 2 || EV1_pTempMode < 0)
282  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface") << " Wrong value for EV1_pTempMode code\n";
283  EV1_emittedMode = 0;
284  if (params.exists("EV1_emittedMode"))
285  EV1_emittedMode = params.getParameter<int>("EV1_emittedMode");
286  EV1_pTdefMode = 1;
287  if (params.exists("EV1_pTdefMode"))
288  EV1_pTdefMode = params.getParameter<int>("EV1_pTdefMode");
289  EV1_MPIvetoOn = false;
290  if (params.exists("EV1_MPIvetoOn"))
291  EV1_MPIvetoOn = params.getParameter<bool>("EV1_MPIvetoOn");
292  EV1_QEDvetoMode = 0;
293  if (params.exists("EV1_QEDvetoMode"))
294  EV1_QEDvetoMode = params.getParameter<int>("EV1_QEDvetoMode");
295  EV1_nFinalMode = 0;
296  if (params.exists("EV1_nFinalMode"))
297  EV1_nFinalMode = params.getParameter<int>("EV1_nFinalMode");
299  EV1_vetoOn,
308  0));
309  }
310 
311  if (params.exists("VinciaPlugin")) {
312  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface")
313  << " Obsolete parameter: VinciaPlugin \n Please use the parameter PartonShowers:model instead \n";
314  }
315  if (params.exists("DirePlugin")) {
316  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface")
317  << " Obsolete parameter: DirePlugin \n Please use the parameter PartonShowers:model instead \n";
318  }
319 }

References edm::errors::Configuration, ElectronPositron, EV1_emittedMode, EV1_maxVetoCount, EV1_MPIvetoOn, EV1_nFinal, EV1_nFinalMode, EV1_pTdefMode, EV1_pTempMode, EV1_pThardMode, EV1_QEDvetoMode, EV1_vetoOn, Exception, edm::ParameterSet::exists(), fEmissionVetoHook1, fInitialState, fJetMatchingHook, gen::Py8InterfaceBase::fMasterGen, fReweightEmpUserHook, fReweightPtHatRapUserHook, fReweightRapUserHook, fReweightUserHook, edm::ParameterSet::getParameter(), CalibrationSummaryClient_cfi::params, PP, PPbar, generator_cfi::scheme, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~Pythia8Hadronizer()

Pythia8Hadronizer::~Pythia8Hadronizer ( )
override

Definition at line 321 of file Pythia8Hadronizer.cc.

321 {}

Member Function Documentation

◆ classname()

const char* Pythia8Hadronizer::classname ( ) const
inlineoverridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 93 of file Pythia8Hadronizer.cc.

93 { return "Pythia8Hadronizer"; }

◆ doSetRandomEngine()

void Pythia8Hadronizer::doSetRandomEngine ( CLHEP::HepRandomEngine *  v)
inlineoverrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 98 of file Pythia8Hadronizer.cc.

98 { p8SetRandomEngine(v); }

References findQualityFiles::v.

◆ doSharedResources()

const std::vector<std::string>& Pythia8Hadronizer::doSharedResources ( ) const
inlineoverrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 99 of file Pythia8Hadronizer.cc.

99 { return p8SharedResources; }

◆ finalizeEvent()

void Pythia8Hadronizer::finalizeEvent ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 896 of file Pythia8Hadronizer.cc.

896  {
897  bool lhe = lheEvent() != nullptr;
898 
899  // protection against empty weight container
900  if ((event()->weights()).empty())
901  (event()->weights()).push_back(1.);
902 
903  // now create the GenEventInfo product from the GenEvent and fill
904  // the missing pieces
905  eventInfo() = std::make_unique<GenEventInfoProduct>(event().get());
906 
907  // in pythia pthat is used to subdivide samples into different bins
908  // in LHE mode the binning is done by the external ME generator
909  // which is likely not pthat, so only filling it for Py6 internal mode
910  if (!lhe) {
911  eventInfo()->setBinningValues(std::vector<double>(1, fMasterGen->info.pTHat()));
912  }
913 
914  eventInfo()->setDJR(DJR);
915  eventInfo()->setNMEPartons(nME);
916  eventInfo()->setNMEPartonsFiltered(nMEFiltered);
917 
918  //******** Verbosity ********
919 
922  if (pythiaPylistVerbosity) {
923  fMasterGen->info.list();
924  fMasterGen->event.list();
925  }
926 
927  if (pythiaHepMCVerbosity) {
928  std::cout << "Event process = " << fMasterGen->info.code() << "\n"
929  << "----------------------" << std::endl;
930  event()->print();
931  }
933  std::cout << "Event process = " << fMasterGen->info.code() << "\n"
934  << "----------------------" << std::endl;
935  ascii_io->write_event(event().get());
936  }
937  }
938 }

References gen::Py8InterfaceBase::ascii_io, gather_cfg::cout, DJR, relativeConstraints::empty, gen::BaseHadronizer::event(), gen::BaseHadronizer::eventInfo(), gen::Py8InterfaceBase::fMasterGen, get, gen::BaseHadronizer::lheEvent(), gen::Py8InterfaceBase::maxEventsToPrint, nME, nMEFiltered, gen::Py8InterfaceBase::pythiaHepMCVerbosity, gen::Py8InterfaceBase::pythiaHepMCVerbosityParticles, gen::Py8InterfaceBase::pythiaPylistVerbosity, and HLT_FULL_cff::weights.

◆ generatePartonsAndHadronize()

bool Pythia8Hadronizer::generatePartonsAndHadronize ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 664 of file Pythia8Hadronizer.cc.

664  {
665  DJR.resize(0);
666  nME = -1;
667  nMEFiltered = -1;
668 
669  if (fJetMatchingHook.get()) {
670  fJetMatchingHook->resetMatchingStatus();
671  fJetMatchingHook->beforeHadronization(lheEvent());
672  }
673 
674  if (!fMasterGen->next())
675  return false;
676 
677  double mergeweight = fMasterGen.get()->info.mergingWeightNLO();
678  if (fMergingHook.get()) {
679  mergeweight *= fMergingHook->getNormFactor();
680  }
681 
682  //protect against 0-weight from ckkw or similar
683  if (std::abs(mergeweight) == 0.) {
684  event().reset();
685  return false;
686  }
687 
688  if (fJetMatchingPy8InternalHook.get()) {
689  const std::vector<double> djrmatch = fJetMatchingPy8InternalHook->getDJR();
690  //cap size of djr vector to save storage space (keep only up to first 6 elements)
691  unsigned int ndjr = std::min(djrmatch.size(), std::vector<double>::size_type(6));
692  for (unsigned int idjr = 0; idjr < ndjr; ++idjr) {
693  DJR.push_back(djrmatch[idjr]);
694  }
695 
696  nME = fJetMatchingPy8InternalHook->nMEpartons().first;
697  nMEFiltered = fJetMatchingPy8InternalHook->nMEpartons().second;
698  }
699 
700  if (evtgenDecays.get())
701  evtgenDecays->decay();
702 
703  event() = std::make_unique<HepMC::GenEvent>();
704  bool py8hepmc = toHepMC.fill_next_event(*(fMasterGen.get()), event().get());
705 
706  if (!py8hepmc) {
707  return false;
708  }
709 
710  //add ckkw/umeps/unlops merging weight
711  if (mergeweight != 1.) {
712  event()->weights()[0] *= mergeweight;
713  }
714 
715  if (fEmissionVetoHook.get()) {
716  nISRveto += fEmissionVetoHook->getNISRveto();
717  nFSRveto += fEmissionVetoHook->getNFSRveto();
718  }
719 
720  //fill additional weights for systematic uncertainties
721  if (fMasterGen->info.getWeightsDetailedSize() > 0) {
722  for (const string &key : fMasterGen->info.initrwgt->weightsKeys) {
723  double wgt = (*fMasterGen->info.weights_detailed)[key];
724  event()->weights().push_back(wgt);
725  }
726  } else if (fMasterGen->info.getWeightsCompressedSize() > 0) {
727  for (unsigned int i = 0; i < fMasterGen->info.getWeightsCompressedSize(); i++) {
728  double wgt = fMasterGen->info.getWeightsCompressedValue(i);
729  event()->weights().push_back(wgt);
730  }
731  }
732 
733  // fill shower weights
734  // http://home.thep.lu.se/~torbjorn/pythia82html/Variations.html
735  if (fMasterGen->info.nWeights() > 1) {
736  for (int i = 0; i < fMasterGen->info.nWeights(); ++i) {
737  double wgt = fMasterGen->info.weight(i);
738  event()->weights().push_back(wgt);
739  }
740  }
741 
742 #if 0
743  // VINCIA shower weights
744  // http://vincia.hepforge.org/current/share/Vincia/htmldoc/VinciaUncertainties.html
745  if (fvincia.get()) {
746  event()->weights()[0] *= fvincia->weight(0);
747  for (int iVar = 1; iVar < fvincia->nWeights(); iVar++) {
748  event()->weights().push_back(fvincia->weight(iVar));
749  }
750  }
751 
752  // Retrieve Dire shower weights
753  if (fDire.get()) {
754  fDire->weightsPtr->calcWeight(0.);
755  fDire->weightsPtr->reset();
756 
757  //Make sure the base weight comes first
758  event()->weights()[0] *= fDire->weightsPtr->getShowerWeight("base");
759 
760  unordered_map<string, double>::iterator it;
761  for (it = fDire->weightsPtr->getShowerWeights()->begin(); it != fDire->weightsPtr->getShowerWeights()->end();
762  it++) {
763  if (it->first == "base")
764  continue;
765  event()->weights().push_back(it->second);
766  }
767  }
768 #endif
769 
770  return true;
771 }

References funct::abs(), DJR, gen::BaseHadronizer::event(), gen::Py8InterfaceBase::evtgenDecays, fEmissionVetoHook, fJetMatchingHook, fJetMatchingPy8InternalHook, gen::Py8InterfaceBase::fMasterGen, fMergingHook, mps_fire::i, crabWrapper::key, gen::BaseHadronizer::lheEvent(), min(), nFSRveto, nISRveto, nME, nMEFiltered, and gen::Py8InterfaceBase::toHepMC.

◆ getGenLumiInfoHeader()

std::unique_ptr< GenLumiInfoHeader > Pythia8Hadronizer::getGenLumiInfoHeader ( ) const
overridevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 940 of file Pythia8Hadronizer.cc.

940  {
941  auto genLumiInfoHeader = BaseHadronizer::getGenLumiInfoHeader();
942 
943  //fill lhe headers
944  //*FIXME* initrwgt header is corrupt due to pythia bug
945  for (const std::string &key : fMasterGen->info.headerKeys()) {
946  genLumiInfoHeader->lheHeaders().emplace_back(key, fMasterGen->info.header(key));
947  }
948 
949  //check, if it is not only nominal weight
950  int weights_number = fMasterGen->info.nWeights();
951  if (fMasterGen->info.initrwgt)
952  weights_number += fMasterGen->info.initrwgt->weightsKeys.size();
953  if (weights_number > 1) {
954  genLumiInfoHeader->weightNames().reserve(weights_number + 1);
955  genLumiInfoHeader->weightNames().push_back("nominal");
956  }
957 
958  //fill weight names
959  if (fMasterGen->info.initrwgt) {
960  for (const std::string &key : fMasterGen->info.initrwgt->weightsKeys) {
961  std::string weightgroupname;
962  for (const auto &wgtgrp : fMasterGen->info.initrwgt->weightgroups) {
963  const auto &wgtgrpwgt = wgtgrp.second.weights.find(key);
964  if (wgtgrpwgt != wgtgrp.second.weights.end()) {
965  weightgroupname = wgtgrp.first;
966  }
967  }
968 
969  std::ostringstream weightname;
970  weightname << "LHE, id = " << key << ", ";
971  if (!weightgroupname.empty()) {
972  weightname << "group = " << weightgroupname << ", ";
973  }
974  weightname << fMasterGen->info.initrwgt->weights[key].contents;
975  genLumiInfoHeader->weightNames().push_back(weightname.str());
976  }
977  }
978 
979  //fill shower labels
980  // http://home.thep.lu.se/~torbjorn/pythia82html/Variations.html
981  // http://home.thep.lu.se/~torbjorn/doxygen/classPythia8_1_1Info.html
982  if (fMasterGen->info.nWeights() > 1) {
983  for (int i = 0; i < fMasterGen->info.nWeights(); ++i) {
984  genLumiInfoHeader->weightNames().push_back(fMasterGen->info.weightLabel(i));
985  }
986  }
987 
988 #if 0
989  // VINCIA shower weights
990  // http://vincia.hepforge.org/current/share/Vincia/htmldoc/VinciaUncertainties.html
991  if (fvincia.get()) {
992  for (int iVar = 0; iVar < fvincia->nWeights(); iVar++) {
993  genLumiInfoHeader->weightNames().push_back(fvincia->weightLabel(iVar));
994  }
995  }
996 
997  if (fDire.get()) {
998  //Make sure the base weight comes first
999  genLumiInfoHeader->weightNames().push_back("base");
1000 
1001  unordered_map<string, double>::iterator it;
1002  for (it = fDire->weightsPtr->getShowerWeights()->begin(); it != fDire->weightsPtr->getShowerWeights()->end();
1003  it++) {
1004  if (it->first == "base")
1005  continue;
1006  genLumiInfoHeader->weightNames().push_back(it->first);
1007  }
1008  }
1009 #endif
1010 
1011  return genLumiInfoHeader;
1012 }

References gen::Py8InterfaceBase::fMasterGen, genWeightsTable_cfi::genLumiInfoHeader, mps_fire::i, crabWrapper::key, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ hadronize()

bool Pythia8Hadronizer::hadronize ( )

Definition at line 773 of file Pythia8Hadronizer.cc.

773  {
774  DJR.resize(0);
775  nME = -1;
776  nMEFiltered = -1;
777  if (LHEInputFileName.empty())
778  lhaUP->loadEvent(lheEvent());
779 
780  if (fJetMatchingHook.get()) {
781  fJetMatchingHook->resetMatchingStatus();
782  fJetMatchingHook->beforeHadronization(lheEvent());
783  }
784 
785  bool py8next = fMasterGen->next();
786 
787  double mergeweight = fMasterGen.get()->info.mergingWeightNLO();
788  if (fMergingHook.get()) {
789  mergeweight *= fMergingHook->getNormFactor();
790  }
791 
792  //protect against 0-weight from ckkw or similar
793  if (!py8next || std::abs(mergeweight) == 0.) {
794  lheEvent()->count(lhef::LHERunInfo::kSelected, 1.0, mergeweight);
795  event().reset();
796  return false;
797  }
798 
799  if (fJetMatchingPy8InternalHook.get()) {
800  const std::vector<double> djrmatch = fJetMatchingPy8InternalHook->getDJR();
801  //cap size of djr vector to save storage space (keep only up to first 6 elements)
802  unsigned int ndjr = std::min(djrmatch.size(), std::vector<double>::size_type(6));
803  for (unsigned int idjr = 0; idjr < ndjr; ++idjr) {
804  DJR.push_back(djrmatch[idjr]);
805  }
806 
807  nME = fJetMatchingPy8InternalHook->nMEpartons().first;
808  nMEFiltered = fJetMatchingPy8InternalHook->nMEpartons().second;
809  }
810 
811  // update LHE matching statistics
812  //
813  lheEvent()->count(lhef::LHERunInfo::kAccepted, 1.0, mergeweight);
814 
815  if (evtgenDecays.get())
816  evtgenDecays->decay();
817 
818  event() = std::make_unique<HepMC::GenEvent>();
819  bool py8hepmc = toHepMC.fill_next_event(*(fMasterGen.get()), event().get());
820  if (!py8hepmc) {
821  return false;
822  }
823 
824  //add ckkw/umeps/unlops merging weight
825  if (mergeweight != 1.) {
826  event()->weights()[0] *= mergeweight;
827  }
828 
829  if (fEmissionVetoHook.get()) {
830  nISRveto += fEmissionVetoHook->getNISRveto();
831  nFSRveto += fEmissionVetoHook->getNFSRveto();
832  }
833 
834  // fill shower weights
835  // http://home.thep.lu.se/~torbjorn/pythia82html/Variations.html
836  if (fMasterGen->info.nWeights() > 1) {
837  for (int i = 0; i < fMasterGen->info.nWeights(); ++i) {
838  double wgt = fMasterGen->info.weight(i);
839  event()->weights().push_back(wgt);
840  }
841  }
842 
843  return true;
844 }

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

◆ initializeForExternalPartons()

bool Pythia8Hadronizer::initializeForExternalPartons ( )

Definition at line 486 of file Pythia8Hadronizer.cc.

486  {
487  edm::LogInfo("Pythia8Interface") << "Initializing for external partons";
488 
489  bool status = false, status1 = false;
490 
491  if (!fUserHooksVector.get())
492  fUserHooksVector.reset(new UserHooksVector);
493  (fUserHooksVector->hooks).clear();
494 
495  if (fReweightUserHook.get())
496  (fUserHooksVector->hooks).push_back(fReweightUserHook);
497  if (fReweightEmpUserHook.get())
498  (fUserHooksVector->hooks).push_back(fReweightEmpUserHook);
499  if (fReweightRapUserHook.get())
500  (fUserHooksVector->hooks).push_back(fReweightRapUserHook);
501  if (fReweightPtHatRapUserHook.get())
502  (fUserHooksVector->hooks).push_back(fReweightPtHatRapUserHook);
503  if (fJetMatchingHook.get())
504  (fUserHooksVector->hooks).push_back(fJetMatchingHook);
505  if (fEmissionVetoHook1.get()) {
506  edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook 1 from CMSSW Pythia8Interface";
507  (fUserHooksVector->hooks).push_back(fEmissionVetoHook1);
508  }
509 
510  if (fMasterGen->settings.mode("POWHEG:veto") > 0 || fMasterGen->settings.mode("POWHEG:MPIveto") > 0) {
511  if (fJetMatchingHook.get() || fEmissionVetoHook1.get())
512  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface")
513  << " Attempt to turn on PowhegHooks by pythia8 settings but there are incompatible hooks on \n Incompatible "
514  "are : jetMatching, emissionVeto1 \n";
515 
516  if (!fEmissionVetoHook.get())
517  fEmissionVetoHook.reset(new PowhegHooks());
518 
519  edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook from pythia8 code";
520  (fUserHooksVector->hooks).push_back(fEmissionVetoHook);
521  }
522 
523  bool PowhegRes = fMasterGen->settings.flag("POWHEGres:calcScales");
524  if (PowhegRes) {
525  edm::LogInfo("Pythia8Interface") << "Turning on resonance scale setting from CMSSW Pythia8Interface";
526  if (!fPowhegResHook.get())
527  fPowhegResHook.reset(new PowhegResHook());
528  (fUserHooksVector->hooks).push_back(fPowhegResHook);
529  }
530 
531  bool PowhegBB4L = fMasterGen->settings.flag("POWHEG:bb4l");
532  if (PowhegBB4L) {
533  edm::LogInfo("Pythia8Interface") << "Turning on BB4l hook from CMSSW Pythia8Interface";
534  if (!fPowhegHooksBB4L.get())
535  fPowhegHooksBB4L.reset(new PowhegHooksBB4L());
536  (fUserHooksVector->hooks).push_back(fPowhegHooksBB4L);
537  }
538 
539  //adapted from main89.cc in pythia8 examples
540  bool internalMatching = fMasterGen->settings.flag("JetMatching:merge");
541  bool internalMerging = !(fMasterGen->settings.word("Merging:Process") == "void");
542 
543  if (internalMatching && internalMerging) {
544  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface")
545  << " Only one jet matching/merging scheme can be used at a time. \n";
546  }
547 
548  if (internalMatching) {
549  if (!fJetMatchingPy8InternalHook.get())
550  fJetMatchingPy8InternalHook.reset(new Pythia8::JetMatchingMadgraph);
551  (fUserHooksVector->hooks).push_back(fJetMatchingPy8InternalHook);
552  }
553 
554  if (internalMerging) {
555  int scheme = (fMasterGen->settings.flag("Merging:doUMEPSTree") || fMasterGen->settings.flag("Merging:doUMEPSSubt"))
556  ? 1
557  : ((fMasterGen->settings.flag("Merging:doUNLOPSTree") ||
558  fMasterGen->settings.flag("Merging:doUNLOPSSubt") ||
559  fMasterGen->settings.flag("Merging:doUNLOPSLoop") ||
560  fMasterGen->settings.flag("Merging:doUNLOPSSubtNLO"))
561  ? 2
562  : 0);
563  if (!fMergingHook.get())
564  fMergingHook.reset(new Pythia8::amcnlo_unitarised_interface(scheme));
565  (fUserHooksVector->hooks).push_back(fMergingHook);
566  }
567 
568  bool biasedTauDecayer = fMasterGen->settings.flag("BiasedTauDecayer:filter");
569  if (biasedTauDecayer) {
570  if (!fBiasedTauDecayer.get()) {
571  Pythia8::Info localInfo = fMasterGen->info;
572  fBiasedTauDecayer.reset(new BiasedTauDecayer(&localInfo, &(fMasterGen->settings)));
573  }
574  std::vector<int> handledParticles;
575  handledParticles.push_back(15);
576  fMasterGen->setDecayPtr(fBiasedTauDecayer, handledParticles);
577  }
578 
579  bool resonanceDecayFilter = fMasterGen->settings.flag("ResonanceDecayFilter:filter");
580  if (resonanceDecayFilter) {
582  (fUserHooksVector->hooks).push_back(fResonanceDecayFilterHook);
583  }
584 
585  bool PTFilter = fMasterGen->settings.flag("PTFilter:filter");
586  if (PTFilter) {
587  fPTFilterHook.reset(new PTFilterHook);
588  (fUserHooksVector->hooks).push_back(fPTFilterHook);
589  }
590 
591  if (!(fUserHooksVector->hooks).empty() && !UserHooksSet) {
592  fMasterGen->setUserHooksPtr(fUserHooksVector);
593  UserHooksSet = true;
594  }
595 
596  if (!LHEInputFileName.empty()) {
597  edm::LogInfo("Pythia8Interface") << "Initialize direct pythia8 reading from LHE file " << LHEInputFileName;
598  edm::LogInfo("Pythia8Interface") << "Some LHE information can be not stored";
599  fMasterGen->settings.mode("Beams:frameType", 4);
600  fMasterGen->settings.word("Beams:LHEF", LHEInputFileName);
601  status = fMasterGen->init();
602 
603  } else {
604  lhaUP.reset(new LHAupLesHouches());
605  lhaUP->setScalesFromLHEF(fMasterGen->settings.flag("Beams:setProductionScalesFromLHEF"));
606  lhaUP->loadRunInfo(lheRunInfo());
607 
608  if (fJetMatchingHook.get()) {
609  fJetMatchingHook->init(lheRunInfo());
610  }
611 
612  fMasterGen->settings.mode("Beams:frameType", 5);
613  fMasterGen->setLHAupPtr(lhaUP);
614  edm::LogInfo("Pythia8Interface") << "Initializing MasterGen";
615  status = fMasterGen->init();
616  }
617 
618  //clean up temp file
619  if (!slhafile_.empty()) {
620  std::remove(slhafile_.c_str());
621  }
622 
623  if (pythiaPylistVerbosity > 10) {
624  if (pythiaPylistVerbosity == 11 || pythiaPylistVerbosity == 13)
625  fMasterGen->settings.listAll();
626  if (pythiaPylistVerbosity == 12 || pythiaPylistVerbosity == 13)
627  fMasterGen->particleData.listAll();
628  }
629 
630  // init decayer
631  fDecayer->settings.flag("ProcessLevel:all", false); // trick
632  fDecayer->settings.flag("ProcessLevel:resonanceDecays", true);
633  edm::LogInfo("Pythia8Interface") << "Initializing Decayer";
634  status1 = fDecayer->init();
635 
636  if (useEvtGen) {
637  edm::LogInfo("Pythia8Hadronizer") << "Creating and initializing pythia8 EvtGen plugin";
638  if (!evtgenDecays.get()) {
639  evtgenDecays.reset(new EvtGenDecays(fMasterGen.get(), evtgenDecFile, evtgenPdlFile));
640  for (unsigned int i = 0; i < evtgenUserFiles.size(); i++)
641  evtgenDecays->readDecayFile(evtgenUserFiles.at(i));
642  }
643  }
644 
645  return (status && status1);
646 }

References clear(), edm::errors::Configuration, gen::Py8InterfaceBase::evtgenDecays, gen::Py8InterfaceBase::evtgenDecFile, gen::Py8InterfaceBase::evtgenPdlFile, gen::Py8InterfaceBase::evtgenUserFiles, Exception, fBiasedTauDecayer, gen::Py8InterfaceBase::fDecayer, fEmissionVetoHook, fEmissionVetoHook1, fJetMatchingHook, fJetMatchingPy8InternalHook, gen::Py8InterfaceBase::fMasterGen, fMergingHook, fPowhegHooksBB4L, fPowhegResHook, fPTFilterHook, fResonanceDecayFilterHook, fReweightEmpUserHook, fReweightPtHatRapUserHook, fReweightRapUserHook, fReweightUserHook, fUserHooksVector, mps_fire::i, lhaUP, LHEInputFileName, gen::BaseHadronizer::lheRunInfo(), gen::Py8InterfaceBase::pythiaPylistVerbosity, MatrixUtil::remove(), generator_cfi::scheme, gen::Py8InterfaceBase::slhafile_, mps_update::status, gen::Py8InterfaceBase::useEvtGen, and UserHooksSet.

◆ initializeForInternalPartons()

bool Pythia8Hadronizer::initializeForInternalPartons ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 323 of file Pythia8Hadronizer.cc.

323  {
324  bool status = false, status1 = false;
325 
326  if (lheFile_.empty()) {
327  if (fInitialState == PP) // default
328  {
329  fMasterGen->settings.mode("Beams:idA", 2212);
330  fMasterGen->settings.mode("Beams:idB", 2212);
331  } else if (fInitialState == PPbar) {
332  fMasterGen->settings.mode("Beams:idA", 2212);
333  fMasterGen->settings.mode("Beams:idB", -2212);
334  } else if (fInitialState == ElectronPositron) {
335  fMasterGen->settings.mode("Beams:idA", 11);
336  fMasterGen->settings.mode("Beams:idB", -11);
337  } else {
338  // throw on unknown initial state !
339  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface")
340  << " UNKNOWN INITIAL STATE. \n The allowed initial states are: PP, PPbar, ElectronPositron \n";
341  }
342  fMasterGen->settings.parm("Beams:eCM", comEnergy);
343  } else {
344  fMasterGen->settings.mode("Beams:frameType", 4);
345  fMasterGen->settings.word("Beams:LHEF", lheFile_);
346  }
347 
348  if (!fUserHooksVector.get())
349  fUserHooksVector.reset(new UserHooksVector);
350  (fUserHooksVector->hooks).clear();
351 
352  if (fReweightUserHook.get())
353  (fUserHooksVector->hooks).push_back(fReweightUserHook);
354  if (fReweightEmpUserHook.get())
355  (fUserHooksVector->hooks).push_back(fReweightEmpUserHook);
356  if (fReweightRapUserHook.get())
357  (fUserHooksVector->hooks).push_back(fReweightRapUserHook);
358  if (fReweightPtHatRapUserHook.get())
359  (fUserHooksVector->hooks).push_back(fReweightPtHatRapUserHook);
360  if (fJetMatchingHook.get())
361  (fUserHooksVector->hooks).push_back(fJetMatchingHook);
362  if (fEmissionVetoHook1.get()) {
363  edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook 1 from CMSSW Pythia8Interface";
364  (fUserHooksVector->hooks).push_back(fEmissionVetoHook1);
365  }
366 
367  if (fMasterGen->settings.mode("POWHEG:veto") > 0 || fMasterGen->settings.mode("POWHEG:MPIveto") > 0) {
368  if (fJetMatchingHook.get() || fEmissionVetoHook1.get())
369  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface")
370  << " Attempt to turn on PowhegHooks by pythia8 settings but there are incompatible hooks on \n Incompatible "
371  "are : jetMatching, emissionVeto1 \n";
372 
373  if (!fEmissionVetoHook.get())
374  fEmissionVetoHook.reset(new PowhegHooks());
375 
376  edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook from pythia8 code";
377  (fUserHooksVector->hooks).push_back(fEmissionVetoHook);
378  }
379 
380  bool PowhegRes = fMasterGen->settings.flag("POWHEGres:calcScales");
381  if (PowhegRes) {
382  edm::LogInfo("Pythia8Interface") << "Turning on resonance scale setting from CMSSW Pythia8Interface";
383  if (!fPowhegResHook.get())
384  fPowhegResHook.reset(new PowhegResHook());
385  (fUserHooksVector->hooks).push_back(fPowhegResHook);
386  }
387 
388  bool PowhegBB4L = fMasterGen->settings.flag("POWHEG:bb4l");
389  if (PowhegBB4L) {
390  edm::LogInfo("Pythia8Interface") << "Turning on BB4l hook from CMSSW Pythia8Interface";
391  if (!fPowhegHooksBB4L.get())
392  fPowhegHooksBB4L.reset(new PowhegHooksBB4L());
393  (fUserHooksVector->hooks).push_back(fPowhegHooksBB4L);
394  }
395 
396  //adapted from main89.cc in pythia8 examples
397  bool internalMatching = fMasterGen->settings.flag("JetMatching:merge");
398  bool internalMerging = !(fMasterGen->settings.word("Merging:Process") == "void");
399 
400  if (internalMatching && internalMerging) {
401  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface")
402  << " Only one jet matching/merging scheme can be used at a time. \n";
403  }
404 
405  if (internalMatching) {
406  if (!fJetMatchingPy8InternalHook.get())
407  fJetMatchingPy8InternalHook.reset(new Pythia8::JetMatchingMadgraph);
408  (fUserHooksVector->hooks).push_back(fJetMatchingPy8InternalHook);
409  }
410 
411  if (internalMerging) {
412  int scheme = (fMasterGen->settings.flag("Merging:doUMEPSTree") || fMasterGen->settings.flag("Merging:doUMEPSSubt"))
413  ? 1
414  : ((fMasterGen->settings.flag("Merging:doUNLOPSTree") ||
415  fMasterGen->settings.flag("Merging:doUNLOPSSubt") ||
416  fMasterGen->settings.flag("Merging:doUNLOPSLoop") ||
417  fMasterGen->settings.flag("Merging:doUNLOPSSubtNLO"))
418  ? 2
419  : 0);
420  if (!fMergingHook.get())
421  fMergingHook.reset(new Pythia8::amcnlo_unitarised_interface(scheme));
422  (fUserHooksVector->hooks).push_back(fMergingHook);
423  }
424 
425  bool biasedTauDecayer = fMasterGen->settings.flag("BiasedTauDecayer:filter");
426  if (biasedTauDecayer) {
427  if (!fBiasedTauDecayer.get()) {
428  Pythia8::Info localInfo = fMasterGen->info;
429  fBiasedTauDecayer.reset(new BiasedTauDecayer(&localInfo, &(fMasterGen->settings)));
430  }
431  std::vector<int> handledParticles;
432  handledParticles.push_back(15);
433  fMasterGen->setDecayPtr(fBiasedTauDecayer, handledParticles);
434  }
435 
436  bool resonanceDecayFilter = fMasterGen->settings.flag("ResonanceDecayFilter:filter");
437  if (resonanceDecayFilter) {
439  (fUserHooksVector->hooks).push_back(fResonanceDecayFilterHook);
440  }
441 
442  bool PTFilter = fMasterGen->settings.flag("PTFilter:filter");
443  if (PTFilter) {
444  fPTFilterHook.reset(new PTFilterHook);
445  (fUserHooksVector->hooks).push_back(fPTFilterHook);
446  }
447 
448  if (!(fUserHooksVector->hooks).empty() && !UserHooksSet) {
449  fMasterGen->setUserHooksPtr(fUserHooksVector);
450  UserHooksSet = true;
451  }
452 
453  edm::LogInfo("Pythia8Interface") << "Initializing MasterGen";
454  status = fMasterGen->init();
455 
456  //clean up temp file
457  if (!slhafile_.empty()) {
458  std::remove(slhafile_.c_str());
459  }
460 
461  if (pythiaPylistVerbosity > 10) {
462  if (pythiaPylistVerbosity == 11 || pythiaPylistVerbosity == 13)
463  fMasterGen->settings.listAll();
464  if (pythiaPylistVerbosity == 12 || pythiaPylistVerbosity == 13)
465  fMasterGen->particleData.listAll();
466  }
467 
468  // init decayer
469  fDecayer->settings.flag("ProcessLevel:all", false); // trick
470  fDecayer->settings.flag("ProcessLevel:resonanceDecays", true);
471  edm::LogInfo("Pythia8Interface") << "Initializing Decayer";
472  status1 = fDecayer->init();
473 
474  if (useEvtGen) {
475  edm::LogInfo("Pythia8Hadronizer") << "Creating and initializing pythia8 EvtGen plugin";
476  if (!evtgenDecays.get()) {
477  evtgenDecays.reset(new EvtGenDecays(fMasterGen.get(), evtgenDecFile, evtgenPdlFile));
478  for (unsigned int i = 0; i < evtgenUserFiles.size(); i++)
479  evtgenDecays->readDecayFile(evtgenUserFiles.at(i));
480  }
481  }
482 
483  return (status && status1);
484 }

References clear(), comEnergy, edm::errors::Configuration, ElectronPositron, gen::Py8InterfaceBase::evtgenDecays, gen::Py8InterfaceBase::evtgenDecFile, gen::Py8InterfaceBase::evtgenPdlFile, gen::Py8InterfaceBase::evtgenUserFiles, Exception, fBiasedTauDecayer, gen::Py8InterfaceBase::fDecayer, fEmissionVetoHook, fEmissionVetoHook1, fInitialState, fJetMatchingHook, fJetMatchingPy8InternalHook, gen::Py8InterfaceBase::fMasterGen, fMergingHook, fPowhegHooksBB4L, fPowhegResHook, fPTFilterHook, fResonanceDecayFilterHook, fReweightEmpUserHook, fReweightPtHatRapUserHook, fReweightRapUserHook, fReweightUserHook, fUserHooksVector, mps_fire::i, gen::BaseHadronizer::lheFile_, PP, PPbar, gen::Py8InterfaceBase::pythiaPylistVerbosity, MatrixUtil::remove(), generator_cfi::scheme, gen::Py8InterfaceBase::slhafile_, mps_update::status, gen::Py8InterfaceBase::useEvtGen, and UserHooksSet.

◆ residualDecay()

bool Pythia8Hadronizer::residualDecay ( )
virtual

Definition at line 846 of file Pythia8Hadronizer.cc.

846  {
847  Event *pythiaEvent = &(fMasterGen->event);
848 
849  int NPartsBeforeDecays = pythiaEvent->size();
850  int NPartsAfterDecays = event().get()->particles_size();
851 
852  if (NPartsAfterDecays == NPartsBeforeDecays)
853  return true;
854 
855  bool result = true;
856 
857  for (int ipart = NPartsAfterDecays; ipart > NPartsBeforeDecays; ipart--) {
858  HepMC::GenParticle *part = event().get()->barcode_to_particle(ipart);
859 
860  if (part->status() == 1 && (fDecayer->particleData).canDecay(part->pdg_id())) {
861  fDecayer->event.reset();
862  Particle py8part(part->pdg_id(),
863  93,
864  0,
865  0,
866  0,
867  0,
868  0,
869  0,
870  part->momentum().x(),
871  part->momentum().y(),
872  part->momentum().z(),
873  part->momentum().t(),
874  part->generated_mass());
875  HepMC::GenVertex *ProdVtx = part->production_vertex();
876  py8part.vProd(ProdVtx->position().x(), ProdVtx->position().y(), ProdVtx->position().z(), ProdVtx->position().t());
877  py8part.tau((fDecayer->particleData).tau0(part->pdg_id()));
878  fDecayer->event.append(py8part);
879  int nentries = fDecayer->event.size();
880  if (!fDecayer->event[nentries - 1].mayDecay())
881  continue;
882  fDecayer->next();
883  int nentries1 = fDecayer->event.size();
884  if (nentries1 <= nentries)
885  continue; //same number of particles, no decays...
886 
887  part->set_status(2);
888 
889  result = toHepMC.fill_next_event(*(fDecayer.get()), event().get(), -1, true, part);
890  }
891  }
892 
893  return result;
894 }

References gen::BaseHadronizer::event(), gen::Py8InterfaceBase::fDecayer, gen::Py8InterfaceBase::fMasterGen, GenParticle::GenParticle, mps_fire::result, and gen::Py8InterfaceBase::toHepMC.

◆ statistics()

void Pythia8Hadronizer::statistics ( )
overridevirtual

Reimplemented from gen::Py8InterfaceBase.

Definition at line 648 of file Pythia8Hadronizer.cc.

648  {
649  fMasterGen->stat();
650 
651  if (fEmissionVetoHook.get()) {
652  edm::LogPrint("Pythia8Interface") << "\n"
653  << "Number of ISR vetoed = " << nISRveto;
654  edm::LogPrint("Pythia8Interface") << "Number of FSR vetoed = " << nFSRveto;
655  }
656 
657  double xsec = fMasterGen->info.sigmaGen(); // cross section in mb
658  xsec *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
659  double err = fMasterGen->info.sigmaErr(); // cross section err in mb
660  err *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
662 }

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

Member Data Documentation

◆ comEnergy

double Pythia8Hadronizer::comEnergy
private

Center-of-Mass energy.

Definition at line 102 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons().

◆ DJR

vector<float> Pythia8Hadronizer::DJR
private

Definition at line 161 of file Pythia8Hadronizer.cc.

Referenced by finalizeEvent(), generatePartonsAndHadronize(), and hadronize().

◆ EV1_emittedMode

int Pythia8Hadronizer::EV1_emittedMode
private

Definition at line 153 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_maxVetoCount

int Pythia8Hadronizer::EV1_maxVetoCount
private

Definition at line 150 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_MPIvetoOn

bool Pythia8Hadronizer::EV1_MPIvetoOn
private

Definition at line 155 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_nFinal

int Pythia8Hadronizer::EV1_nFinal
private

Definition at line 148 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_nFinalMode

int Pythia8Hadronizer::EV1_nFinalMode
private

Definition at line 157 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_pTdefMode

int Pythia8Hadronizer::EV1_pTdefMode
private

Definition at line 154 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_pTempMode

int Pythia8Hadronizer::EV1_pTempMode
private

Definition at line 152 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_pThardMode

int Pythia8Hadronizer::EV1_pThardMode
private

Definition at line 151 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_QEDvetoMode

int Pythia8Hadronizer::EV1_QEDvetoMode
private

Definition at line 156 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_vetoOn

bool Pythia8Hadronizer::EV1_vetoOn
private

Definition at line 149 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ fBeam1PZ

double Pythia8Hadronizer::fBeam1PZ
private

Definition at line 110 of file Pythia8Hadronizer.cc.

◆ fBeam2PZ

double Pythia8Hadronizer::fBeam2PZ
private

Definition at line 111 of file Pythia8Hadronizer.cc.

◆ fBiasedTauDecayer

std::shared_ptr<BiasedTauDecayer> Pythia8Hadronizer::fBiasedTauDecayer
private

◆ fEmissionVetoHook

std::shared_ptr<PowhegHooks> Pythia8Hadronizer::fEmissionVetoHook
private

◆ fEmissionVetoHook1

std::shared_ptr<EmissionVetoHook1> Pythia8Hadronizer::fEmissionVetoHook1
private

◆ fInitialState

int Pythia8Hadronizer::fInitialState
private

Definition at line 108 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons(), and Pythia8Hadronizer().

◆ fJetMatchingHook

std::shared_ptr<JetMatchingHook> Pythia8Hadronizer::fJetMatchingHook
private

◆ fJetMatchingPy8InternalHook

std::shared_ptr<Pythia8::JetMatchingMadgraph> Pythia8Hadronizer::fJetMatchingPy8InternalHook
private

◆ fMergingHook

std::shared_ptr<Pythia8::amcnlo_unitarised_interface> Pythia8Hadronizer::fMergingHook
private

◆ fPowhegHooksBB4L

std::shared_ptr<PowhegHooksBB4L> Pythia8Hadronizer::fPowhegHooksBB4L
private

◆ fPowhegResHook

std::shared_ptr<PowhegResHook> Pythia8Hadronizer::fPowhegResHook
private

◆ fPTFilterHook

std::shared_ptr<PTFilterHook> Pythia8Hadronizer::fPTFilterHook
private

◆ fResonanceDecayFilterHook

std::shared_ptr<ResonanceDecayFilterHook> Pythia8Hadronizer::fResonanceDecayFilterHook
private

◆ fReweightEmpUserHook

std::shared_ptr<UserHooks> Pythia8Hadronizer::fReweightEmpUserHook
private

◆ fReweightPtHatRapUserHook

std::shared_ptr<UserHooks> Pythia8Hadronizer::fReweightPtHatRapUserHook
private

◆ fReweightRapUserHook

std::shared_ptr<UserHooks> Pythia8Hadronizer::fReweightRapUserHook
private

◆ fReweightUserHook

std::shared_ptr<UserHooks> Pythia8Hadronizer::fReweightUserHook
private

◆ fUserHooksVector

std::shared_ptr<UserHooksVector> Pythia8Hadronizer::fUserHooksVector
private

◆ lhaUP

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

Definition at line 105 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

◆ LHEInputFileName

std::string Pythia8Hadronizer::LHEInputFileName
private

Definition at line 104 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

◆ nFSRveto

int Pythia8Hadronizer::nFSRveto
private

Definition at line 166 of file Pythia8Hadronizer.cc.

Referenced by generatePartonsAndHadronize(), hadronize(), and statistics().

◆ nISRveto

int Pythia8Hadronizer::nISRveto
private

Definition at line 165 of file Pythia8Hadronizer.cc.

Referenced by generatePartonsAndHadronize(), hadronize(), and statistics().

◆ nME

int Pythia8Hadronizer::nME
private

Definition at line 162 of file Pythia8Hadronizer.cc.

Referenced by finalizeEvent(), generatePartonsAndHadronize(), and hadronize().

◆ nMEFiltered

int Pythia8Hadronizer::nMEFiltered
private

Definition at line 163 of file Pythia8Hadronizer.cc.

Referenced by finalizeEvent(), generatePartonsAndHadronize(), and hadronize().

◆ p8SharedResources

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

Definition at line 159 of file Pythia8Hadronizer.cc.

◆ UserHooksSet

bool Pythia8Hadronizer::UserHooksSet
private
lhef::LHERunInfo::kAccepted
Definition: LHERunInfo.h:64
gen::Py8InterfaceBase::fMasterGen
std::unique_ptr< Pythia8::Pythia > fMasterGen
Definition: Py8InterfaceBase.h:47
genWeightsTable_cfi.genLumiInfoHeader
genLumiInfoHeader
Definition: genWeightsTable_cfi.py:5
Pythia8Hadronizer::fUserHooksVector
std::shared_ptr< UserHooksVector > fUserHooksVector
Definition: Pythia8Hadronizer.cc:114
gen::BaseHadronizer::lheRunInfo
lhef::LHERunInfo * lheRunInfo()
Definition: BaseHadronizer.h:90
gen::Py8InterfaceBase::evtgenDecays
std::shared_ptr< Pythia8::EvtGenDecays > evtgenDecays
Definition: Py8InterfaceBase.h:62
gen::BaseHadronizer::lheEvent
lhef::LHEEvent * lheEvent()
Definition: BaseHadronizer.h:89
Pythia8Hadronizer::comEnergy
double comEnergy
Center-of-Mass energy.
Definition: Pythia8Hadronizer.cc:102
mps_fire.i
i
Definition: mps_fire.py:428
gen::Py8InterfaceBase::ascii_io
HepMC::IO_AsciiParticles * ascii_io
Definition: Py8InterfaceBase.h:57
ResonanceDecayFilterHook
Definition: ResonanceDecayFilterHook.h:5
mps_update.status
status
Definition: mps_update.py:69
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
min
T min(T a, T b)
Definition: MathUtil.h:58
edm::Transition::Event
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition: MessageLogger.h:130
Pythia8Hadronizer::fReweightUserHook
std::shared_ptr< UserHooks > fReweightUserHook
Definition: Pythia8Hadronizer.cc:119
Pythia8Hadronizer::nISRveto
int nISRveto
Definition: Pythia8Hadronizer.cc:165
EmissionVetoHook1
Definition: EmissionVetoHook1.h:3
Pythia8Hadronizer::EV1_pThardMode
int EV1_pThardMode
Definition: Pythia8Hadronizer.cc:151
Pythia8Hadronizer::fReweightPtHatRapUserHook
std::shared_ptr< UserHooks > fReweightPtHatRapUserHook
Definition: Pythia8Hadronizer.cc:122
GenRunInfoProduct::setInternalXSec
void setInternalXSec(const XSec &xsec)
Definition: GenRunInfoProduct.h:26
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
findQualityFiles.v
v
Definition: findQualityFiles.py:179
Pythia8Hadronizer::EV1_pTempMode
int EV1_pTempMode
Definition: Pythia8Hadronizer.cc:152
Pythia8Hadronizer::UserHooksSet
bool UserHooksSet
Definition: Pythia8Hadronizer.cc:115
Pythia8Hadronizer::fPowhegHooksBB4L
std::shared_ptr< PowhegHooksBB4L > fPowhegHooksBB4L
Definition: Pythia8Hadronizer.cc:137
Pythia8Hadronizer::DJR
vector< float > DJR
Definition: Pythia8Hadronizer.cc:161
edm::LogImportant
Log< level::Error, true > LogImportant
Definition: MessageLogger.h:133
Pythia8Hadronizer::fMergingHook
std::shared_ptr< Pythia8::amcnlo_unitarised_interface > fMergingHook
Definition: Pythia8Hadronizer.cc:128
edm::Exception
Definition: EDMException.h:77
Pythia8Hadronizer::EV1_pTdefMode
int EV1_pTdefMode
Definition: Pythia8Hadronizer.cc:154
lhef::LHERunInfo::kSelected
Definition: LHERunInfo.h:64
part
part
Definition: HCALResponse.h:20
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
gen::Py8InterfaceBase::Py8InterfaceBase
Py8InterfaceBase(edm::ParameterSet const &ps)
Definition: Py8InterfaceBase.cc:21
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99178
Pythia8Hadronizer::nME
int nME
Definition: Pythia8Hadronizer.cc:162
gen::Py8InterfaceBase::useEvtGen
bool useEvtGen
Definition: Py8InterfaceBase.h:61
PtHatEmpReweightUserHook
Definition: ReweightUserHooks.h:27
gen::Py8InterfaceBase::pythiaHepMCVerbosityParticles
bool pythiaHepMCVerbosityParticles
Definition: Py8InterfaceBase.h:55
Pythia8Hadronizer::fReweightEmpUserHook
std::shared_ptr< UserHooks > fReweightEmpUserHook
Definition: Pythia8Hadronizer.cc:120
gen::BaseHadronizer::eventInfo
std::unique_ptr< GenEventInfoProduct > & eventInfo()
Definition: BaseHadronizer.h:87
Pythia8Hadronizer::fEmissionVetoHook
std::shared_ptr< PowhegHooks > fEmissionVetoHook
Definition: Pythia8Hadronizer.cc:132
gen::BaseHadronizer::lheFile_
std::string lheFile_
Definition: BaseHadronizer.h:92
Pythia8Hadronizer::PPbar
Definition: Pythia8Hadronizer.cc:107
Pythia8::PowhegHooksBB4L
Definition: PowhegHooksBB4L.h:18
Pythia8Hadronizer::EV1_MPIvetoOn
bool EV1_MPIvetoOn
Definition: Pythia8Hadronizer.cc:155
Pythia8Hadronizer::fPTFilterHook
std::shared_ptr< PTFilterHook > fPTFilterHook
Definition: Pythia8Hadronizer.cc:146
gen::Py8InterfaceBase::evtgenUserFiles
std::vector< std::string > evtgenUserFiles
Definition: Py8InterfaceBase.h:65
gen::Py8InterfaceBase::pythiaPylistVerbosity
unsigned int pythiaPylistVerbosity
Definition: Py8InterfaceBase.h:53
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Pythia8Hadronizer::ElectronPositron
Definition: Pythia8Hadronizer.cc:107
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
Pythia8Hadronizer::fPowhegResHook
std::shared_ptr< PowhegResHook > fPowhegResHook
Definition: Pythia8Hadronizer.cc:136
edm::ParameterSet
Definition: ParameterSet.h:47
clear
void clear(HadCaloObj &c)
Definition: data.h:124
gen::Py8InterfaceBase::evtgenPdlFile
std::string evtgenPdlFile
Definition: Py8InterfaceBase.h:64
GenRunInfoProduct::XSec
Definition: GenRunInfoProduct.h:32
Pythia8Hadronizer::fJetMatchingHook
std::shared_ptr< JetMatchingHook > fJetMatchingHook
Definition: Pythia8Hadronizer.cc:126
PtHatRapReweightUserHook
Definition: ReweightUserHooks.h:116
gen::Py8InterfaceBase::maxEventsToPrint
unsigned int maxEventsToPrint
Definition: Py8InterfaceBase.h:56
LHAupLesHouches
Definition: LHAupLesHouches.h:20
Pythia8Hadronizer::p8SharedResources
static const std::vector< std::string > p8SharedResources
Definition: Pythia8Hadronizer.cc:159
Pythia8Hadronizer::EV1_maxVetoCount
int EV1_maxVetoCount
Definition: Pythia8Hadronizer.cc:150
Pythia8Hadronizer::PP
Definition: Pythia8Hadronizer.cc:107
BiasedTauDecayer
Definition: BiasedTauDecayer.h:9
Pythia8Hadronizer::fBiasedTauDecayer
std::shared_ptr< BiasedTauDecayer > fBiasedTauDecayer
Definition: Pythia8Hadronizer.cc:140
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
RapReweightUserHook
Definition: ReweightUserHooks.h:67
Pythia8Hadronizer::EV1_QEDvetoMode
int EV1_QEDvetoMode
Definition: Pythia8Hadronizer.cc:156
get
#define get
generator_cfi.scheme
scheme
Definition: generator_cfi.py:22
Pythia8Hadronizer::EV1_vetoOn
bool EV1_vetoOn
Definition: Pythia8Hadronizer.cc:149
Pythia8Hadronizer::LHEInputFileName
std::string LHEInputFileName
Definition: Pythia8Hadronizer.cc:104
JetMatchingHook
Definition: JetMatchingHook.h:18
PowhegResHook
Definition: PowhegResHook.h:6
Pythia8Hadronizer::EV1_nFinalMode
int EV1_nFinalMode
Definition: Pythia8Hadronizer.cc:157
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
gen::BaseHadronizer::event
std::unique_ptr< HepMC::GenEvent > & event()
Definition: BaseHadronizer.h:86
gen::Py8InterfaceBase::pythiaHepMCVerbosity
bool pythiaHepMCVerbosity
Definition: Py8InterfaceBase.h:54
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
Exception
Definition: hltDiff.cc:246
gen::Py8InterfaceBase::toHepMC
HepMC::Pythia8ToHepMC toHepMC
Definition: Py8InterfaceBase.h:49
Pythia8Hadronizer::lhaUP
std::shared_ptr< LHAupLesHouches > lhaUP
Definition: Pythia8Hadronizer.cc:105
MatrixUtil.remove
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:219
Particle
Definition: Particle.py:1
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Pythia8Hadronizer::nFSRveto
int nFSRveto
Definition: Pythia8Hadronizer.cc:166
Pythia8Hadronizer::EV1_emittedMode
int EV1_emittedMode
Definition: Pythia8Hadronizer.cc:153
PtHatReweightUserHook
Definition: ReweightUserHooks.h:4
Pythia8Hadronizer::fInitialState
int fInitialState
Definition: Pythia8Hadronizer.cc:108
lhef::LHEEvent::count
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
Definition: LHEEvent.cc:184
Pythia8Hadronizer::nMEFiltered
int nMEFiltered
Definition: Pythia8Hadronizer.cc:163
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Pythia8Hadronizer::fResonanceDecayFilterHook
std::shared_ptr< ResonanceDecayFilterHook > fResonanceDecayFilterHook
Definition: Pythia8Hadronizer.cc:143
PTFilterHook
Definition: PTFilterHook.h:4
Pythia8Hadronizer::fEmissionVetoHook1
std::shared_ptr< EmissionVetoHook1 > fEmissionVetoHook1
Definition: Pythia8Hadronizer.cc:133
crabWrapper.key
key
Definition: crabWrapper.py:19
gen::BaseHadronizer::runInfo
GenRunInfoProduct & runInfo()
Definition: BaseHadronizer.h:85
Pythia8Hadronizer::fJetMatchingPy8InternalHook
std::shared_ptr< Pythia8::JetMatchingMadgraph > fJetMatchingPy8InternalHook
Definition: Pythia8Hadronizer.cc:127
edm::errors::Configuration
Definition: EDMException.h:36
Pythia8Hadronizer::fReweightRapUserHook
std::shared_ptr< UserHooks > fReweightRapUserHook
Definition: Pythia8Hadronizer.cc:121
gen::Py8InterfaceBase::fDecayer
std::unique_ptr< Pythia8::Pythia > fDecayer
Definition: Py8InterfaceBase.h:48
gen::Py8InterfaceBase::evtgenDecFile
std::string evtgenDecFile
Definition: Py8InterfaceBase.h:63
gen::Py8InterfaceBase::slhafile_
std::string slhafile_
Definition: Py8InterfaceBase.h:67
Pythia8Hadronizer::EV1_nFinal
int EV1_nFinal
Definition: Pythia8Hadronizer.cc:148
gen::Py8InterfaceBase::p8SetRandomEngine
void p8SetRandomEngine(CLHEP::HepRandomEngine *v)
Definition: Py8InterfaceBase.h:43