#include <ProducerSourceBase.h>
Public Member Functions | |
EventNumber_t | event () const |
unsigned int | eventCreationDelay () const |
LuminosityBlockNumber_t | luminosityBlock () const |
Accessor for current luminosity block number. | |
unsigned int | numberEventsInLumi () const |
unsigned int | numberEventsInRun () const |
unsigned int | numberEventsInThisLumi () const |
unsigned int | numberEventsInThisRun () const |
TimeValue_t | presentTime () const |
ProducerSourceBase (ParameterSet const &pset, InputSourceDescription const &desc, bool realData) | |
RunNumber_t | run () const |
Accessor for current run number. | |
unsigned int | timeBetweenEvents () const |
virtual | ~ProducerSourceBase () |
Static Public Member Functions | |
static void | fillDescription (ParameterSetDescription &desc) |
Private Member Functions | |
void | advanceToNext (EventID &eventID, TimeValue_t &time) |
virtual void | beginJob () override |
virtual void | beginLuminosityBlock (LuminosityBlock &) override |
virtual void | beginRun (Run &) override |
virtual void | endLuminosityBlock (LuminosityBlock &) override |
virtual void | endRun (Run &) override |
virtual size_t | fileIndex () const |
virtual ItemType | getNextItemType () override |
virtual void | initialize (EventID &id, TimeValue_t &time, TimeValue_t &interval) |
virtual bool | noFiles () const |
virtual void | produce (Event &e)=0 |
virtual EventPrincipal * | readEvent_ (EventPrincipal &eventPrincipal) override |
virtual boost::shared_ptr < LuminosityBlockAuxiliary > | readLuminosityBlockAuxiliary_ () override |
virtual boost::shared_ptr < RunAuxiliary > | readRunAuxiliary_ () override |
void | retreatToPrevious (EventID &eventID, TimeValue_t &time) |
virtual void | rewind_ () override |
virtual bool | setRunAndEventInfo (EventID &id, TimeValue_t &time)=0 |
virtual void | skip (int offset) override |
Private Attributes | |
EventAuxiliary::ExperimentType | eType_ |
unsigned int | eventCreationDelay_ |
EventID | eventID_ |
bool | isRealData_ |
unsigned int | numberEventsInLumi_ |
unsigned int | numberEventsInRun_ |
unsigned int | numberEventsInThisLumi_ |
unsigned int | numberEventsInThisRun_ |
EventID | origEventID_ |
TimeValue_t | origTime_ |
TimeValue_t | presentTime_ |
TimeValue_t | timeBetweenEvents_ |
unsigned int const | zerothEvent_ |
Definition at line 19 of file ProducerSourceBase.h.
edm::ProducerSourceBase::ProducerSourceBase | ( | ParameterSet const & | pset, |
InputSourceDescription const & | desc, | ||
bool | realData | ||
) | [explicit] |
Definition at line 19 of file ProducerSourceBase.cc.
References presentTime_, and edm::InputSource::setTimestamp().
: InputSource(pset, desc), numberEventsInRun_(pset.getUntrackedParameter<unsigned int>("numberEventsInRun", remainingEvents())), numberEventsInLumi_(pset.getUntrackedParameter<unsigned int>("numberEventsInLuminosityBlock", remainingEvents())), presentTime_(pset.getUntrackedParameter<unsigned long long>("firstTime", 1ULL)), //time in ns origTime_(presentTime_), timeBetweenEvents_(pset.getUntrackedParameter<unsigned long long>("timeBetweenEvents", kNanoSecPerSec/kAveEventPerSec)), eventCreationDelay_(pset.getUntrackedParameter<unsigned int>("eventCreationDelay", 0)), numberEventsInThisRun_(0), numberEventsInThisLumi_(0), zerothEvent_(pset.getUntrackedParameter<unsigned int>("firstEvent", 1) - 1), eventID_(pset.getUntrackedParameter<unsigned int>("firstRun", 1), pset.getUntrackedParameter<unsigned int>("firstLuminosityBlock", 1), zerothEvent_), origEventID_(eventID_), isRealData_(realData), eType_(EventAuxiliary::Undefined) { setTimestamp(Timestamp(presentTime_)); // We need to map this string to the EventAuxiliary::ExperimentType enumeration // std::string eType = pset.getUntrackedParameter<std::string>("experimentType", std::string("Any"))), }
edm::ProducerSourceBase::~ProducerSourceBase | ( | ) | [virtual] |
Definition at line 41 of file ProducerSourceBase.cc.
{ }
void edm::ProducerSourceBase::advanceToNext | ( | EventID & | eventID, |
TimeValue_t & | time | ||
) | [private] |
Definition at line 175 of file ProducerSourceBase.cc.
References edm::EventID::luminosityBlock(), edm::EventID::next(), edm::EventID::nextRunFirstEvent(), numberEventsInLumi_, numberEventsInRun_, numberEventsInThisLumi_, numberEventsInThisRun_, origEventID_, and timeBetweenEvents_.
Referenced by getNextItemType(), and skip().
{ if (numberEventsInRun_ < 1 || numberEventsInThisRun_ < numberEventsInRun_) { // same run ++numberEventsInThisRun_; if (!(numberEventsInLumi_ < 1 || numberEventsInThisLumi_ < numberEventsInLumi_)) { // new lumi eventID = eventID.next(eventID.luminosityBlock() + 1); numberEventsInThisLumi_ = 1; } else { eventID = eventID.next(eventID.luminosityBlock()); ++numberEventsInThisLumi_; } } else { // new run eventID = eventID.nextRunFirstEvent(origEventID_.luminosityBlock()); numberEventsInThisLumi_ = 1; numberEventsInThisRun_ = 1; } time += timeBetweenEvents_; }
void edm::ProducerSourceBase::beginJob | ( | void | ) | [override, private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 93 of file ProducerSourceBase.cc.
References eventID_, initialize(), presentTime_, and timeBetweenEvents_.
{ // initialize cannot be called from the constructor, because it is a virtual function // that needs to be invoked from a derived class if the derived class overrides it. initialize(eventID_, presentTime_, timeBetweenEvents_); }
void edm::ProducerSourceBase::beginLuminosityBlock | ( | LuminosityBlock & | ) | [override, private, virtual] |
Reimplemented from edm::InputSource.
Reimplemented in ErrorStreamSource.
Definition at line 108 of file ProducerSourceBase.cc.
{ }
void edm::ProducerSourceBase::beginRun | ( | Run & | ) | [override, private, virtual] |
Reimplemented from edm::InputSource.
Reimplemented in ErrorStreamSource, AlpgenSource, LHESource, and MCatNLOSource.
Definition at line 100 of file ProducerSourceBase.cc.
{ }
void edm::ProducerSourceBase::endLuminosityBlock | ( | LuminosityBlock & | ) | [override, private, virtual] |
Reimplemented from edm::InputSource.
Reimplemented in ErrorStreamSource.
Definition at line 112 of file ProducerSourceBase.cc.
{ }
void edm::ProducerSourceBase::endRun | ( | Run & | ) | [override, private, virtual] |
Reimplemented from edm::InputSource.
Reimplemented in ErrorStreamSource, and LHESource.
Definition at line 104 of file ProducerSourceBase.cc.
{ }
EventNumber_t edm::ProducerSourceBase::event | ( | ) | const [inline] |
Definition at line 32 of file ProducerSourceBase.h.
References edm::EventID::event(), and eventID_.
Referenced by ErrorStreamSource::setRunAndEventInfo().
{return eventID_.event();}
unsigned int edm::ProducerSourceBase::eventCreationDelay | ( | ) | const [inline] |
Definition at line 28 of file ProducerSourceBase.h.
References eventCreationDelay_.
{return eventCreationDelay_;}
size_t edm::ProducerSourceBase::fileIndex | ( | ) | const [private, virtual] |
Reimplemented in edm::ProducerSourceFromFiles.
Definition at line 225 of file ProducerSourceBase.cc.
Referenced by getNextItemType().
{
return 0UL;
}
void edm::ProducerSourceBase::fillDescription | ( | ParameterSetDescription & | desc | ) | [static] |
Reimplemented from edm::InputSource.
Reimplemented in edm::ProducerSourceFromFiles.
Definition at line 230 of file ProducerSourceBase.cc.
References edm::ParameterSetDescription::addOptionalUntracked(), edm::ParameterSetDescription::addUntracked(), edm::kAveEventPerSec, and edm::kNanoSecPerSec.
Referenced by edm::EmptySource::fillDescriptions().
{ desc.addOptionalUntracked<unsigned int>("numberEventsInRun")->setComment("Number of events to generate in each run."); desc.addOptionalUntracked<unsigned int>("numberEventsInLuminosityBlock")->setComment("Number of events to generate in each lumi."); desc.addUntracked<unsigned long long>("firstTime", 1)->setComment("Time before first event (ns) (for timestamp)."); desc.addUntracked<unsigned long long>("timeBetweenEvents", kNanoSecPerSec/kAveEventPerSec)->setComment("Time between consecutive events (ns) (for timestamp)."); desc.addUntracked<unsigned int>("eventCreationDelay", 0)->setComment("Real time delay between generation of consecutive events (ms)."); desc.addUntracked<unsigned int>("firstEvent", 1)->setComment("Event number of first event to generate."); desc.addUntracked<unsigned int>("firstLuminosityBlock", 1)->setComment("Luminosity block number of first lumi to generate."); desc.addUntracked<unsigned int>("firstRun", 1)->setComment("Run number of first run to generate."); InputSource::fillDescription(desc); }
InputSource::ItemType edm::ProducerSourceBase::getNextItemType | ( | ) | [override, private, virtual] |
Implements edm::InputSource.
Definition at line 130 of file ProducerSourceBase.cc.
References advanceToNext(), edm::InputSource::eventCached(), eventCreationDelay_, eventID_, fileIndex(), getHLTprescales::index, edm::InputSource::IsEvent, edm::InputSource::IsFile, edm::InputSource::IsInvalid, edm::InputSource::IsLumi, edm::InputSource::IsRun, edm::InputSource::IsStop, edm::EventID::luminosityBlock(), edm::InputSource::newLumi(), edm::InputSource::newRun(), noFiles(), presentTime_, edm::InputSource::processingMode(), edm::EventID::run(), edm::InputSource::Runs, edm::InputSource::RunsAndLumis, edm::InputSource::setEventCached(), edm::InputSource::setNewLumi(), edm::InputSource::setNewRun(), setRunAndEventInfo(), and edm::InputSource::state().
{ if(state() == IsInvalid) { return noFiles() ? IsStop : IsFile; } if (newRun()) { return IsRun; } if (newLumi()) { return IsLumi; } if(eventCached()) { return IsEvent; } EventID oldEventID = eventID_; advanceToNext(eventID_, presentTime_); if (eventCreationDelay_ > 0) {usleep(eventCreationDelay_);} size_t index = fileIndex(); bool another = setRunAndEventInfo(eventID_, presentTime_); if(!another) { return IsStop; } bool newFile = (fileIndex() > index); setEventCached(); if(eventID_.run() != oldEventID.run()) { // New Run setNewRun(); setNewLumi(); return newFile ? IsFile : IsRun; } if (processingMode() == Runs) { return newFile ? IsFile : IsRun; } if (processingMode() == RunsAndLumis) { return newFile ? IsFile : IsLumi; } // Same Run if (eventID_.luminosityBlock() != oldEventID.luminosityBlock()) { // New Lumi setNewLumi(); return newFile ? IsFile : IsLumi; } return newFile ? IsFile : IsEvent; }
void edm::ProducerSourceBase::initialize | ( | EventID & | id, |
TimeValue_t & | time, | ||
TimeValue_t & | interval | ||
) | [private, virtual] |
Reimplemented in cond::EmptyIOVSource.
Definition at line 116 of file ProducerSourceBase.cc.
Referenced by beginJob().
{ }
LuminosityBlockNumber_t edm::ProducerSourceBase::luminosityBlock | ( | ) | const [inline] |
Accessor for current luminosity block number.
Reimplemented from edm::InputSource.
Definition at line 33 of file ProducerSourceBase.h.
References eventID_, and edm::EventID::luminosityBlock().
Referenced by cond::EmptyIOVSource::initialize(), L1MuGMTHWFileReader::setRunAndEventInfo(), PixelSLinkDataInputSource::setRunAndEventInfo(), and cond::EmptyIOVSource::setRunAndEventInfo().
{return eventID_.luminosityBlock();}
bool edm::ProducerSourceBase::noFiles | ( | ) | const [private, virtual] |
Reimplemented in edm::ProducerSourceFromFiles.
Definition at line 220 of file ProducerSourceBase.cc.
Referenced by getNextItemType().
{ return false; }
unsigned int edm::ProducerSourceBase::numberEventsInLumi | ( | ) | const [inline] |
Definition at line 25 of file ProducerSourceBase.h.
References numberEventsInLumi_.
{return numberEventsInLumi_;}
unsigned int edm::ProducerSourceBase::numberEventsInRun | ( | ) | const [inline] |
Definition at line 24 of file ProducerSourceBase.h.
References numberEventsInRun_.
{return numberEventsInRun_;}
unsigned int edm::ProducerSourceBase::numberEventsInThisLumi | ( | ) | const [inline] |
Definition at line 30 of file ProducerSourceBase.h.
References numberEventsInThisLumi_.
{return numberEventsInThisLumi_;}
unsigned int edm::ProducerSourceBase::numberEventsInThisRun | ( | ) | const [inline] |
Definition at line 29 of file ProducerSourceBase.h.
References numberEventsInThisRun_.
{return numberEventsInThisRun_;}
TimeValue_t edm::ProducerSourceBase::presentTime | ( | ) | const [inline] |
Definition at line 26 of file ProducerSourceBase.h.
References presentTime_.
Referenced by L1MuGMTHWFileReader::setRunAndEventInfo().
{return presentTime_;}
virtual void edm::ProducerSourceBase::produce | ( | Event & | e | ) | [private, pure virtual] |
Implemented in LmfSource, cond::EmptyIOVSource, ErrorStreamSource, edm::EmptySource, AlpgenSource, LHESource, MCatNLOSource, edm::MCFileSource, HcalTBSource, PixelSLinkDataInputSource, and L1MuGMTHWFileReader.
Referenced by readEvent_().
EventPrincipal * edm::ProducerSourceBase::readEvent_ | ( | EventPrincipal & | eventPrincipal | ) | [override, private, virtual] |
Implements edm::InputSource.
Definition at line 60 of file ProducerSourceBase.cc.
References printConversionInfo::aux, edm::Event::commit_(), alignCSCRings::e, eType_, edm::InputSource::eventCached(), eventID_, edm::EventPrincipal::fillEventPrincipal(), isRealData_, edm::InputSource::moduleDescription(), presentTime_, edm::InputSource::processGUID(), edm::InputSource::processingMode(), produce(), edm::InputSource::resetEventCached(), and edm::InputSource::RunsLumisAndEvents.
{ assert(eventCached() || processingMode() != RunsLumisAndEvents); EventSourceSentry sentry(*this); EventAuxiliary aux(eventID_, processGUID(), Timestamp(presentTime_), isRealData_, eType_); eventPrincipal.fillEventPrincipal(aux); Event e(eventPrincipal, moduleDescription()); produce(e); e.commit_(); resetEventCached(); return &eventPrincipal; }
boost::shared_ptr< LuminosityBlockAuxiliary > edm::ProducerSourceBase::readLuminosityBlockAuxiliary_ | ( | ) | [override, private, virtual] |
Implements edm::InputSource.
Definition at line 52 of file ProducerSourceBase.cc.
References eventID_, edm::Timestamp::invalidTimestamp(), edm::EventID::luminosityBlock(), presentTime_, edm::InputSource::processingMode(), edm::InputSource::resetNewLumi(), edm::EventID::run(), and edm::InputSource::Runs.
{ if (processingMode() == Runs) return boost::shared_ptr<LuminosityBlockAuxiliary>(); Timestamp ts = Timestamp(presentTime_); resetNewLumi(); return boost::shared_ptr<LuminosityBlockAuxiliary>(new LuminosityBlockAuxiliary(eventID_.run(), eventID_.luminosityBlock(), ts, Timestamp::invalidTimestamp())); }
boost::shared_ptr< RunAuxiliary > edm::ProducerSourceBase::readRunAuxiliary_ | ( | ) | [override, private, virtual] |
Implements edm::InputSource.
Definition at line 45 of file ProducerSourceBase.cc.
References eventID_, edm::Timestamp::invalidTimestamp(), presentTime_, edm::InputSource::resetNewRun(), and edm::EventID::run().
{ Timestamp ts = Timestamp(presentTime_); resetNewRun(); return boost::shared_ptr<RunAuxiliary>(new RunAuxiliary(eventID_.run(), ts, Timestamp::invalidTimestamp())); }
void edm::ProducerSourceBase::retreatToPrevious | ( | EventID & | eventID, |
TimeValue_t & | time | ||
) | [private] |
Definition at line 197 of file ProducerSourceBase.cc.
References edm::EventID::luminosityBlock(), numberEventsInLumi_, numberEventsInRun_, numberEventsInThisLumi_, numberEventsInThisRun_, origEventID_, edm::EventID::previous(), edm::EventID::previousRunLastEvent(), edm::EventID::run(), and timeBetweenEvents_.
Referenced by skip().
{ if (numberEventsInRun_ < 1 || numberEventsInThisRun_ > 0) { // same run --numberEventsInThisRun_; eventID = eventID.previous(eventID.luminosityBlock()); if (!(numberEventsInLumi_ < 1 || numberEventsInThisLumi_ > 0)) { // new lumi eventID = eventID.previous(eventID.luminosityBlock() - 1); numberEventsInThisLumi_ = numberEventsInLumi_; } else { --numberEventsInThisLumi_; } } else { // new run eventID = eventID.previousRunLastEvent(origEventID_.luminosityBlock() + numberEventsInRun_/numberEventsInLumi_); eventID = EventID(numberEventsInRun_, eventID.luminosityBlock(), eventID.run()); numberEventsInThisLumi_ = numberEventsInLumi_; numberEventsInThisRun_ = numberEventsInRun_; } time -= timeBetweenEvents_; }
void edm::ProducerSourceBase::rewind_ | ( | ) | [override, private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 120 of file ProducerSourceBase.cc.
References eventID_, numberEventsInThisLumi_, numberEventsInThisRun_, origEventID_, origTime_, presentTime_, edm::InputSource::setNewLumi(), and edm::InputSource::setNewRun().
{ presentTime_ = origTime_; eventID_ = origEventID_; numberEventsInThisRun_ = 0; numberEventsInThisLumi_ = 0; setNewRun(); setNewLumi(); }
RunNumber_t edm::ProducerSourceBase::run | ( | void | ) | const [inline] |
Accessor for current run number.
Reimplemented from edm::InputSource.
Definition at line 31 of file ProducerSourceBase.h.
References eventID_, and edm::EventID::run().
Referenced by PixelSLinkDataInputSource::setRunAndEventInfo().
{return eventID_.run();}
virtual bool edm::ProducerSourceBase::setRunAndEventInfo | ( | EventID & | id, |
TimeValue_t & | time | ||
) | [private, pure virtual] |
Implemented in LmfSource, cond::EmptyIOVSource, ErrorStreamSource, edm::EmptySource, AlpgenSource, LHESource, MCatNLOSource, edm::MCFileSource, HcalTBSource, PixelSLinkDataInputSource, and L1MuGMTHWFileReader.
Referenced by getNextItemType().
void edm::ProducerSourceBase::skip | ( | int | offset | ) | [override, private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 73 of file ProducerSourceBase.cc.
References advanceToNext(), eventID_, edm::EventID::luminosityBlock(), evf::evtn::offset(), presentTime_, retreatToPrevious(), edm::EventID::run(), edm::InputSource::setNewLumi(), and edm::InputSource::setNewRun().
{ EventID oldEventID = eventID_; for(; offset < 0; ++offset) { retreatToPrevious(eventID_, presentTime_); } for(; offset > 0; --offset) { advanceToNext(eventID_, presentTime_); } if(eventID_.run() != oldEventID.run()) { // New Run setNewRun(); setNewLumi(); } if (eventID_.luminosityBlock() != oldEventID.luminosityBlock()) { // New Lumi setNewLumi(); } }
unsigned int edm::ProducerSourceBase::timeBetweenEvents | ( | ) | const [inline] |
Definition at line 27 of file ProducerSourceBase.h.
References timeBetweenEvents_.
Referenced by L1MuGMTHWFileReader::setRunAndEventInfo().
{return timeBetweenEvents_;}
Definition at line 73 of file ProducerSourceBase.h.
Referenced by readEvent_().
unsigned int edm::ProducerSourceBase::eventCreationDelay_ [private] |
Definition at line 65 of file ProducerSourceBase.h.
Referenced by eventCreationDelay(), and getNextItemType().
EventID edm::ProducerSourceBase::eventID_ [private] |
Definition at line 70 of file ProducerSourceBase.h.
Referenced by beginJob(), event(), getNextItemType(), luminosityBlock(), readEvent_(), readLuminosityBlockAuxiliary_(), readRunAuxiliary_(), rewind_(), run(), and skip().
bool edm::ProducerSourceBase::isRealData_ [private] |
Definition at line 72 of file ProducerSourceBase.h.
Referenced by readEvent_().
unsigned int edm::ProducerSourceBase::numberEventsInLumi_ [private] |
Definition at line 61 of file ProducerSourceBase.h.
Referenced by advanceToNext(), numberEventsInLumi(), and retreatToPrevious().
unsigned int edm::ProducerSourceBase::numberEventsInRun_ [private] |
Definition at line 60 of file ProducerSourceBase.h.
Referenced by advanceToNext(), numberEventsInRun(), and retreatToPrevious().
unsigned int edm::ProducerSourceBase::numberEventsInThisLumi_ [private] |
Definition at line 68 of file ProducerSourceBase.h.
Referenced by advanceToNext(), numberEventsInThisLumi(), retreatToPrevious(), and rewind_().
unsigned int edm::ProducerSourceBase::numberEventsInThisRun_ [private] |
Definition at line 67 of file ProducerSourceBase.h.
Referenced by advanceToNext(), numberEventsInThisRun(), retreatToPrevious(), and rewind_().
EventID edm::ProducerSourceBase::origEventID_ [private] |
Definition at line 71 of file ProducerSourceBase.h.
Referenced by advanceToNext(), retreatToPrevious(), and rewind_().
Definition at line 63 of file ProducerSourceBase.h.
Referenced by rewind_().
Definition at line 62 of file ProducerSourceBase.h.
Referenced by beginJob(), getNextItemType(), presentTime(), ProducerSourceBase(), readEvent_(), readLuminosityBlockAuxiliary_(), readRunAuxiliary_(), rewind_(), and skip().
Definition at line 64 of file ProducerSourceBase.h.
Referenced by advanceToNext(), beginJob(), retreatToPrevious(), and timeBetweenEvents().
unsigned int const edm::ProducerSourceBase::zerothEvent_ [private] |
Definition at line 69 of file ProducerSourceBase.h.