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
 
GenLumiInfoHeadergetGenLumiInfoHeader () const override
 
bool hadronize ()
 
bool initializeForExternalPartons ()
 
bool initializeForInternalPartons () override
 
 Pythia8Hadronizer (const edm::ParameterSet &params)
 
virtual bool residualDecay ()
 
void statistics () override
 
 ~Pythia8Hadronizer ()
 
- Public Member Functions inherited from gen::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)
 
virtual ~Py8InterfaceBase ()
 
- 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
 
HepMC::GenEvent * getGenEvent ()
 
GenEventInfoProductgetGenEventInfo ()
 
GenRunInfoProductgetGenRunInfo ()
 
const boost::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 (HepMC::GenEvent *event)
 
void resetEventInfo (GenEventInfoProduct *eventInfo)
 
virtual bool select (HepMC::GenEvent *) const
 
void setEDMEvent (edm::Event &event)
 
void setLHEEvent (lhef::LHEEvent *event)
 
void setLHERunInfo (lhef::LHERunInfo *runInfo)
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
std::vector< std::string > const & sharedResources () const
 
virtual ~BaseHadronizer ()(false)
 

Private Types

enum  { PP, PPbar, ElectronPositron }
 

Private Member Functions

virtual void doSetRandomEngine (CLHEP::HepRandomEngine *v) override
 
virtual std::vector< std::string > const & doSharedResources () const override
 

Private Attributes

double comEnergy
 Center-of-Mass energy. More...
 
vector< float > DJR
 
int EV1_emittedMode
 
int EV1_maxVetoCount
 
bool EV1_MPIvetoOn
 
int EV1_nFinal
 
int EV1_pTdefMode
 
int EV1_pTempMode
 
int EV1_pThardMode
 
bool EV1_vetoOn
 
double fBeam1PZ
 
double fBeam2PZ
 
std::auto_ptr< PowhegHooks > fEmissionVetoHook
 
std::auto_ptr< EmissionVetoHook1fEmissionVetoHook1
 
int fInitialState
 
std::auto_ptr< JetMatchingHookfJetMatchingHook
 
std::auto_ptr< Pythia8::JetMatchingMadgraph > fJetMatchingPy8InternalHook
 
std::auto_ptr< Pythia8::amcnlo_unitarised_interface > fMergingHook
 
std::auto_ptr< MultiUserHookfMultiUserHook
 
std::auto_ptr< PowhegHooksBB4LfPowhegHooksBB4L
 
std::auto_ptr< PowhegResHookfPowhegResHook
 
std::auto_ptr< PTFilterHookfPTFilterHook
 
std::auto_ptr< ResonanceDecayFilterHookfResonanceDecayFilterHook
 
std::auto_ptr< UserHooks > fReweightEmpUserHook
 
std::auto_ptr< UserHooks > fReweightPtHatRapUserHook
 
std::auto_ptr< UserHooks > fReweightRapUserHook
 
std::auto_ptr< UserHooks > fReweightUserHook
 
std::auto_ptr< LHAupLesHoucheslhaUP
 
std::string LHEInputFileName
 
int nFSRveto
 
int nFSRvetoBB4L
 
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::auto_ptr< HepMC::GenEvent > & event ()
 
std::auto_ptr< GenEventInfoProduct > & eventInfo ()
 
lhef::LHEEventlheEvent ()
 
lhef::LHERunInfolheRunInfo ()
 
GenRunInfoProductrunInfo ()
 
- Protected Attributes inherited from gen::Py8InterfaceBase
HepMC::IO_AsciiParticles * ascii_io
 
std::auto_ptr< EvtGenDecays > evtgenDecays
 
std::string evtgenDecFile
 
std::string evtgenPdlFile
 
std::vector< std::string > evtgenUserFiles
 
std::auto_ptr< Pythia8::Pythia > fDecayer
 
std::auto_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 72 of file Pythia8Hadronizer.cc.

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

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

Definition at line 166 of file Pythia8Hadronizer.cc.

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

166  :
167  Py8InterfaceBase(params),
168  comEnergy(params.getParameter<double>("comEnergy")),
169  LHEInputFileName(params.getUntrackedParameter<std::string>("LHEInputFileName","")),
170  fInitialState(PP),
171  nME(-1), nMEFiltered(-1), nISRveto(0), nFSRveto(0), nFSRvetoBB4L(0)
172 {
173 
174  // J.Y.: the following 3 parameters are hacked "for a reason"
175  //
176  if ( params.exists( "PPbarInitialState" ) )
177  {
178  if ( fInitialState == PP )
179  {
181  edm::LogImportant("GeneratorInterface|Pythia8Interface")
182  << "Pythia8 will be initialized for PROTON-ANTIPROTON INITIAL STATE. "
183  << "This is a user-request change from the DEFAULT PROTON-PROTON initial state.";
184  }
185  else
186  {
187  // probably need to throw on attempt to override ?
188  }
189  }
190  else if ( params.exists( "ElectronPositronInitialState" ) )
191  {
192  if ( fInitialState == PP )
193  {
195  edm::LogInfo("GeneratorInterface|Pythia8Interface")
196  << "Pythia8 will be initialized for ELECTRON-POSITRON INITIAL STATE. "
197  << "This is a user-request change from the DEFAULT PROTON-PROTON initial state.";
198  }
199  else
200  {
201  // probably need to throw on attempt to override ?
202  }
203  }
204  else if ( params.exists( "ElectronProtonInitialState" ) || params.exists( "PositronProtonInitialState" ) )
205  {
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  {
215  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGen";
216  edm::ParameterSet rgParams =
217  params.getParameter<edm::ParameterSet>("reweightGen");
218  fReweightUserHook.reset(
219  new PtHatReweightUserHook(rgParams.getParameter<double>("pTRef"),
220  rgParams.getParameter<double>("power"))
221  );
222  edm::LogInfo("Pythia8Interface") << "End setup for reweightGen";
223  }
224  if( params.exists( "reweightGenEmp" ) )
225  {
226  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenEmp";
227  edm::ParameterSet rgeParams =
228  params.getParameter<edm::ParameterSet>("reweightGenEmp");
229 
230  std::string tuneName = "";
231  if(rgeParams.exists("tune"))
232  tuneName = rgeParams.getParameter<std::string>("tune");
233  fReweightEmpUserHook.reset(new PtHatEmpReweightUserHook(tuneName));
234  edm::LogInfo("Pythia8Interface") << "End setup for reweightGenEmp";
235  }
236  if( params.exists( "reweightGenRap" ) )
237  {
238  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenRap";
239  edm::ParameterSet rgrParams =
240  params.getParameter<edm::ParameterSet>("reweightGenRap");
241  fReweightRapUserHook.reset(
242  new RapReweightUserHook(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
243  rgrParams.getParameter<double>("yLabPower"),
244  rgrParams.getParameter<std::string>("yCMSigmaFunc"),
245  rgrParams.getParameter<double>("yCMPower"),
246  rgrParams.getParameter<double>("pTHatMin"),
247  rgrParams.getParameter<double>("pTHatMax"))
248  );
249  edm::LogInfo("Pythia8Interface") << "End setup for reweightGenRap";
250  }
251  if( params.exists( "reweightGenPtHatRap" ) )
252  {
253  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenPtHatRap";
254  edm::ParameterSet rgrParams =
255  params.getParameter<edm::ParameterSet>("reweightGenPtHatRap");
257  new PtHatRapReweightUserHook(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
258  rgrParams.getParameter<double>("yLabPower"),
259  rgrParams.getParameter<std::string>("yCMSigmaFunc"),
260  rgrParams.getParameter<double>("yCMPower"),
261  rgrParams.getParameter<double>("pTHatMin"),
262  rgrParams.getParameter<double>("pTHatMax"))
263  );
264  edm::LogInfo("Pythia8Interface") << "End setup for reweightGenPtHatRap";
265  }
266 
267  if( params.exists( "useUserHook" ) )
268  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
269  <<" Obsolete parameter: useUserHook \n Please use the actual one instead \n";
270 
271  // PS matching prototype
272  //
273  if ( params.exists("jetMatching") )
274  {
275  edm::ParameterSet jmParams =
276  params.getUntrackedParameter<edm::ParameterSet>("jetMatching");
277  std::string scheme = jmParams.getParameter<std::string>("scheme");
278  if ( scheme == "Madgraph" || scheme == "MadgraphFastJet" )
279  {
280  fJetMatchingHook.reset(new JetMatchingHook( jmParams, &fMasterGen->info ));
281  }
282  }
283 
284  // Pythia8Interface emission veto
285  //
286  if ( params.exists("emissionVeto1") )
287  {
288  EV1_nFinal = -1;
289  if(params.exists("EV1_nFinal")) EV1_nFinal = params.getParameter<int>("EV1_nFinal");
290  EV1_vetoOn = true;
291  if(params.exists("EV1_vetoOn")) EV1_vetoOn = params.getParameter<bool>("EV1_vetoOn");
292  EV1_maxVetoCount = 10;
293  if(params.exists("EV1_maxVetoCount")) EV1_maxVetoCount = params.getParameter<int>("EV1_maxVetoCount");
294  EV1_pThardMode = 1;
295  if(params.exists("EV1_pThardMode")) EV1_pThardMode = params.getParameter<int>("EV1_pThardMode");
296  EV1_pTempMode = 0;
297  if(params.exists("EV1_pTempMode")) EV1_pTempMode = params.getParameter<int>("EV1_pTempMode");
298  if(EV1_pTempMode > 2 || EV1_pTempMode < 0)
299  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
300  <<" Wrong value for EV1_pTempMode code\n";
301  EV1_emittedMode = 0;
302  if(params.exists("EV1_emittedMode")) EV1_emittedMode = params.getParameter<int>("EV1_emittedMode");
303  EV1_pTdefMode = 1;
304  if(params.exists("EV1_pTdefMode")) EV1_pTdefMode = params.getParameter<int>("EV1_pTdefMode");
305  EV1_MPIvetoOn = false;
306  if(params.exists("EV1_MPIvetoOn")) EV1_MPIvetoOn = params.getParameter<bool>("EV1_MPIvetoOn");
310  }
311 
312 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double comEnergy
Center-of-Mass energy.
std::auto_ptr< Pythia8::Pythia > fMasterGen
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string LHEInputFileName
Py8InterfaceBase(edm::ParameterSet const &ps)
std::auto_ptr< JetMatchingHook > fJetMatchingHook
std::auto_ptr< UserHooks > fReweightPtHatRapUserHook
std::auto_ptr< UserHooks > fReweightEmpUserHook
std::auto_ptr< UserHooks > fReweightUserHook
std::auto_ptr< UserHooks > fReweightRapUserHook
std::auto_ptr< EmissionVetoHook1 > fEmissionVetoHook1
Pythia8Hadronizer::~Pythia8Hadronizer ( )

Definition at line 315 of file Pythia8Hadronizer.cc.

316 {
317 
318 }

Member Function Documentation

const char* Pythia8Hadronizer::classname ( ) const
inlineoverridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 91 of file Pythia8Hadronizer.cc.

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

Reimplemented from gen::BaseHadronizer.

Definition at line 97 of file Pythia8Hadronizer.cc.

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

Reimplemented from gen::BaseHadronizer.

Definition at line 98 of file Pythia8Hadronizer.cc.

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

Implements gen::Py8InterfaceBase.

Definition at line 865 of file Pythia8Hadronizer.cc.

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

866 {
867  bool lhe = lheEvent() != 0;
868 
869  // now create the GenEventInfo product from the GenEvent and fill
870  // the missing pieces
871  eventInfo().reset( new GenEventInfoProduct( event().get() ) );
872 
873  // in pythia pthat is used to subdivide samples into different bins
874  // in LHE mode the binning is done by the external ME generator
875  // which is likely not pthat, so only filling it for Py6 internal mode
876  if (!lhe) {
877  eventInfo()->setBinningValues(std::vector<double>(1, fMasterGen->info.pTHat()));
878  }
879 
880  eventInfo()->setDJR(DJR);
881  eventInfo()->setNMEPartons(nME);
882  eventInfo()->setNMEPartonsFiltered(nMEFiltered);
883 
884  //******** Verbosity ********
885 
886  if (maxEventsToPrint > 0 &&
890  if (pythiaPylistVerbosity) {
891  fMasterGen->info.list();
892  fMasterGen->event.list();
893  }
894 
895  if (pythiaHepMCVerbosity) {
896  std::cout << "Event process = "
897  << fMasterGen->info.code() << "\n"
898  << "----------------------" << std::endl;
899  event()->print();
900  }
902  std::cout << "Event process = "
903  << fMasterGen->info.code() << "\n"
904  << "----------------------" << std::endl;
905  ascii_io->write_event(event().get());
906  }
907  }
908 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
HepMC::IO_AsciiParticles * ascii_io
std::auto_ptr< HepMC::GenEvent > & event()
lhef::LHEEvent * lheEvent()
unsigned int pythiaPylistVerbosity
std::auto_ptr< GenEventInfoProduct > & eventInfo()
unsigned int maxEventsToPrint
vector< float > DJR
bool Pythia8Hadronizer::generatePartonsAndHadronize ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 649 of file Pythia8Hadronizer.cc.

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

650 {
651 
652  DJR.resize(0);
653  nME = -1;
654  nMEFiltered = -1;
655 
656  if ( fJetMatchingHook.get() )
657  {
658  fJetMatchingHook->resetMatchingStatus();
659  fJetMatchingHook->beforeHadronization( lheEvent() );
660  }
661 
662  if (!fMasterGen->next()) return false;
663 
664  double mergeweight = fMasterGen.get()->info.mergingWeightNLO();
665  if (fMergingHook.get()) {
666  mergeweight *= fMergingHook->getNormFactor();
667  }
668 
669  //protect against 0-weight from ckkw or similar
670  if (std::abs(mergeweight)==0.)
671  {
672  event().reset();
673  return false;
674  }
675 
676  if (fJetMatchingPy8InternalHook.get()) {
677  const std::vector<double> djrmatch = fJetMatchingPy8InternalHook->getDJR();
678  //cap size of djr vector to save storage space (keep only up to first 6 elements)
679  unsigned int ndjr = std::min(djrmatch.size(), std::vector<double>::size_type(6));
680  for (unsigned int idjr=0; idjr<ndjr; ++idjr) {
681  DJR.push_back(djrmatch[idjr]);
682  }
683 
684  nME=fJetMatchingPy8InternalHook->nMEpartons().first;
685  nMEFiltered=fJetMatchingPy8InternalHook->nMEpartons().second;
686  }
687 
688  if (evtgenDecays.get()) evtgenDecays->decay();
689 
690  event().reset(new HepMC::GenEvent);
691  bool py8hepmc = toHepMC.fill_next_event( *(fMasterGen.get()), event().get());
692 
693  if (!py8hepmc) {
694  return false;
695  }
696 
697  //add ckkw/umeps/unlops merging weight
698  if (mergeweight!=1.) {
699  event()->weights()[0] *= mergeweight;
700  }
701 
702  if (fEmissionVetoHook.get()) {
703  nISRveto += fEmissionVetoHook->getNISRveto();
704  nFSRveto += fEmissionVetoHook->getNFSRveto();
705  }
706  if (fPowhegHooksBB4L.get()) {
707  nFSRvetoBB4L += fPowhegHooksBB4L->getNFSRveto();
708  }
709 
710  //fill additional weights for systematic uncertainties
711  if (fMasterGen->info.getWeightsDetailedSize() > 0) {
712  for (const string &key : fMasterGen->info.initrwgt->weightsKeys) {
713  double wgt = (*fMasterGen->info.weights_detailed)[key];
714  event()->weights().push_back(wgt);
715  }
716  }
717  else if (fMasterGen->info.getWeightsCompressedSize() > 0) {
718  for (unsigned int i = 0; i < fMasterGen->info.getWeightsCompressedSize(); i++) {
719  double wgt = fMasterGen->info.getWeightsCompressedValue(i);
720  event()->weights().push_back(wgt);
721  }
722  }
723 
724  // fill shower weights
725  // http://home.thep.lu.se/~torbjorn/pythia82html/Variations.html
726  if( fMasterGen->info.nWeights() > 1 ){
727  for(int i = 0; i < fMasterGen->info.nWeights(); ++i) {
728  double wgt = fMasterGen->info.weight(i);
729  event()->weights().push_back(wgt);
730  }
731  }
732 
733  return true;
734 
735 }
std::auto_ptr< PowhegHooks > fEmissionVetoHook
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< EvtGenDecays > evtgenDecays
std::auto_ptr< PowhegHooksBB4L > fPowhegHooksBB4L
std::auto_ptr< JetMatchingHook > fJetMatchingHook
uint16_t size_type
std::auto_ptr< HepMC::GenEvent > & event()
lhef::LHEEvent * lheEvent()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
vector< float > DJR
HepMC::Pythia8ToHepMC toHepMC
std::auto_ptr< Pythia8::JetMatchingMadgraph > fJetMatchingPy8InternalHook
std::auto_ptr< Pythia8::amcnlo_unitarised_interface > fMergingHook
GenLumiInfoHeader * Pythia8Hadronizer::getGenLumiInfoHeader ( ) const
overridevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 910 of file Pythia8Hadronizer.cc.

References gen::Py8InterfaceBase::fMasterGen, mps_fire::i, crabWrapper::key, GenLumiInfoHeader::lheHeaders(), AlCaHLTBitMon_QueryRunRegistry::string, and GenLumiInfoHeader::weightNames().

910  {
911  GenLumiInfoHeader *genLumiInfoHeader = BaseHadronizer::getGenLumiInfoHeader();
912 
913  //fill lhe headers
914  //*FIXME* initrwgt header is corrupt due to pythia bug
915  for (const std::string &key : fMasterGen->info.headerKeys()) {
916  genLumiInfoHeader->lheHeaders().emplace_back(key,fMasterGen->info.header(key));
917  }
918 
919  //check, if it is not only nominal weight
920  int weights_number = fMasterGen->info.nWeights();
921  if (fMasterGen->info.initrwgt) weights_number += fMasterGen->info.initrwgt->weightsKeys.size();
922  if(weights_number > 1){
923  genLumiInfoHeader->weightNames().reserve(weights_number + 1);
924  genLumiInfoHeader->weightNames().push_back("nominal");
925  }
926 
927  //fill weight names
928  if (fMasterGen->info.initrwgt) {
929  for (const std::string &key : fMasterGen->info.initrwgt->weightsKeys) {
930  std::string weightgroupname;
931  for (const auto &wgtgrp : fMasterGen->info.initrwgt->weightgroups) {
932  const auto &wgtgrpwgt = wgtgrp.second.weights.find(key);
933  if (wgtgrpwgt != wgtgrp.second.weights.end()) {
934  weightgroupname = wgtgrp.first;
935  }
936  }
937 
938  std::ostringstream weightname;
939  weightname << "LHE, id = " << key << ", ";
940  if (!weightgroupname.empty()) {
941  weightname << "group = " << weightgroupname << ", ";
942  }
943  weightname<< fMasterGen->info.initrwgt->weights[key].contents;
944  genLumiInfoHeader->weightNames().push_back(weightname.str());
945  }
946  }
947 
948  //fill shower labels
949  // http://home.thep.lu.se/~torbjorn/pythia82html/Variations.html
950  // http://home.thep.lu.se/~torbjorn/doxygen/classPythia8_1_1Info.html
951  if( fMasterGen->info.nWeights() > 1 ){
952  for(int i = 0; i < fMasterGen->info.nWeights(); ++i) {
953  genLumiInfoHeader->weightNames().push_back( fMasterGen->info.weightLabel(i) );
954  }
955  }
956 
957  return genLumiInfoHeader;
958 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
const std::vector< std::string > & weightNames() const
const std::vector< std::pair< std::string, std::string > > & lheHeaders() const
bool Pythia8Hadronizer::hadronize ( )

Definition at line 738 of file Pythia8Hadronizer.cc.

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, AlCaHLTBitMon_QueryRunRegistry::string, and gen::Py8InterfaceBase::toHepMC.

739 {
740  DJR.resize(0);
741  nME = -1;
742  nMEFiltered = -1;
743  if(LHEInputFileName == std::string()) lhaUP->loadEvent(lheEvent());
744 
745  if ( fJetMatchingHook.get() )
746  {
747  fJetMatchingHook->resetMatchingStatus();
748  fJetMatchingHook->beforeHadronization( lheEvent() );
749  }
750 
751  bool py8next = fMasterGen->next();
752 
753  double mergeweight = fMasterGen.get()->info.mergingWeightNLO();
754  if (fMergingHook.get()) {
755  mergeweight *= fMergingHook->getNormFactor();
756  }
757 
758 
759  //protect against 0-weight from ckkw or similar
760  if (!py8next || std::abs(mergeweight)==0.)
761  {
762  lheEvent()->count( lhef::LHERunInfo::kSelected, 1.0, mergeweight );
763  event().reset();
764  return false;
765  }
766 
767  if (fJetMatchingPy8InternalHook.get()) {
768  const std::vector<double> djrmatch = fJetMatchingPy8InternalHook->getDJR();
769  //cap size of djr vector to save storage space (keep only up to first 6 elements)
770  unsigned int ndjr = std::min(djrmatch.size(), std::vector<double>::size_type(6));
771  for (unsigned int idjr=0; idjr<ndjr; ++idjr) {
772  DJR.push_back(djrmatch[idjr]);
773  }
774 
775  nME=fJetMatchingPy8InternalHook->nMEpartons().first;
776  nMEFiltered=fJetMatchingPy8InternalHook->nMEpartons().second;
777  }
778 
779  // update LHE matching statistics
780  //
781  lheEvent()->count( lhef::LHERunInfo::kAccepted, 1.0, mergeweight );
782 
783  if (evtgenDecays.get()) evtgenDecays->decay();
784 
785  event().reset(new HepMC::GenEvent);
786  bool py8hepmc = toHepMC.fill_next_event( *(fMasterGen.get()), event().get());
787  if (!py8hepmc) {
788  return false;
789  }
790 
791  //add ckkw/umeps/unlops merging weight
792  if (mergeweight!=1.) {
793  event()->weights()[0] *= mergeweight;
794  }
795 
796  if (fEmissionVetoHook.get()) {
797  nISRveto += fEmissionVetoHook->getNISRveto();
798  nFSRveto += fEmissionVetoHook->getNFSRveto();
799  }
800 
801  // fill shower weights
802  // http://home.thep.lu.se/~torbjorn/pythia82html/Variations.html
803  if( fMasterGen->info.nWeights() > 1 ){
804  for(int i = 0; i < fMasterGen->info.nWeights(); ++i) {
805  double wgt = fMasterGen->info.weight(i);
806  event()->weights().push_back(wgt);
807  }
808  }
809 
810 
811  return true;
812 
813 }
std::auto_ptr< PowhegHooks > fEmissionVetoHook
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< EvtGenDecays > evtgenDecays
std::string LHEInputFileName
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
Definition: LHEEvent.cc:207
std::auto_ptr< JetMatchingHook > fJetMatchingHook
uint16_t size_type
std::auto_ptr< HepMC::GenEvent > & event()
std::auto_ptr< LHAupLesHouches > lhaUP
lhef::LHEEvent * lheEvent()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
vector< float > DJR
HepMC::Pythia8ToHepMC toHepMC
std::auto_ptr< Pythia8::JetMatchingMadgraph > fJetMatchingPy8InternalHook
std::auto_ptr< Pythia8::amcnlo_unitarised_interface > fMergingHook
bool Pythia8Hadronizer::initializeForExternalPartons ( )

Definition at line 474 of file Pythia8Hadronizer.cc.

References edm::errors::Configuration, gen::Py8InterfaceBase::evtgenDecays, gen::Py8InterfaceBase::evtgenDecFile, gen::Py8InterfaceBase::evtgenPdlFile, gen::Py8InterfaceBase::evtgenUserFiles, Exception, 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(), gen::Py8InterfaceBase::slhafile_, mps_update::status, AlCaHLTBitMon_QueryRunRegistry::string, and gen::Py8InterfaceBase::useEvtGen.

475 {
476 
477  edm::LogInfo("Pythia8Interface") << "Initializing for external partons";
478 
479  bool status = false, status1 = false;
480 
481  fMultiUserHook.reset(new MultiUserHook);
482 
483  if(fReweightUserHook.get()) fMultiUserHook->addHook(fReweightUserHook.get());
484  if(fReweightEmpUserHook.get()) fMultiUserHook->addHook(fReweightEmpUserHook.get());
485  if(fReweightRapUserHook.get()) fMultiUserHook->addHook(fReweightRapUserHook.get());
487  if(fJetMatchingHook.get()) fMultiUserHook->addHook(fJetMatchingHook.get());
488  if(fEmissionVetoHook1.get()) {
489  edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook 1 from CMSSW Pythia8Interface";
490  fMultiUserHook->addHook(fEmissionVetoHook1.get());
491  }
492 
493  if (fMasterGen->settings.mode("POWHEG:veto") > 0 || fMasterGen->settings.mode("POWHEG:MPIveto") > 0) {
494 
495  if(fJetMatchingHook.get() || fEmissionVetoHook1.get())
496  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
497  <<" Attempt to turn on PowhegHooks by pythia8 settings but there are incompatible hooks on \n Incompatible are : jetMatching, emissionVeto1 \n";
498 
499  fEmissionVetoHook.reset(new PowhegHooks());
500 
501  edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook from pythia8 code";
502  fMultiUserHook->addHook(fEmissionVetoHook.get());
503  }
504 
505  bool PowhegRes = fMasterGen->settings.flag("POWHEGres:calcScales");
506  if (PowhegRes) {
507  edm::LogInfo("Pythia8Interface") << "Turning on resonance scale setting from CMSSW Pythia8Interface";
508  fPowhegResHook.reset(new PowhegResHook());
509  fMultiUserHook->addHook(fPowhegResHook.get());
510  }
511 
512  bool PowhegBB4L = fMasterGen->settings.flag("POWHEG:bb4l");
513  if (PowhegBB4L) {
514  edm::LogInfo("Pythia8Interface") << "Turning on BB4l hook from CMSSW Pythia8Interface";
515  fPowhegHooksBB4L.reset(new PowhegHooksBB4L());
516  fMultiUserHook->addHook(fPowhegHooksBB4L.get());
517  }
518 
519  //adapted from main89.cc in pythia8 examples
520  bool internalMatching = fMasterGen->settings.flag("JetMatching:merge");
521  bool internalMerging = !(fMasterGen->settings.word("Merging:Process")=="void");
522 
523  if (internalMatching && internalMerging) {
524  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
525  <<" Only one jet matching/merging scheme can be used at a time. \n";
526  }
527 
528  if (internalMatching) {
529  fJetMatchingPy8InternalHook.reset(new Pythia8::JetMatchingMadgraph);
531  }
532 
533  if (internalMerging) {
534  int scheme = ( fMasterGen->settings.flag("Merging:doUMEPSTree")
535  || fMasterGen->settings.flag("Merging:doUMEPSSubt")) ?
536  1 :
537  ( ( fMasterGen->settings.flag("Merging:doUNLOPSTree")
538  || fMasterGen->settings.flag("Merging:doUNLOPSSubt")
539  || fMasterGen->settings.flag("Merging:doUNLOPSLoop")
540  || fMasterGen->settings.flag("Merging:doUNLOPSSubtNLO")) ?
541  2 :
542  0 );
543  fMergingHook.reset(new Pythia8::amcnlo_unitarised_interface(scheme));
544  fMultiUserHook->addHook(fMergingHook.get());
545  }
546 
547  bool resonanceDecayFilter = fMasterGen->settings.flag("ResonanceDecayFilter:filter");
548  if (resonanceDecayFilter) {
551  }
552 
553  bool PTFilter = fMasterGen->settings.flag("PTFilter:filter");
554  if (PTFilter) {
555  fPTFilterHook.reset(new PTFilterHook);
556  fMultiUserHook->addHook(fPTFilterHook.get());
557  }
558 
559  if (fMultiUserHook->nHooks()>0) {
560  fMasterGen->setUserHooksPtr(fMultiUserHook.get());
561  }
562 
563  if(LHEInputFileName != std::string()) {
564 
565  edm::LogInfo("Pythia8Interface") << "Initialize direct pythia8 reading from LHE file "
566  << LHEInputFileName;
567  edm::LogInfo("Pythia8Interface") << "Some LHE information can be not stored";
568  fMasterGen->settings.mode("Beams:frameType", 4);
569  fMasterGen->settings.word("Beams:LHEF", LHEInputFileName);
570  status = fMasterGen->init();
571 
572  } else {
573 
574  lhaUP.reset(new LHAupLesHouches());
575  lhaUP->setScalesFromLHEF(fMasterGen->settings.flag("Beams:setProductionScalesFromLHEF"));
576  lhaUP->loadRunInfo(lheRunInfo());
577 
578  if ( fJetMatchingHook.get() )
579  {
580  fJetMatchingHook->init ( lheRunInfo() );
581  }
582 
583  fMasterGen->settings.mode("Beams:frameType", 5);
584  fMasterGen->setLHAupPtr(lhaUP.get());
585  edm::LogInfo("Pythia8Interface") << "Initializing MasterGen";
586  status = fMasterGen->init();
587  }
588 
589  //clean up temp file
590  if (!slhafile_.empty()) {
591  std::remove(slhafile_.c_str());
592  }
593 
594  if ( pythiaPylistVerbosity > 10 )
595  {
596  if ( pythiaPylistVerbosity == 11 || pythiaPylistVerbosity == 13 )
597  fMasterGen->settings.listAll();
598  if ( pythiaPylistVerbosity == 12 || pythiaPylistVerbosity == 13 )
599  fMasterGen->particleData.listAll();
600  }
601 
602  // init decayer
603  fDecayer->settings.flag("ProcessLevel:all", false ); // trick
604  fDecayer->settings.flag("ProcessLevel:resonanceDecays", true );
605  edm::LogInfo("Pythia8Interface") << "Initializing Decayer";
606  status1 = fDecayer->init();
607 
608  if (useEvtGen) {
609  edm::LogInfo("Pythia8Interface") << "Creating and initializing pythia8 EvtGen plugin";
610 
611  std::string evtgenpath(getenv("EVTGENDATA"));
612  evtgenDecays.reset(new EvtGenDecays(fMasterGen.get(), evtgenDecFile.c_str(), evtgenPdlFile.c_str()));
613 
614  for (unsigned int i=0; i<evtgenUserFiles.size(); i++) {
615  edm::FileInPath evtgenUserFile(evtgenUserFiles.at(i));
616  evtgenDecays->readDecayFile(evtgenUserFile.fullPath().c_str());
617  }
618 
619  }
620 
621  return (status&&status1);
622 }
std::auto_ptr< PowhegHooks > fEmissionVetoHook
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< ResonanceDecayFilterHook > fResonanceDecayFilterHook
std::auto_ptr< EvtGenDecays > evtgenDecays
std::auto_ptr< PowhegHooksBB4L > fPowhegHooksBB4L
std::auto_ptr< PTFilterHook > fPTFilterHook
std::string LHEInputFileName
std::auto_ptr< JetMatchingHook > fJetMatchingHook
std::vector< std::string > evtgenUserFiles
std::auto_ptr< LHAupLesHouches > lhaUP
std::auto_ptr< MultiUserHook > fMultiUserHook
std::auto_ptr< UserHooks > fReweightPtHatRapUserHook
std::auto_ptr< UserHooks > fReweightEmpUserHook
std::auto_ptr< PowhegResHook > fPowhegResHook
unsigned int pythiaPylistVerbosity
lhef::LHERunInfo * lheRunInfo()
std::auto_ptr< UserHooks > fReweightUserHook
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:209
std::auto_ptr< UserHooks > fReweightRapUserHook
std::auto_ptr< Pythia8::Pythia > fDecayer
std::auto_ptr< Pythia8::JetMatchingMadgraph > fJetMatchingPy8InternalHook
std::auto_ptr< EmissionVetoHook1 > fEmissionVetoHook1
std::auto_ptr< Pythia8::amcnlo_unitarised_interface > fMergingHook
bool Pythia8Hadronizer::initializeForInternalPartons ( )
overridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 320 of file Pythia8Hadronizer.cc.

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

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

Definition at line 816 of file Pythia8Hadronizer.cc.

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

817 {
818 
819  Event* pythiaEvent = &(fMasterGen->event);
820 
821  int NPartsBeforeDecays = pythiaEvent->size();
822  int NPartsAfterDecays = event().get()->particles_size();
823 
824  if(NPartsAfterDecays == NPartsBeforeDecays) return true;
825 
826  bool result = true;
827 
828  for ( int ipart=NPartsAfterDecays; ipart>NPartsBeforeDecays; ipart-- )
829  {
830 
831  HepMC::GenParticle* part = event().get()->barcode_to_particle( ipart );
832 
833  if ( part->status() == 1 && (fDecayer->particleData).canDecay(part->pdg_id()) )
834  {
835  fDecayer->event.reset();
836  Particle py8part( part->pdg_id(), 93, 0, 0, 0, 0, 0, 0,
837  part->momentum().x(),
838  part->momentum().y(),
839  part->momentum().z(),
840  part->momentum().t(),
841  part->generated_mass() );
842  HepMC::GenVertex* ProdVtx = part->production_vertex();
843  py8part.vProd( ProdVtx->position().x(), ProdVtx->position().y(),
844  ProdVtx->position().z(), ProdVtx->position().t() );
845  py8part.tau( (fDecayer->particleData).tau0( part->pdg_id() ) );
846  fDecayer->event.append( py8part );
847  int nentries = fDecayer->event.size();
848  if ( !fDecayer->event[nentries-1].mayDecay() ) continue;
849  fDecayer->next();
850  int nentries1 = fDecayer->event.size();
851  if ( nentries1 <= nentries ) continue; //same number of particles, no decays...
852 
853  part->set_status(2);
854 
855  result = toHepMC.fill_next_event( *(fDecayer.get()), event().get(), -1, true, part);
856 
857  }
858  }
859 
860  return result;
861 
862 }
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< HepMC::GenEvent > & event()
part
Definition: HCALResponse.h:20
std::auto_ptr< Pythia8::Pythia > fDecayer
HepMC::Pythia8ToHepMC toHepMC
void Pythia8Hadronizer::statistics ( )
overridevirtual

Reimplemented from gen::Py8InterfaceBase.

Definition at line 625 of file Pythia8Hadronizer.cc.

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

626 {
627  fMasterGen->stat();
628 
629  if(fEmissionVetoHook.get()) {
630  edm::LogPrint("Pythia8Interface") << "\n"
631  << "Number of ISR vetoed = " << nISRveto;
632  edm::LogPrint("Pythia8Interface")
633  << "Number of FSR vetoed = " << nFSRveto;
634  }
635 
636  if(fPowhegHooksBB4L.get()) {
637  edm::LogInfo("Pythia8Interface") << "\n"
638  << "BB4L: Number of FSR vetoed = " << nFSRvetoBB4L;
639  }
640 
641  double xsec = fMasterGen->info.sigmaGen(); // cross section in mb
642  xsec *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
643  double err = fMasterGen->info.sigmaErr(); // cross section err in mb
644  err *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
646 }
std::auto_ptr< PowhegHooks > fEmissionVetoHook
std::auto_ptr< Pythia8::Pythia > fMasterGen
std::auto_ptr< PowhegHooksBB4L > fPowhegHooksBB4L
void setInternalXSec(const XSec &xsec)
GenRunInfoProduct & runInfo()

Member Data Documentation

double Pythia8Hadronizer::comEnergy
private

Center-of-Mass energy.

Definition at line 101 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons().

vector<float> Pythia8Hadronizer::DJR
private

Definition at line 154 of file Pythia8Hadronizer.cc.

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

int Pythia8Hadronizer::EV1_emittedMode
private

Definition at line 148 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_maxVetoCount
private

Definition at line 145 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

bool Pythia8Hadronizer::EV1_MPIvetoOn
private

Definition at line 150 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_nFinal
private

Definition at line 143 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pTdefMode
private

Definition at line 149 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pTempMode
private

Definition at line 147 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pThardMode
private

Definition at line 146 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

bool Pythia8Hadronizer::EV1_vetoOn
private

Definition at line 144 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

double Pythia8Hadronizer::fBeam1PZ
private

Definition at line 109 of file Pythia8Hadronizer.cc.

double Pythia8Hadronizer::fBeam2PZ
private

Definition at line 110 of file Pythia8Hadronizer.cc.

std::auto_ptr<PowhegHooks> Pythia8Hadronizer::fEmissionVetoHook
private
std::auto_ptr<EmissionVetoHook1> Pythia8Hadronizer::fEmissionVetoHook1
private
int Pythia8Hadronizer::fInitialState
private

Definition at line 107 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons(), and Pythia8Hadronizer().

std::auto_ptr<JetMatchingHook> Pythia8Hadronizer::fJetMatchingHook
private
std::auto_ptr<Pythia8::JetMatchingMadgraph> Pythia8Hadronizer::fJetMatchingPy8InternalHook
private
std::auto_ptr<Pythia8::amcnlo_unitarised_interface> Pythia8Hadronizer::fMergingHook
private
std::auto_ptr<MultiUserHook> Pythia8Hadronizer::fMultiUserHook
private
std::auto_ptr<PowhegHooksBB4L> Pythia8Hadronizer::fPowhegHooksBB4L
private
std::auto_ptr<PowhegResHook> Pythia8Hadronizer::fPowhegResHook
private
std::auto_ptr<PTFilterHook> Pythia8Hadronizer::fPTFilterHook
private
std::auto_ptr<ResonanceDecayFilterHook> Pythia8Hadronizer::fResonanceDecayFilterHook
private
std::auto_ptr<UserHooks> Pythia8Hadronizer::fReweightEmpUserHook
private
std::auto_ptr<UserHooks> Pythia8Hadronizer::fReweightPtHatRapUserHook
private
std::auto_ptr<UserHooks> Pythia8Hadronizer::fReweightRapUserHook
private
std::auto_ptr<UserHooks> Pythia8Hadronizer::fReweightUserHook
private
std::auto_ptr<LHAupLesHouches> Pythia8Hadronizer::lhaUP
private

Definition at line 104 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

std::string Pythia8Hadronizer::LHEInputFileName
private

Definition at line 103 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

int Pythia8Hadronizer::nFSRveto
private

Definition at line 159 of file Pythia8Hadronizer.cc.

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

int Pythia8Hadronizer::nFSRvetoBB4L
private

Definition at line 160 of file Pythia8Hadronizer.cc.

Referenced by generatePartonsAndHadronize(), and statistics().

int Pythia8Hadronizer::nISRveto
private

Definition at line 158 of file Pythia8Hadronizer.cc.

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

int Pythia8Hadronizer::nME
private

Definition at line 155 of file Pythia8Hadronizer.cc.

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

int Pythia8Hadronizer::nMEFiltered
private

Definition at line 156 of file Pythia8Hadronizer.cc.

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

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

Definition at line 152 of file Pythia8Hadronizer.cc.