CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
edm::BMixingModule Class Reference

#include <BMixingModule.h>

Inheritance diagram for edm::BMixingModule:
edm::stream::EDProducer< GlobalCache< MixingCache::Config > > edm::DataMixingModule edm::MixingModule edm::PreMixingModule

Public Member Functions

virtual void addPileups (const int bcr, EventPrincipal *ep, unsigned int eventId, unsigned int worker, const edm::EventSetup &c)
 
virtual void addSignals (const edm::Event &e, const edm::EventSetup &c)
 
double averageNumber () const
 
void beginLuminosityBlock (const edm::LuminosityBlock &l, const edm::EventSetup &setup) override
 
void beginRun (const edm::Run &r, const edm::EventSetup &setup) override
 
 BMixingModule (const edm::ParameterSet &ps, MixingCache::Config const *globalConf)
 
virtual void checkSignal (const edm::Event &e)
 
virtual void createnewEDProduct ()
 
virtual void doPileUp (edm::Event &e, const edm::EventSetup &c)
 
void endLuminosityBlock (const edm::LuminosityBlock &l, const edm::EventSetup &setup) override
 
void endRun (const edm::Run &r, const edm::EventSetup &setup) override
 
virtual void finalizeEvent (edm::Event &event, const edm::EventSetup &setup)
 
virtual void initializeEvent (const edm::Event &event, const edm::EventSetup &setup)
 
bool poisson () const
 
void produce (edm::Event &e1, const edm::EventSetup &c) override
 
virtual void put (edm::Event &e, const edm::EventSetup &c)
 
void registerLateConsumes (eventsetup::ESRecordsToProductResolverIndices const &) override
 
virtual void reload (const edm::EventSetup &setup)
 
virtual void setBcrOffset ()
 
virtual void setSourceOffset (const unsigned int s)
 
 ~BMixingModule () override
 
- Public Member Functions inherited from edm::stream::EDProducer< GlobalCache< MixingCache::Config > >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void globalEndJob (MixingCache::Config *)
 
static std::unique_ptr< MixingCache::ConfiginitializeGlobalCache (edm::ParameterSet const &)
 

Protected Member Functions

void beginStream (edm::StreamID) override
 
void dropUnwantedBranches (std::vector< std::string > const &wantedBranches)
 
void endStream () override
 
void setupPileUpEvent (const edm::EventSetup &setup)
 
void update (edm::EventSetup const &)
 

Protected Attributes

int bunchSpace_
 
bool checktof_
 
bool doit_ [4]
 
unsigned int eventId_
 
std::vector< std::shared_ptr< PileUp > > inputSources_
 
int maxBunch_
 
int minBunch_
 
bool const mixProdStep1_
 
bool const mixProdStep2_
 
edm::ESWatcher< MixingRcdparameterWatcher_
 
bool playback_
 
bool readDB_
 
std::vector< float > TrueNumInteractions_
 
int vertexOffset_
 

Static Protected Attributes

static const unsigned int maxNbSources_ = 4
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< GlobalCache< MixingCache::Config > >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 41 of file BMixingModule.h.

Constructor & Destructor Documentation

◆ BMixingModule()

BMixingModule::BMixingModule ( const edm::ParameterSet ps,
MixingCache::Config const *  globalConf 
)
explicit

standard constructor

Definition at line 180 of file BMixingModule.cc.

References edm::MixingCache::Config::inputConfigs_, inputSources_, maxNbSources_, muonDTDigis_cfi::pset, and readDB_.

181  : bunchSpace_(globalConf->bunchSpace_),
182  vertexOffset_(0),
183  minBunch_(globalConf->minBunch_),
184  maxBunch_(globalConf->maxBunch_),
185  mixProdStep1_(pset.getParameter<bool>("mixProdStep1")),
186  mixProdStep2_(pset.getParameter<bool>("mixProdStep2")),
187  readDB_(globalConf->configFromDB_),
188  playback_(globalConf->playback_) {
189  for (size_t makeIdx = 0; makeIdx < maxNbSources_; makeIdx++) {
190  if (globalConf->inputConfigs_[makeIdx]) {
191  const edm::ParameterSet& psin =
192  pset.getParameter<edm::ParameterSet>(globalConf->inputConfigs_[makeIdx]->sourcename_);
193  inputSources_.push_back(
194  std::make_shared<PileUp>(psin, globalConf->inputConfigs_[makeIdx], consumesCollector(), readDB_));
195  inputSources_.back()->input(makeIdx);
196  } else {
197  inputSources_.push_back(nullptr);
198  }
199  }
200  }
bool const mixProdStep2_
static const unsigned int maxNbSources_
bool const mixProdStep1_
Definition: BMixingModule.h:99
std::vector< std::shared_ptr< PileUp > > inputSources_

◆ ~BMixingModule()

BMixingModule::~BMixingModule ( )
override

Default destructor

Definition at line 203 of file BMixingModule.cc.

203 { ; }

Member Function Documentation

◆ addPileups()

virtual void edm::BMixingModule::addPileups ( const int  bcr,
EventPrincipal ep,
unsigned int  eventId,
unsigned int  worker,
const edm::EventSetup c 
)
inlinevirtual

Definition at line 81 of file BMixingModule.h.

82  {}

◆ addSignals()

virtual void edm::BMixingModule::addSignals ( const edm::Event e,
const edm::EventSetup c 
)
inlinevirtual

Reimplemented in edm::MixingModule, edm::DataMixingModule, and edm::PreMixingModule.

Definition at line 80 of file BMixingModule.h.

Referenced by produce().

80 {}

◆ averageNumber()

double edm::BMixingModule::averageNumber ( ) const
inline

Definition at line 74 of file BMixingModule.h.

References inputSources_.

74 { return inputSources_[0] ? inputSources_[0]->averageNumber() : 0.0; }
std::vector< std::shared_ptr< PileUp > > inputSources_

◆ beginLuminosityBlock()

void BMixingModule::beginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup setup 
)
override

Definition at line 244 of file BMixingModule.cc.

References inputSources_, maxNbSources_, singleTopDQM_cfi::setup, and update().

Referenced by edm::PreMixingModule::beginLuminosityBlock(), edm::MixingModule::beginLuminosityBlock(), and edm::DataMixingModule::beginLuminosityBlock().

244  {
245  update(setup);
246  for (size_t endIdx = 0; endIdx < maxNbSources_; ++endIdx) {
247  if (inputSources_[endIdx])
248  inputSources_[endIdx]->beginLuminosityBlock(lumi, setup);
249  }
250  }
static const unsigned int maxNbSources_
std::vector< std::shared_ptr< PileUp > > inputSources_
void update(edm::EventSetup const &)

◆ beginRun()

void BMixingModule::beginRun ( const edm::Run r,
const edm::EventSetup setup 
)
override

Definition at line 252 of file BMixingModule.cc.

References inputSources_, maxNbSources_, writedatasetfile::run, and singleTopDQM_cfi::setup.

Referenced by edm::PreMixingModule::beginRun(), edm::DataMixingModule::beginRun(), and edm::MixingModule::beginRun().

252  {
253  for (size_t endIdx = 0; endIdx < maxNbSources_; ++endIdx) {
254  if (inputSources_[endIdx])
255  inputSources_[endIdx]->beginRun(run, setup);
256  }
257  }
static const unsigned int maxNbSources_
std::vector< std::shared_ptr< PileUp > > inputSources_

◆ beginStream()

void BMixingModule::beginStream ( edm::StreamID  streamID)
overrideprotected

Definition at line 322 of file BMixingModule.cc.

References inputSources_, and maxNbSources_.

322  {
323  for (size_t endIdx = 0; endIdx < maxNbSources_; ++endIdx) {
324  if (inputSources_[endIdx])
325  inputSources_[endIdx]->beginStream(streamID);
326  }
327  }
static const unsigned int maxNbSources_
std::vector< std::shared_ptr< PileUp > > inputSources_

◆ checkSignal()

void BMixingModule::checkSignal ( const edm::Event e)
virtual

Reimplemented in edm::MixingModule, edm::DataMixingModule, and edm::PreMixingModule.

Definition at line 347 of file BMixingModule.cc.

Referenced by produce().

347  {
348  edm::LogWarning("MixingModule") << "BMixingModule::checkSignal must be overwritten!";
349  }
Log< level::Warning, false > LogWarning

◆ createnewEDProduct()

void BMixingModule::createnewEDProduct ( )
virtual

Reimplemented in edm::MixingModule, edm::DataMixingModule, and edm::PreMixingModule.

Definition at line 343 of file BMixingModule.cc.

Referenced by produce().

343  {
344  edm::LogWarning("MixingModule") << "BMixingModule::createnewEDProduct must be overwritten!";
345  }
Log< level::Warning, false > LogWarning

◆ doPileUp()

void BMixingModule::doPileUp ( edm::Event e,
const edm::EventSetup c 
)
virtual

Reimplemented in edm::MixingModule, edm::DataMixingModule, and edm::PreMixingModule.

Definition at line 359 of file BMixingModule.cc.

Referenced by produce().

359  {
360  edm::LogWarning("MixingModule") << "BMixingModule::doPileUp must be overwritten!";
361  }
Log< level::Warning, false > LogWarning

◆ dropUnwantedBranches()

void BMixingModule::dropUnwantedBranches ( std::vector< std::string > const &  wantedBranches)
protected

Definition at line 315 of file BMixingModule.cc.

References inputSources_, and maxNbSources_.

Referenced by edm::MixingModule::MixingModule().

315  {
316  for (size_t dropIdx = 0; dropIdx < maxNbSources_; ++dropIdx) {
317  if (inputSources_[dropIdx])
318  inputSources_[dropIdx]->dropUnwantedBranches(wantedBranches);
319  }
320  }
static const unsigned int maxNbSources_
std::vector< std::shared_ptr< PileUp > > inputSources_

◆ endLuminosityBlock()

void BMixingModule::endLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup setup 
)
override

Definition at line 259 of file BMixingModule.cc.

References inputSources_, maxNbSources_, and singleTopDQM_cfi::setup.

Referenced by edm::PreMixingModule::endLuminosityBlock(), edm::DataMixingModule::endLuminosityBlock(), and edm::MixingModule::endLuminosityBlock().

259  {
260  for (size_t endIdx = 0; endIdx < maxNbSources_; ++endIdx) {
261  if (inputSources_[endIdx])
262  inputSources_[endIdx]->endLuminosityBlock(lumi, setup);
263  }
264  }
static const unsigned int maxNbSources_
std::vector< std::shared_ptr< PileUp > > inputSources_

◆ endRun()

void BMixingModule::endRun ( const edm::Run r,
const edm::EventSetup setup 
)
override

Definition at line 266 of file BMixingModule.cc.

References inputSources_, maxNbSources_, writedatasetfile::run, and singleTopDQM_cfi::setup.

Referenced by edm::PreMixingModule::endRun(), edm::MixingModule::endRun(), and edm::DataMixingModule::endRun().

266  {
267  for (size_t endIdx = 0; endIdx < maxNbSources_; ++endIdx) {
268  if (inputSources_[endIdx])
269  inputSources_[endIdx]->endRun(run, setup);
270  }
271  }
static const unsigned int maxNbSources_
std::vector< std::shared_ptr< PileUp > > inputSources_

◆ endStream()

void BMixingModule::endStream ( )
overrideprotected

Definition at line 329 of file BMixingModule.cc.

References edm::ExceptionCollector::hasThrown(), inputSources_, maxNbSources_, and edm::ExceptionCollector::rethrow().

329  {
330  ExceptionCollector exceptionCollector(
331  "Multiple exceptions were thrown while executing endStream and endJob for mixing modules. "
332  "An exception message follows for each.\n");
333 
334  for (size_t endIdx = 0; endIdx < maxNbSources_; ++endIdx) {
335  if (inputSources_[endIdx])
336  inputSources_[endIdx]->endStream(exceptionCollector);
337  }
338  if (exceptionCollector.hasThrown()) {
339  exceptionCollector.rethrow();
340  }
341  }
static const unsigned int maxNbSources_
std::vector< std::shared_ptr< PileUp > > inputSources_

◆ finalizeEvent()

virtual void edm::BMixingModule::finalizeEvent ( edm::Event event,
const edm::EventSetup setup 
)
inlinevirtual

Reimplemented in edm::MixingModule.

Definition at line 57 of file BMixingModule.h.

Referenced by produce().

57 {}

◆ globalEndJob()

static void edm::BMixingModule::globalEndJob ( MixingCache::Config )
inlinestatic

Definition at line 66 of file BMixingModule.h.

66 {}

◆ initializeEvent()

virtual void edm::BMixingModule::initializeEvent ( const edm::Event event,
const edm::EventSetup setup 
)
inlinevirtual

Reimplemented in edm::MixingModule, edm::DataMixingModule, and edm::PreMixingModule.

Definition at line 54 of file BMixingModule.h.

Referenced by produce().

54 {}

◆ initializeGlobalCache()

std::unique_ptr< MixingCache::Config > BMixingModule::initializeGlobalCache ( edm::ParameterSet const &  pset)
static

Definition at line 239 of file BMixingModule.cc.

References maxNbSources_, and muonDTDigis_cfi::pset.

239  {
240  return std::make_unique<MixingCache::Config>(pset, maxNbSources_);
241  }
static const unsigned int maxNbSources_

◆ poisson()

bool edm::BMixingModule::poisson ( ) const
inline

Definition at line 76 of file BMixingModule.h.

References inputSources_.

76 { return inputSources_[0] ? inputSources_[0]->poisson() : 0.0; }
std::vector< std::shared_ptr< PileUp > > inputSources_

◆ produce()

void BMixingModule::produce ( edm::Event e1,
const edm::EventSetup c 
)
override

Cumulates the pileup events onto this event

Definition at line 284 of file BMixingModule.cc.

References addSignals(), checkSignal(), createnewEDProduct(), doPileUp(), MillePedeFileConverter_cfg::e, finalizeEvent(), initializeEvent(), mixProdStep1_, put(), and singleTopDQM_cfi::setup.

284  {
285  // Check if the signal is present in the root file
286  // for all the objects we want to mix
287  checkSignal(e);
288 
289  // Create EDProduct
291 
293 
294  // Add signals
295  if (!mixProdStep1_) {
296  addSignals(e, setup);
297  }
298 
299  doPileUp(e, setup);
300 
301  // Includes putting digi products into the edm::Event.
303 
304  // Put output into event (here only playback info)
305  put(e, setup);
306  }
virtual void addSignals(const edm::Event &e, const edm::EventSetup &c)
Definition: BMixingModule.h:80
virtual void finalizeEvent(edm::Event &event, const edm::EventSetup &setup)
Definition: BMixingModule.h:57
virtual void checkSignal(const edm::Event &e)
virtual void put(edm::Event &e, const edm::EventSetup &c)
Definition: BMixingModule.h:85
virtual void createnewEDProduct()
virtual void doPileUp(edm::Event &e, const edm::EventSetup &c)
virtual void initializeEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: BMixingModule.h:54
bool const mixProdStep1_
Definition: BMixingModule.h:99

◆ put()

virtual void edm::BMixingModule::put ( edm::Event e,
const edm::EventSetup c 
)
inlinevirtual

Reimplemented in edm::MixingModule, edm::DataMixingModule, and edm::PreMixingModule.

Definition at line 85 of file BMixingModule.h.

Referenced by produce().

85 {}

◆ registerLateConsumes()

void BMixingModule::registerLateConsumes ( eventsetup::ESRecordsToProductResolverIndices const &  iES)
override

Definition at line 205 of file BMixingModule.cc.

References inputSources_, and maxNbSources_.

205  {
206  for (size_t endIdx = 0; endIdx < maxNbSources_; ++endIdx) {
207  if (inputSources_[endIdx])
208  inputSources_[endIdx]->beginJob(iES);
209  }
210  }
static const unsigned int maxNbSources_
std::vector< std::shared_ptr< PileUp > > inputSources_

◆ reload()

virtual void edm::BMixingModule::reload ( const edm::EventSetup setup)
inlinevirtual

Reimplemented in edm::MixingModule.

Definition at line 69 of file BMixingModule.h.

Referenced by update().

69 {};

◆ setBcrOffset()

void BMixingModule::setBcrOffset ( )
virtual

Definition at line 351 of file BMixingModule.cc.

351  {
352  edm::LogWarning("MixingModule") << "BMixingModule::setBcrOffset must be overwritten!";
353  }
Log< level::Warning, false > LogWarning

◆ setSourceOffset()

void BMixingModule::setSourceOffset ( const unsigned int  s)
virtual

Definition at line 355 of file BMixingModule.cc.

355  {
356  edm::LogWarning("MixingModule") << "BMixingModule::setSourceOffset must be overwritten!";
357  }
Log< level::Warning, false > LogWarning

◆ setupPileUpEvent()

void BMixingModule::setupPileUpEvent ( const edm::EventSetup setup)
protected

Definition at line 308 of file BMixingModule.cc.

References inputSources_, maxNbSources_, and singleTopDQM_cfi::setup.

Referenced by edm::MixingModule::pileAllWorkers(), edm::DataMixingModule::pileWorker(), and edm::PreMixingModule::pileWorker().

308  {
309  for (size_t dropIdx = 0; dropIdx < maxNbSources_; ++dropIdx) {
310  if (inputSources_[dropIdx])
311  inputSources_[dropIdx]->setupPileUpEvent(setup);
312  }
313  }
static const unsigned int maxNbSources_
std::vector< std::shared_ptr< PileUp > > inputSources_

◆ update()

void BMixingModule::update ( edm::EventSetup const &  setup)
protected

Definition at line 273 of file BMixingModule.cc.

References edm::ESWatcher< T >::check(), inputSources_, maxNbSources_, parameterWatcher_, readDB_, reload(), and singleTopDQM_cfi::setup.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), beginLuminosityBlock(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

273  {
275  for (size_t makeIdx = 0; makeIdx < maxNbSources_; makeIdx++) {
276  if (inputSources_[makeIdx])
277  inputSources_[makeIdx]->reload(setup);
278  }
279  reload(setup);
280  }
281  }
edm::ESWatcher< MixingRcd > parameterWatcher_
static const unsigned int maxNbSources_
virtual void reload(const edm::EventSetup &setup)
Definition: BMixingModule.h:69
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
std::vector< std::shared_ptr< PileUp > > inputSources_

Member Data Documentation

◆ bunchSpace_

int edm::BMixingModule::bunchSpace_
protected

◆ checktof_

bool edm::BMixingModule::checktof_
protected

Definition at line 96 of file BMixingModule.h.

◆ doit_

bool edm::BMixingModule::doit_[4]
protected

Definition at line 105 of file BMixingModule.h.

◆ eventId_

unsigned int edm::BMixingModule::eventId_
protected

Definition at line 108 of file BMixingModule.h.

◆ inputSources_

std::vector<std::shared_ptr<PileUp> > edm::BMixingModule::inputSources_
protected

◆ maxBunch_

int edm::BMixingModule::maxBunch_
protected

◆ maxNbSources_

const unsigned int BMixingModule::maxNbSources_ = 4
staticprotected

◆ minBunch_

int edm::BMixingModule::minBunch_
protected

◆ mixProdStep1_

bool const edm::BMixingModule::mixProdStep1_
protected

Definition at line 99 of file BMixingModule.h.

Referenced by produce().

◆ mixProdStep2_

bool const edm::BMixingModule::mixProdStep2_
protected

Definition at line 100 of file BMixingModule.h.

◆ parameterWatcher_

edm::ESWatcher<MixingRcd> edm::BMixingModule::parameterWatcher_
protected

Definition at line 114 of file BMixingModule.h.

Referenced by update().

◆ playback_

bool edm::BMixingModule::playback_
protected

◆ readDB_

bool edm::BMixingModule::readDB_
protected

Definition at line 102 of file BMixingModule.h.

Referenced by BMixingModule(), and update().

◆ TrueNumInteractions_

std::vector<float> edm::BMixingModule::TrueNumInteractions_
protected

◆ vertexOffset_

int edm::BMixingModule::vertexOffset_
protected

Definition at line 95 of file BMixingModule.h.