CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/GeneratorInterface/Core/interface/BaseHadronizer.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 //
00004 
00005 // class BaseHadronizer meant as base class for hadronizers
00006 // implements a few common methods concerning communication with the
00007 // gen::HadronizerFilter<...> and gen::GeneratorFilter<...> templates,
00008 // mostly memory management regarding the GenEvent pointers and such
00009 
00010 #ifndef gen_BaseHadronizer_h
00011 #define gen_BaseHadronizer_h
00012 
00013 #include <memory>
00014 
00015 #include <boost/shared_ptr.hpp>
00016 
00017 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00018 
00019 #include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h"
00020 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
00021 
00022 #include "SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h"
00023 #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h"
00024 
00025 #include "GeneratorInterface/LHEInterface/interface/LHERunInfo.h"
00026 #include "GeneratorInterface/LHEInterface/interface/LHEEvent.h"
00027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00028 
00029 // foward declarations
00030 namespace edm {
00031   class Event;
00032 }
00033 
00034 namespace gen {
00035 
00036   class BaseHadronizer {
00037   public:
00038     BaseHadronizer( edm::ParameterSet const& ps );
00039     ~BaseHadronizer() {}
00040 
00041     // GenRunInfo and GenEvent passing
00042     GenRunInfoProduct &getGenRunInfo() { return genRunInfo_; }
00043     HepMC::GenEvent *getGenEvent() { return genEvent_.release(); }
00044     GenEventInfoProduct *getGenEventInfo() { return genEventInfo_.release(); }
00045 
00046     void resetEvent(HepMC::GenEvent *event) { genEvent_.reset(event); }
00047     void resetEventInfo(GenEventInfoProduct *eventInfo) { genEventInfo_.reset(eventInfo); }
00048 
00049     // LHERunInfo and LHEEvent passing
00050     const boost::shared_ptr<lhef::LHERunInfo> &getLHERunInfo() const { return lheRunInfo_; }
00051 
00052     void setLHERunInfo(lhef::LHERunInfo *runInfo) { lheRunInfo_.reset(runInfo); }
00053     void setLHEEvent(lhef::LHEEvent *event) { lheEvent_.reset(event); }
00054 
00055     // interface for accessing the EDM information from the hadronizer
00056     void setEDMEvent(edm::Event &event) { edmEvent_ = &event; }
00057     edm::Event &getEDMEvent() const { return *edmEvent_; }
00058     virtual bool select(HepMC::GenEvent*) const { return true;}
00059 
00060   protected:
00061     GenRunInfoProduct& runInfo() { return genRunInfo_; }
00062     std::auto_ptr<HepMC::GenEvent>& event() { return genEvent_; }
00063     std::auto_ptr<GenEventInfoProduct>& eventInfo() { return genEventInfo_; }
00064 
00065     lhef::LHEEvent* lheEvent() { return lheEvent_.get(); }
00066     lhef::LHERunInfo *lheRunInfo() { return lheRunInfo_.get(); }
00067 
00068   private:
00069     GenRunInfoProduct                   genRunInfo_;
00070     std::auto_ptr<HepMC::GenEvent>      genEvent_;
00071     std::auto_ptr<GenEventInfoProduct>  genEventInfo_;
00072 
00073     boost::shared_ptr<lhef::LHERunInfo> lheRunInfo_;
00074     std::auto_ptr<lhef::LHEEvent>       lheEvent_;
00075 
00076     edm::Event                          *edmEvent_;
00077   };
00078 
00079 } // namespace gen
00080 
00081 #endif // gen_BaseHadronizer_h