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 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::unique_ptr< BiasedTauDecayerfBiasedTauDecayer
 
std::unique_ptr< Pythia8::Dire > fDire
 
std::unique_ptr< PowhegHooks > fEmissionVetoHook
 
std::unique_ptr< EmissionVetoHook1fEmissionVetoHook1
 
int fInitialState
 
std::unique_ptr< JetMatchingHookfJetMatchingHook
 
std::unique_ptr< Pythia8::JetMatchingMadgraph > fJetMatchingPy8InternalHook
 
std::unique_ptr< Pythia8::amcnlo_unitarised_interface > fMergingHook
 
std::unique_ptr< MultiUserHookfMultiUserHook
 
std::unique_ptr< PowhegHooksBB4LfPowhegHooksBB4L
 
std::unique_ptr< PowhegResHookfPowhegResHook
 
std::unique_ptr< PTFilterHookfPTFilterHook
 
std::unique_ptr< ResonanceDecayFilterHookfResonanceDecayFilterHook
 
std::unique_ptr< UserHooks > fReweightEmpUserHook
 
std::unique_ptr< UserHooks > fReweightPtHatRapUserHook
 
std::unique_ptr< UserHooks > fReweightRapUserHook
 
std::unique_ptr< UserHooks > fReweightUserHook
 
std::unique_ptr< Pythia8::VinciaPlugin > fvincia
 
std::unique_ptr< LHAupLesHoucheslhaUP
 
std::string LHEInputFileName
 
int nFSRveto
 
int nISRveto
 
int nME
 
int nMEFiltered
 

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< 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 79 of file Pythia8Hadronizer.cc.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
PP 
PPbar 
ElectronPositron 

Definition at line 113 of file Pythia8Hadronizer.cc.

Constructor & Destructor Documentation

◆ Pythia8Hadronizer()

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

Definition at line 176 of file Pythia8Hadronizer.cc.

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

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(), fDire, fEmissionVetoHook1, fInitialState, fJetMatchingHook, gen::Py8InterfaceBase::fMasterGen, fReweightEmpUserHook, fReweightPtHatRapUserHook, fReweightRapUserHook, fReweightUserHook, fvincia, edm::ParameterSet::getParameter(), CalibrationSummaryClient_cfi::params, PP, PPbar, generator_cfi::scheme, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~Pythia8Hadronizer()

Pythia8Hadronizer::~Pythia8Hadronizer ( )
override

Definition at line 327 of file Pythia8Hadronizer.cc.

327 {}

Member Function Documentation

◆ classname()

const char* Pythia8Hadronizer::classname ( ) const
inlineoverridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 96 of file Pythia8Hadronizer.cc.

96 { return "Pythia8Hadronizer"; }

◆ doSetRandomEngine()

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

Reimplemented from gen::BaseHadronizer.

Definition at line 104 of file Pythia8Hadronizer.cc.

104 { p8SetRandomEngine(v); }

References findQualityFiles::v.

◆ doSharedResources()

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

Reimplemented from gen::BaseHadronizer.

Definition at line 105 of file Pythia8Hadronizer.cc.

105 { return p8SharedResources; }

◆ finalizeEvent()

void Pythia8Hadronizer::finalizeEvent ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 892 of file Pythia8Hadronizer.cc.

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

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

◆ generatePartonsAndHadronize()

bool Pythia8Hadronizer::generatePartonsAndHadronize ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 662 of file Pythia8Hadronizer.cc.

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

References funct::abs(), DJR, gen::BaseHadronizer::event(), gen::Py8InterfaceBase::evtgenDecays, fDire, fEmissionVetoHook, fJetMatchingHook, fJetMatchingPy8InternalHook, gen::Py8InterfaceBase::fMasterGen, fMergingHook, fvincia, 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 932 of file Pythia8Hadronizer.cc.

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

References fDire, gen::Py8InterfaceBase::fMasterGen, fvincia, nano_cff::genLumiInfoHeader, mps_fire::i, crabWrapper::key, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ hadronize()

bool Pythia8Hadronizer::hadronize ( )

Definition at line 769 of file Pythia8Hadronizer.cc.

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

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 493 of file Pythia8Hadronizer.cc.

493  {
494  edm::LogInfo("Pythia8Interface") << "Initializing for external partons";
495 
496  bool status = false, status1 = false;
497 
498  fMultiUserHook.reset(new MultiUserHook);
499 
500  if (fReweightUserHook.get())
501  fMultiUserHook->addHook(fReweightUserHook.get());
502  if (fReweightEmpUserHook.get())
503  fMultiUserHook->addHook(fReweightEmpUserHook.get());
504  if (fReweightRapUserHook.get())
505  fMultiUserHook->addHook(fReweightRapUserHook.get());
506  if (fReweightPtHatRapUserHook.get())
508  if (fJetMatchingHook.get())
509  fMultiUserHook->addHook(fJetMatchingHook.get());
510  if (fEmissionVetoHook1.get()) {
511  edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook 1 from CMSSW Pythia8Interface";
512  fMultiUserHook->addHook(fEmissionVetoHook1.get());
513  }
514 
515  if (fMasterGen->settings.mode("POWHEG:veto") > 0 || fMasterGen->settings.mode("POWHEG:MPIveto") > 0) {
516  if (fJetMatchingHook.get() || fEmissionVetoHook1.get())
517  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface")
518  << " Attempt to turn on PowhegHooks by pythia8 settings but there are incompatible hooks on \n Incompatible "
519  "are : jetMatching, emissionVeto1 \n";
520 
521  fEmissionVetoHook.reset(new PowhegHooks());
522 
523  edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook from pythia8 code";
524  fMultiUserHook->addHook(fEmissionVetoHook.get());
525  }
526 
527  bool PowhegRes = fMasterGen->settings.flag("POWHEGres:calcScales");
528  if (PowhegRes) {
529  edm::LogInfo("Pythia8Interface") << "Turning on resonance scale setting from CMSSW Pythia8Interface";
530  fPowhegResHook.reset(new PowhegResHook());
531  fMultiUserHook->addHook(fPowhegResHook.get());
532  }
533 
534  bool PowhegBB4L = fMasterGen->settings.flag("POWHEG:bb4l");
535  if (PowhegBB4L) {
536  edm::LogInfo("Pythia8Interface") << "Turning on BB4l hook from CMSSW Pythia8Interface";
537  fPowhegHooksBB4L.reset(new PowhegHooksBB4L());
538  fMultiUserHook->addHook(fPowhegHooksBB4L.get());
539  }
540 
541  //adapted from main89.cc in pythia8 examples
542  bool internalMatching = fMasterGen->settings.flag("JetMatching:merge");
543  bool internalMerging = !(fMasterGen->settings.word("Merging:Process") == "void");
544 
545  if (internalMatching && internalMerging) {
546  throw edm::Exception(edm::errors::Configuration, "Pythia8Interface")
547  << " Only one jet matching/merging scheme can be used at a time. \n";
548  }
549 
550  if (internalMatching) {
551  fJetMatchingPy8InternalHook.reset(new Pythia8::JetMatchingMadgraph);
553  }
554 
555  if (internalMerging) {
556  int scheme = (fMasterGen->settings.flag("Merging:doUMEPSTree") || fMasterGen->settings.flag("Merging:doUMEPSSubt"))
557  ? 1
558  : ((fMasterGen->settings.flag("Merging:doUNLOPSTree") ||
559  fMasterGen->settings.flag("Merging:doUNLOPSSubt") ||
560  fMasterGen->settings.flag("Merging:doUNLOPSLoop") ||
561  fMasterGen->settings.flag("Merging:doUNLOPSSubtNLO"))
562  ? 2
563  : 0);
564  fMergingHook.reset(new Pythia8::amcnlo_unitarised_interface(scheme));
565  fMultiUserHook->addHook(fMergingHook.get());
566  }
567 
568  bool biasedTauDecayer = fMasterGen->settings.flag("BiasedTauDecayer:filter");
569  if (biasedTauDecayer) {
570  fBiasedTauDecayer.reset(new BiasedTauDecayer(&(fMasterGen->info),
571  &(fMasterGen->settings),
572  &(fMasterGen->particleData),
573  &(fMasterGen->rndm),
574  &(fMasterGen->couplings)));
575  std::vector<int> handledParticles;
576  handledParticles.push_back(15);
577  fMasterGen->setDecayPtr(fBiasedTauDecayer.get(), handledParticles);
578  }
579 
580  bool resonanceDecayFilter = fMasterGen->settings.flag("ResonanceDecayFilter:filter");
581  if (resonanceDecayFilter) {
584  }
585 
586  bool PTFilter = fMasterGen->settings.flag("PTFilter:filter");
587  if (PTFilter) {
588  fPTFilterHook.reset(new PTFilterHook);
589  fMultiUserHook->addHook(fPTFilterHook.get());
590  }
591 
592  if (fMultiUserHook->nHooks() > 0) {
593  fMasterGen->setUserHooksPtr(fMultiUserHook.get());
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.get());
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  evtgenDecays.reset(new EvtGenDecays(fMasterGen.get(), evtgenDecFile, evtgenPdlFile));
639  for (unsigned int i = 0; i < evtgenUserFiles.size(); i++)
640  evtgenDecays->readDecayFile(evtgenUserFiles.at(i));
641  }
642 
643  return (status && status1);
644 }

References 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, fMultiUserHook, fPowhegHooksBB4L, fPowhegResHook, fPTFilterHook, fResonanceDecayFilterHook, fReweightEmpUserHook, fReweightPtHatRapUserHook, fReweightRapUserHook, fReweightUserHook, mps_fire::i, lhaUP, LHEInputFileName, gen::BaseHadronizer::lheRunInfo(), gen::Py8InterfaceBase::pythiaPylistVerbosity, MatrixUtil::remove(), generator_cfi::scheme, gen::Py8InterfaceBase::slhafile_, mps_update::status, and gen::Py8InterfaceBase::useEvtGen.

◆ initializeForInternalPartons()

bool Pythia8Hadronizer::initializeForInternalPartons ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 329 of file Pythia8Hadronizer.cc.

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

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

◆ residualDecay()

bool Pythia8Hadronizer::residualDecay ( )
virtual

Definition at line 842 of file Pythia8Hadronizer.cc.

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

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 646 of file Pythia8Hadronizer.cc.

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

References runTheMatrix::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 108 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons().

◆ DJR

vector<float> Pythia8Hadronizer::DJR
private

Definition at line 166 of file Pythia8Hadronizer.cc.

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

◆ EV1_emittedMode

int Pythia8Hadronizer::EV1_emittedMode
private

Definition at line 158 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_maxVetoCount

int Pythia8Hadronizer::EV1_maxVetoCount
private

Definition at line 155 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_MPIvetoOn

bool Pythia8Hadronizer::EV1_MPIvetoOn
private

Definition at line 160 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_nFinal

int Pythia8Hadronizer::EV1_nFinal
private

Definition at line 153 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_nFinalMode

int Pythia8Hadronizer::EV1_nFinalMode
private

Definition at line 162 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_pTdefMode

int Pythia8Hadronizer::EV1_pTdefMode
private

Definition at line 159 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_pTempMode

int Pythia8Hadronizer::EV1_pTempMode
private

Definition at line 157 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_pThardMode

int Pythia8Hadronizer::EV1_pThardMode
private

Definition at line 156 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_QEDvetoMode

int Pythia8Hadronizer::EV1_QEDvetoMode
private

Definition at line 161 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_vetoOn

bool Pythia8Hadronizer::EV1_vetoOn
private

Definition at line 154 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ fBeam1PZ

double Pythia8Hadronizer::fBeam1PZ
private

Definition at line 116 of file Pythia8Hadronizer.cc.

◆ fBeam2PZ

double Pythia8Hadronizer::fBeam2PZ
private

Definition at line 117 of file Pythia8Hadronizer.cc.

◆ fBiasedTauDecayer

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

◆ fDire

std::unique_ptr<Pythia8::Dire> Pythia8Hadronizer::fDire
private

◆ fEmissionVetoHook

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

◆ fEmissionVetoHook1

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

◆ fInitialState

int Pythia8Hadronizer::fInitialState
private

Definition at line 114 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons(), and Pythia8Hadronizer().

◆ fJetMatchingHook

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

◆ fJetMatchingPy8InternalHook

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

◆ fMergingHook

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

◆ fMultiUserHook

std::unique_ptr<MultiUserHook> Pythia8Hadronizer::fMultiUserHook
private

◆ fPowhegHooksBB4L

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

◆ fPowhegResHook

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

◆ fPTFilterHook

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

◆ fResonanceDecayFilterHook

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

◆ fReweightEmpUserHook

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

◆ fReweightPtHatRapUserHook

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

◆ fReweightRapUserHook

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

◆ fReweightUserHook

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

◆ fvincia

std::unique_ptr<Pythia8::VinciaPlugin> Pythia8Hadronizer::fvincia
private

◆ lhaUP

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

Definition at line 111 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

◆ LHEInputFileName

std::string Pythia8Hadronizer::LHEInputFileName
private

Definition at line 110 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

◆ nFSRveto

int Pythia8Hadronizer::nFSRveto
private

Definition at line 171 of file Pythia8Hadronizer.cc.

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

◆ nISRveto

int Pythia8Hadronizer::nISRveto
private

Definition at line 170 of file Pythia8Hadronizer.cc.

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

◆ nME

int Pythia8Hadronizer::nME
private

Definition at line 167 of file Pythia8Hadronizer.cc.

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

◆ nMEFiltered

int Pythia8Hadronizer::nMEFiltered
private

Definition at line 168 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 164 of file Pythia8Hadronizer.cc.

lhef::LHERunInfo::kAccepted
Definition: LHERunInfo.h:64
GenEventInfoProduct
Definition: GenEventInfoProduct.h:17
gen::Py8InterfaceBase::fMasterGen
std::unique_ptr< Pythia8::Pythia > fMasterGen
Definition: Py8InterfaceBase.h:44
gen::BaseHadronizer::lheRunInfo
lhef::LHERunInfo * lheRunInfo()
Definition: BaseHadronizer.h:90
gen::BaseHadronizer::lheEvent
lhef::LHEEvent * lheEvent()
Definition: BaseHadronizer.h:89
Pythia8Hadronizer::comEnergy
double comEnergy
Center-of-Mass energy.
Definition: Pythia8Hadronizer.cc:108
mps_fire.i
i
Definition: mps_fire.py:355
gen::Py8InterfaceBase::ascii_io
HepMC::IO_AsciiParticles * ascii_io
Definition: Py8InterfaceBase.h:54
Pythia8Hadronizer::fDire
std::unique_ptr< Pythia8::Dire > fDire
Definition: Pythia8Hadronizer.cc:102
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
Pythia8Hadronizer::fEmissionVetoHook
std::unique_ptr< PowhegHooks > fEmissionVetoHook
Definition: Pythia8Hadronizer.cc:137
Pythia8Hadronizer::fReweightEmpUserHook
std::unique_ptr< UserHooks > fReweightEmpUserHook
Definition: Pythia8Hadronizer.cc:125
edm::Transition::Event
Pythia8Hadronizer::fJetMatchingPy8InternalHook
std::unique_ptr< Pythia8::JetMatchingMadgraph > fJetMatchingPy8InternalHook
Definition: Pythia8Hadronizer.cc:132
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::LogInfo
Definition: MessageLogger.h:254
Pythia8Hadronizer::nISRveto
int nISRveto
Definition: Pythia8Hadronizer.cc:170
EmissionVetoHook1
Definition: EmissionVetoHook1.h:3
edm::LogImportant
Definition: MessageLogger.h:428
Pythia8Hadronizer::fReweightRapUserHook
std::unique_ptr< UserHooks > fReweightRapUserHook
Definition: Pythia8Hadronizer.cc:126
Pythia8Hadronizer::EV1_pThardMode
int EV1_pThardMode
Definition: Pythia8Hadronizer.cc:156
Pythia8Hadronizer::fPTFilterHook
std::unique_ptr< PTFilterHook > fPTFilterHook
Definition: Pythia8Hadronizer.cc:151
GenRunInfoProduct::setInternalXSec
void setInternalXSec(const XSec &xsec)
Definition: GenRunInfoProduct.h:26
Pythia8Hadronizer::PP
Definition: Pythia8Hadronizer.cc:113
findQualityFiles.v
v
Definition: findQualityFiles.py:179
Pythia8Hadronizer::fReweightPtHatRapUserHook
std::unique_ptr< UserHooks > fReweightPtHatRapUserHook
Definition: Pythia8Hadronizer.cc:127
Pythia8Hadronizer::EV1_pTempMode
int EV1_pTempMode
Definition: Pythia8Hadronizer.cc:157
gen::Py8InterfaceBase::evtgenDecays
std::shared_ptr< EvtGenDecays > evtgenDecays
Definition: Py8InterfaceBase.h:59
Pythia8Hadronizer::DJR
vector< float > DJR
Definition: Pythia8Hadronizer.cc:166
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
edm::Exception
Definition: EDMException.h:77
Pythia8Hadronizer::EV1_pTdefMode
int EV1_pTdefMode
Definition: Pythia8Hadronizer.cc:159
lhef::LHERunInfo::kSelected
Definition: LHERunInfo.h:64
nano_cff.genLumiInfoHeader
genLumiInfoHeader
Definition: nano_cff.py:98
Pythia8Hadronizer::fReweightUserHook
std::unique_ptr< UserHooks > fReweightUserHook
Definition: Pythia8Hadronizer.cc:124
part
part
Definition: HCALResponse.h:20
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
Pythia8Hadronizer::fJetMatchingHook
std::unique_ptr< JetMatchingHook > fJetMatchingHook
Definition: Pythia8Hadronizer.cc:131
gen::Py8InterfaceBase::Py8InterfaceBase
Py8InterfaceBase(edm::ParameterSet const &ps)
Definition: Py8InterfaceBase.cc:17
Pythia8Hadronizer::nME
int nME
Definition: Pythia8Hadronizer.cc:167
gen::Py8InterfaceBase::useEvtGen
bool useEvtGen
Definition: Py8InterfaceBase.h:58
PtHatEmpReweightUserHook
Definition: ReweightUserHooks.h:27
gen::Py8InterfaceBase::pythiaHepMCVerbosityParticles
bool pythiaHepMCVerbosityParticles
Definition: Py8InterfaceBase.h:52
Pythia8Hadronizer::fPowhegResHook
std::unique_ptr< PowhegResHook > fPowhegResHook
Definition: Pythia8Hadronizer.cc:141
gen::BaseHadronizer::eventInfo
std::unique_ptr< GenEventInfoProduct > & eventInfo()
Definition: BaseHadronizer.h:87
gen::BaseHadronizer::lheFile_
std::string lheFile_
Definition: BaseHadronizer.h:92
Pythia8::PowhegHooksBB4L
Definition: PowhegHooksBB4L.h:18
Pythia8Hadronizer::EV1_MPIvetoOn
bool EV1_MPIvetoOn
Definition: Pythia8Hadronizer.cc:160
gen::Py8InterfaceBase::evtgenUserFiles
std::vector< std::string > evtgenUserFiles
Definition: Py8InterfaceBase.h:62
gen::Py8InterfaceBase::pythiaPylistVerbosity
unsigned int pythiaPylistVerbosity
Definition: Py8InterfaceBase.h:50
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
edm::ParameterSet
Definition: ParameterSet.h:36
Pythia8Hadronizer::PPbar
Definition: Pythia8Hadronizer.cc:113
gen::Py8InterfaceBase::evtgenPdlFile
std::string evtgenPdlFile
Definition: Py8InterfaceBase.h:61
GenRunInfoProduct::XSec
Definition: GenRunInfoProduct.h:32
PtHatRapReweightUserHook
Definition: ReweightUserHooks.h:116
gen::Py8InterfaceBase::maxEventsToPrint
unsigned int maxEventsToPrint
Definition: Py8InterfaceBase.h:53
LHAupLesHouches
Definition: LHAupLesHouches.h:20
runTheMatrix.err
err
Definition: runTheMatrix.py:288
Pythia8Hadronizer::p8SharedResources
static const std::vector< std::string > p8SharedResources
Definition: Pythia8Hadronizer.cc:164
Pythia8Hadronizer::EV1_maxVetoCount
int EV1_maxVetoCount
Definition: Pythia8Hadronizer.cc:155
BiasedTauDecayer
Definition: BiasedTauDecayer.h:9
edm::LogPrint
Definition: MessageLogger.h:342
RapReweightUserHook
Definition: ReweightUserHooks.h:67
Pythia8Hadronizer::EV1_QEDvetoMode
int EV1_QEDvetoMode
Definition: Pythia8Hadronizer.cc:161
get
#define get
generator_cfi.scheme
scheme
Definition: generator_cfi.py:22
Pythia8Hadronizer::EV1_vetoOn
bool EV1_vetoOn
Definition: Pythia8Hadronizer.cc:154
Pythia8Hadronizer::LHEInputFileName
std::string LHEInputFileName
Definition: Pythia8Hadronizer.cc:110
JetMatchingHook
Definition: JetMatchingHook.h:18
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
MultiUserHook
Definition: MultiUserHook.h:6
PowhegResHook
Definition: PowhegResHook.h:6
Pythia8Hadronizer::EV1_nFinalMode
int EV1_nFinalMode
Definition: Pythia8Hadronizer.cc:162
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
gen::BaseHadronizer::event
std::unique_ptr< HepMC::GenEvent > & event()
Definition: BaseHadronizer.h:86
Pythia8Hadronizer::ElectronPositron
Definition: Pythia8Hadronizer.cc:113
gen::Py8InterfaceBase::pythiaHepMCVerbosity
bool pythiaHepMCVerbosity
Definition: Py8InterfaceBase.h:51
Pythia8Hadronizer::fMergingHook
std::unique_ptr< Pythia8::amcnlo_unitarised_interface > fMergingHook
Definition: Pythia8Hadronizer.cc:133
Pythia8Hadronizer::fEmissionVetoHook1
std::unique_ptr< EmissionVetoHook1 > fEmissionVetoHook1
Definition: Pythia8Hadronizer.cc:138
Pythia8Hadronizer::lhaUP
std::unique_ptr< LHAupLesHouches > lhaUP
Definition: Pythia8Hadronizer.cc:111
Exception
Definition: hltDiff.cc:246
gen::Py8InterfaceBase::toHepMC
HepMC::Pythia8ToHepMC toHepMC
Definition: Py8InterfaceBase.h:46
Pythia8Hadronizer::fvincia
std::unique_ptr< Pythia8::VinciaPlugin > fvincia
Definition: Pythia8Hadronizer.cc:101
MatrixUtil.remove
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:212
Particle
Definition: Particle.py:1
Pythia8Hadronizer::nFSRveto
int nFSRveto
Definition: Pythia8Hadronizer.cc:171
Pythia8Hadronizer::EV1_emittedMode
int EV1_emittedMode
Definition: Pythia8Hadronizer.cc:158
PtHatReweightUserHook
Definition: ReweightUserHooks.h:4
Pythia8Hadronizer::fInitialState
int fInitialState
Definition: Pythia8Hadronizer.cc:114
lhef::LHEEvent::count
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
Definition: LHEEvent.cc:182
Pythia8Hadronizer::fResonanceDecayFilterHook
std::unique_ptr< ResonanceDecayFilterHook > fResonanceDecayFilterHook
Definition: Pythia8Hadronizer.cc:148
Pythia8Hadronizer::nMEFiltered
int nMEFiltered
Definition: Pythia8Hadronizer.cc:168
mps_fire.result
result
Definition: mps_fire.py:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PTFilterHook
Definition: PTFilterHook.h:4
Pythia8Hadronizer::fBiasedTauDecayer
std::unique_ptr< BiasedTauDecayer > fBiasedTauDecayer
Definition: Pythia8Hadronizer.cc:145
Pythia8Hadronizer::fMultiUserHook
std::unique_ptr< MultiUserHook > fMultiUserHook
Definition: Pythia8Hadronizer.cc:120
crabWrapper.key
key
Definition: crabWrapper.py:19
gen::BaseHadronizer::runInfo
GenRunInfoProduct & runInfo()
Definition: BaseHadronizer.h:85
edm::errors::Configuration
Definition: EDMException.h:36
Pythia8Hadronizer::fPowhegHooksBB4L
std::unique_ptr< PowhegHooksBB4L > fPowhegHooksBB4L
Definition: Pythia8Hadronizer.cc:142
gen::Py8InterfaceBase::fDecayer
std::unique_ptr< Pythia8::Pythia > fDecayer
Definition: Py8InterfaceBase.h:45
gen::Py8InterfaceBase::evtgenDecFile
std::string evtgenDecFile
Definition: Py8InterfaceBase.h:60
gen::Py8InterfaceBase::slhafile_
std::string slhafile_
Definition: Py8InterfaceBase.h:64
Pythia8Hadronizer::EV1_nFinal
int EV1_nFinal
Definition: Pythia8Hadronizer.cc:153
gen::Py8InterfaceBase::p8SetRandomEngine
void p8SetRandomEngine(CLHEP::HepRandomEngine *v)
Definition: Py8InterfaceBase.h:40