CMS 3D CMS Logo

BMixingModule.h
Go to the documentation of this file.
1 #ifndef BMixingModule_h
2 #define BMixingModule_h
3 
18 #include <vector>
19 #include <memory>
20 
26 
27 namespace edm {
28  namespace MixingCache {
29  struct Config {
30  Config(edm::ParameterSet const& pset, unsigned int maxNbSources);
32  int minBunch_;
33  int maxBunch_;
34  bool playback_;
35  std::vector<std::string> sourceNames_;
36  std::vector<std::shared_ptr<PileUpConfig>> inputConfigs_;
37  };
38  } // namespace MixingCache
39 
40  class BMixingModule : public stream::EDProducer<GlobalCache<MixingCache::Config>> {
41  public:
43  explicit BMixingModule(const edm::ParameterSet& ps, MixingCache::Config const* globalConf);
44 
46  ~BMixingModule() override;
47 
49  void produce(edm::Event& e1, const edm::EventSetup& c) override;
50 
51  virtual void initializeEvent(const edm::Event& event, const edm::EventSetup& setup) {}
52 
53  // edm::Event is non-const because digitizers put their products into the Event.
55 
56  void beginRun(const edm::Run& r, const edm::EventSetup& setup) override;
57  void beginLuminosityBlock(const edm::LuminosityBlock& l, const edm::EventSetup& setup) override;
58 
59  void endRun(const edm::Run& r, const edm::EventSetup& setup) override;
60  void endLuminosityBlock(const edm::LuminosityBlock& l, const edm::EventSetup& setup) override;
61 
62  static std::unique_ptr<MixingCache::Config> initializeGlobalCache(edm::ParameterSet const&);
64 
65  // to be overloaded by dependent class
66  virtual void reload(const edm::EventSetup& setup){};
67 
68  // Should 'averageNumber' return 0 or 1 if there is no mixing? It is the average number of
69  // *crossings*, including the hard scatter, or the average number of overlapping events?
70  // We have guessed 'overlapping events'.
71  double averageNumber() const { return inputSources_[0] ? inputSources_[0]->averageNumber() : 0.0; }
72  // Should 'poisson' return 0 or 1 if there is no mixing? See also averageNumber above.
73  bool poisson() const { return inputSources_[0] ? inputSources_[0]->poisson() : 0.0; }
74 
75  virtual void createnewEDProduct();
76  virtual void checkSignal(const edm::Event& e);
77  virtual void addSignals(const edm::Event& e, const edm::EventSetup& c) {}
78  virtual void addPileups(
79  const int bcr, EventPrincipal* ep, unsigned int eventId, unsigned int worker, const edm::EventSetup& c) {}
80  virtual void setBcrOffset();
81  virtual void setSourceOffset(const unsigned int s);
82  virtual void put(edm::Event& e, const edm::EventSetup& c) {}
83  virtual void doPileUp(edm::Event& e, const edm::EventSetup& c);
84 
85  protected:
87  void dropUnwantedBranches(std::vector<std::string> const& wantedBranches);
88  void beginStream(edm::StreamID) override;
89  void endStream() override;
90  // std::string type_;
93  bool checktof_;
94  int minBunch_;
95  int maxBunch_;
96  bool const mixProdStep1_;
97  bool const mixProdStep2_;
98 
99  bool readDB_;
100  bool playback_;
101  const static unsigned int maxNbSources_;
102  bool doit_[4]; //FIXME
103  std::vector<float> TrueNumInteractions_;
104 
105  unsigned int eventId_;
106 
107  // input, cosmics, beamhalo_plus, beamhalo_minus
108  std::vector<std::shared_ptr<PileUp>> inputSources_;
109 
110  void update(edm::EventSetup const&);
112  };
113 
114 } // namespace edm
115 
116 #endif
edm::BMixingModule::reload
virtual void reload(const edm::EventSetup &setup)
Definition: BMixingModule.h:66
edm::BMixingModule::endRun
void endRun(const edm::Run &r, const edm::EventSetup &setup) override
Definition: BMixingModule.cc:256
edm::BMixingModule::inputSources_
std::vector< std::shared_ptr< PileUp > > inputSources_
Definition: BMixingModule.h:108
edm::StreamID
Definition: StreamID.h:30
edm::MixingCache::Config::sourceNames_
std::vector< std::string > sourceNames_
Definition: BMixingModule.h:35
edm::BMixingModule::endLuminosityBlock
void endLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &setup) override
Definition: BMixingModule.cc:249
edm::BMixingModule::bunchSpace_
int bunchSpace_
Definition: BMixingModule.h:91
edm::BMixingModule::minBunch_
int minBunch_
Definition: BMixingModule.h:94
edm::ESWatcher< MixingRcd >
edm::BMixingModule::setupPileUpEvent
void setupPileUpEvent(const edm::EventSetup &setup)
Definition: BMixingModule.cc:298
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::BMixingModule::doit_
bool doit_[4]
Definition: BMixingModule.h:102
edm::BMixingModule::maxBunch_
int maxBunch_
Definition: BMixingModule.h:95
EDProducer.h
edm::BMixingModule::TrueNumInteractions_
std::vector< float > TrueNumInteractions_
Definition: BMixingModule.h:103
edm::MixingCache::Config::playback_
bool playback_
Definition: BMixingModule.h:34
edm::BMixingModule
Definition: BMixingModule.h:40
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::BMixingModule::setSourceOffset
virtual void setSourceOffset(const unsigned int s)
Definition: BMixingModule.cc:338
edm::BMixingModule::beginLuminosityBlock
void beginLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &setup) override
Definition: BMixingModule.cc:233
edm::MixingCache::Config::Config
Config(edm::ParameterSet const &pset, unsigned int maxNbSources)
Definition: BMixingModule.cc:205
edm::BMixingModule::checktof_
bool checktof_
Definition: BMixingModule.h:93
edm::BMixingModule::readDB_
bool readDB_
Definition: BMixingModule.h:99
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::BMixingModule::endStream
void endStream() override
Definition: BMixingModule.cc:319
edm::BMixingModule::eventId_
unsigned int eventId_
Definition: BMixingModule.h:105
edm::MixingCache::Config::minBunch_
int minBunch_
Definition: BMixingModule.h:32
edm::EventPrincipal
Definition: EventPrincipal.h:46
edm::BMixingModule::maxNbSources_
const static unsigned int maxNbSources_
Definition: BMixingModule.h:101
edm::BMixingModule::playback_
bool playback_
Definition: BMixingModule.h:100
edm::BMixingModule::mixProdStep2_
const bool mixProdStep2_
Definition: BMixingModule.h:97
edm::BMixingModule::update
void update(edm::EventSetup const &)
Definition: BMixingModule.cc:263
edm::BMixingModule::averageNumber
double averageNumber() const
Definition: BMixingModule.h:71
edm::BMixingModule::poisson
bool poisson() const
Definition: BMixingModule.h:73
edm::BMixingModule::finalizeEvent
virtual void finalizeEvent(edm::Event &event, const edm::EventSetup &setup)
Definition: BMixingModule.h:54
edm::BMixingModule::checkSignal
virtual void checkSignal(const edm::Event &e)
Definition: BMixingModule.cc:330
edm::ParameterSet
Definition: ParameterSet.h:36
edm::BMixingModule::produce
void produce(edm::Event &e1, const edm::EventSetup &c) override
Definition: BMixingModule.cc:274
edm::BMixingModule::~BMixingModule
~BMixingModule() override
Definition: BMixingModule.cc:202
edm::MixingCache::Config
Definition: BMixingModule.h:29
edm::BMixingModule::beginStream
void beginStream(edm::StreamID) override
Definition: BMixingModule.cc:312
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
edm::BMixingModule::put
virtual void put(edm::Event &e, const edm::EventSetup &c)
Definition: BMixingModule.h:82
MixingRcd.h
edm::BMixingModule::dropUnwantedBranches
void dropUnwantedBranches(std::vector< std::string > const &wantedBranches)
Definition: BMixingModule.cc:305
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::MixingCache::Config::bunchSpace_
int bunchSpace_
Definition: BMixingModule.h:31
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::BMixingModule::addPileups
virtual void addPileups(const int bcr, EventPrincipal *ep, unsigned int eventId, unsigned int worker, const edm::EventSetup &c)
Definition: BMixingModule.h:78
edm::BMixingModule::addSignals
virtual void addSignals(const edm::Event &e, const edm::EventSetup &c)
Definition: BMixingModule.h:77
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::BMixingModule::mixProdStep1_
const bool mixProdStep1_
Definition: BMixingModule.h:96
edm::BMixingModule::initializeEvent
virtual void initializeEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: BMixingModule.h:51
edm::BMixingModule::createnewEDProduct
virtual void createnewEDProduct()
Definition: BMixingModule.cc:326
edm::BMixingModule::BMixingModule
BMixingModule(const edm::ParameterSet &ps, MixingCache::Config const *globalConf)
Definition: BMixingModule.cc:177
edm::BMixingModule::vertexOffset_
int vertexOffset_
Definition: BMixingModule.h:92
Frameworkfwd.h
ESWatcher.h
edm::MixingCache::Config::maxBunch_
int maxBunch_
Definition: BMixingModule.h:33
edm::MixingCache::Config::inputConfigs_
std::vector< std::shared_ptr< PileUpConfig > > inputConfigs_
Definition: BMixingModule.h:36
edm::BMixingModule::globalEndJob
static void globalEndJob(MixingCache::Config *)
Definition: BMixingModule.h:63
edm::BMixingModule::parameterWatcher_
edm::ESWatcher< MixingRcd > parameterWatcher_
Definition: BMixingModule.h:111
PileUp.h
Config
Definition: Config.py:1
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
edm::BMixingModule::setBcrOffset
virtual void setBcrOffset()
Definition: BMixingModule.cc:334
edm::BMixingModule::initializeGlobalCache
static std::unique_ptr< MixingCache::Config > initializeGlobalCache(edm::ParameterSet const &)
Definition: BMixingModule.cc:228
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::BMixingModule::beginRun
void beginRun(const edm::Run &r, const edm::EventSetup &setup) override
Definition: BMixingModule.cc:241
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::BMixingModule::doPileUp
virtual void doPileUp(edm::Event &e, const edm::EventSetup &c)
Definition: BMixingModule.cc:342