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 () override
 
- Public Member Functions inherited from gen::Py8InterfaceBase
bool decay ()
 
bool declareSpecialSettings (const std::vector< std::string > &)
 
bool declareStableParticles (const std::vector< int > &)
 
void p8SetRandomEngine (CLHEP::HepRandomEngine *v)
 
 Py8InterfaceBase (edm::ParameterSet const &ps)
 
P8RndmEnginerandomEngine ()
 
bool readSettings (int)
 
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::GenEventgetGenEvent ()
 
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

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< Vincia::VinciaPlugin > fvincia
 
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 74 of file Pythia8Hadronizer.cc.

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

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

Definition at line 170 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, fvincia, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), PP, PPbar, and AlCaHLTBitMon_QueryRunRegistry::string.

170  :
171  Py8InterfaceBase(params),
172  comEnergy(params.getParameter<double>("comEnergy")),
173  LHEInputFileName(params.getUntrackedParameter<std::string>("LHEInputFileName","")),
174  fInitialState(PP),
175  nME(-1), nMEFiltered(-1), nISRveto(0), nFSRveto(0), nFSRvetoBB4L(0)
176 {
177 
178  // J.Y.: the following 3 parameters are hacked "for a reason"
179  //
180  if ( params.exists( "PPbarInitialState" ) )
181  {
182  if ( fInitialState == PP )
183  {
185  edm::LogImportant("GeneratorInterface|Pythia8Interface")
186  << "Pythia8 will be initialized for PROTON-ANTIPROTON INITIAL STATE. "
187  << "This is a user-request change from the DEFAULT PROTON-PROTON initial state.";
188  }
189  else
190  {
191  // probably need to throw on attempt to override ?
192  }
193  }
194  else if ( params.exists( "ElectronPositronInitialState" ) )
195  {
196  if ( fInitialState == PP )
197  {
199  edm::LogInfo("GeneratorInterface|Pythia8Interface")
200  << "Pythia8 will be initialized for ELECTRON-POSITRON INITIAL STATE. "
201  << "This is a user-request change from the DEFAULT PROTON-PROTON initial state.";
202  }
203  else
204  {
205  // probably need to throw on attempt to override ?
206  }
207  }
208  else if ( params.exists( "ElectronProtonInitialState" ) || params.exists( "PositronProtonInitialState" ) )
209  {
210  // throw on unknown initial state !
211  throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
212  <<" UNKNOWN INITIAL STATE. \n The allowed initial states are: PP, PPbar, ElectronPositron \n";
213  }
214 
215  // Reweight user hook
216  //
217  if( params.exists( "reweightGen" ) )
218  {
219  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGen";
220  edm::ParameterSet rgParams =
221  params.getParameter<edm::ParameterSet>("reweightGen");
222  fReweightUserHook.reset(
223  new PtHatReweightUserHook(rgParams.getParameter<double>("pTRef"),
224  rgParams.getParameter<double>("power"))
225  );
226  edm::LogInfo("Pythia8Interface") << "End setup for reweightGen";
227  }
228  if( params.exists( "reweightGenEmp" ) )
229  {
230  edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenEmp";
231  edm::ParameterSet rgeParams =
232  params.getParameter<edm::ParameterSet>("reweightGenEmp");
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  if( params.exists( "VinciaPlugin" ) ) {
313  fMasterGen.reset(new Pythia);
314  fvincia.reset(new Vincia::VinciaPlugin(fMasterGen.get()));
315  }
316 
317 }
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< Vincia::VinciaPlugin > fvincia
std::auto_ptr< EmissionVetoHook1 > fEmissionVetoHook1
Pythia8Hadronizer::~Pythia8Hadronizer ( )
override

Definition at line 320 of file Pythia8Hadronizer.cc.

321 {
322 
323 }

Member Function Documentation

const char* Pythia8Hadronizer::classname ( ) const
inlineoverridevirtual

Implements gen::Py8InterfaceBase.

Definition at line 93 of file Pythia8Hadronizer.cc.

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

Reimplemented from gen::BaseHadronizer.

Definition at line 101 of file Pythia8Hadronizer.cc.

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

Reimplemented from gen::BaseHadronizer.

Definition at line 102 of file Pythia8Hadronizer.cc.

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

Implements gen::Py8InterfaceBase.

Definition at line 873 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.

874 {
875  bool lhe = lheEvent() != 0;
876 
877  // now create the GenEventInfo product from the GenEvent and fill
878  // the missing pieces
879  eventInfo().reset( new GenEventInfoProduct( event().get() ) );
880 
881  // in pythia pthat is used to subdivide samples into different bins
882  // in LHE mode the binning is done by the external ME generator
883  // which is likely not pthat, so only filling it for Py6 internal mode
884  if (!lhe) {
885  eventInfo()->setBinningValues(std::vector<double>(1, fMasterGen->info.pTHat()));
886  }
887 
888  eventInfo()->setDJR(DJR);
889  eventInfo()->setNMEPartons(nME);
890  eventInfo()->setNMEPartonsFiltered(nMEFiltered);
891 
892  //******** Verbosity ********
893 
894  if (maxEventsToPrint > 0 &&
898  if (pythiaPylistVerbosity) {
899  fMasterGen->info.list();
900  fMasterGen->event.list();
901  }
902 
903  if (pythiaHepMCVerbosity) {
904  std::cout << "Event process = "
905  << fMasterGen->info.code() << "\n"
906  << "----------------------" << std::endl;
907  event()->print();
908  }
910  std::cout << "Event process = "
911  << fMasterGen->info.code() << "\n"
912  << "----------------------" << std::endl;
913  ascii_io->write_event(event().get());
914  }
915  }
916 }
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 658 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.

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

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

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

748 {
749  DJR.resize(0);
750  nME = -1;
751  nMEFiltered = -1;
752  if(LHEInputFileName == std::string()) lhaUP->loadEvent(lheEvent());
753 
754  if ( fJetMatchingHook.get() )
755  {
756  fJetMatchingHook->resetMatchingStatus();
757  fJetMatchingHook->beforeHadronization( lheEvent() );
758  }
759 
760  bool py8next = fMasterGen->next();
761 
762  double mergeweight = fMasterGen.get()->info.mergingWeightNLO();
763  if (fMergingHook.get()) {
764  mergeweight *= fMergingHook->getNormFactor();
765  }
766 
767 
768  //protect against 0-weight from ckkw or similar
769  if (!py8next || std::abs(mergeweight)==0.)
770  {
771  lheEvent()->count( lhef::LHERunInfo::kSelected, 1.0, mergeweight );
772  event().reset();
773  return false;
774  }
775 
776  if (fJetMatchingPy8InternalHook.get()) {
777  const std::vector<double> djrmatch = fJetMatchingPy8InternalHook->getDJR();
778  //cap size of djr vector to save storage space (keep only up to first 6 elements)
779  unsigned int ndjr = std::min(djrmatch.size(), std::vector<double>::size_type(6));
780  for (unsigned int idjr=0; idjr<ndjr; ++idjr) {
781  DJR.push_back(djrmatch[idjr]);
782  }
783 
784  nME=fJetMatchingPy8InternalHook->nMEpartons().first;
785  nMEFiltered=fJetMatchingPy8InternalHook->nMEpartons().second;
786  }
787 
788  // update LHE matching statistics
789  //
790  lheEvent()->count( lhef::LHERunInfo::kAccepted, 1.0, mergeweight );
791 
792  if (evtgenDecays.get()) evtgenDecays->decay();
793 
794  event().reset(new HepMC::GenEvent);
795  bool py8hepmc = toHepMC.fill_next_event( *(fMasterGen.get()), event().get());
796  if (!py8hepmc) {
797  return false;
798  }
799 
800  //add ckkw/umeps/unlops merging weight
801  if (mergeweight!=1.) {
802  event()->weights()[0] *= mergeweight;
803  }
804 
805  if (fEmissionVetoHook.get()) {
806  nISRveto += fEmissionVetoHook->getNISRveto();
807  nFSRveto += fEmissionVetoHook->getNFSRveto();
808  }
809 
810  // fill shower weights
811  // http://home.thep.lu.se/~torbjorn/pythia82html/Variations.html
812  if( fMasterGen->info.nWeights() > 1 ){
813  for(int i = 0; i < fMasterGen->info.nWeights(); ++i) {
814  double wgt = fMasterGen->info.weight(i);
815  event()->weights().push_back(wgt);
816  }
817  }
818 
819  return true;
820 
821 }
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 483 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.

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

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

Definition at line 824 of file Pythia8Hadronizer.cc.

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

825 {
826 
827  Event* pythiaEvent = &(fMasterGen->event);
828 
829  int NPartsBeforeDecays = pythiaEvent->size();
830  int NPartsAfterDecays = event().get()->particles_size();
831 
832  if(NPartsAfterDecays == NPartsBeforeDecays) return true;
833 
834  bool result = true;
835 
836  for ( int ipart=NPartsAfterDecays; ipart>NPartsBeforeDecays; ipart-- )
837  {
838 
839  HepMC::GenParticle* part = event().get()->barcode_to_particle( ipart );
840 
841  if ( part->status() == 1 && (fDecayer->particleData).canDecay(part->pdg_id()) )
842  {
843  fDecayer->event.reset();
844  Particle py8part( part->pdg_id(), 93, 0, 0, 0, 0, 0, 0,
845  part->momentum().x(),
846  part->momentum().y(),
847  part->momentum().z(),
848  part->momentum().t(),
849  part->generated_mass() );
850  HepMC::GenVertex* ProdVtx = part->production_vertex();
851  py8part.vProd( ProdVtx->position().x(), ProdVtx->position().y(),
852  ProdVtx->position().z(), ProdVtx->position().t() );
853  py8part.tau( (fDecayer->particleData).tau0( part->pdg_id() ) );
854  fDecayer->event.append( py8part );
855  int nentries = fDecayer->event.size();
856  if ( !fDecayer->event[nentries-1].mayDecay() ) continue;
857  fDecayer->next();
858  int nentries1 = fDecayer->event.size();
859  if ( nentries1 <= nentries ) continue; //same number of particles, no decays...
860 
861  part->set_status(2);
862 
863  result = toHepMC.fill_next_event( *(fDecayer.get()), event().get(), -1, true, part);
864 
865  }
866  }
867 
868  return result;
869 
870 }
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 634 of file Pythia8Hadronizer.cc.

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

635 {
636  fMasterGen->stat();
637 
638  if(fEmissionVetoHook.get()) {
639  edm::LogPrint("Pythia8Interface") << "\n"
640  << "Number of ISR vetoed = " << nISRveto;
641  edm::LogPrint("Pythia8Interface")
642  << "Number of FSR vetoed = " << nFSRveto;
643  }
644 
645  if(fPowhegHooksBB4L.get()) {
646  edm::LogInfo("Pythia8Interface") << "\n"
647  << "BB4L: Number of FSR vetoed = " << nFSRvetoBB4L;
648  }
649 
650  double xsec = fMasterGen->info.sigmaGen(); // cross section in mb
651  xsec *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
652  double err = fMasterGen->info.sigmaErr(); // cross section err in mb
653  err *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
655 }
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 105 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons().

vector<float> Pythia8Hadronizer::DJR
private

Definition at line 158 of file Pythia8Hadronizer.cc.

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

int Pythia8Hadronizer::EV1_emittedMode
private

Definition at line 152 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_maxVetoCount
private

Definition at line 149 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

bool Pythia8Hadronizer::EV1_MPIvetoOn
private

Definition at line 154 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_nFinal
private

Definition at line 147 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pTdefMode
private

Definition at line 153 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pTempMode
private

Definition at line 151 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

int Pythia8Hadronizer::EV1_pThardMode
private

Definition at line 150 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

bool Pythia8Hadronizer::EV1_vetoOn
private

Definition at line 148 of file Pythia8Hadronizer.cc.

Referenced by Pythia8Hadronizer().

double Pythia8Hadronizer::fBeam1PZ
private

Definition at line 113 of file Pythia8Hadronizer.cc.

double Pythia8Hadronizer::fBeam2PZ
private

Definition at line 114 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 111 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<Vincia::VinciaPlugin> Pythia8Hadronizer::fvincia
private

Definition at line 99 of file Pythia8Hadronizer.cc.

Referenced by initializeForInternalPartons(), and Pythia8Hadronizer().

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

Definition at line 108 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

std::string Pythia8Hadronizer::LHEInputFileName
private

Definition at line 107 of file Pythia8Hadronizer.cc.

Referenced by hadronize(), and initializeForExternalPartons().

int Pythia8Hadronizer::nFSRveto
private

Definition at line 163 of file Pythia8Hadronizer.cc.

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

int Pythia8Hadronizer::nFSRvetoBB4L
private

Definition at line 164 of file Pythia8Hadronizer.cc.

Referenced by generatePartonsAndHadronize(), and statistics().

int Pythia8Hadronizer::nISRveto
private

Definition at line 162 of file Pythia8Hadronizer.cc.

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

int Pythia8Hadronizer::nME
private

Definition at line 159 of file Pythia8Hadronizer.cc.

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

int Pythia8Hadronizer::nMEFiltered
private

Definition at line 160 of file Pythia8Hadronizer.cc.

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

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

Definition at line 156 of file Pythia8Hadronizer.cc.