![]() |
![]() |
#include <FWCore/Framework/interface/InputSource.h>
Public Types | |
enum | ItemType { IsInvalid, IsStop, IsFile, IsRun, IsLumi, IsEvent, IsRepeat } |
enum | ProcessingMode { Runs, RunsAndLumis, RunsLumisAndEvents } |
typedef ProductRegistryHelper::TypeLabelList | TypeLabelList |
Public Member Functions | |
boost::shared_ptr < ActivityRegistry > | actReg () const |
Accessor for Activity Registry. | |
void | closeFile () |
close current file | |
void | doBeginJob (EventSetup const &) |
Called by framework at beginning of job. | |
void | doEndJob () |
Called by framework at end of job. | |
void | doEndLumi (LuminosityBlockPrincipal &lbp) |
Called by framework when events are exhausted. | |
void | doEndRun (RunPrincipal &rp) |
InputSource (ParameterSet const &, InputSourceDescription const &) | |
Constructor. | |
void | issueReports (EventID const &eventID, LuminosityBlockNumber_t const &lumi) |
issue an event report | |
LuminosityBlockNumber_t | luminosityBlock () const |
Accessor for current luminosity block number. | |
int | maxEvents () const |
Accessor for maximum number of events to be read. | |
int | maxLuminosityBlocks () const |
Accessor for maximum number of lumis to be read. | |
ModuleDescription const & | moduleDescription () const |
Accessor for 'module' description. | |
ItemType | nextItemType () |
bool const | primary () const |
Accessor for primary input source flag. | |
ProcessConfiguration const & | processConfiguration () const |
Accessor for Process Configuration. | |
std::string const & | processGUID () const |
Accessor for global process identifier. | |
ProcessingMode | processingMode () const |
RunsLumisAndEvents (default), RunsAndLumis, or Runs. | |
boost::shared_ptr < ProductRegistry const > | productRegistry () const |
Accessor for product registry. | |
std::auto_ptr< EventPrincipal > | readEvent (EventID const &) |
Read a specific event. | |
std::auto_ptr< EventPrincipal > | readEvent (boost::shared_ptr< LuminosityBlockPrincipal > lbp) |
Read next event Indicate inability to get a new event by returning a null auto_ptr. | |
boost::shared_ptr< FileBlock > | readFile () |
Read next file. | |
boost::shared_ptr < LuminosityBlockPrincipal > | readLuminosityBlock (boost::shared_ptr< RunPrincipal > rp) |
Read next luminosity block. | |
boost::shared_ptr< RunPrincipal > | readRun () |
Read next run. | |
void | registerProducts () |
Register any produced products. | |
int | remainingEvents () const |
Accessor for remaining number of events to be read. | |
int | remainingLuminosityBlocks () const |
Accessor for remaining number of lumis to be read. | |
void | repeat () |
Reset the remaining number of events/lumis to the maximum number. | |
void | rewind () |
Begin again at the first event. | |
RunNumber_t | run () const |
Accessor for current run number. | |
void | setLuminosityBlockNumber_t (LuminosityBlockNumber_t lb) |
Set the luminosity block ID. | |
void | setRunNumber (RunNumber_t r) |
Set the run number. | |
void | skipEvents (int offset) |
Skip the number of events specified. | |
Timestamp const & | timestamp () const |
Accessor for the current time, as seen by the input source. | |
void | wakeUp () |
Wake up the input source. | |
virtual | ~InputSource () |
Destructor. | |
Protected Member Functions | |
boost::shared_ptr < LuminosityBlockPrincipal > | luminosityBlockPrincipal () const |
ProductRegistry & | productRegistryUpdate () const |
void | reset () const |
void | resetLuminosityBlockPrincipal () |
void | resetRunPrincipal () |
boost::shared_ptr< RunPrincipal > | runPrincipal () const |
void | setLuminosityBlockPrincipal (boost::shared_ptr< LuminosityBlockPrincipal > lbp) |
void | setRunPrincipal (boost::shared_ptr< RunPrincipal > rp) |
void | setTimestamp (Timestamp const &theTime) |
To set the current time, as seen by the input source. | |
ItemType | state () const |
Private Member Functions | |
virtual void | beginJob (EventSetup const &) |
virtual void | closeFile_ () |
virtual void | endJob () |
virtual void | endLuminosityBlock (LuminosityBlock &) |
virtual void | endRun (Run &) |
bool | eventLimitReached () const |
virtual ItemType | getNextItemType ()=0 |
bool | limitReached () const |
bool | lumiLimitReached () const |
ItemType | nextItemType_ () |
void | postRead (Event &event) |
void | preRead () |
virtual std::auto_ptr < EventPrincipal > | readEvent_ ()=0 |
virtual boost::shared_ptr < FileBlock > | readFile_ () |
virtual std::auto_ptr < EventPrincipal > | readIt (EventID const &) |
virtual boost::shared_ptr < LuminosityBlockPrincipal > | readLuminosityBlock_ ()=0 |
virtual boost::shared_ptr < RunPrincipal > | readRun_ ()=0 |
virtual void | rewind_ () |
virtual void | setLumi (LuminosityBlockNumber_t lb) |
virtual void | setRun (RunNumber_t r) |
virtual void | skip (int) |
virtual void | wakeUp_ () |
Private Attributes | |
boost::shared_ptr < ActivityRegistry > | actReg_ |
bool | doneReadAhead_ |
boost::shared_ptr < LuminosityBlockPrincipal > | lumiPrincipal_ |
int | maxEvents_ |
int | maxLumis_ |
ModuleDescription const | moduleDescription_ |
bool const | primary_ |
std::string | processGUID_ |
ProcessingMode | processingMode_ |
boost::shared_ptr < ProductRegistry const > | productRegistry_ |
int | readCount_ |
int | remainingEvents_ |
int | remainingLumis_ |
boost::shared_ptr< RunPrincipal > | runPrincipal_ |
ItemType | state_ |
Timestamp | time_ |
Classes | |
class | EventSourceSentry |
class | FileCloseSentry |
class | FileOpenSentry |
class | LumiSourceSentry |
class | RunSourceSentry |
class | SourceSentry |
Definition at line 63 of file InputSource.h.
Definition at line 75 of file InputSource.h.
00075 { 00076 Runs, 00077 RunsAndLumis, 00078 RunsLumisAndEvents 00079 };
edm::InputSource::InputSource | ( | ParameterSet const & | pset, | |
InputSourceDescription const & | desc | |||
) | [explicit] |
Constructor.
Definition at line 48 of file InputSource.cc.
References edm::errors::Configuration, edm::ParameterSet::getUntrackedParameter(), edm::improbable, primary_, processingMode(), processingMode_, edm::InputSourceDescription::productRegistry_, Runs, and RunsAndLumis.
00048 : 00049 ProductRegistryHelper(), 00050 actReg_(desc.actReg_), 00051 maxEvents_(desc.maxEvents_), 00052 remainingEvents_(maxEvents_), 00053 maxLumis_(desc.maxLumis_), 00054 remainingLumis_(maxLumis_), 00055 readCount_(0), 00056 processingMode_(RunsLumisAndEvents), 00057 moduleDescription_(desc.moduleDescription_), 00058 productRegistry_(createSharedPtrToStatic<ProductRegistry const>(desc.productRegistry_)), 00059 primary_(pset.getParameter<std::string>("@module_label") == std::string("@main_input")), 00060 processGUID_(primary_ ? createGlobalIdentifier() : std::string()), 00061 time_(), 00062 doneReadAhead_(false), 00063 state_(IsInvalid), 00064 runPrincipal_(), 00065 lumiPrincipal_() { 00066 // Secondary input sources currently do not have a product registry. 00067 if (primary_) { 00068 assert(desc.productRegistry_ != 0); 00069 } 00070 int maxEventsOldStyle = pset.getUntrackedParameter<int>("maxEvents", improbable); 00071 if (maxEventsOldStyle != improbable) { 00072 throw edm::Exception(edm::errors::Configuration) 00073 << "InputSource::InputSource()\n" 00074 << "The 'maxEvents' parameter for sources is no longer supported.\n" 00075 << "Please use instead the process level parameter set\n" 00076 << "'untracked PSet maxEvents = {untracked int32 input = " << maxEventsOldStyle << "}'\n"; 00077 } 00078 std::string const defaultMode("RunsLumisAndEvents"); 00079 std::string const runMode("Runs"); 00080 std::string const runLumiMode("RunsAndLumis"); 00081 std::string processingMode = pset.getUntrackedParameter<std::string>("processingMode", defaultMode); 00082 if (processingMode == runMode) { 00083 processingMode_ = Runs; 00084 } else if (processingMode == runLumiMode) { 00085 processingMode_ = RunsAndLumis; 00086 } else if (processingMode != defaultMode) { 00087 throw edm::Exception(edm::errors::Configuration) 00088 << "InputSource::InputSource()\n" 00089 << "The 'processingMode' parameter for sources has an illegal value '" << processingMode << "'\n" 00090 << "Legal values are '" << defaultMode << "', '" << runLumiMode << "', or '" << runMode << "'.\n"; 00091 } 00092 }
edm::InputSource::~InputSource | ( | ) | [virtual] |
boost::shared_ptr<ActivityRegistry> edm::InputSource::actReg | ( | ) | const [inline] |
Accessor for Activity Registry.
Definition at line 196 of file InputSource.h.
References actReg_.
00196 {return actReg_;}
void edm::InputSource::beginJob | ( | EventSetup const & | ) | [private, virtual] |
Reimplemented in edm::BaseFlatGunSource, HcalPatternSource, and EcalSimpleSource.
Definition at line 386 of file InputSource.cc.
Referenced by doBeginJob().
void edm::InputSource::closeFile | ( | ) |
close current file
Definition at line 197 of file InputSource.cc.
References closeFile_().
00197 { 00198 return closeFile_(); 00199 }
virtual void edm::InputSource::closeFile_ | ( | ) | [inline, private, virtual] |
Reimplemented in edm::PoolSource.
Definition at line 273 of file InputSource.h.
Referenced by closeFile().
void edm::InputSource::doBeginJob | ( | EventSetup const & | c | ) |
Called by framework at beginning of job.
Definition at line 170 of file InputSource.cc.
References beginJob().
void edm::InputSource::doEndJob | ( | ) |
Called by framework at end of job.
Definition at line 175 of file InputSource.cc.
References endJob().
Referenced by edm::PileUp::endJob(), and edm::EventProcessor::endJob().
00175 { 00176 endJob(); 00177 }
void edm::InputSource::doEndLumi | ( | LuminosityBlockPrincipal & | lbp | ) |
Called by framework when events are exhausted.
Definition at line 369 of file InputSource.cc.
References edm::LuminosityBlock::commit_(), endLuminosityBlock(), moduleDescription(), edm::LuminosityBlockPrincipal::setEndTime(), and time_.
00369 { 00370 lbp.setEndTime(time_); 00371 LuminosityBlock lb(lbp, moduleDescription()); 00372 endLuminosityBlock(lb); 00373 lb.commit_(); 00374 }
void edm::InputSource::doEndRun | ( | RunPrincipal & | rp | ) |
Definition at line 361 of file InputSource.cc.
References edm::Run::commit_(), endRun(), moduleDescription(), run(), edm::RunPrincipal::setEndTime(), and time_.
00361 { 00362 rp.setEndTime(time_); 00363 Run run(rp, moduleDescription()); 00364 endRun(run); 00365 run.commit_(); 00366 }
Reimplemented in LHESource, and edm::PoolSource.
Definition at line 389 of file InputSource.cc.
Referenced by doEndJob().
void edm::InputSource::endLuminosityBlock | ( | LuminosityBlock & | ) | [private, virtual] |
Reimplemented in ErrorStreamSource, and edm::ConfigurableInputSource.
Definition at line 380 of file InputSource.cc.
Referenced by doEndLumi().
Reimplemented in ErrorStreamSource, edm::ConfigurableInputSource, edm::ExhumeSource, edm::Herwig6Source, edm::MadGraphSource, edm::MCatNLOSource, edm::PomwigSource, edm::PythiaSource, edm::Pythia8Source, and ThePEGSource.
Definition at line 383 of file InputSource.cc.
Referenced by doEndRun().
bool edm::InputSource::eventLimitReached | ( | ) | const [inline, private] |
Definition at line 263 of file InputSource.h.
References remainingEvents_.
Referenced by limitReached(), nextItemType(), and readEvent().
00263 {return remainingEvents_ == 0;}
virtual ItemType edm::InputSource::getNextItemType | ( | ) | [private, pure virtual] |
Implemented in edm::ConfigurableInputSource, edm::RawInputSource, edm::PoolSource, edm::StreamerInputSource, and edm::DaqSource.
Referenced by nextItemType_().
void edm::InputSource::issueReports | ( | EventID const & | eventID, | |
LuminosityBlockNumber_t const & | lumi | |||
) |
issue an event report
Definition at line 287 of file InputSource.cc.
References edm::EventID::event(), readCount_, edm::EventID::run(), edm::suffix(), and t.
Referenced by readEvent().
00287 { 00288 time_t t = time(0); 00289 char ts[] = "dd-Mon-yyyy hh:mm:ss TZN "; 00290 strftime( ts, strlen(ts)+1, "%d-%b-%Y %H:%M:%S %Z", localtime(&t) ); 00291 LogVerbatim("FwkReport") << "Begin processing the " << readCount_ 00292 << suffix(readCount_) << " record. Run " << eventID.run() 00293 << ", Event " << eventID.event() 00294 << ", LumiSection " << lumi<< " at " << ts; 00295 // At some point we may want to initiate checkpointing here 00296 }
bool edm::InputSource::limitReached | ( | ) | const [inline, private] |
Definition at line 265 of file InputSource.h.
References eventLimitReached(), and lumiLimitReached().
Referenced by readEvent(), readFile(), readLuminosityBlock(), and readRun().
00265 {return eventLimitReached() || lumiLimitReached();}
bool edm::InputSource::lumiLimitReached | ( | ) | const [inline, private] |
Definition at line 264 of file InputSource.h.
References remainingLumis_.
Referenced by limitReached(), and nextItemType().
00264 {return remainingLumis_ == 0;}
LuminosityBlockNumber_t edm::InputSource::luminosityBlock | ( | ) | const |
Accessor for current luminosity block number.
Reimplemented in edm::ConfigurableInputSource.
Definition at line 398 of file InputSource.cc.
References luminosityBlockPrincipal().
Referenced by edm::StreamerInputSource::deserializeEvent().
00398 { 00399 assert(luminosityBlockPrincipal()); 00400 return luminosityBlockPrincipal()->luminosityBlock(); 00401 }
boost::shared_ptr<LuminosityBlockPrincipal> edm::InputSource::luminosityBlockPrincipal | ( | ) | const [inline, protected] |
Definition at line 252 of file InputSource.h.
References lumiPrincipal_.
Referenced by edm::StreamerInputSource::deserializeEvent(), edm::StreamerInputSource::getNextItemType(), luminosityBlock(), and edm::StreamerInputSource::readLuminosityBlock_().
00252 {return lumiPrincipal_;}
int edm::InputSource::maxEvents | ( | ) | const [inline] |
Accessor for maximum number of events to be read.
-1 is used for unlimited.
Definition at line 147 of file InputSource.h.
References maxEvents_.
Referenced by edm::AlpgenSource::AlpgenSource(), edm::H2RootNtplSource::H2RootNtplSource(), edm::Herwig6Source::Herwig6Source(), edm::MadGraphSource::MadGraphSource(), and edm::PomwigSource::PomwigSource().
00147 {return maxEvents_;}
int edm::InputSource::maxLuminosityBlocks | ( | ) | const [inline] |
Accessor for maximum number of lumis to be read.
-1 is used for unlimited.
Definition at line 155 of file InputSource.h.
References maxLumis_.
00155 {return maxLumis_;}
ModuleDescription const& edm::InputSource::moduleDescription | ( | ) | const [inline] |
Accessor for 'module' description.
Definition at line 162 of file InputSource.h.
References moduleDescription_.
Referenced by doEndLumi(), doEndRun(), edm::RawInputSource::makeEvent(), processConfiguration(), readEvent(), edm::ConfigurableInputSource::readLuminosityBlock_(), edm::ConfigurableInputSource::readRun_(), edm::ConfigurableInputSource::reallyReadEvent(), and registerProducts().
00162 {return moduleDescription_;}
InputSource::ItemType edm::InputSource::nextItemType | ( | ) |
Definition at line 119 of file InputSource.cc.
References doneReadAhead_, eventLimitReached(), IsEvent, IsFile, IsInvalid, IsLumi, IsRun, IsStop, lumiLimitReached(), lumiPrincipal_, nextItemType_(), processingMode(), readLuminosityBlock_(), readRun_(), runPrincipal_, Runs, RunsLumisAndEvents, setLuminosityBlockPrincipal(), setRunPrincipal(), and state_.
00119 { 00120 if (doneReadAhead_) { 00121 return state_; 00122 } 00123 doneReadAhead_ = true; 00124 ItemType oldState = state_; 00125 if (eventLimitReached()) { 00126 // If the maximum event limit has been reached, stop. 00127 state_ = IsStop; 00128 } else if (lumiLimitReached()) { 00129 // If the maximum lumi limit has been reached, stop 00130 // when reaching a new file, run, or lumi. 00131 if (oldState == IsInvalid || oldState == IsFile || oldState == IsRun || processingMode() != RunsLumisAndEvents) { 00132 state_ = IsStop; 00133 } else { 00134 ItemType newState = nextItemType_(); 00135 if (newState == IsEvent) { 00136 assert (processingMode() == RunsLumisAndEvents); 00137 state_ = IsEvent; 00138 } else { 00139 state_ = IsStop; 00140 } 00141 } 00142 } else { 00143 ItemType newState = nextItemType_(); 00144 if (newState == IsStop) { 00145 state_ = IsStop; 00146 } else if (newState == IsFile || oldState == IsInvalid) { 00147 state_ = IsFile; 00148 } else if (newState == IsRun || oldState == IsFile) { 00149 RunSourceSentry(*this); 00150 setRunPrincipal(readRun_()); 00151 state_ = IsRun; 00152 } else if (newState == IsLumi || oldState == IsRun) { 00153 assert (processingMode() != Runs); 00154 LumiSourceSentry(*this); 00155 setLuminosityBlockPrincipal(readLuminosityBlock_()); 00156 state_ = IsLumi; 00157 } else { 00158 assert (processingMode() == RunsLumisAndEvents); 00159 state_ = IsEvent; 00160 } 00161 } 00162 if (state_ == IsStop) { 00163 lumiPrincipal_.reset(); 00164 runPrincipal_.reset(); 00165 } 00166 return state_; 00167 }
InputSource::ItemType edm::InputSource::nextItemType_ | ( | ) | [private] |
Definition at line 105 of file InputSource.cc.
References getNextItemType(), IsEvent, IsLumi, processingMode(), readEvent_(), readLuminosityBlock_(), Runs, and RunsLumisAndEvents.
Referenced by nextItemType().
00105 { 00106 ItemType itemType = getNextItemType(); 00107 if (itemType == IsEvent && processingMode() != RunsLumisAndEvents) { 00108 readEvent_(); 00109 return nextItemType_(); 00110 } 00111 if (itemType == IsLumi && processingMode() == Runs) { 00112 readLuminosityBlock_(); 00113 return nextItemType_(); 00114 } 00115 return itemType; 00116 }
Definition at line 350 of file InputSource.cc.
References edm::Service< T >::isAvailable(), and primary().
Referenced by readEvent().
00350 { 00351 00352 if (primary()) { 00353 Service<RandomNumberGenerator> rng; 00354 if (rng.isAvailable()) { 00355 rng->restoreState(event); 00356 } 00357 } 00358 }
void edm::InputSource::preRead | ( | ) | [private] |
Definition at line 339 of file InputSource.cc.
References edm::Service< T >::isAvailable(), and primary().
Referenced by readEvent().
00339 { 00340 00341 if (primary()) { 00342 Service<RandomNumberGenerator> rng; 00343 if (rng.isAvailable()) { 00344 rng->snapShot(); 00345 } 00346 } 00347 }
bool const edm::InputSource::primary | ( | ) | const [inline] |
Accessor for primary input source flag.
Definition at line 168 of file InputSource.h.
References primary_.
Referenced by edm::PoolSource::dropUnwantedBranches_(), edm::PoolSource::PoolSource(), postRead(), preRead(), edm::RootInputFileSequence::primary(), and readFile_().
00168 {return primary_;}
ProcessConfiguration const& edm::InputSource::processConfiguration | ( | ) | const [inline] |
Accessor for Process Configuration.
Definition at line 165 of file InputSource.h.
References moduleDescription(), and edm::ModuleDescription::processConfiguration().
Referenced by edm::StreamerInputSource::deserializeEvent(), edm::RawInputSource::makeEvent(), edm::RootInputFileSequence::processConfiguration(), edm::RawInputSource::readLuminosityBlock_(), edm::ConfigurableInputSource::readLuminosityBlock_(), edm::RawInputSource::readRun_(), edm::ConfigurableInputSource::readRun_(), and edm::ConfigurableInputSource::reallyReadEvent().
00165 {return moduleDescription().processConfiguration();}
std::string const& edm::InputSource::processGUID | ( | ) | const [inline] |
Accessor for global process identifier.
Definition at line 171 of file InputSource.h.
References processGUID_.
Referenced by edm::RawInputSource::makeEvent(), and edm::ConfigurableInputSource::reallyReadEvent().
00171 {return processGUID_;}
ProcessingMode edm::InputSource::processingMode | ( | ) | const [inline] |
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition at line 193 of file InputSource.h.
References processingMode_.
Referenced by edm::ConfigurableInputSource::getNextItemType(), edm::RootInputFileSequence::initFile(), InputSource(), nextItemType(), nextItemType_(), edm::ConfigurableInputSource::readEvent_(), edm::ConfigurableInputSource::readLuminosityBlock_(), and edm::ConfigurableInputSource::reallyReadEvent().
00193 {return processingMode_;}
boost::shared_ptr<ProductRegistry const> edm::InputSource::productRegistry | ( | ) | const [inline] |
Accessor for product registry.
Definition at line 136 of file InputSource.h.
References productRegistry_.
Referenced by edm::StreamerInputSource::deserializeEvent(), edm::RawInputSource::makeEvent(), edm::RootInputFileSequence::productRegistry(), edm::StreamerInputSource::readFile_(), edm::RawInputSource::readLuminosityBlock_(), edm::ConfigurableInputSource::readLuminosityBlock_(), edm::RawInputSource::readRun_(), edm::ConfigurableInputSource::readRun_(), and edm::ConfigurableInputSource::reallyReadEvent().
00136 {return productRegistry_;}
ProductRegistry& edm::InputSource::productRegistryUpdate | ( | ) | const [inline, protected] |
Definition at line 249 of file InputSource.h.
Referenced by edm::StreamerInputSource::deserializeAndMergeWithRegistry(), edm::StreamerInputSource::deserializeEvent(), edm::RootInputFileSequence::productRegistryUpdate(), readFile_(), edm::StreamerInputSource::readFile_(), and registerProducts().
std::auto_ptr< EventPrincipal > edm::InputSource::readEvent | ( | EventID const & | eventID | ) |
Read a specific event.
Definition at line 263 of file InputSource.cc.
References edm::event, issueReports(), limitReached(), moduleDescription(), postRead(), preRead(), readCount_, readIt(), remainingEvents_, and HLT_VtxMuL3::result.
00263 { 00264 00265 std::auto_ptr<EventPrincipal> result(0); 00266 00267 if (!limitReached()) { 00268 preRead(); 00269 result = readIt(eventID); 00270 if (result.get() != 0) { 00271 Event event(*result, moduleDescription()); 00272 postRead(event); 00273 if (remainingEvents_ > 0) --remainingEvents_; 00274 ++readCount_; 00275 issueReports(result->id(), result->luminosityBlock()); 00276 } 00277 } 00278 return result; 00279 }
std::auto_ptr< EventPrincipal > edm::InputSource::readEvent | ( | boost::shared_ptr< LuminosityBlockPrincipal > | lbp | ) |
Read next event Indicate inability to get a new event by returning a null auto_ptr.
Definition at line 240 of file InputSource.cc.
References doneReadAhead_, edm::event, eventLimitReached(), IsEvent, issueReports(), moduleDescription(), postRead(), preRead(), readCount_, readEvent_(), remainingEvents_, HLT_VtxMuL3::result, setTimestamp(), and state_.
00240 { 00241 assert(doneReadAhead_); 00242 assert(state_ == IsEvent); 00243 assert(!eventLimitReached()); 00244 doneReadAhead_ = false; 00245 00246 preRead(); 00247 std::auto_ptr<EventPrincipal> result = readEvent_(); 00248 assert(lbp->run() == result->run()); 00249 assert(lbp->luminosityBlock() == result->luminosityBlock()); 00250 result->setLuminosityBlockPrincipal(lbp); 00251 if (result.get() != 0) { 00252 Event event(*result, moduleDescription()); 00253 postRead(event); 00254 if (remainingEvents_ > 0) --remainingEvents_; 00255 ++readCount_; 00256 setTimestamp(result->time()); 00257 issueReports(result->id(), result->luminosityBlock()); 00258 } 00259 return result; 00260 }
virtual std::auto_ptr<EventPrincipal> edm::InputSource::readEvent_ | ( | ) | [private, pure virtual] |
Implemented in edm::ConfigurableInputSource, edm::RawInputSource, edm::PoolSource, edm::StreamerInputSource, and edm::DaqSource.
Referenced by nextItemType_(), and readEvent().
boost::shared_ptr< FileBlock > edm::InputSource::readFile | ( | ) |
Read next file.
Definition at line 188 of file InputSource.cc.
References doneReadAhead_, IsFile, limitReached(), readFile_(), and state_.
00188 { 00189 assert(doneReadAhead_); 00190 assert(state_ == IsFile); 00191 assert(!limitReached()); 00192 doneReadAhead_ = false; 00193 return readFile_(); 00194 }
boost::shared_ptr< FileBlock > edm::InputSource::readFile_ | ( | ) | [private, virtual] |
Reimplemented in edm::PoolSource, and edm::StreamerInputSource.
Definition at line 205 of file InputSource.cc.
References primary(), productRegistryUpdate(), and edm::ProductRegistry::setProductIDs().
Referenced by readFile().
00205 { 00206 if (primary()) { 00207 productRegistryUpdate().setProductIDs(1U); 00208 } 00209 return boost::shared_ptr<FileBlock>(new FileBlock); 00210 }
std::auto_ptr< EventPrincipal > edm::InputSource::readIt | ( | EventID const & | ) | [private, virtual] |
Reimplemented in edm::RawInputSource, edm::PoolSource, and edm::DaqSource.
Definition at line 299 of file InputSource.cc.
References edm::errors::LogicError.
Referenced by readEvent().
00299 { 00300 throw edm::Exception(edm::errors::LogicError) 00301 << "InputSource::readIt()\n" 00302 << "Random access is not implemented for this type of Input Source\n" 00303 << "Contact a Framework Developer\n"; 00304 }
boost::shared_ptr< LuminosityBlockPrincipal > edm::InputSource::readLuminosityBlock | ( | boost::shared_ptr< RunPrincipal > | rp | ) |
Read next luminosity block.
Definition at line 225 of file InputSource.cc.
References doneReadAhead_, IsLumi, limitReached(), lumiPrincipal_, remainingLumis_, and state_.
00225 { 00226 // Note: For the moment, we do not support saving and restoring the state of the 00227 // random number generator if random numbers are generated during processing of lumi blocks 00228 // (e.g. beginLuminosityBlock(), endLuminosityBlock()) 00229 assert(doneReadAhead_); 00230 assert(state_ == IsLumi); 00231 assert(!limitReached()); 00232 doneReadAhead_ = false; 00233 --remainingLumis_; 00234 assert(lumiPrincipal_->run() == rp->run()); 00235 lumiPrincipal_->setRunPrincipal(rp); 00236 return lumiPrincipal_; 00237 }
virtual boost::shared_ptr<LuminosityBlockPrincipal> edm::InputSource::readLuminosityBlock_ | ( | ) | [private, pure virtual] |
Implemented in edm::ConfigurableInputSource, edm::RawInputSource, edm::PoolSource, edm::StreamerInputSource, and edm::DaqSource.
Referenced by nextItemType(), and nextItemType_().
boost::shared_ptr< RunPrincipal > edm::InputSource::readRun | ( | ) |
Read next run.
Definition at line 213 of file InputSource.cc.
References doneReadAhead_, IsRun, limitReached(), runPrincipal_, and state_.
00213 { 00214 // Note: For the moment, we do not support saving and restoring the state of the 00215 // random number generator if random numbers are generated during processing of runs 00216 // (e.g. beginRun(), endRun()) 00217 assert(doneReadAhead_); 00218 assert(state_ == IsRun); 00219 assert(!limitReached()); 00220 doneReadAhead_ = false; 00221 return runPrincipal_; 00222 }
virtual boost::shared_ptr<RunPrincipal> edm::InputSource::readRun_ | ( | ) | [private, pure virtual] |
Implemented in edm::ConfigurableInputSource, edm::RawInputSource, edm::PoolSource, edm::StreamerInputSource, and edm::DaqSource.
Referenced by nextItemType().
void edm::InputSource::registerProducts | ( | ) |
Register any produced products.
Definition at line 180 of file InputSource.cc.
References edm::ProductRegistryHelper::addToRegistry(), begin, empty, end, moduleDescription(), productRegistryUpdate(), and edm::ProductRegistryHelper::typeLabelList().
00180 { 00181 if (!typeLabelList().empty()) { 00182 addToRegistry(typeLabelList().begin(), typeLabelList().end(), moduleDescription(), productRegistryUpdate()); 00183 } 00184 }
int edm::InputSource::remainingEvents | ( | ) | const [inline] |
Accessor for remaining number of events to be read.
-1 is used for unlimited.
Definition at line 151 of file InputSource.h.
References remainingEvents_.
Referenced by edm::FlatRandomEGunSource::FlatRandomEGunSource(), edm::AlpgenSource::produce(), ThePEGSource::produce(), edm::ToprexSource::produce(), edm::Herwig6Source::produce(), edm::MCatNLOSource::produce(), edm::ExhumeSource::produce(), edm::PythiaMuEnrichSource::produce(), edm::PythiaSource::produce(), edm::Pythia8Source::produce(), edm::ComphepSource::produce(), edm::PomwigSource::produce(), edm::MadGraphSource::produce(), edm::HydjetSource::produce(), edm::PyquenSource::produce(), and edm::RootInputFileSequence::remainingEvents().
00151 {return remainingEvents_;}
int edm::InputSource::remainingLuminosityBlocks | ( | ) | const [inline] |
Accessor for remaining number of lumis to be read.
-1 is used for unlimited.
Definition at line 159 of file InputSource.h.
References remainingLumis_.
Referenced by edm::RootInputFileSequence::remainingLuminosityBlocks().
00159 {return remainingLumis_;}
void edm::InputSource::repeat | ( | ) | [inline] |
Reset the remaining number of events/lumis to the maximum number.
Definition at line 139 of file InputSource.h.
References doneReadAhead_, maxEvents_, maxLumis_, remainingEvents_, and remainingLumis_.
00139 { 00140 remainingEvents_ = maxEvents_; 00141 remainingLumis_ = maxLumis_; 00142 doneReadAhead_ = false; 00143 }
Definition at line 257 of file InputSource.h.
References doneReadAhead_, IsInvalid, and state_.
Referenced by edm::StreamerInputSource::resetAfterEndRun().
00257 { 00258 doneReadAhead_ = false; 00259 state_ = IsInvalid; 00260 }
void edm::InputSource::resetLuminosityBlockPrincipal | ( | ) | [inline, protected] |
Definition at line 256 of file InputSource.h.
References lumiPrincipal_.
Referenced by edm::StreamerInputSource::deserializeEvent(), edm::StreamerInputSource::getNextItemType(), edm::RawInputSource::getNextItemType(), edm::ConfigurableInputSource::getNextItemType(), edm::ConfigurableInputSource::rewind_(), edm::ConfigurableInputSource::setLumi(), edm::ConfigurableInputSource::setRun(), and edm::OnlineHttpReader::setRun().
00256 {lumiPrincipal_.reset();}
void edm::InputSource::resetRunPrincipal | ( | ) | [inline, protected] |
Definition at line 255 of file InputSource.h.
References runPrincipal_.
Referenced by edm::StreamerInputSource::getNextItemType(), edm::RawInputSource::getNextItemType(), edm::ConfigurableInputSource::getNextItemType(), edm::ConfigurableInputSource::rewind_(), edm::ConfigurableInputSource::setRun(), and edm::OnlineHttpReader::setRun().
00255 {runPrincipal_.reset();}
void edm::InputSource::rewind | ( | ) | [inline] |
Begin again at the first event.
Definition at line 114 of file InputSource.h.
References doneReadAhead_, IsInvalid, rewind_(), and state_.
00114 { 00115 doneReadAhead_ = false; 00116 state_ = IsInvalid; 00117 rewind_(); 00118 }
void edm::InputSource::rewind_ | ( | ) | [private, virtual] |
Reimplemented in edm::ConfigurableInputSource, and edm::PoolSource.
Definition at line 331 of file InputSource.cc.
References edm::errors::LogicError.
Referenced by rewind().
00331 { 00332 throw edm::Exception(edm::errors::LogicError) 00333 << "InputSource::rewind()\n" 00334 << "Rewind is not implemented for this type of Input Source\n" 00335 << "Contact a Framework Developer\n"; 00336 }
RunNumber_t edm::InputSource::run | ( | void | ) | const |
Accessor for current run number.
Reimplemented in edm::ConfigurableInputSource.
Definition at line 392 of file InputSource.cc.
References runPrincipal().
Referenced by edm::StreamerInputSource::deserializeEvent(), and doEndRun().
00392 { 00393 assert(runPrincipal()); 00394 return runPrincipal()->run(); 00395 }
boost::shared_ptr<RunPrincipal> edm::InputSource::runPrincipal | ( | ) | const [inline, protected] |
Definition at line 251 of file InputSource.h.
References runPrincipal_.
Referenced by edm::StreamerInputSource::deserializeEvent(), edm::StreamerInputSource::getNextItemType(), edm::ConfigurableInputSource::readLuminosityBlock_(), edm::StreamerInputSource::readRun_(), edm::ConfigurableInputSource::readRun_(), run(), and edm::RootInputFileSequence::runPrincipal().
00251 {return runPrincipal_;}
void edm::InputSource::setLumi | ( | LuminosityBlockNumber_t | lb | ) | [private, virtual] |
Reimplemented in edm::ConfigurableInputSource, edm::EDInputSource, and edm::DaqSource.
Definition at line 315 of file InputSource.cc.
References edm::errors::LogicError.
Referenced by setLuminosityBlockNumber_t().
00315 { 00316 throw edm::Exception(edm::errors::LogicError) 00317 << "InputSource::setLumi()\n" 00318 << "Luminosity Block ID cannot be modified for this type of Input Source\n" 00319 << "Contact a Framework Developer\n"; 00320 }
void edm::InputSource::setLuminosityBlockNumber_t | ( | LuminosityBlockNumber_t | lb | ) | [inline] |
Set the luminosity block ID.
Definition at line 127 of file InputSource.h.
References setLumi().
00127 {setLumi(lb);}
void edm::InputSource::setLuminosityBlockPrincipal | ( | boost::shared_ptr< LuminosityBlockPrincipal > | lbp | ) | [inline, protected] |
Definition at line 254 of file InputSource.h.
References lumiPrincipal_.
Referenced by edm::StreamerInputSource::deserializeEvent(), and nextItemType().
00254 {lumiPrincipal_ = lbp;}
void edm::InputSource::setRun | ( | RunNumber_t | r | ) | [private, virtual] |
Reimplemented in edm::OnlineHttpReader, edm::ConfigurableInputSource, edm::EDInputSource, edm::StreamerInputSource, and edm::DaqSource.
Definition at line 307 of file InputSource.cc.
References edm::errors::LogicError.
Referenced by setRunNumber().
00307 { 00308 throw edm::Exception(edm::errors::LogicError) 00309 << "InputSource::setRun()\n" 00310 << "Run number cannot be modified for this type of Input Source\n" 00311 << "Contact a Framework Developer\n"; 00312 }
void edm::InputSource::setRunNumber | ( | RunNumber_t | r | ) | [inline] |
Set the run number.
Definition at line 124 of file InputSource.h.
References setRun().
Referenced by PixelSLinkDataInputSource::PixelSLinkDataInputSource(), HcalTBSource::setRunAndEventInfo(), L1MuGMTHWFileReader::setRunAndEventInfo(), ErrorStreamSource::setRunAndEventInfo(), TBRUInputSource::setRunAndEventInfo(), RPCFileReader::setRunAndEventInfo(), LinkDataXMLReader::setRunAndEventInfo(), DAQEcalTBInputService::setRunAndEventInfo(), and Ecal2004TBSource::setRunAndEventInfo().
void edm::InputSource::setRunPrincipal | ( | boost::shared_ptr< RunPrincipal > | rp | ) | [inline, protected] |
Definition at line 253 of file InputSource.h.
References runPrincipal_.
Referenced by edm::StreamerInputSource::deserializeEvent(), and nextItemType().
00253 {runPrincipal_ = rp;}
To set the current time, as seen by the input source.
Definition at line 247 of file InputSource.h.
References time_.
Referenced by edm::ConfigurableInputSource::ConfigurableInputSource(), edm::DaqSource::DaqSource(), edm::RawInputSource::RawInputSource(), and readEvent().
00247 {time_ = theTime;}
Reimplemented in edm::ConfigurableInputSource, edm::RawInputSource, edm::PoolSource, and edm::DaqSource.
Definition at line 323 of file InputSource.cc.
References edm::errors::LogicError.
Referenced by skipEvents().
00323 { 00324 throw edm::Exception(edm::errors::LogicError) 00325 << "InputSource::skip()\n" 00326 << "Random access is not implemented for this type of Input Source\n" 00327 << "Contact a Framework Developer\n"; 00328 }
Skip the number of events specified.
Offset may be negative.
Definition at line 282 of file InputSource.cc.
References skip().
ItemType edm::InputSource::state | ( | ) | const [inline, protected] |
Definition at line 250 of file InputSource.h.
References state_.
Referenced by edm::RawInputSource::getNextItemType().
00250 {return state_;}
Timestamp const& edm::InputSource::timestamp | ( | ) | const [inline] |
Accessor for the current time, as seen by the input source.
Definition at line 184 of file InputSource.h.
References time_.
Referenced by edm::RawInputSource::readLuminosityBlock_(), and edm::RawInputSource::readRun_().
00184 {return time_;}
void edm::InputSource::wakeUp | ( | ) | [inline] |
Wake up the input source.
Definition at line 121 of file InputSource.h.
References wakeUp_().
00121 {wakeUp_();}
void edm::InputSource::wakeUp_ | ( | ) | [private, virtual] |
boost::shared_ptr<ActivityRegistry> edm::InputSource::actReg_ [private] |
bool edm::InputSource::doneReadAhead_ [mutable, private] |
Definition at line 300 of file InputSource.h.
Referenced by nextItemType(), readEvent(), readFile(), readLuminosityBlock(), readRun(), repeat(), reset(), and rewind().
boost::shared_ptr<LuminosityBlockPrincipal> edm::InputSource::lumiPrincipal_ [mutable, private] |
Definition at line 303 of file InputSource.h.
Referenced by luminosityBlockPrincipal(), nextItemType(), readLuminosityBlock(), resetLuminosityBlockPrincipal(), and setLuminosityBlockPrincipal().
int edm::InputSource::maxEvents_ [private] |
int edm::InputSource::maxLumis_ [private] |
ModuleDescription const edm::InputSource::moduleDescription_ [private] |
bool const edm::InputSource::primary_ [private] |
std::string edm::InputSource::processGUID_ [private] |
boost::shared_ptr<ProductRegistry const> edm::InputSource::productRegistry_ [private] |
int edm::InputSource::readCount_ [private] |
int edm::InputSource::remainingEvents_ [private] |
Definition at line 290 of file InputSource.h.
Referenced by eventLimitReached(), readEvent(), remainingEvents(), and repeat().
int edm::InputSource::remainingLumis_ [private] |
Definition at line 292 of file InputSource.h.
Referenced by lumiLimitReached(), readLuminosityBlock(), remainingLuminosityBlocks(), and repeat().
boost::shared_ptr<RunPrincipal> edm::InputSource::runPrincipal_ [mutable, private] |
Definition at line 302 of file InputSource.h.
Referenced by nextItemType(), readRun(), resetRunPrincipal(), runPrincipal(), and setRunPrincipal().
ItemType edm::InputSource::state_ [mutable, private] |
Definition at line 301 of file InputSource.h.
Referenced by nextItemType(), readEvent(), readFile(), readLuminosityBlock(), readRun(), reset(), rewind(), and state().
Timestamp edm::InputSource::time_ [private] |
Definition at line 299 of file InputSource.h.
Referenced by doEndLumi(), doEndRun(), setTimestamp(), and timestamp().