#include <BMixingModule.h>
Public Types | |
typedef PileUp::EventPrincipalVector | EventPrincipalVector |
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 |
BMixingModule (const edm::ParameterSet &ps) | |
virtual void | checkSignal (const edm::Event &e) |
virtual void | createnewEDProduct () |
virtual void | doPileUp (edm::Event &e, const edm::EventSetup &c) |
virtual void | getEventStartInfo (edm::Event &e, const unsigned int source) |
void | merge (const int bcr, const EventPrincipalVector &vec, unsigned int worker, const edm::EventSetup &c) |
bool | poisson () const |
virtual void | produce (edm::Event &e1, const edm::EventSetup &c) |
virtual void | put (edm::Event &e, const edm::EventSetup &c) |
virtual void | setBcrOffset () |
virtual void | setEventStartInfo (const unsigned int s) |
virtual void | setSourceOffset (const unsigned int s) |
virtual | ~BMixingModule () |
Protected Member Functions | |
void | dropUnwantedBranches (std::vector< std::string > const &wantedBranches) |
virtual void | endJob () |
Protected Attributes | |
int | bunchSpace_ |
bool | checktof_ |
bool | doit_ [4] |
std::vector< edm::EventID > | eventIDs_ |
std::vector< int > | fileSeqNrs_ |
int const | maxBunch_ |
int const | minBunch_ |
bool const | mixProdStep1_ |
bool const | mixProdStep2_ |
std::vector< unsigned int > | nrEvents_ |
std::vector< EventPrincipalVector > | pileup_ [4] |
bool | playback_ |
std::vector< std::vector < edm::EventID > > | vectorEventIDs_ |
Static Protected Attributes | |
static const unsigned int | maxNbSources_ = 4 |
static int | vertexoffset = 0 |
Private Attributes | |
boost::shared_ptr< PileUp > | beamHalo_m_ |
boost::shared_ptr< PileUp > | beamHalo_p_ |
boost::shared_ptr< PileUp > | cosmics_ |
unsigned int | eventId_ |
boost::shared_ptr< PileUp > | input_ |
Definition at line 29 of file BMixingModule.h.
Definition at line 31 of file BMixingModule.h.
BMixingModule::BMixingModule | ( | const edm::ParameterSet & | ps | ) | [explicit] |
standard constructor
Definition at line 172 of file BMixingModule.cc.
References beamHalo_m_, beamHalo_p_, cosmics_, spr::find(), edm::ParameterSet::getParameterNames(), edm::ParameterSet::getUntrackedParameter(), input_, maxBunch_, minBunch_, playback_, and vectorEventIDs_.
: bunchSpace_(pset.getParameter<int>("bunchspace")), minBunch_((pset.getParameter<int>("minBunch")*25)/pset.getParameter<int>("bunchspace")), maxBunch_((pset.getParameter<int>("maxBunch")*25)/pset.getParameter<int>("bunchspace")), mixProdStep1_(pset.getParameter<bool>("mixProdStep1")), mixProdStep2_(pset.getParameter<bool>("mixProdStep2")) { // FIXME: temporary to keep bwds compatibility for cfg files vector<string> names = pset.getParameterNames(); if (find(names.begin(), names.end(),"playback") != names.end()) { playback_=pset.getUntrackedParameter<bool>("playback"); } else playback_=false; //We use std::cout in order to make sure the message appears in all possible configurations of the Message Logger if (playback_) { LogInfo("MixingModule") <<" ATTENTION:Mixing will be done in playback mode! \n" <<" ATTENTION:Mixing Configuration must be the same as for the original mixing!"; } input_= maybeMakePileUp(pset,"input",minBunch_,maxBunch_,playback_); cosmics_= maybeMakePileUp(pset,"cosmics",minBunch_,maxBunch_,playback_); beamHalo_p_=maybeMakePileUp(pset,"beamhalo_plus",minBunch_,maxBunch_,playback_); beamHalo_m_=maybeMakePileUp(pset,"beamhalo_minus",minBunch_,maxBunch_,playback_); //prepare playback info structures vectorEventIDs_.resize(maxBunch_-minBunch_+1); }
BMixingModule::~BMixingModule | ( | ) | [virtual] |
virtual void edm::BMixingModule::addPileups | ( | const int | bcr, |
EventPrincipal * | ep, | ||
unsigned int | eventId, | ||
unsigned int | worker, | ||
const edm::EventSetup & | c | ||
) | [inline, virtual] |
Reimplemented in edm::DataMixingModule, and edm::MixingModule.
Definition at line 54 of file BMixingModule.h.
Referenced by merge().
{;}
virtual void edm::BMixingModule::addSignals | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [inline, virtual] |
Reimplemented in edm::DataMixingModule, and edm::MixingModule.
Definition at line 53 of file BMixingModule.h.
Referenced by produce().
{;}
double edm::BMixingModule::averageNumber | ( | ) | const [inline] |
Definition at line 45 of file BMixingModule.h.
References input_.
virtual void edm::BMixingModule::checkSignal | ( | const edm::Event & | e | ) | [inline, virtual] |
Reimplemented in edm::DataMixingModule, and edm::MixingModule.
Definition at line 51 of file BMixingModule.h.
References gather_cfg::cout.
Referenced by produce().
{std::cout << "BMixingModule::checkSignal must be overwritten!" << std::endl;}
virtual void edm::BMixingModule::createnewEDProduct | ( | ) | [inline, virtual] |
Reimplemented in edm::DataMixingModule, and edm::MixingModule.
Definition at line 50 of file BMixingModule.h.
References gather_cfg::cout.
Referenced by produce().
{std::cout << "BMixingModule::createnewEDProduct must be overwritten!" << std::endl;}
virtual void edm::BMixingModule::doPileUp | ( | edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [inline, virtual] |
Reimplemented in edm::DataMixingModule, and edm::MixingModule.
Definition at line 58 of file BMixingModule.h.
References gather_cfg::cout.
Referenced by produce().
{std::cout << "BMixingModule::doPileUp must be overwritten!" << std::endl;}
void BMixingModule::dropUnwantedBranches | ( | std::vector< std::string > const & | wantedBranches | ) | [protected] |
Definition at line 303 of file BMixingModule.cc.
References beamHalo_m_, beamHalo_p_, cosmics_, and input_.
Referenced by edm::MixingModule::MixingModule().
{ if (input_) input_->dropUnwantedBranches(wantedBranches); if (cosmics_) cosmics_->dropUnwantedBranches(wantedBranches); if (beamHalo_p_) beamHalo_p_->dropUnwantedBranches(wantedBranches); if (beamHalo_m_) beamHalo_m_->dropUnwantedBranches(wantedBranches); }
void BMixingModule::endJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 310 of file BMixingModule.cc.
References beamHalo_m_, beamHalo_p_, cosmics_, and input_.
{ if (input_) input_->endJob(); if (cosmics_) cosmics_->endJob(); if (beamHalo_p_) beamHalo_p_->endJob(); if (beamHalo_m_) beamHalo_m_->endJob(); }
virtual void edm::BMixingModule::getEventStartInfo | ( | edm::Event & | e, |
const unsigned int | source | ||
) | [inline, virtual] |
Reimplemented in edm::MixingModule.
Definition at line 60 of file BMixingModule.h.
Referenced by produce().
{;} //to be set locally
void BMixingModule::merge | ( | const int | bcr, |
const EventPrincipalVector & | vec, | ||
unsigned int | worker, | ||
const edm::EventSetup & | c | ||
) |
Definition at line 287 of file BMixingModule.cc.
References addPileups(), eventId_, i, LogDebug, and vertexoffset.
Referenced by edm::DataMixingModule::doPileUp(), and edm::MixingModule::doPileUp().
{ // // main loop: loop over events and merge // eventId_=0; LogDebug("MixingModule") <<"For bunchcrossing "<<bcr<<", "<<vec.size()<<" events will be merged"; vertexoffset=0; int i=0; for (EventPrincipalVector::const_iterator it = vec.begin(); it != vec.end(); ++it) { LogDebug("MixingModule") <<" merging Event: id " << (*it)->id(); addPileups(bcr, &(**it), ++eventId_,worker,setup); i = i + 1; }// end main loop }
bool edm::BMixingModule::poisson | ( | ) | const [inline] |
Definition at line 48 of file BMixingModule.h.
References input_.
void BMixingModule::produce | ( | edm::Event & | e1, |
const edm::EventSetup & | c | ||
) | [virtual] |
Cumulates the pileup events onto this event
Implements edm::EDProducer.
Definition at line 206 of file BMixingModule.cc.
References addSignals(), beamHalo_m_, beamHalo_p_, checkSignal(), cosmics_, createnewEDProduct(), doit_, doPileUp(), getEventStartInfo(), edm::EventBase::id(), input_, LogDebug, maxNbSources_, mixProdStep1_, pileup_, playback_, put(), setEventStartInfo(), and vectorEventIDs_.
{ // Check if the signal is present in the root file // for all the objects we want to mix checkSignal(e); // Create EDProduct createnewEDProduct(); // Add signals if (!mixProdStep1_){ addSignals(e,setup); } // Read the PileUp for (unsigned int is=0;is< maxNbSources_;++is) { doit_[is]=false; pileup_[is].clear(); } if (input_) { if (playback_) { getEventStartInfo(e,0); input_->readPileUp(pileup_[0], vectorEventIDs_); } else { input_->readPileUp(pileup_[0], vectorEventIDs_); setEventStartInfo(0); } if (input_->doPileup()) { LogDebug("MixingModule") <<"\n\n==============================>Adding pileup to signal event "<<e.id(); doit_[0]=true; } } if (cosmics_) { if (playback_) { getEventStartInfo(e,1); cosmics_->readPileUp(pileup_[1], vectorEventIDs_); } else { cosmics_->readPileUp(pileup_[1], vectorEventIDs_); setEventStartInfo(1); } if (cosmics_->doPileup()) { LogDebug("MixingModule") <<"\n\n==============================>Adding cosmics to signal event "<<e.id(); doit_[1]=true; } } if (beamHalo_p_) { if (playback_) { getEventStartInfo(e,2); beamHalo_p_->readPileUp(pileup_[2], vectorEventIDs_); } else { beamHalo_p_->readPileUp(pileup_[2], vectorEventIDs_); setEventStartInfo(2); } if (beamHalo_p_->doPileup()) { LogDebug("MixingModule") <<"\n\n==============================>Adding beam halo+ to signal event "<<e.id(); doit_[2]=true; } } if (beamHalo_m_) { if (playback_) { getEventStartInfo(e,3); beamHalo_m_->readPileUp(pileup_[3], vectorEventIDs_); } else { beamHalo_m_->readPileUp(pileup_[3], vectorEventIDs_); setEventStartInfo(3); } if (beamHalo_m_->doPileup()) { LogDebug("MixingModule") <<"\n\n==============================>Adding beam halo- to signal event "<<e.id(); doit_[3]=true; } } doPileUp(e,setup); // Put output into event (here only playback info) put(e,setup); }
virtual void edm::BMixingModule::put | ( | edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [inline, virtual] |
Reimplemented in edm::DataMixingModule, and edm::MixingModule.
Definition at line 57 of file BMixingModule.h.
Referenced by produce().
{;}
virtual void edm::BMixingModule::setBcrOffset | ( | ) | [inline, virtual] |
Reimplemented in edm::DataMixingModule.
Definition at line 55 of file BMixingModule.h.
References gather_cfg::cout.
{std::cout << "BMixingModule::setBcrOffset must be overwritten!" << std::endl;} //FIXME: LogWarning
virtual void edm::BMixingModule::setEventStartInfo | ( | const unsigned int | s | ) | [inline, virtual] |
Reimplemented in edm::MixingModule.
Definition at line 59 of file BMixingModule.h.
Referenced by produce().
{;} //to be set in CF
virtual void edm::BMixingModule::setSourceOffset | ( | const unsigned int | s | ) | [inline, virtual] |
Reimplemented in edm::DataMixingModule.
Definition at line 56 of file BMixingModule.h.
References gather_cfg::cout.
{std::cout << "BMixingModule::setSourceOffset must be overwritten!" << std::endl;}
boost::shared_ptr<PileUp> edm::BMixingModule::beamHalo_m_ [private] |
Definition at line 88 of file BMixingModule.h.
Referenced by BMixingModule(), dropUnwantedBranches(), endJob(), and produce().
boost::shared_ptr<PileUp> edm::BMixingModule::beamHalo_p_ [private] |
Definition at line 87 of file BMixingModule.h.
Referenced by BMixingModule(), dropUnwantedBranches(), endJob(), and produce().
int edm::BMixingModule::bunchSpace_ [protected] |
Definition at line 65 of file BMixingModule.h.
Referenced by edm::MixingModule::MixingModule().
bool edm::BMixingModule::checktof_ [protected] |
Definition at line 67 of file BMixingModule.h.
boost::shared_ptr<PileUp> edm::BMixingModule::cosmics_ [private] |
Definition at line 86 of file BMixingModule.h.
Referenced by BMixingModule(), dropUnwantedBranches(), endJob(), and produce().
bool edm::BMixingModule::doit_[4] [protected] |
Definition at line 80 of file BMixingModule.h.
Referenced by edm::DataMixingModule::doPileUp(), edm::MixingModule::doPileUp(), and produce().
unsigned int edm::BMixingModule::eventId_ [private] |
Definition at line 90 of file BMixingModule.h.
Referenced by merge().
std::vector<edm::EventID> edm::BMixingModule::eventIDs_ [protected] |
Definition at line 75 of file BMixingModule.h.
std::vector<int> edm::BMixingModule::fileSeqNrs_ [protected] |
Definition at line 77 of file BMixingModule.h.
boost::shared_ptr<PileUp> edm::BMixingModule::input_ [private] |
Definition at line 85 of file BMixingModule.h.
Referenced by averageNumber(), BMixingModule(), dropUnwantedBranches(), endJob(), poisson(), and produce().
int const edm::BMixingModule::maxBunch_ [protected] |
Definition at line 69 of file BMixingModule.h.
Referenced by BMixingModule(), edm::MixingModule::createnewEDProduct(), edm::DataMixingModule::doPileUp(), edm::MixingModule::doPileUp(), and edm::MixingModule::MixingModule().
const unsigned int BMixingModule::maxNbSources_ = 4 [static, protected] |
Definition at line 79 of file BMixingModule.h.
Referenced by edm::MixingModule::createnewEDProduct(), edm::DataMixingModule::doPileUp(), edm::MixingModule::doPileUp(), edm::MixingModule::MixingModule(), and produce().
int const edm::BMixingModule::minBunch_ [protected] |
Definition at line 68 of file BMixingModule.h.
Referenced by BMixingModule(), edm::MixingModule::createnewEDProduct(), edm::DataMixingModule::doPileUp(), edm::MixingModule::doPileUp(), and edm::MixingModule::MixingModule().
bool const edm::BMixingModule::mixProdStep1_ [protected] |
Reimplemented in edm::MixingModule.
Definition at line 70 of file BMixingModule.h.
Referenced by produce().
bool const edm::BMixingModule::mixProdStep2_ [protected] |
Reimplemented in edm::MixingModule.
Definition at line 71 of file BMixingModule.h.
std::vector<unsigned int> edm::BMixingModule::nrEvents_ [protected] |
Definition at line 78 of file BMixingModule.h.
std::vector<EventPrincipalVector> edm::BMixingModule::pileup_[4] [protected] |
Definition at line 81 of file BMixingModule.h.
Referenced by edm::DataMixingModule::doPileUp(), edm::MixingModule::doPileUp(), and produce().
bool edm::BMixingModule::playback_ [protected] |
Definition at line 74 of file BMixingModule.h.
Referenced by BMixingModule(), edm::MixingModule::getEventStartInfo(), and produce().
std::vector<std::vector<edm::EventID> > edm::BMixingModule::vectorEventIDs_ [protected] |
Definition at line 76 of file BMixingModule.h.
Referenced by BMixingModule(), edm::MixingModule::getEventStartInfo(), produce(), and edm::MixingModule::setEventStartInfo().
int BMixingModule::vertexoffset = 0 [static, protected] |
Definition at line 66 of file BMixingModule.h.
Referenced by edm::MixingModule::addPileups(), and merge().