CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/GeneratorInterface/LHEInterface/interface/Hadronisation.h

Go to the documentation of this file.
00001 #ifndef GeneratorInterface_LHEInterface_Hadronisation_h
00002 #define GeneratorInterface_LHEInterface_Hadronisation_h
00003 
00004 #include <memory>
00005 #include <string>
00006 #include <set>
00007 
00008 #include <boost/shared_ptr.hpp>
00009 #include <sigc++/signal.h>
00010 
00011 #include <HepMC/GenEvent.h>
00012 
00013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00014 #include "FWCore/PluginManager/interface/PluginFactory.h"
00015 
00016 namespace lhef {
00017 
00018 class LHEEvent;
00019 class LHERunInfo;
00020 
00021 class Hadronisation {
00022     public:
00023         Hadronisation(const edm::ParameterSet &params);
00024         virtual ~Hadronisation();
00025 
00026         void init();
00027         bool setEvent(const boost::shared_ptr<LHEEvent> &event);
00028         void clear();
00029 
00030         virtual void statistics() {}
00031         virtual double totalBranchingRatio(int pdgId) const { return 1.0; }
00032 
00033         std::auto_ptr<HepMC::GenEvent> hadronize();
00034 
00035         virtual std::set<std::string> capabilities() const;
00036         virtual void matchingCapabilities(
00037                                 const std::set<std::string> &capabilities);
00038 
00039         inline sigc::signal<bool, const boost::shared_ptr<HepMC::GenEvent>&>&
00040                                         onShoweredEvent() { return sigShower; }
00041         inline sigc::signal<void>& onInit() { return sigInit; }
00042         inline sigc::signal<void>& onBeforeHadronisation()
00043         { return sigBeforeHadronisation; }
00044 
00045         static std::auto_ptr<Hadronisation> create(
00046                                         const edm::ParameterSet &params);
00047 
00048         typedef edmplugin::PluginFactory<Hadronisation*(
00049                                         const edm::ParameterSet &)> Factory;
00050 
00051     protected:
00052         inline bool wantsShoweredEvent() const
00053         { return psRequested && !sigShower.empty(); }
00054         inline bool wantsShoweredEventAsHepMC() const
00055         { return psAsHepMC; }
00056 
00057         bool showeredEvent(const boost::shared_ptr<HepMC::GenEvent> &event);
00058 
00059         inline const boost::shared_ptr<LHEEvent> &getRawEvent() const
00060         { return rawEvent; }
00061 
00062         virtual void doInit() = 0;
00063         virtual std::auto_ptr<HepMC::GenEvent> doHadronisation() = 0;
00064         virtual void newRunInfo(const boost::shared_ptr<LHERunInfo> &runInfo);
00065 
00066     private:
00067         sigc::signal<bool, const boost::shared_ptr<HepMC::GenEvent>&>   sigShower;
00068         sigc::signal<void>                                              sigInit;
00069         sigc::signal<void>                                              sigBeforeHadronisation;
00070         bool                                                            psRequested;
00071         bool                                                            psAsHepMC;
00072         boost::shared_ptr<LHEEvent>                                     rawEvent;
00073 };
00074 
00075 } // namespace lhef
00076 
00077 #define DEFINE_LHE_HADRONISATION_PLUGIN(T) \
00078         DEFINE_EDM_PLUGIN(lhef::Hadronisation::Factory, T, #T)
00079 
00080 #endif // GeneratorRunInfo_LHEInterface_Hadronisation_h