CMS 3D CMS Logo

BaseHadronizer.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 //
4 
5 // class BaseHadronizer meant as base class for hadronizers
6 // implements a few common methods concerning communication with the
7 // gen::HadronizerFilter<...> and gen::GeneratorFilter<...> templates,
8 // mostly memory management regarding the GenEvent pointers and such
9 
10 #ifndef gen_BaseHadronizer_h
11 #define gen_BaseHadronizer_h
12 
13 #include <memory>
14 #include <string>
15 #include <vector>
16 
17 #include <memory>
18 
20 
24 
27 
32 
33 #include "CLHEP/Random/RandomEngine.h"
34 
35 // foward declarations
36 namespace edm {
37  class Event;
38 }
39 
40 namespace CLHEP {
41  class HepRandomEngine;
42 }
43 
44 namespace gen {
45 
47  public:
49  virtual ~BaseHadronizer() noexcept(false) {}
50 
51  // GenRunInfo and GenEvent passing
53  std::unique_ptr<HepMC::GenEvent> getGenEvent() { return std::move(genEvent_); }
54  std::unique_ptr<GenEventInfoProduct> getGenEventInfo() { return std::move(genEventInfo_); }
55  virtual std::unique_ptr<GenLumiInfoHeader> getGenLumiInfoHeader() const;
56  std::unique_ptr<lhef::LHEEvent> getLHEEvent() { return std::move(lheEvent_); }
57 
58  void resetEvent(std::unique_ptr<HepMC::GenEvent> event) { genEvent_ = std::move(event); }
59  void resetEventInfo(std::unique_ptr<GenEventInfoProduct> eventInfo) { genEventInfo_ = std::move(eventInfo); }
60 
61  // LHERunInfo and LHEEvent passing
62  const std::shared_ptr<lhef::LHERunInfo>& getLHERunInfo() const { return lheRunInfo_; }
63 
64  void setLHERunInfo(std::unique_ptr<lhef::LHERunInfo> runInfo) { lheRunInfo_ = std::move(runInfo); }
65  void setLHEEvent(std::unique_ptr<lhef::LHEEvent> event) { lheEvent_ = std::move(event); }
66 
67  // interface for accessing the EDM information from the hadronizer
69  edm::Event& getEDMEvent() const { return *edmEvent_; }
70  virtual bool select(HepMC::GenEvent*) const { return true; }
71 
72  void setRandomEngine(CLHEP::HepRandomEngine* v) { doSetRandomEngine(v); }
73 
74  std::vector<std::string> const& sharedResources() const { return doSharedResources(); }
75 
76  int randomIndex() const { return randomIndex_; }
79 
80  void randomizeIndex(edm::LuminosityBlock const& lumi, CLHEP::HepRandomEngine* rengine);
81  void generateLHE(edm::LuminosityBlock const& lumi, CLHEP::HepRandomEngine* rengine, unsigned int ncpu);
82  void cleanLHE();
83 
84  protected:
86  std::unique_ptr<HepMC::GenEvent>& event() { return genEvent_; }
87  std::unique_ptr<GenEventInfoProduct>& eventInfo() { return genEventInfo_; }
88 
89  lhef::LHEEvent* lheEvent() { return lheEvent_.get(); }
93 
94  private:
95  virtual void doSetRandomEngine(CLHEP::HepRandomEngine* v) {}
96 
97  virtual std::vector<std::string> const& doSharedResources() const { return theSharedResources; }
98 
100  std::unique_ptr<HepMC::GenEvent> genEvent_;
101  std::unique_ptr<GenEventInfoProduct> genEventInfo_;
102 
103  std::shared_ptr<lhef::LHERunInfo> lheRunInfo_;
104  std::unique_ptr<lhef::LHEEvent> lheEvent_;
105 
107 
108  static const std::vector<std::string> theSharedResources;
109 
110  std::vector<double> randomInitWeights_;
111  std::vector<std::string> randomInitConfigDescriptions_;
112  std::vector<std::string> gridpackPaths_;
113  };
114 
115 } // namespace gen
116 
117 #endif // gen_BaseHadronizer_h
gen::BaseHadronizer::randomInitConfigDescriptions_
std::vector< std::string > randomInitConfigDescriptions_
Definition: BaseHadronizer.h:111
gen::BaseHadronizer::lheRunInfo
lhef::LHERunInfo * lheRunInfo()
Definition: BaseHadronizer.h:90
gen::BaseHadronizer::lheEvent
lhef::LHEEvent * lheEvent()
Definition: BaseHadronizer.h:89
funct::false
false
Definition: Factorize.h:29
gen::BaseHadronizer::getGenLumiInfoHeader
virtual std::unique_ptr< GenLumiInfoHeader > getGenLumiInfoHeader() const
Definition: BaseHadronizer.cc:40
gen::BaseHadronizer::doSharedResources
virtual std::vector< std::string > const & doSharedResources() const
Definition: BaseHadronizer.h:97
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
gen::BaseHadronizer::setLHEEvent
void setLHEEvent(std::unique_ptr< lhef::LHEEvent > event)
Definition: BaseHadronizer.h:65
LuminosityBlock.h
edm
HLT enums.
Definition: AlignableModifier.h:19
gen::BaseHadronizer::gridpackPath
const std::string & gridpackPath() const
Definition: BaseHadronizer.h:78
gen::BaseHadronizer::edmEvent_
edm::Event * edmEvent_
Definition: BaseHadronizer.h:106
gen::BaseHadronizer::getLHEEvent
std::unique_ptr< lhef::LHEEvent > getLHEEvent()
Definition: BaseHadronizer.h:56
gen::BaseHadronizer
Definition: BaseHadronizer.h:46
GenRunInfoProduct.h
gen::BaseHadronizer::setLHERunInfo
void setLHERunInfo(std::unique_ptr< lhef::LHERunInfo > runInfo)
Definition: BaseHadronizer.h:64
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
LHERunInfoProduct.h
gen::BaseHadronizer::select
virtual bool select(HepMC::GenEvent *) const
Definition: BaseHadronizer.h:70
gen::BaseHadronizer::randomizeIndex
void randomizeIndex(edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine)
Definition: BaseHadronizer.cc:52
gen::BaseHadronizer::genEvent_
std::unique_ptr< HepMC::GenEvent > genEvent_
Definition: BaseHadronizer.h:100
gen::BaseHadronizer::getEDMEvent
edm::Event & getEDMEvent() const
Definition: BaseHadronizer.h:69
Event
gen::BaseHadronizer::eventInfo
std::unique_ptr< GenEventInfoProduct > & eventInfo()
Definition: BaseHadronizer.h:87
gen::BaseHadronizer::lheFile_
std::string lheFile_
Definition: BaseHadronizer.h:92
gen::BaseHadronizer::randomInitWeights_
std::vector< double > randomInitWeights_
Definition: BaseHadronizer.h:110
gen
Definition: PythiaDecays.h:13
gen::BaseHadronizer::randomIndex_
int randomIndex_
Definition: BaseHadronizer.h:91
gen::BaseHadronizer::resetEvent
void resetEvent(std::unique_ptr< HepMC::GenEvent > event)
Definition: BaseHadronizer.h:58
GenRunInfoProduct
Definition: GenRunInfoProduct.h:8
CLHEP
Definition: CocoaGlobals.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
gen::BaseHadronizer::theSharedResources
static const std::vector< std::string > theSharedResources
Definition: BaseHadronizer.h:108
gen::BaseHadronizer::genEventInfo_
std::unique_ptr< GenEventInfoProduct > genEventInfo_
Definition: BaseHadronizer.h:101
lhef::LHERunInfo
Definition: LHERunInfo.h:25
edm::ParameterSet
Definition: ParameterSet.h:47
GenEventInfoProduct.h
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
LHERunInfo.h
gen::BaseHadronizer::randomIndex
int randomIndex() const
Definition: BaseHadronizer.h:76
gen::BaseHadronizer::getGenEvent
std::unique_ptr< HepMC::GenEvent > getGenEvent()
Definition: BaseHadronizer.h:53
lhef::LHEEvent
Definition: LHEEvent.h:23
gen::BaseHadronizer::getGenEventInfo
std::unique_ptr< GenEventInfoProduct > getGenEventInfo()
Definition: BaseHadronizer.h:54
gen::v
double v[5][pyjets_maxn]
Definition: Cascade2Hadronizer.cc:76
gen::BaseHadronizer::getGenRunInfo
GenRunInfoProduct & getGenRunInfo()
Definition: BaseHadronizer.h:52
gen::BaseHadronizer::cleanLHE
void cleanLHE()
Definition: BaseHadronizer.cc:137
GenLumiInfoHeader.h
gen::BaseHadronizer::doSetRandomEngine
virtual void doSetRandomEngine(CLHEP::HepRandomEngine *v)
Definition: BaseHadronizer.h:95
LHEEventProduct.h
gen::BaseHadronizer::sharedResources
std::vector< std::string > const & sharedResources() const
Definition: BaseHadronizer.h:74
eostools.move
def move(src, dest)
Definition: eostools.py:511
gen::BaseHadronizer::event
std::unique_ptr< HepMC::GenEvent > & event()
Definition: BaseHadronizer.h:86
gen::BaseHadronizer::setEDMEvent
void setEDMEvent(edm::Event &event)
Definition: BaseHadronizer.h:68
gen::BaseHadronizer::generateLHE
void generateLHE(edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine, unsigned int ncpu)
Definition: BaseHadronizer.cc:69
gen::BaseHadronizer::BaseHadronizer
BaseHadronizer(edm::ParameterSet const &ps)
Definition: BaseHadronizer.cc:12
gen::BaseHadronizer::genRunInfo_
GenRunInfoProduct genRunInfo_
Definition: BaseHadronizer.h:99
gen::BaseHadronizer::gridpackPaths_
std::vector< std::string > gridpackPaths_
Definition: BaseHadronizer.h:112
gen::BaseHadronizer::randomInitConfigDescription
const std::string & randomInitConfigDescription() const
Definition: BaseHadronizer.h:77
LHEEvent.h
gen::BaseHadronizer::setRandomEngine
void setRandomEngine(CLHEP::HepRandomEngine *v)
Definition: BaseHadronizer.h:72
ParameterSet.h
HepMCProduct.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
lumi
Definition: LumiSectionData.h:20
gen::BaseHadronizer::runInfo
GenRunInfoProduct & runInfo()
Definition: BaseHadronizer.h:85
gen::BaseHadronizer::getLHERunInfo
const std::shared_ptr< lhef::LHERunInfo > & getLHERunInfo() const
Definition: BaseHadronizer.h:62
gen::BaseHadronizer::lheRunInfo_
std::shared_ptr< lhef::LHERunInfo > lheRunInfo_
Definition: BaseHadronizer.h:103
gen::BaseHadronizer::~BaseHadronizer
virtual ~BaseHadronizer() noexcept(false)
Definition: BaseHadronizer.h:49
gen::BaseHadronizer::resetEventInfo
void resetEventInfo(std::unique_ptr< GenEventInfoProduct > eventInfo)
Definition: BaseHadronizer.h:59
gen::BaseHadronizer::lheEvent_
std::unique_ptr< lhef::LHEEvent > lheEvent_
Definition: BaseHadronizer.h:104