CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/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 
00027 
00028 namespace edm {
00029   class BMixingModule : public edm::EDProducer {
00030     public:
00031       typedef PileUp::EventPrincipalVector EventPrincipalVector;
00032 
00034       explicit BMixingModule(const edm::ParameterSet& ps);
00035 
00037       virtual ~BMixingModule();
00038 
00040       virtual void produce(edm::Event& e1, const edm::EventSetup& c);
00041 
00042       // Should 'averageNumber' return 0 or 1 if there is no mixing? It is the average number of
00043       // *crossings*, including the hard scatter, or the average number of overlapping events?
00044       // We have guessed 'overlapping events'.
00045       double averageNumber() const {return input_ ? input_->averageNumber() : 0.0;}
00046       // Should 'poisson' return 0 or 1 if there is no mixing? See also averageNumber above.
00047       //bool poisson() const {return input_.poisson();}
00048       bool poisson() const {return input_ ? input_->poisson() : 0.0 ;}
00049 
00050       virtual void createnewEDProduct() {std::cout << "BMixingModule::createnewEDProduct must be overwritten!" << std::endl;}
00051       virtual void checkSignal(const edm::Event &e) {std::cout << "BMixingModule::checkSignal must be overwritten!" << std::endl;}
00052       void merge(const int bcr, const EventPrincipalVector& vec,unsigned int worker, const edm::EventSetup& c);
00053       virtual void addSignals(const edm::Event &e,const edm::EventSetup& c) {;}
00054       virtual void addPileups(const int bcr, EventPrincipal *ep, unsigned int eventId,unsigned int worker, const edm::EventSetup& c) {;}
00055       virtual void setBcrOffset () {std::cout << "BMixingModule::setBcrOffset must be overwritten!" << std::endl;} //FIXME: LogWarning
00056       virtual void setSourceOffset (const unsigned int s) {std::cout << "BMixingModule::setSourceOffset must be overwritten!" << std::endl;}
00057       virtual void put(edm::Event &e,const edm::EventSetup& c) {;}
00058       virtual void doPileUp(edm::Event &e, const edm::EventSetup& c) {std::cout << "BMixingModule::doPileUp must be overwritten!" << std::endl;}
00059       virtual void setEventStartInfo(const unsigned int s) {;} //to be set in CF
00060       virtual void getEventStartInfo(edm::Event & e,const unsigned int source) {;} //to be set locally
00061 
00062   protected:
00063       void dropUnwantedBranches(std::vector<std::string> const& wantedBranches);
00064       virtual void endJob();
00065       int bunchSpace_;
00066       static int vertexoffset;
00067       bool checktof_;
00068       int const minBunch_;
00069       int const maxBunch_;
00070       bool const mixProdStep1_;         
00071       bool const mixProdStep2_;
00072         
00073       // playback info
00074       bool playback_;
00075       std::vector<edm::EventID> eventIDs_;
00076       std::vector<std::vector<edm::EventID> > vectorEventIDs_;
00077       std::vector<int> fileSeqNrs_;
00078       std::vector<unsigned int> nrEvents_;
00079       const static unsigned int maxNbSources_;
00080       bool doit_[4];//FIXME
00081       std::vector<EventPrincipalVector> pileup_[4];//FIXME
00082 
00083   private:
00084 
00085       boost::shared_ptr<PileUp> input_;
00086       boost::shared_ptr<PileUp> cosmics_;
00087       boost::shared_ptr<PileUp> beamHalo_p_;
00088       boost::shared_ptr<PileUp> beamHalo_m_;
00089 
00090       unsigned int eventId_;
00091   };
00092 
00093 }//edm
00094 
00095 #endif