CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Herwig7Hadronizer Class Reference
Inheritance diagram for Herwig7Hadronizer:
Herwig7Interface gen::BaseHadronizer

Public Member Functions

const char * classname () const
 
bool decay ()
 
bool declareSpecialSettings (const std::vector< std::string >)
 
bool declareStableParticles (const std::vector< int > &pdgIds)
 
void finalizeEvent ()
 
bool generatePartonsAndHadronize ()
 
bool hadronize ()
 
 Herwig7Hadronizer (const edm::ParameterSet &params)
 
bool initializeForExternalPartons ()
 
bool initializeForInternalPartons ()
 
bool readSettings (int)
 
bool residualDecay ()
 
void statistics ()
 
 ~Herwig7Hadronizer () override
 
- Public Member Functions inherited from Herwig7Interface
 Herwig7Interface (const edm::ParameterSet &params)
 
void setPEGRandomEngine (CLHEP::HepRandomEngine *)
 
 ~Herwig7Interface ()
 
- 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 ()
 
virtual GenLumiInfoHeadergetGenLumiInfoHeader () const
 
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 Member Functions

void doSetRandomEngine (CLHEP::HepRandomEngine *v) override
 

Private Attributes

unsigned int eventsToPrint
 
const std::string handlerDirectory_
 
edm::ParameterSet paramSettings
 
boost::shared_ptr< lhef::LHEProxyproxy_
 
const std::string runFileName
 
ThePEG::EventPtr thepegEvent
 

Additional Inherited Members

- Public Attributes inherited from Herwig7Interface
ThePEG::EGPtr eg_
 
- Protected Member Functions inherited from Herwig7Interface
void callHerwigGenerator ()
 
void createInputFile (const edm::ParameterSet &params)
 
void flushRandomNumberGenerator ()
 
bool initGenerator ()
 
void initRepository (const edm::ParameterSet &params)
 
- Protected Member Functions inherited from gen::BaseHadronizer
std::unique_ptr< HepMC::GenEvent > & event ()
 
std::unique_ptr< GenEventInfoProduct > & eventInfo ()
 
lhef::LHEEventlheEvent ()
 
lhef::LHERunInfolheRunInfo ()
 
GenRunInfoProductrunInfo ()
 
- Static Protected Member Functions inherited from Herwig7Interface
static std::unique_ptr< HepMC::GenEvent > convert (const ThePEG::EventPtr &event)
 
static double pthat (const ThePEG::EventPtr &event)
 
- Protected Attributes inherited from Herwig7Interface
Herwig::HerwigUIProviderHwUI_
 
std::unique_ptr< HepMC::IO_BaseClass > iobc_
 
- Protected Attributes inherited from gen::BaseHadronizer
std::string lheFile_
 
int randomIndex_
 

Detailed Description

Definition at line 31 of file Herwig7Hadronizer.cc.

Constructor & Destructor Documentation

Herwig7Hadronizer::Herwig7Hadronizer ( const edm::ParameterSet params)

Definition at line 66 of file Herwig7Hadronizer.cc.

References Herwig7Interface::initRepository(), paramSettings, and muonDTDigis_cfi::pset.

66  :
69  eventsToPrint(pset.getUntrackedParameter<unsigned int>("eventsToPrint", 0)),
70  handlerDirectory_(pset.getParameter<std::string>("eventHandlers")),
71  runFileName(pset.getParameter<std::string>("run"))
72 {
75 }
void initRepository(const edm::ParameterSet &params)
BaseHadronizer(edm::ParameterSet const &ps)
unsigned int eventsToPrint
edm::ParameterSet paramSettings
Herwig7Interface(const edm::ParameterSet &params)
const std::string handlerDirectory_
const std::string runFileName
Herwig7Hadronizer::~Herwig7Hadronizer ( )
override

Definition at line 77 of file Herwig7Hadronizer.cc.

78 {
79 }

Member Function Documentation

const char* Herwig7Hadronizer::classname ( ) const
inline

Definition at line 50 of file Herwig7Hadronizer.cc.

50 { return "Herwig7Hadronizer"; }
bool Herwig7Hadronizer::decay ( )

Definition at line 167 of file Herwig7Hadronizer.cc.

168 {
169  return true;
170 }
bool Herwig7Hadronizer::declareSpecialSettings ( const std::vector< std::string >  )
inline

Definition at line 40 of file Herwig7Hadronizer.cc.

References SelectingProcedure_cff::decay, and myMessageLogger_cff::statistics.

40 { return true; }
bool Herwig7Hadronizer::declareStableParticles ( const std::vector< int > &  pdgIds)

Definition at line 102 of file Herwig7Hadronizer.cc.

103 {
104  return false;
105 }
void Herwig7Hadronizer::doSetRandomEngine ( CLHEP::HepRandomEngine *  v)
inlineoverrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 54 of file Herwig7Hadronizer.cc.

void setPEGRandomEngine(CLHEP::HepRandomEngine *)
void Herwig7Hadronizer::finalizeEvent ( )

Definition at line 150 of file Herwig7Hadronizer.cc.

References gen::BaseHadronizer::event(), gen::BaseHadronizer::eventInfo(), eventsToPrint, Herwig7Interface::iobc_, Herwig7Interface::pthat(), and thepegEvent.

151 {
152  eventInfo().reset(new GenEventInfoProduct(event().get()));
153  eventInfo()->setBinningValues(
154  std::vector<double>(1, pthat(thepegEvent)));
155 
156  if (eventsToPrint) {
157  eventsToPrint--;
158  event()->print();
159  }
160 
161  if (iobc_.get())
162  iobc_->write_event(event().get());
163 
164  edm::LogInfo("Generator|Herwig7Hadronizer") << "Event produced";
165 }
static double pthat(const ThePEG::EventPtr &event)
std::unique_ptr< HepMC::IO_BaseClass > iobc_
unsigned int eventsToPrint
std::unique_ptr< HepMC::GenEvent > & event()
std::unique_ptr< GenEventInfoProduct > & eventInfo()
ThePEG::EventPtr thepegEvent
Definition: event.py:1
bool Herwig7Hadronizer::generatePartonsAndHadronize ( )

Definition at line 116 of file Herwig7Hadronizer.cc.

References Herwig7Interface::convert(), Herwig7Interface::eg_, gen::BaseHadronizer::event(), cppFunctionSkipper::exception, Herwig7Interface::flushRandomNumberGenerator(), and thepegEvent.

117 {
118  edm::LogInfo("Generator|Herwig7Hadronizer") << "Start production";
119 
121 
122  try {
123  thepegEvent = eg_->shoot();
124  } catch (std::exception& exc) {
125  edm::LogWarning("Generator|Herwig7Hadronizer") << "EGPtr::shoot() thrown an exception, event skipped: " << exc.what();
126  return false;
127  }
128 
129  if (!thepegEvent) {
130  edm::LogWarning("Generator|Herwig7Hadronizer") << "thepegEvent not initialized";
131  return false;
132  }
133 
135  if (!event().get()) {
136  edm::LogWarning("Generator|Herwig7Hadronizer") << "genEvent not initialized";
137  return false;
138  }
139 
140  return true;
141 }
ThePEG::EGPtr eg_
static std::unique_ptr< HepMC::GenEvent > convert(const ThePEG::EventPtr &event)
std::unique_ptr< HepMC::GenEvent > & event()
ThePEG::EventPtr thepegEvent
void flushRandomNumberGenerator()
bool Herwig7Hadronizer::hadronize ( )

Definition at line 143 of file Herwig7Hadronizer.cc.

144 {
145 
146  edm::LogError("Herwig7 interface") << "Read in of LHE files is not supported in this way. You can read them manually if necessary.";
147  return false;
148 }
bool Herwig7Hadronizer::initializeForExternalPartons ( )

Definition at line 96 of file Herwig7Hadronizer.cc.

97 {
98  edm::LogError("Herwig7 interface") << "Read in of LHE files is not supported in this way. You can read them manually if necessary.";
99  return false;
100 }
bool Herwig7Hadronizer::initializeForInternalPartons ( )

Definition at line 81 of file Herwig7Hadronizer.cc.

References cmsRelvalreport::exit, Herwig7Interface::initGenerator(), Herwig7Interface::initRepository(), paramSettings, and runFileName.

82 {
83  std::ifstream runFile(runFileName+".run");
84  if (runFile.fail()) //required for showering of LHE files
85  {
87  }
88  if (!initGenerator())
89  {
90  edm::LogInfo("Generator|Herwig7Hadronizer") << "No run step for Herwig chosen. Program will be aborted.";
91  exit(0);
92  }
93  return true;
94 }
void initRepository(const edm::ParameterSet &params)
edm::ParameterSet paramSettings
const std::string runFileName
bool Herwig7Hadronizer::readSettings ( int  )
inline

Definition at line 36 of file Herwig7Hadronizer.cc.

36 { return true; }
bool Herwig7Hadronizer::residualDecay ( )

Definition at line 172 of file Herwig7Hadronizer.cc.

173 {
174  return true;
175 }
void Herwig7Hadronizer::statistics ( )

Definition at line 107 of file Herwig7Hadronizer.cc.

References Herwig7Interface::eg_, gen::BaseHadronizer::runInfo(), and GenRunInfoProduct::setInternalXSec().

108 {
109  if(eg_) {
111  eg_->integratedXSec() / ThePEG::picobarn,
112  eg_->integratedXSecErr() / ThePEG::picobarn));
113  }
114 }
void setInternalXSec(const XSec &xsec)
GenRunInfoProduct & runInfo()
ThePEG::EGPtr eg_

Member Data Documentation

unsigned int Herwig7Hadronizer::eventsToPrint
private

Definition at line 56 of file Herwig7Hadronizer.cc.

Referenced by finalizeEvent().

const std::string Herwig7Hadronizer::handlerDirectory_
private

Definition at line 61 of file Herwig7Hadronizer.cc.

edm::ParameterSet Herwig7Hadronizer::paramSettings
private

Definition at line 62 of file Herwig7Hadronizer.cc.

Referenced by Herwig7Hadronizer(), and initializeForInternalPartons().

boost::shared_ptr<lhef::LHEProxy> Herwig7Hadronizer::proxy_
private

Definition at line 60 of file Herwig7Hadronizer.cc.

const std::string Herwig7Hadronizer::runFileName
private

Definition at line 63 of file Herwig7Hadronizer.cc.

Referenced by initializeForInternalPartons().

ThePEG::EventPtr Herwig7Hadronizer::thepegEvent
private

Definition at line 58 of file Herwig7Hadronizer.cc.

Referenced by finalizeEvent(), and generatePartonsAndHadronize().