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 <boost/shared_ptr.hpp>
18 
20 
24 
27 
32 
33 #include "CLHEP/Random/RandomEngine.h"
34 
35 
36 // foward declarations
37 namespace edm {
38  class Event;
39 }
40 
41 namespace CLHEP {
42  class HepRandomEngine;
43 }
44 
45 namespace gen {
46 
48  public:
49  BaseHadronizer( edm::ParameterSet const& ps );
51 
52  // GenRunInfo and GenEvent passing
53  GenRunInfoProduct &getGenRunInfo() { return genRunInfo_; }
54  HepMC::GenEvent *getGenEvent() { return genEvent_.release(); }
55  GenEventInfoProduct *getGenEventInfo() { return genEventInfo_.release(); }
56  virtual GenLumiInfoHeader *getGenLumiInfoHeader() const;
57 
58  void resetEvent(HepMC::GenEvent *event) { genEvent_.reset(event); }
59  void resetEventInfo(GenEventInfoProduct *eventInfo) { genEventInfo_.reset(eventInfo); }
60 
61  // LHERunInfo and LHEEvent passing
62  const boost::shared_ptr<lhef::LHERunInfo> &getLHERunInfo() const { return lheRunInfo_; }
63 
64  void setLHERunInfo(lhef::LHERunInfo *runInfo) { lheRunInfo_.reset(runInfo); }
65  void setLHEEvent(lhef::LHEEvent *event) { lheEvent_.reset(event); }
66 
67  // interface for accessing the EDM information from the hadronizer
68  void setEDMEvent(edm::Event &event) { edmEvent_ = &event; }
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_; }
77  const std::string &randomInitConfigDescription() const { return randomInitConfigDescriptions_[randomIndex_]; }
78  const std::string &gridpackPath() const { return gridpackPaths_[std::max(randomIndex_,0)]; }
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:
85  GenRunInfoProduct& runInfo() { return genRunInfo_; }
86  std::auto_ptr<HepMC::GenEvent>& event() { return genEvent_; }
87  std::auto_ptr<GenEventInfoProduct>& eventInfo() { return genEventInfo_; }
88 
89  lhef::LHEEvent* lheEvent() { return lheEvent_.get(); }
90  lhef::LHERunInfo *lheRunInfo() { return lheRunInfo_.get(); }
93 
94  private:
95 
96  virtual void doSetRandomEngine(CLHEP::HepRandomEngine* v) { }
97 
98  virtual std::vector<std::string> const& doSharedResources() const { return theSharedResources; }
99 
101  std::auto_ptr<HepMC::GenEvent> genEvent_;
102  std::auto_ptr<GenEventInfoProduct> genEventInfo_;
103 
104  boost::shared_ptr<lhef::LHERunInfo> lheRunInfo_;
105  std::auto_ptr<lhef::LHEEvent> lheEvent_;
106 
108 
109  static const std::vector<std::string> theSharedResources;
110 
111  std::vector<double> randomInitWeights_;
112  std::vector<std::string> randomInitConfigDescriptions_;
113  std::vector<std::string> gridpackPaths_;
114 
115  };
116 
117 } // namespace gen
118 
119 #endif // gen_BaseHadronizer_h
virtual bool select(HepMC::GenEvent *) const
GenRunInfoProduct genRunInfo_
std::vector< double > randomInitWeights_
void setEDMEvent(edm::Event &event)
edm::Event * edmEvent_
GenRunInfoProduct & getGenRunInfo()
void resetEventInfo(GenEventInfoProduct *eventInfo)
std::string lheFile_
std::auto_ptr< HepMC::GenEvent > & event()
GenRunInfoProduct & runInfo()
lhef::LHEEvent * lheEvent()
void setRandomEngine(CLHEP::HepRandomEngine *v)
std::auto_ptr< lhef::LHEEvent > lheEvent_
const std::string & randomInitConfigDescription() const
std::vector< std::string > const & sharedResources() const
std::vector< std::string > gridpackPaths_
void setLHEEvent(lhef::LHEEvent *event)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::auto_ptr< GenEventInfoProduct > & eventInfo()
std::vector< std::string > randomInitConfigDescriptions_
lhef::LHERunInfo * lheRunInfo()
HepMC::GenEvent * getGenEvent()
virtual std::vector< std::string > const & doSharedResources() const
virtual void doSetRandomEngine(CLHEP::HepRandomEngine *v)
GenEventInfoProduct * getGenEventInfo()
int randomIndex() const
HLT enums.
const std::string & gridpackPath() const
void setLHERunInfo(lhef::LHERunInfo *runInfo)
void resetEvent(HepMC::GenEvent *event)
eventInfo
add run, event number and lumi section
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
Definition: event.py:1