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

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
PP 
PPbar 
ElectronPositron 

Definition at line 108 of file Pythia8Hadronizer.cc.

Constructor & Destructor Documentation

◆ Pythia8Hadronizer()

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

Definition at line 172 of file Pythia8Hadronizer.cc.

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

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

322 {}

Member Function Documentation

◆ classname()

const char* Pythia8Hadronizer::classname ( ) const
inlineoverridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 94 of file Pythia8Hadronizer.cc.

94 { return "Pythia8Hadronizer"; }

◆ doSetRandomEngine()

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

Reimplemented from gen::BaseHadronizer.

Definition at line 99 of file Pythia8Hadronizer.cc.

99 { p8SetRandomEngine(v); }

References findQualityFiles::v.

◆ doSharedResources()

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

Reimplemented from gen::BaseHadronizer.

Definition at line 100 of file Pythia8Hadronizer.cc.

100 { return p8SharedResources; }

◆ finalizeEvent()

void Pythia8Hadronizer::finalizeEvent ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 901 of file Pythia8Hadronizer.cc.

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

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

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

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

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

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

◆ hadronize()

bool Pythia8Hadronizer::hadronize ( )

Definition at line 778 of file Pythia8Hadronizer.cc.

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

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

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

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

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

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

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

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

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

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

Referenced by initializeForInternalPartons().

◆ DJR

vector<float> Pythia8Hadronizer::DJR
private

Definition at line 162 of file Pythia8Hadronizer.cc.

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

◆ EV1_emittedMode

int Pythia8Hadronizer::EV1_emittedMode
private

Definition at line 154 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_maxVetoCount

int Pythia8Hadronizer::EV1_maxVetoCount
private

Definition at line 151 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_MPIvetoOn

bool Pythia8Hadronizer::EV1_MPIvetoOn
private

Definition at line 156 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_nFinal

int Pythia8Hadronizer::EV1_nFinal
private

Definition at line 149 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_nFinalMode

int Pythia8Hadronizer::EV1_nFinalMode
private

Definition at line 158 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_pTdefMode

int Pythia8Hadronizer::EV1_pTdefMode
private

Definition at line 155 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_pTempMode

int Pythia8Hadronizer::EV1_pTempMode
private

Definition at line 153 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_pThardMode

int Pythia8Hadronizer::EV1_pThardMode
private

Definition at line 152 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_QEDvetoMode

int Pythia8Hadronizer::EV1_QEDvetoMode
private

Definition at line 157 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ EV1_vetoOn

bool Pythia8Hadronizer::EV1_vetoOn
private

Definition at line 150 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

◆ fBeam1PZ

double Pythia8Hadronizer::fBeam1PZ
private

Definition at line 111 of file Pythia8Hadronizer.cc.

◆ fBeam2PZ

double Pythia8Hadronizer::fBeam2PZ
private

Definition at line 112 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 109 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 106 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

◆ LHEInputFileName

std::string Pythia8Hadronizer::LHEInputFileName
private

Definition at line 105 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

◆ nFSRveto

int Pythia8Hadronizer::nFSRveto
private

Definition at line 167 of file Pythia8Hadronizer.cc.

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

◆ nISRveto

int Pythia8Hadronizer::nISRveto
private

Definition at line 166 of file Pythia8Hadronizer.cc.

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

◆ nME

int Pythia8Hadronizer::nME
private

Definition at line 163 of file Pythia8Hadronizer.cc.

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

◆ nMEFiltered

int Pythia8Hadronizer::nMEFiltered
private

Definition at line 164 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 160 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:115
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:103
mps_fire.i
i
Definition: mps_fire.py:428
Pythia8Hadronizer::ElectronPositron
Definition: Pythia8Hadronizer.cc:108
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:68
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:120
Pythia8Hadronizer::nISRveto
int nISRveto
Definition: Pythia8Hadronizer.cc:166
EmissionVetoHook1
Definition: EmissionVetoHook1.h:3
Pythia8Hadronizer::EV1_pThardMode
int EV1_pThardMode
Definition: Pythia8Hadronizer.cc:152
Pythia8Hadronizer::fReweightPtHatRapUserHook
std::shared_ptr< UserHooks > fReweightPtHatRapUserHook
Definition: Pythia8Hadronizer.cc:123
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:153
Pythia8Hadronizer::UserHooksSet
bool UserHooksSet
Definition: Pythia8Hadronizer.cc:116
Pythia8Hadronizer::fPowhegHooksBB4L
std::shared_ptr< PowhegHooksBB4L > fPowhegHooksBB4L
Definition: Pythia8Hadronizer.cc:138
Pythia8Hadronizer::PPbar
Definition: Pythia8Hadronizer.cc:108
Pythia8Hadronizer::DJR
vector< float > DJR
Definition: Pythia8Hadronizer.cc:162
edm::LogImportant
Log< level::Error, true > LogImportant
Definition: MessageLogger.h:133
Pythia8Hadronizer::fMergingHook
std::shared_ptr< Pythia8::amcnlo_unitarised_interface > fMergingHook
Definition: Pythia8Hadronizer.cc:129
edm::Exception
Definition: EDMException.h:77
Pythia8Hadronizer::EV1_pTdefMode
int EV1_pTdefMode
Definition: Pythia8Hadronizer.cc:155
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:19
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99207
Pythia8Hadronizer::nME
int nME
Definition: Pythia8Hadronizer.cc:163
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:121
gen::BaseHadronizer::eventInfo
std::unique_ptr< GenEventInfoProduct > & eventInfo()
Definition: BaseHadronizer.h:87
Pythia8Hadronizer::fEmissionVetoHook
std::shared_ptr< PowhegHooks > fEmissionVetoHook
Definition: Pythia8Hadronizer.cc:133
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:156
Pythia8Hadronizer::fPTFilterHook
std::shared_ptr< PTFilterHook > fPTFilterHook
Definition: Pythia8Hadronizer.cc:147
gen::Py8InterfaceBase::evtgenUserFiles
std::vector< std::string > evtgenUserFiles
Definition: Py8InterfaceBase.h:65
gen::Py8InterfaceBase::pythiaPylistVerbosity
unsigned int pythiaPylistVerbosity
Definition: Py8InterfaceBase.h:53
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:137
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:127
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:160
Pythia8Hadronizer::EV1_maxVetoCount
int EV1_maxVetoCount
Definition: Pythia8Hadronizer.cc:151
BiasedTauDecayer
Definition: BiasedTauDecayer.h:9
Pythia8Hadronizer::fBiasedTauDecayer
std::shared_ptr< BiasedTauDecayer > fBiasedTauDecayer
Definition: Pythia8Hadronizer.cc:141
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
RapReweightUserHook
Definition: ReweightUserHooks.h:67
Pythia8Hadronizer::EV1_QEDvetoMode
int EV1_QEDvetoMode
Definition: Pythia8Hadronizer.cc:157
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
generator_cfi.scheme
scheme
Definition: generator_cfi.py:22
Pythia8Hadronizer::EV1_vetoOn
bool EV1_vetoOn
Definition: Pythia8Hadronizer.cc:150
Pythia8Hadronizer::LHEInputFileName
std::string LHEInputFileName
Definition: Pythia8Hadronizer.cc:105
JetMatchingHook
Definition: JetMatchingHook.h:18
PowhegResHook
Definition: PowhegResHook.h:6
Pythia8Hadronizer::EV1_nFinalMode
int EV1_nFinalMode
Definition: Pythia8Hadronizer.cc:158
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
Pythia8Hadronizer::PP
Definition: Pythia8Hadronizer.cc:108
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
Exception
Definition: hltDiff.cc:245
gen::Py8InterfaceBase::toHepMC
HepMC::Pythia8ToHepMC toHepMC
Definition: Py8InterfaceBase.h:49
Pythia8Hadronizer::lhaUP
std::shared_ptr< LHAupLesHouches > lhaUP
Definition: Pythia8Hadronizer.cc:106
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:167
Pythia8Hadronizer::EV1_emittedMode
int EV1_emittedMode
Definition: Pythia8Hadronizer.cc:154
PtHatReweightUserHook
Definition: ReweightUserHooks.h:4
Pythia8Hadronizer::fInitialState
int fInitialState
Definition: Pythia8Hadronizer.cc:109
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:164
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:144
PTFilterHook
Definition: PTFilterHook.h:4
Pythia8Hadronizer::fEmissionVetoHook1
std::shared_ptr< EmissionVetoHook1 > fEmissionVetoHook1
Definition: Pythia8Hadronizer.cc:134
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:128
edm::errors::Configuration
Definition: EDMException.h:36
Pythia8Hadronizer::fReweightRapUserHook
std::shared_ptr< UserHooks > fReweightRapUserHook
Definition: Pythia8Hadronizer.cc:122
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:149
gen::Py8InterfaceBase::p8SetRandomEngine
void p8SetRandomEngine(CLHEP::HepRandomEngine *v)
Definition: Py8InterfaceBase.h:43