CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/Mixing/Base/interface/BMixingModule.h

Go to the documentation of this file.
00001 #ifndef BMixingModule_h
00002 #define BMixingModule_h
00003 
00018 #include "boost/shared_ptr.hpp"
00019 
00020 #include "FWCore/Framework/interface/EventPrincipal.h"
00021 #include "FWCore/Framework/interface/EDProducer.h"
00022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00023 #include "FWCore/Framework/interface/Frameworkfwd.h"
00024 #include "DataFormats/Provenance/interface/EventID.h"
00025 #include "Mixing/Base/interface/PileUp.h"
00026 #include "FWCore/Framework/interface/ESWatcher.h"
00027 #include "CondFormats/DataRecord/interface/MixingRcd.h"
00028 
00029 namespace edm {
00030   class BMixingModule : public edm::EDProducer {
00031     public:
00033       explicit BMixingModule(const edm::ParameterSet& ps);
00034 
00036       virtual ~BMixingModule();
00037 
00039       virtual void produce(edm::Event& e1, const edm::EventSetup& c);
00040 
00041       virtual void beginRun(edm::Run & r, const edm::EventSetup & setup);
00042       virtual void beginLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&);
00043 
00044       // to be overloaded by dependent class
00045       virtual void reload(const edm::EventSetup & setup){};
00046 
00047       // Should 'averageNumber' return 0 or 1 if there is no mixing? It is the average number of
00048       // *crossings*, including the hard scatter, or the average number of overlapping events?
00049       // We have guessed 'overlapping events'.
00050       double averageNumber() const {return inputSources_[0] ? inputSources_[0]->averageNumber() : 0.0; }
00051       // Should 'poisson' return 0 or 1 if there is no mixing? See also averageNumber above.
00052       bool poisson() const {return inputSources_[0] ? inputSources_[0]->poisson() : 0.0 ;}
00053 
00054       virtual void createnewEDProduct() {std::cout << "BMixingModule::createnewEDProduct must be overwritten!" << std::endl;}
00055       virtual void checkSignal(const edm::Event &e) {std::cout << "BMixingModule::checkSignal must be overwritten!" << std::endl;}
00056       virtual void addSignals(const edm::Event &e,const edm::EventSetup& c) {;}
00057       virtual void addPileups(const int bcr, EventPrincipal *ep, unsigned int eventId,unsigned int worker, const edm::EventSetup& c) {;}
00058       virtual void setBcrOffset () {std::cout << "BMixingModule::setBcrOffset must be overwritten!" << std::endl;} //FIXME: LogWarning
00059       virtual void setSourceOffset (const unsigned int s) {std::cout << "BMixingModule::setSourceOffset must be overwritten!" << std::endl;}
00060       virtual void put(edm::Event &e,const edm::EventSetup& c) {;}
00061       virtual void doPileUp(edm::Event &e, const edm::EventSetup& c) {std::cout << "BMixingModule::doPileUp must be overwritten!" << std::endl;}
00062       virtual void setEventStartInfo(const unsigned int s) {;} //to be set in CF
00063       virtual void getEventStartInfo(edm::Event & e,const unsigned int source) {;} //to be set locally
00064 
00065   protected:
00066       void dropUnwantedBranches(std::vector<std::string> const& wantedBranches);
00067       virtual void endJob();
00068       //      std::string type_;
00069       int bunchSpace_;
00070       static int vertexoffset;
00071       bool checktof_;
00072       int minBunch_;
00073       int maxBunch_;
00074       bool const mixProdStep1_;         
00075       bool const mixProdStep2_;
00076         
00077       bool readDB_;
00078       bool playback_;
00079       const static unsigned int maxNbSources_;
00080       std::vector<std::string> sourceNames_;
00081       bool doit_[4];//FIXME
00082       std::vector< float > TrueNumInteractions_;
00083 
00084       unsigned int eventId_;
00085 
00086       // input, cosmics, beamhalo_plus, beamhalo_minus
00087       std::vector<boost::shared_ptr<PileUp> > inputSources_;
00088 
00089       void update(edm::EventSetup const&);
00090       edm::ESWatcher<MixingRcd> parameterWatcher_;
00091   };
00092 
00093 }//edm
00094 
00095 #endif