CMS 3D CMS Logo

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

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