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_nFinalMode
 
int EV1_pTdefMode
 
int EV1_pTempMode
 
int EV1_pThardMode
 
int EV1_QEDvetoMode
 
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 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 167 of file Pythia8Hadronizer.cc.

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

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

322 {
323 
324 }

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

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

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

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

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

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

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

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

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

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

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

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

632 {
633  fMasterGen->stat();
634 
635  if(fEmissionVetoHook.get()) {
636  edm::LogPrint("Pythia8Interface") << "\n"
637  << "Number of ISR vetoed = " << nISRveto;
638  edm::LogPrint("Pythia8Interface")
639  << "Number of FSR vetoed = " << nFSRveto;
640  }
641 
642  double xsec = fMasterGen->info.sigmaGen(); // cross section in mb
643  xsec *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
644  double err = fMasterGen->info.sigmaErr(); // cross section err in mb
645  err *= 1.0e9; // translate to pb (CMS/Gen "convention" as of May 2009)
647 }
std::auto_ptr< PowhegHooks > fEmissionVetoHook
std::auto_ptr< Pythia8::Pythia > fMasterGen
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 156 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_nFinalMode
private

Definition at line 152 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().

int Pythia8Hadronizer::EV1_QEDvetoMode
private

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

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

int Pythia8Hadronizer::nISRveto
private

Definition at line 160 of file Pythia8Hadronizer.cc.

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

int Pythia8Hadronizer::nME
private

Definition at line 157 of file Pythia8Hadronizer.cc.

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

int Pythia8Hadronizer::nMEFiltered
private

Definition at line 158 of file Pythia8Hadronizer.cc.

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

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

Definition at line 154 of file Pythia8Hadronizer.cc.