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");
230  edm::LogInfo("Pythia8Interface") << "End setup for reweightGenEmp";
231  }
232  if( params.exists( "reweightGenRap" ) )
233  {
234  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenRap";
235  edm::ParameterSet rgrParams =
236  params.getParameter<edm::ParameterSet>("reweightGenRap");
237  fReweightRapUserHook.reset(
238  new RapReweightUserHook(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
239  rgrParams.getParameter<double>("yLabPower"),
240  rgrParams.getParameter<std::string>("yCMSigmaFunc"),
241  rgrParams.getParameter<double>("yCMPower"),
242  rgrParams.getParameter<double>("pTHatMin"),
243  rgrParams.getParameter<double>("pTHatMax"))
244  );
245  edm::LogInfo("Pythia8Interface") << "End setup for reweightGenRap";
246  }
247  if( params.exists( "reweightGenPtHatRap" ) )
248  {
249  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenPtHatRap";
250  edm::ParameterSet rgrParams =
251  params.getParameter<edm::ParameterSet>("reweightGenPtHatRap");
253  new PtHatRapReweightUserHook(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
254  rgrParams.getParameter<double>("yLabPower"),
255  rgrParams.getParameter<std::string>("yCMSigmaFunc"),
256  rgrParams.getParameter<double>("yCMPower"),
257  rgrParams.getParameter<double>("pTHatMin"),
258  rgrParams.getParameter<double>("pTHatMax"))
259  );
260  edm::LogInfo("Pythia8Interface") << "End setup for reweightGenPtHatRap";
261  }
262 
263  if( params.exists( "useUserHook" ) )
264  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
265  <<" Obsolete parameter: useUserHook \n Please use the actual one instead \n";
266 
267  // PS matching prototype
268  //
269  if ( params.exists("jetMatching") )
270  {
271  edm::ParameterSet jmParams =
272  params.getUntrackedParameter<edm::ParameterSet>("jetMatching");
273  std::string scheme = jmParams.getParameter<std::string>("scheme");
274  if ( scheme == "Madgraph" || scheme == "MadgraphFastJet" )
275  {
276  fJetMatchingHook.reset(new JetMatchingHook( jmParams, &fMasterGen->info ));
277  }
278  }
279 
280  // Pythia8Interface emission veto
281  //
282  if ( params.exists("emissionVeto1") )
283  {
284  EV1_nFinal = -1;
285  if(params.exists("EV1_nFinal")) EV1_nFinal = params.getParameter<int>("EV1_nFinal");
286  EV1_vetoOn = true;
287  if(params.exists("EV1_vetoOn")) EV1_vetoOn = params.getParameter<bool>("EV1_vetoOn");
288  EV1_maxVetoCount = 10;
289  if(params.exists("EV1_maxVetoCount")) EV1_maxVetoCount = params.getParameter<int>("EV1_maxVetoCount");
290  EV1_pThardMode = 1;
291  if(params.exists("EV1_pThardMode")) EV1_pThardMode = params.getParameter<int>("EV1_pThardMode");
292  EV1_pTempMode = 0;
293  if(params.exists("EV1_pTempMode")) EV1_pTempMode = params.getParameter<int>("EV1_pTempMode");
294  if(EV1_pTempMode > 2 || EV1_pTempMode < 0)
295  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
296  <<" Wrong value for EV1_pTempMode code\n";
297  EV1_emittedMode = 0;
298  if(params.exists("EV1_emittedMode")) EV1_emittedMode = params.getParameter<int>("EV1_emittedMode");
299  EV1_pTdefMode = 1;
300  if(params.exists("EV1_pTdefMode")) EV1_pTdefMode = params.getParameter<int>("EV1_pTdefMode");
301  EV1_MPIvetoOn = false;
302  if(params.exists("EV1_MPIvetoOn")) EV1_MPIvetoOn = params.getParameter<bool>("EV1_MPIvetoOn");
306  }
307 
308 }
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 311 of file Pythia8Hadronizer.cc.

312 {
313 
314 }

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 851 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.

852 {
853  bool lhe = lheEvent() != 0;
854 
855  // now create the GenEventInfo product from the GenEvent and fill
856  // the missing pieces
857  eventInfo().reset( new GenEventInfoProduct( event().get() ) );
858 
859  // in pythia pthat is used to subdivide samples into different bins
860  // in LHE mode the binning is done by the external ME generator
861  // which is likely not pthat, so only filling it for Py6 internal mode
862  if (!lhe) {
863  eventInfo()->setBinningValues(std::vector<double>(1, fMasterGen->info.pTHat()));
864  }
865 
866  eventInfo()->setDJR(DJR);
867  eventInfo()->setNMEPartons(nME);
868  eventInfo()->setNMEPartonsFiltered(nMEFiltered);
869 
870  //******** Verbosity ********
871 
872  if (maxEventsToPrint > 0 &&
876  if (pythiaPylistVerbosity) {
877  fMasterGen->info.list();
878  fMasterGen->event.list();
879  }
880 
881  if (pythiaHepMCVerbosity) {
882  std::cout << "Event process = "
883  << fMasterGen->info.code() << "\n"
884  << "----------------------" << std::endl;
885  event()->print();
886  }
888  std::cout << "Event process = "
889  << fMasterGen->info.code() << "\n"
890  << "----------------------" << std::endl;
891  ascii_io->write_event(event().get());
892  }
893  }
894 }
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 645 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.

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

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

896  {
897  GenLumiInfoHeader *genLumiInfoHeader = BaseHadronizer::getGenLumiInfoHeader();
898 
899  //fill lhe headers
900  //*FIXME* initrwgt header is corrupt due to pythia bug
901  for (const std::string &key : fMasterGen->info.headerKeys()) {
902  genLumiInfoHeader->lheHeaders().emplace_back(key,fMasterGen->info.header(key));
903  }
904 
905  //check, if it is not only nominal weight
906  int weights_number = fMasterGen->info.nWeights();
907  if (fMasterGen->info.initrwgt) weights_number += fMasterGen->info.initrwgt->weightsKeys.size();
908  if(weights_number > 1){
909  genLumiInfoHeader->weightNames().reserve(weights_number + 1);
910  genLumiInfoHeader->weightNames().push_back("nominal");
911  }
912 
913  //fill weight names
914  if (fMasterGen->info.initrwgt) {
915  for (const std::string &key : fMasterGen->info.initrwgt->weightsKeys) {
916  std::string weightgroupname;
917  for (const auto &wgtgrp : fMasterGen->info.initrwgt->weightgroups) {
918  const auto &wgtgrpwgt = wgtgrp.second.weights.find(key);
919  if (wgtgrpwgt != wgtgrp.second.weights.end()) {
920  weightgroupname = wgtgrp.first;
921  }
922  }
923 
924  std::ostringstream weightname;
925  weightname << "LHE, id = " << key << ", ";
926  if (!weightgroupname.empty()) {
927  weightname << "group = " << weightgroupname << ", ";
928  }
929  weightname<< fMasterGen->info.initrwgt->weights[key].contents;
930  genLumiInfoHeader->weightNames().push_back(weightname.str());
931  }
932  }
933 
934  //fill shower labels
935  // http://home.thep.lu.se/~torbjorn/pythia82html/Variations.html
936  // http://home.thep.lu.se/~torbjorn/doxygen/classPythia8_1_1Info.html
937  if( fMasterGen->info.nWeights() > 1 ){
938  for(int i = 0; i < fMasterGen->info.nWeights(); ++i) {
939  genLumiInfoHeader->weightNames().push_back( fMasterGen->info.weightLabel(i) );
940  }
941  }
942 
943  return genLumiInfoHeader;
944 }
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 734 of file Pythia8Hadronizer.cc.

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

735 {
736  DJR.resize(0);
737  nME = -1;
738  nMEFiltered = -1;
739  if(LHEInputFileName == std::string()) lhaUP->loadEvent(lheEvent());
740 
741  if ( fJetMatchingHook.get() )
742  {
743  fJetMatchingHook->resetMatchingStatus();
744  fJetMatchingHook->beforeHadronization( lheEvent() );
745  }
746 
747  bool py8next = fMasterGen->next();
748 
749  double mergeweight = fMasterGen.get()->info.mergingWeightNLO();
750  if (fMergingHook.get()) {
751  mergeweight *= fMergingHook->getNormFactor();
752  }
753 
754 
755  //protect against 0-weight from ckkw or similar
756  if (!py8next || std::abs(mergeweight)==0.)
757  {
758  lheEvent()->count( lhef::LHERunInfo::kSelected, 1.0, mergeweight );
759  event().reset();
760  return false;
761  }
762 
763  if (fJetMatchingPy8InternalHook.get()) {
764  const std::vector<double> djrmatch = fJetMatchingPy8InternalHook->getDJR();
765  //cap size of djr vector to save storage space (keep only up to first 6 elements)
766  unsigned int ndjr = std::min(djrmatch.size(), std::vector<double>::size_type(6));
767  for (unsigned int idjr=0; idjr<ndjr; ++idjr) {
768  DJR.push_back(djrmatch[idjr]);
769  }
770 
771  nME=fJetMatchingPy8InternalHook->nMEpartons().first;
772  nMEFiltered=fJetMatchingPy8InternalHook->nMEpartons().second;
773  }
774 
775  // update LHE matching statistics
776  //
777  lheEvent()->count( lhef::LHERunInfo::kAccepted, 1.0, mergeweight );
778 
779  if (evtgenDecays.get()) evtgenDecays->decay();
780 
781  event().reset(new HepMC::GenEvent);
782  bool py8hepmc = toHepMC.fill_next_event( *(fMasterGen.get()), event().get());
783  if (!py8hepmc) {
784  return false;
785  }
786 
787  //add ckkw/umeps/unlops merging weight
788  if (mergeweight!=1.) {
789  event()->weights()[0] *= mergeweight;
790  }
791 
792  if (fEmissionVetoHook.get()) {
793  nISRveto += fEmissionVetoHook->getNISRveto();
794  nFSRveto += fEmissionVetoHook->getNFSRveto();
795  }
796 
797  return true;
798 
799 }
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 470 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.

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

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

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

803 {
804 
805  Event* pythiaEvent = &(fMasterGen->event);
806 
807  int NPartsBeforeDecays = pythiaEvent->size();
808  int NPartsAfterDecays = event().get()->particles_size();
809 
810  if(NPartsAfterDecays == NPartsBeforeDecays) return true;
811 
812  bool result = true;
813 
814  for ( int ipart=NPartsAfterDecays; ipart>NPartsBeforeDecays; ipart-- )
815  {
816 
817  HepMC::GenParticle* part = event().get()->barcode_to_particle( ipart );
818 
819  if ( part->status() == 1 && (fDecayer->particleData).canDecay(part->pdg_id()) )
820  {
821  fDecayer->event.reset();
822  Particle py8part( part->pdg_id(), 93, 0, 0, 0, 0, 0, 0,
823  part->momentum().x(),
824  part->momentum().y(),
825  part->momentum().z(),
826  part->momentum().t(),
827  part->generated_mass() );
828  HepMC::GenVertex* ProdVtx = part->production_vertex();
829  py8part.vProd( ProdVtx->position().x(), ProdVtx->position().y(),
830  ProdVtx->position().z(), ProdVtx->position().t() );
831  py8part.tau( (fDecayer->particleData).tau0( part->pdg_id() ) );
832  fDecayer->event.append( py8part );
833  int nentries = fDecayer->event.size();
834  if ( !fDecayer->event[nentries-1].mayDecay() ) continue;
835  fDecayer->next();
836  int nentries1 = fDecayer->event.size();
837  if ( nentries1 <= nentries ) continue; //same number of particles, no decays...
838 
839  part->set_status(2);
840 
841  result = toHepMC.fill_next_event( *(fDecayer.get()), event().get(), -1, true, part);
842 
843  }
844  }
845 
846  return result;
847 
848 }
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 621 of file Pythia8Hadronizer.cc.

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

622 {
623  fMasterGen->stat();
624 
625  if(fEmissionVetoHook.get()) {
626  edm::LogPrint("Pythia8Interface") << "\n"
627  << "Number of ISR vetoed = " << nISRveto;
628  edm::LogPrint("Pythia8Interface")
629  << "Number of FSR vetoed = " << nFSRveto;
630  }
631 
632  if(fPowhegHooksBB4L.get()) {
633  edm::LogInfo("Pythia8Interface") << "\n"
634  << "BB4L: Number of FSR vetoed = " << nFSRvetoBB4L;
635  }
636 
637  double xsec = fMasterGen->info.sigmaGen(); // cross section in mb
638  xsec *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
639  double err = fMasterGen->info.sigmaErr(); // cross section err in mb
640  err *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
642 }
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.