CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <boost/shared_ptr.hpp>
18 
20 
23 
26 
30 
31 // foward declarations
32 namespace edm {
33  class Event;
34 }
35 
36 namespace CLHEP {
37  class HepRandomEngine;
38 }
39 
40 namespace gen {
41 
43  public:
44  BaseHadronizer( edm::ParameterSet const& ps );
46 
47  // GenRunInfo and GenEvent passing
49  HepMC::GenEvent *getGenEvent() { return genEvent_.release(); }
51 
52  void resetEvent(HepMC::GenEvent *event) { genEvent_.reset(event); }
54 
55  // LHERunInfo and LHEEvent passing
56  const boost::shared_ptr<lhef::LHERunInfo> &getLHERunInfo() const { return lheRunInfo_; }
57 
59  void setLHEEvent(lhef::LHEEvent *event) { lheEvent_.reset(event); }
60 
61  // interface for accessing the EDM information from the hadronizer
63  edm::Event &getEDMEvent() const { return *edmEvent_; }
64  virtual bool select(HepMC::GenEvent*) const { return true;}
65 
66  void setRandomEngine(CLHEP::HepRandomEngine* v) { doSetRandomEngine(v); }
67 
68  std::vector<std::string> const& sharedResources() const { return doSharedResources(); }
69 
70  protected:
72  std::auto_ptr<HepMC::GenEvent>& event() { return genEvent_; }
73  std::auto_ptr<GenEventInfoProduct>& eventInfo() { return genEventInfo_; }
74 
75  lhef::LHEEvent* lheEvent() { return lheEvent_.get(); }
77 
78  private:
79 
80  virtual void doSetRandomEngine(CLHEP::HepRandomEngine* v) { }
81 
82  virtual std::vector<std::string> const& doSharedResources() const { return theSharedResources; }
83 
85  std::auto_ptr<HepMC::GenEvent> genEvent_;
86  std::auto_ptr<GenEventInfoProduct> genEventInfo_;
87 
88  boost::shared_ptr<lhef::LHERunInfo> lheRunInfo_;
89  std::auto_ptr<lhef::LHEEvent> lheEvent_;
90 
92 
93  static const std::vector<std::string> theSharedResources;
94  };
95 
96 } // namespace gen
97 
98 #endif // gen_BaseHadronizer_h
virtual bool select(HepMC::GenEvent *) const
GenRunInfoProduct genRunInfo_
void setEDMEvent(edm::Event &event)
BaseHadronizer(edm::ParameterSet const &ps)
edm::Event * edmEvent_
GenRunInfoProduct & getGenRunInfo()
void resetEventInfo(GenEventInfoProduct *eventInfo)
double v[5][pyjets_maxn]
std::auto_ptr< HepMC::GenEvent > & event()
GenRunInfoProduct & runInfo()
lhef::LHEEvent * lheEvent()
void setRandomEngine(CLHEP::HepRandomEngine *v)
std::auto_ptr< lhef::LHEEvent > lheEvent_
std::vector< std::string > const & sharedResources() const
void setLHEEvent(lhef::LHEEvent *event)
std::auto_ptr< GenEventInfoProduct > & eventInfo()
lhef::LHERunInfo * lheRunInfo()
HepMC::GenEvent * getGenEvent()
virtual std::vector< std::string > const & doSharedResources() const
virtual void doSetRandomEngine(CLHEP::HepRandomEngine *v)
GenEventInfoProduct * getGenEventInfo()
void setLHERunInfo(lhef::LHERunInfo *runInfo)
void resetEvent(HepMC::GenEvent *event)
std::auto_ptr< HepMC::GenEvent > genEvent_
boost::shared_ptr< lhef::LHERunInfo > lheRunInfo_
std::auto_ptr< GenEventInfoProduct > genEventInfo_
const boost::shared_ptr< lhef::LHERunInfo > & getLHERunInfo() const
static const std::vector< std::string > theSharedResources
edm::Event & getEDMEvent() const