CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

edm::InputSource Class Reference

#include <InputSource.h>

Inheritance diagram for edm::InputSource:
edm::ProductRegistryHelper DQMRootSource edm::ConfigurableInputSource edm::DaqSource edm::EDInputSource edm::RawInputSource edm::StreamerInputSource cond::EmptyIOVSource edm::ExternalInputSource edm::GeneratedInputSource LmfSource edm::VectorInputSource edm::DQMHttpSource edm::EventStreamHttpReader edm::StreamerFileReader edm::StreamerInputModule< Producer >

List of all members.

Classes

class  EventSourceSentry
class  FileCloseSentry
class  FileOpenSentry
class  LumiSourceSentry
class  RunSourceSentry
class  SourceSentry

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 (boost::shared_ptr< FileBlock >, bool cleaningUpAfterException)
 close current file
void doBeginJob ()
 Called by framework at beginning of job.
void doBeginLumi (LuminosityBlockPrincipal &lbp)
 Called by framework at beginning of lumi block.
void doBeginRun (RunPrincipal &rp)
 Called by framework at beginning of run.
void doEndJob ()
 Called by framework at end of job.
void doEndLumi (LuminosityBlockPrincipal &lbp, bool cleaningUpAfterException)
 Called by framework at end of lumi block.
void doEndRun (RunPrincipal &rp, bool cleaningUpAfterException)
 Called by framework at end of run.
void doPostForkReacquireResources (boost::shared_ptr< multicore::MessageReceiverForSource >)
void doPreForkReleaseResources ()
 Called by the framework before forking the process.
ProcessingController::ForwardState forwardState () const
bool goToEvent (EventID const &eventID)
 InputSource (ParameterSet const &, InputSourceDescription const &)
 Constructor.
void issueReports (EventID const &eventID)
 issue an event report
LuminosityBlockNumber_t luminosityBlock () const
 Accessor for current luminosity block number.
boost::shared_ptr
< LuminosityBlockAuxiliary
luminosityBlockAuxiliary () const
 Called by the framework to merge or insert lumi in principal cache.
int markLumi ()
 Mark lumi as read.
int markRun ()
 Mark run as read.
int maxEvents () const
int maxLuminosityBlocks () const
ModuleDescription const & moduleDescription () const
 Accessor for 'module' description.
ItemType nextItemType ()
bool 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.
bool randomAccess () const
void readAndCacheLumi (bool merge, HistoryAppender &historyAppender)
 Read next luminosity block.
void readAndCacheRun (bool merge, HistoryAppender &historyAppender)
 Read next run.
EventPrincipalreadEvent (EventID const &)
 Read a specific event.
EventPrincipalreadEvent (boost::shared_ptr< LuminosityBlockPrincipal > lbCache)
boost::shared_ptr< FileBlockreadFile ()
 Read next file.
boost::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary ()
 Read next luminosity block Auxilary.
boost::shared_ptr< RunAuxiliaryreadRunAuxiliary ()
 Read next run Auxiliary.
ProcessHistoryID const & reducedProcessHistoryID () const
void registerProducts ()
 Register any produced products.
int remainingEvents () const
int remainingLuminosityBlocks () const
void repeat ()
 Reset the remaining number of events/lumis to the maximum number.
ProcessingController::ReverseState reverseState () const
void rewind ()
 Begin again at the first event.
RunNumber_t run () const
 Accessor for current run number.
boost::shared_ptr< RunAuxiliaryrunAuxiliary () const
 Called by the framework to merge or insert run in principal cache.
void setLuminosityBlockNumber_t (LuminosityBlockNumber_t lb)
 Set the luminosity block ID.
void setRunNumber (RunNumber_t r)
 Set the run number.
void skipEvents (int offset)
Timestamp const & timestamp () const
 Accessor for the current time, as seen by the input source.
virtual ~InputSource ()
 Destructor.

Static Public Member Functions

static const std::string & baseType ()
static void fillDescription (ParameterSetDescription &desc)
static void fillDescriptions (ConfigurationDescriptions &descriptions)
static void prevalidate (ConfigurationDescriptions &)

Protected Member Functions

void decreaseRemainingEventsBy (int iSkipped)
EventPrincipaleventPrincipalCache ()
boost::shared_ptr
< LuminosityBlockPrincipal >
const 
luminosityBlockPrincipal () const
PrincipalCache const & principalCache () const
PrincipalCacheprincipalCache ()
ProductRegistryproductRegistryUpdate () const
void reset () const
void resetLuminosityBlockAuxiliary () const
void resetRunAuxiliary () const
boost::shared_ptr
< RunPrincipal > const 
runPrincipal () const
void setLuminosityBlockAuxiliary (LuminosityBlockAuxiliary *lbp)
void setRunAuxiliary (RunAuxiliary *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 ()
virtual void beginLuminosityBlock (LuminosityBlock &)
virtual void beginRun (Run &)
virtual void closeFile_ ()
virtual void endJob ()
virtual void endLuminosityBlock (LuminosityBlock &)
virtual void endRun (Run &)
bool eventLimitReached () const
virtual
ProcessingController::ForwardState 
forwardState_ () const
virtual ItemType getNextItemType ()=0
virtual bool goToEvent_ (EventID const &eventID)
bool limitReached () const
bool lumiLimitReached () const
ItemType nextItemType_ ()
virtual void postForkReacquireResources (boost::shared_ptr< multicore::MessageReceiverForSource >)
void postRead (Event &event)
virtual void preForkReleaseResources ()
virtual bool randomAccess_ () const
virtual EventPrincipalreadEvent_ ()=0
virtual boost::shared_ptr
< FileBlock
readFile_ ()
virtual EventPrincipalreadIt (EventID const &)
virtual boost::shared_ptr
< LuminosityBlockPrincipal
readLuminosityBlock_ (boost::shared_ptr< LuminosityBlockPrincipal > lbCache)
virtual boost::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary_ ()=0
virtual boost::shared_ptr
< RunPrincipal
readRun_ (boost::shared_ptr< RunPrincipal > rpCache)
virtual boost::shared_ptr
< RunAuxiliary
readRunAuxiliary_ ()=0
virtual
ProcessingController::ReverseState 
reverseState_ () const
virtual void rewind_ ()
virtual void setLumi (LuminosityBlockNumber_t lb)
virtual void setRun (RunNumber_t r)
virtual void skip (int)

Private Attributes

boost::shared_ptr
< ActivityRegistry
actReg_
bool doneReadAhead_
boost::shared_ptr
< LuminosityBlockAuxiliary
lumiAuxiliary_
int maxEvents_
int maxLumis_
ModuleDescription const moduleDescription_
bool const primary_
PrincipalCacheprincipalCache_
std::string processGUID_
ProcessingMode processingMode_
boost::shared_ptr
< ProductRegistry const > 
productRegistry_
int readCount_
int remainingEvents_
int remainingLumis_
boost::shared_ptr< RunAuxiliaryrunAuxiliary_
ItemType state_
std::string statusFileName_
Timestamp time_

Detailed Description

Definition at line 68 of file InputSource.h.


Member Typedef Documentation

Reimplemented from edm::ProductRegistryHelper.

Definition at line 86 of file InputSource.h.


Member Enumeration Documentation

Enumerator:
IsInvalid 
IsStop 
IsFile 
IsRun 
IsLumi 
IsEvent 
IsRepeat 

Definition at line 70 of file InputSource.h.

Enumerator:
Runs 
RunsAndLumis 
RunsLumisAndEvents 

Definition at line 80 of file InputSource.h.


Constructor & Destructor Documentation

InputSource::InputSource ( ParameterSet const &  pset,
InputSourceDescription const &  desc 
) [explicit]

Constructor.

Definition at line 54 of file InputSource.cc.

References edm::errors::Configuration, Exception, edm::ParameterSet::getUntrackedParameter(), primary_, processingMode(), processingMode_, edm::InputSourceDescription::productRegistry_, Runs, RunsAndLumis, and statusFileName_.

                                                                                       :
      ProductRegistryHelper(),
      actReg_(desc.actReg_),
      principalCache_(desc.principalCache_),
      maxEvents_(desc.maxEvents_),
      remainingEvents_(maxEvents_),
      maxLumis_(desc.maxLumis_),
      remainingLumis_(maxLumis_),
      readCount_(0),
      processingMode_(RunsLumisAndEvents),
      moduleDescription_(desc.moduleDescription_),
      productRegistry_(createSharedPtrToStatic<ProductRegistry const>(desc.productRegistry_)),
      primary_(pset.getParameter<std::string>("@module_label") == std::string("@main_input")),
      processGUID_(primary_ ? createGlobalIdentifier() : std::string()),
      time_(),
      doneReadAhead_(false),
      state_(IsInvalid),
      runAuxiliary_(),
      lumiAuxiliary_(),
      statusFileName_() {

    if(pset.getUntrackedParameter<bool>("writeStatusFile", false)) {
      std::ostringstream statusfilename;
      statusfilename << "source_" << getpid();
      statusFileName_ = statusfilename.str();
    }

    // Secondary input sources currently do not have a product registry.
    if(primary_) {
      assert(desc.productRegistry_ != 0);
    }
    std::string const defaultMode("RunsLumisAndEvents");
    std::string const runMode("Runs");
    std::string const runLumiMode("RunsAndLumis");

    // The default value provided as the second argument to the getUntrackedParameter function call
    // is not used when the ParameterSet has been validated and the parameters are not optional
    // in the description.  As soon as all primary input sources and all modules with a secondary
    // input sources have defined descriptions, the defaults in the getUntrackedParameterSet function
    // calls can and should be deleted from the code.
    std::string processingMode = pset.getUntrackedParameter<std::string>("processingMode", defaultMode);
    if(processingMode == runMode) {
      processingMode_ = Runs;
    } else if(processingMode == runLumiMode) {
      processingMode_ = RunsAndLumis;
    } else if(processingMode != defaultMode) {
      throw Exception(errors::Configuration)
        << "InputSource::InputSource()\n"
        << "The 'processingMode' parameter for sources has an illegal value '" << processingMode << "'\n"
        << "Legal values are '" << defaultMode << "', '" << runLumiMode << "', or '" << runMode << "'.\n";
    }
  }
InputSource::~InputSource ( ) [virtual]

Destructor.

Definition at line 107 of file InputSource.cc.

{}

Member Function Documentation

boost::shared_ptr<ActivityRegistry> edm::InputSource::actReg ( ) const [inline]

Accessor for Activity Registry.

Definition at line 232 of file InputSource.h.

References actReg_.

{return actReg_;}
std::string const & InputSource::baseType ( ) [static]

Definition at line 124 of file InputSource.cc.

References edm::kBaseType().

                        {
    return kBaseType;
  }
void InputSource::beginJob ( void  ) [private, virtual]

Reimplemented in EcalSimpleSource.

Definition at line 573 of file InputSource.cc.

Referenced by doBeginJob().

{}
void InputSource::beginLuminosityBlock ( LuminosityBlock ) [private, virtual]

Reimplemented in ErrorStreamSource, and edm::ConfigurableInputSource.

Definition at line 561 of file InputSource.cc.

Referenced by doBeginLumi().

{}
void InputSource::beginRun ( Run ) [private, virtual]

Reimplemented in ErrorStreamSource, edm::ConfigurableInputSource, AlpgenSource, LHESource, and MCatNLOSource.

Definition at line 567 of file InputSource.cc.

Referenced by doBeginRun().

{}
void InputSource::closeFile ( boost::shared_ptr< FileBlock fb,
bool  cleaningUpAfterException 
)

close current file

Definition at line 259 of file InputSource.cc.

References closeFile_().

                                                                                     {
    fb->close();
    callWithTryCatchAndPrint<void>( [this](){ closeFile_(); },
                                    "Calling InputSource::closeFile_",
                                    cleaningUpAfterException );
    return;
  }
virtual void edm::InputSource::closeFile_ ( ) [inline, private, virtual]

Reimplemented in DQMRootSource, and edm::PoolSource.

Definition at line 335 of file InputSource.h.

Referenced by closeFile().

{}
void InputSource::decreaseRemainingEventsBy ( int  iSkipped) [protected]

Called by inheriting classes when running multicore when the receiver has told them to skip some events.

Definition at line 482 of file InputSource.cc.

References remainingEvents_.

Referenced by edm::PoolSource::getNextItemType(), edm::ConfigurableInputSource::rewind_(), and edm::ConfigurableInputSource::setRunAndEventInfo().

                                                     {
    if(-1 == remainingEvents_) {
      return;
    }
    if(iSkipped < remainingEvents_) {
      remainingEvents_ -= iSkipped;
    } else {
      remainingEvents_ = 0;
    }
  }
void InputSource::doBeginJob ( )

Called by framework at beginning of job.

Definition at line 230 of file InputSource.cc.

References beginJob().

                          {
    this->beginJob();
  }
void InputSource::doBeginLumi ( LuminosityBlockPrincipal lbp)

Called by framework at beginning of lumi block.

Definition at line 517 of file InputSource.cc.

References beginLuminosityBlock(), edm::LuminosityBlock::commit_(), and moduleDescription().

                                                        {
    LuminosityBlock lb(lbp, moduleDescription());
    callWithTryCatchAndPrint<void>( [this,&lb](){ beginLuminosityBlock(lb); }, "Calling InputSource::beginLuminosityBlock" );
    lb.commit_();
  }
void InputSource::doBeginRun ( RunPrincipal rp)

Called by framework at beginning of run.

Definition at line 502 of file InputSource.cc.

References beginRun(), edm::Run::commit_(), moduleDescription(), and run().

                                          {
    Run run(rp, moduleDescription());
    callWithTryCatchAndPrint<void>( [this,&run](){ beginRun(run); }, "Calling InputSource::beginRun" );
    run.commit_();
  }
void InputSource::doEndJob ( )

Called by framework at end of job.

Definition at line 235 of file InputSource.cc.

References endJob().

Referenced by edm::PileUp::endJob().

                        {
    endJob();
  }
void InputSource::doEndLumi ( LuminosityBlockPrincipal lbp,
bool  cleaningUpAfterException 
)

Called by framework at end of lumi block.

Definition at line 524 of file InputSource.cc.

References edm::LuminosityBlock::commit_(), endLuminosityBlock(), moduleDescription(), edm::LuminosityBlockPrincipal::setEndTime(), and time_.

                                                                                     {
    lbp.setEndTime(time_);
    LuminosityBlock lb(lbp, moduleDescription());
    callWithTryCatchAndPrint<void>( [this,&lb](){ endLuminosityBlock(lb); }, "Calling InputSource::endLuminosityBlock", cleaningUpAfterException );
    lb.commit_();
  }
void InputSource::doEndRun ( RunPrincipal rp,
bool  cleaningUpAfterException 
)

Called by framework at end of run.

Definition at line 509 of file InputSource.cc.

References edm::Run::commit_(), endRun(), moduleDescription(), run(), edm::RunPrincipal::setEndTime(), and time_.

                                                                       {
    rp.setEndTime(time_);
    Run run(rp, moduleDescription());
    callWithTryCatchAndPrint<void>( [this,&run](){ endRun(run); }, "Calling InputSource::endRun", cleaningUpAfterException );
    run.commit_();
  }
void InputSource::doPostForkReacquireResources ( boost::shared_ptr< multicore::MessageReceiverForSource iReceiver)

Definition at line 537 of file InputSource.cc.

References postForkReacquireResources().

                                                                                                        {
    callWithTryCatchAndPrint<void>( [this, &iReceiver](){ postForkReacquireResources(iReceiver); },
                                    "Calling InputSource::postForkReacquireResources" );
  }
void InputSource::doPreForkReleaseResources ( )

Called by the framework before forking the process.

Definition at line 532 of file InputSource.cc.

References preForkReleaseResources().

                                         {
    callWithTryCatchAndPrint<void>( [this](){ preForkReleaseResources(); }, "Calling InputSource::preForkReleaseResources" );
  }
void InputSource::endJob ( void  ) [private, virtual]

Reimplemented in LHESource, MCatNLOSource, and edm::PoolSource.

Definition at line 576 of file InputSource.cc.

Referenced by doEndJob().

{}
void InputSource::endLuminosityBlock ( LuminosityBlock ) [private, virtual]

Reimplemented in DQMRootSource, ErrorStreamSource, and edm::ConfigurableInputSource.

Definition at line 564 of file InputSource.cc.

Referenced by doEndLumi().

{}
void InputSource::endRun ( Run ) [private, virtual]

Reimplemented in DQMRootSource, ErrorStreamSource, edm::ConfigurableInputSource, edm::CosMuoGenSource, and LHESource.

Definition at line 570 of file InputSource.cc.

Referenced by doEndRun().

{}
bool edm::InputSource::eventLimitReached ( ) const [inline, private]

Definition at line 322 of file InputSource.h.

References remainingEvents_.

Referenced by limitReached(), nextItemType(), and readEvent().

{return remainingEvents_ == 0;}
EventPrincipal * InputSource::eventPrincipalCache ( ) [protected]
void InputSource::fillDescription ( ParameterSetDescription desc) [static]

Reimplemented in edm::ConfigurableInputSource, edm::EDInputSource, edm::ExternalInputSource, and edm::StreamerInputSource.

Definition at line 129 of file InputSource.cc.

References edm::ParameterSetDescription::addUntracked().

                                                            {
    std::string defaultString("RunsLumisAndEvents");
    desc.addUntracked<std::string>("processingMode", defaultString)->setComment(
    "'RunsLumisAndEvents': process runs, lumis, and events.\n"
    "'RunsAndLumis':       process runs and lumis (not events).\n"
    "'Runs':               process runs (not lumis or events).");
    desc.addUntracked<bool>("writeStatusFile", false)->setComment("Write a status file. Intended for use by workflow management.");
  }
void InputSource::fillDescriptions ( ConfigurationDescriptions descriptions) [static]

Reimplemented in DQMRootSource, edm::EmptySource, edm::PoolSource, and edm::StreamerFileReader.

Definition at line 110 of file InputSource.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

                                                                       {
    ParameterSetDescription desc;
    desc.setUnknown();
    descriptions.addDefault(desc);
  }
ProcessingController::ForwardState InputSource::forwardState ( ) const

Definition at line 549 of file InputSource.cc.

References forwardState_().

                                  {
    return callWithTryCatchAndPrint<ProcessingController::ForwardState>( [this](){ return forwardState_(); },
                                                                         "Calling InputSource::forwardState_" );
  }
ProcessingController::ForwardState InputSource::forwardState_ ( ) const [private, virtual]

Reimplemented in edm::PoolSource.

Definition at line 590 of file InputSource.cc.

References edm::ProcessingController::kUnknownForward.

Referenced by forwardState().

virtual ItemType edm::InputSource::getNextItemType ( ) [private, pure virtual]
bool InputSource::goToEvent ( EventID const &  eventID)

Definition at line 401 of file InputSource.cc.

References doneReadAhead_, and goToEvent_().

                                               {
    doneReadAhead_ = false;
    return callWithTryCatchAndPrint<bool>( [this,&eventID](){ return goToEvent_(eventID); }, "Calling InputSource::goToEvent_" );
  }
bool InputSource::goToEvent_ ( EventID const &  eventID) [private, virtual]

Reimplemented in edm::PoolSource.

Definition at line 465 of file InputSource.cc.

References Exception, and edm::errors::LogicError.

Referenced by goToEvent().

                                        {
    throw Exception(errors::LogicError)
      << "InputSource::goToEvent_()\n"
      << "Random access is not implemented for this type of Input Source\n"
      << "Contact a Framework Developer\n";
    return true;
  }
void InputSource::issueReports ( EventID const &  eventID)

issue an event report

Definition at line 415 of file InputSource.cc.

References edm::EventID::event(), edm::isInfoEnabled(), edm::EventID::luminosityBlock(), readCount_, edm::EventID::run(), statusFileName_, and createPayload::suffix.

Referenced by readEvent().

                                                  {
    if(isInfoEnabled()) {
      LogVerbatim("FwkReport") << "Begin processing the " << readCount_
                               << suffix(readCount_) << " record. Run " << eventID.run()
                               << ", Event " << eventID.event()
                               << ", LumiSection " << eventID.luminosityBlock()
                               << " at " << std::setprecision(3) << TimeOfDay();
    }
    if(!statusFileName_.empty()) {
      std::ofstream statusFile(statusFileName_.c_str());
      statusFile << eventID << " time: " << std::setprecision(3) << TimeOfDay() << '\n';
      statusFile.close();
    }

    // At some point we may want to initiate checkpointing here
  }
bool edm::InputSource::limitReached ( ) const [inline, private]

Definition at line 324 of file InputSource.h.

References eventLimitReached(), and lumiLimitReached().

Referenced by markLumi(), markRun(), readEvent(), and readFile().

bool edm::InputSource::lumiLimitReached ( ) const [inline, private]

Definition at line 323 of file InputSource.h.

References remainingLumis_.

Referenced by limitReached(), and nextItemType().

{return remainingLumis_ == 0;}
LuminosityBlockNumber_t InputSource::luminosityBlock ( ) const

Accessor for current luminosity block number.

Reimplemented in edm::ConfigurableInputSource.

Definition at line 612 of file InputSource.cc.

References luminosityBlockAuxiliary().

Referenced by edm::StreamerInputSource::deserializeEvent().

                                     {
    assert(luminosityBlockAuxiliary());
    return luminosityBlockAuxiliary()->luminosityBlock();
  }
boost::shared_ptr<LuminosityBlockAuxiliary> edm::InputSource::luminosityBlockAuxiliary ( ) const [inline]
boost::shared_ptr< LuminosityBlockPrincipal > const InputSource::luminosityBlockPrincipal ( ) const [protected]
int InputSource::markLumi ( )

Mark lumi as read.

Definition at line 326 of file InputSource.cc.

References doneReadAhead_, IsLumi, limitReached(), edm::LuminosityBlockPrincipal::luminosityBlock(), luminosityBlockAuxiliary(), edm::PrincipalCache::lumiPrincipal(), principalCache_, remainingLumis_, and state_.

                        {
    assert(doneReadAhead_);
    assert(state_ == IsLumi);
    assert(!limitReached());
    doneReadAhead_ = false;
    --remainingLumis_;
    assert(principalCache_->lumiPrincipal().luminosityBlock() == luminosityBlockAuxiliary()->luminosityBlock());
    return principalCache_->lumiPrincipal().luminosityBlock();
  }
int InputSource::markRun ( )

Mark run as read.

Definition at line 299 of file InputSource.cc.

References doneReadAhead_, IsRun, limitReached(), principalCache_, edm::RunPrincipal::run(), edm::PrincipalCache::runPrincipal(), and state_.

                       {
    assert(doneReadAhead_);
    assert(state_ == IsRun);
    assert(!limitReached());
    doneReadAhead_ = false;
    return principalCache_->runPrincipal().run();
  }
int edm::InputSource::maxEvents ( ) const [inline]

Accessor for maximum number of events to be read. -1 is used for unlimited.

Definition at line 166 of file InputSource.h.

References maxEvents_.

Referenced by edm::H2RootNtplSource::H2RootNtplSource().

{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 174 of file InputSource.h.

References maxLumis_.

{return maxLumis_;}
ModuleDescription const& edm::InputSource::moduleDescription ( ) const [inline]
InputSource::ItemType InputSource::nextItemType ( )

Definition at line 169 of file InputSource.cc.

References doneReadAhead_, eventLimitReached(), IsEvent, IsFile, IsInvalid, IsLumi, IsRun, IsStop, lumiAuxiliary_, lumiLimitReached(), nextItemType_(), processingMode(), readLuminosityBlockAuxiliary(), readRunAuxiliary(), runAuxiliary_, Runs, RunsLumisAndEvents, and state_.

                            {
    if(doneReadAhead_) {
      return state_;
    }
    doneReadAhead_ = true;
    ItemType oldState = state_;
    if(eventLimitReached()) {
      // If the maximum event limit has been reached, stop.
      state_ = IsStop;
    } else if(lumiLimitReached()) {
      // If the maximum lumi limit has been reached, stop
      // when reaching a new file, run, or lumi.
      if(oldState == IsInvalid || oldState == IsFile || oldState == IsRun || processingMode() != RunsLumisAndEvents) {
        state_ = IsStop;
      } else {
        ItemType newState = nextItemType_();
        if(newState == IsEvent) {
          assert (processingMode() == RunsLumisAndEvents);
          state_ = IsEvent;
        } else {
          state_ = IsStop;
        }
      }
    } else {
      ItemType newState = nextItemType_();
      if(newState == IsStop) {
        state_ = IsStop;
      } else if(newState == IsFile || oldState == IsInvalid) {
        state_ = IsFile;
      } else if(newState == IsRun || oldState == IsFile) {
        runAuxiliary_ = readRunAuxiliary();
        state_ = IsRun;
      } else if(newState == IsLumi || oldState == IsRun) {
        assert (processingMode() != Runs);
        lumiAuxiliary_ = readLuminosityBlockAuxiliary();
        state_ = IsLumi;
      } else {
        assert (processingMode() == RunsLumisAndEvents);
        state_ = IsEvent;
      }
    }
    if(state_ == IsStop) {
      lumiAuxiliary_.reset();
      runAuxiliary_.reset();
    }
    return state_;
  }
InputSource::ItemType InputSource::nextItemType_ ( ) [private]

Definition at line 152 of file InputSource.cc.

References getNextItemType(), IsEvent, IsLumi, processingMode(), readEvent_(), Runs, and RunsLumisAndEvents.

Referenced by nextItemType().

                             {

    ItemType itemType = callWithTryCatchAndPrint<ItemType>( [this](){ return getNextItemType(); }, "Calling InputSource::getNextItemType" );

    if(itemType == IsEvent && processingMode() != RunsLumisAndEvents) {
      callWithTryCatchAndPrint<EventPrincipal*>( [this](){ return readEvent_(); },
                                                 "Calling InputSource::readEvent_" );
      return nextItemType_();
    }
    if(itemType == IsLumi && processingMode() == Runs) {
      // QQQ skipLuminosityBlock_();
      return nextItemType_();
    }
    return itemType;
  }
void InputSource::postForkReacquireResources ( boost::shared_ptr< multicore::MessageReceiverForSource ) [private, virtual]

Definition at line 582 of file InputSource.cc.

Referenced by doPostForkReacquireResources().

{}
void InputSource::postRead ( Event event) [private]

Definition at line 494 of file InputSource.cc.

References edm::Service< T >::isAvailable().

Referenced by readEvent().

                                    {
    Service<RandomNumberGenerator> rng;
    if(rng.isAvailable()) {
      rng->postEventRead(event);
    }
  }
void InputSource::preForkReleaseResources ( ) [private, virtual]

Reimplemented in edm::PoolSource.

Definition at line 579 of file InputSource.cc.

Referenced by doPreForkReleaseResources().

{}
void InputSource::prevalidate ( ConfigurationDescriptions ) [static]

Definition at line 117 of file InputSource.cc.

                                                      {
  }
bool edm::InputSource::primary ( ) const [inline]

Accessor for primary input source flag.

Definition at line 187 of file InputSource.h.

References primary_.

{return primary_;}
PrincipalCache const& edm::InputSource::principalCache ( ) const [inline, protected]
PrincipalCache& edm::InputSource::principalCache ( ) [inline, protected]

Definition at line 313 of file InputSource.h.

References principalCache_.

{return *principalCache_;}
ProcessConfiguration const& edm::InputSource::processConfiguration ( ) const [inline]
std::string const& edm::InputSource::processGUID ( ) const [inline]

Accessor for global process identifier.

Definition at line 190 of file InputSource.h.

References processGUID_.

Referenced by edm::RawInputSource::makeEvent(), and edm::ConfigurableInputSource::reallyReadEvent().

{return processGUID_;}
ProcessingMode edm::InputSource::processingMode ( ) const [inline]
boost::shared_ptr<ProductRegistry const> edm::InputSource::productRegistry ( ) const [inline]

Accessor for product registry.

Definition at line 155 of file InputSource.h.

References productRegistry_.

Referenced by edm::StreamerInputSource::deserializeAndMergeWithRegistry(), and edm::RootInputFileSequence::productRegistry().

{return productRegistry_;}
ProductRegistry& edm::InputSource::productRegistryUpdate ( ) const [inline, protected]

Definition at line 295 of file InputSource.h.

Referenced by edm::DaqSource::DaqSource(), edm::StreamerInputSource::deserializeAndMergeWithRegistry(), edm::RootInputFileSequence::productRegistryUpdate(), and registerProducts().

{return const_cast<ProductRegistry&>(*productRegistry_);}
bool InputSource::randomAccess ( ) const

Definition at line 543 of file InputSource.cc.

References randomAccess_().

                                  {
    return callWithTryCatchAndPrint<bool>( [this](){ return randomAccess_(); },
                                           "Calling InputSource::randomAccess_" );
  }
bool InputSource::randomAccess_ ( ) const [private, virtual]

Reimplemented in edm::PoolSource.

Definition at line 585 of file InputSource.cc.

Referenced by randomAccess().

                                   {
    return false;
  }
void InputSource::readAndCacheLumi ( bool  merge,
HistoryAppender historyAppender 
)

Read next luminosity block.

Definition at line 308 of file InputSource.cc.

References edm::PrincipalCache::insert(), luminosityBlockAuxiliary(), edm::PrincipalCache::lumiPrincipalPtr(), edm::PrincipalCache::merge(), principalCache_, processConfiguration(), productRegistry_, readLuminosityBlock_(), and edm::PrincipalCache::runPrincipalPtr().

                                                                            {
    LumiSourceSentry(*this);
    if (merge) {
      principalCache_->merge(luminosityBlockAuxiliary(), productRegistry_);
    } else {
      boost::shared_ptr<LuminosityBlockPrincipal> lb(
        new LuminosityBlockPrincipal(luminosityBlockAuxiliary(),
                                     productRegistry_,
                                     processConfiguration(),
                                     principalCache_->runPrincipalPtr(),
                                     &historyAppender));
      principalCache_->insert(lb);
    }
    callWithTryCatchAndPrint<boost::shared_ptr<LuminosityBlockPrincipal> >( [this](){ return readLuminosityBlock_(principalCache_->lumiPrincipalPtr()); },
                                                                            "Calling InputSource::readLuminosityBlock_" );
  }
void InputSource::readAndCacheRun ( bool  merge,
HistoryAppender historyAppender 
)

Read next run.

Definition at line 286 of file InputSource.cc.

References edm::PrincipalCache::insert(), edm::PrincipalCache::merge(), principalCache_, processConfiguration(), productRegistry_, readRun_(), runAuxiliary(), and edm::PrincipalCache::runPrincipalPtr().

                                                                           {
    RunSourceSentry(*this);
    if (merge) {
      principalCache_->merge(runAuxiliary(), productRegistry_);
    } else {
      boost::shared_ptr<RunPrincipal> rp(new RunPrincipal(runAuxiliary(), productRegistry_, processConfiguration(), &historyAppender));
      principalCache_->insert(rp);
    }
    callWithTryCatchAndPrint<boost::shared_ptr<RunPrincipal> >( [this](){ return readRun_(principalCache_->runPrincipalPtr()); },
                                                                "Calling InputSource::readRun_" );
  }
EventPrincipal * InputSource::readEvent ( boost::shared_ptr< LuminosityBlockPrincipal lbCache)

Read next event Indicate inability to get a new event by returning a null ptr.

Definition at line 352 of file InputSource.cc.

References doneReadAhead_, event(), eventLimitReached(), edm::EventPrincipal::id(), IsEvent, issueReports(), edm::EventPrincipal::luminosityBlock(), edm::EventPrincipal::luminosityBlockPrincipalPtrValid(), moduleDescription(), postRead(), readCount_, readEvent_(), remainingEvents_, query::result, edm::EventPrincipal::run(), setTimestamp(), state_, and edm::EventPrincipal::time().

                                                                          {
    assert(doneReadAhead_);
    assert(state_ == IsEvent);
    assert(!eventLimitReached());
    doneReadAhead_ = false;

    EventPrincipal* result = callWithTryCatchAndPrint<EventPrincipal*>( [this](){ return readEvent_(); },
                                                                        "Calling InputSource::readEvent_" );

    if(result != 0) {
      assert(result->luminosityBlockPrincipalPtrValid());
      assert(lbCache->run() == result->run());
      assert(lbCache->luminosityBlock() == result->luminosityBlock());
      Event event(*result, moduleDescription());
      postRead(event);
      if(remainingEvents_ > 0) --remainingEvents_;
      ++readCount_;
      setTimestamp(result->time());
      issueReports(result->id());
    }
    return result;
  }
EventPrincipal * InputSource::readEvent ( EventID const &  eventID)

Read a specific event.

Definition at line 376 of file InputSource.cc.

References event(), edm::EventPrincipal::id(), issueReports(), limitReached(), moduleDescription(), postRead(), readCount_, readIt(), remainingEvents_, and query::result.

                                               {
    EventPrincipal* result = 0;

    if(!limitReached()) {
      result = callWithTryCatchAndPrint<EventPrincipal*>( [this,&eventID](){ return readIt(eventID); },
                                                          "Calling InputSource::readIt" );

      if(result != 0) {
        Event event(*result, moduleDescription());
        postRead(event);
        if(remainingEvents_ > 0) --remainingEvents_;
        ++readCount_;
        issueReports(result->id());
      }
    }
    return result;
  }
virtual EventPrincipal* edm::InputSource::readEvent_ ( ) [private, pure virtual]
boost::shared_ptr< FileBlock > InputSource::readFile ( )

Read next file.

Definition at line 248 of file InputSource.cc.

References doneReadAhead_, benchmark_cfg::fb, IsFile, limitReached(), readFile_(), and state_.

                        {
    assert(doneReadAhead_);
    assert(state_ == IsFile);
    assert(!limitReached());
    doneReadAhead_ = false;
    boost::shared_ptr<FileBlock> fb = callWithTryCatchAndPrint<boost::shared_ptr<FileBlock> >( [this](){ return readFile_(); },
                                                                                               "Calling InputSource::readFile_" );
    return fb;
  }
boost::shared_ptr< FileBlock > InputSource::readFile_ ( ) [private, virtual]

Reimplemented in DQMRootSource, edm::PoolSource, and edm::StreamerInputSource.

Definition at line 271 of file InputSource.cc.

Referenced by readFile().

                         {
    return boost::shared_ptr<FileBlock>(new FileBlock);
  }
EventPrincipal * InputSource::readIt ( EventID const &  ) [private, virtual]

Reimplemented in edm::RawInputSource, edm::PoolSource, and edm::DaqSource.

Definition at line 433 of file InputSource.cc.

References Exception, and edm::errors::LogicError.

Referenced by readEvent().

                                    {
    throw Exception(errors::LogicError)
      << "InputSource::readIt()\n"
      << "Random access is not implemented for this type of Input Source\n"
      << "Contact a Framework Developer\n";
  }
boost::shared_ptr< LuminosityBlockPrincipal > InputSource::readLuminosityBlock_ ( boost::shared_ptr< LuminosityBlockPrincipal lbCache) [private, virtual]

Reimplemented in DQMRootSource, and edm::PoolSource.

Definition at line 346 of file InputSource.cc.

Referenced by readAndCacheLumi().

                                                                                     {
    lbCache->fillLuminosityBlockPrincipal();
    return lbCache;
  }
boost::shared_ptr< LuminosityBlockAuxiliary > InputSource::readLuminosityBlockAuxiliary ( )

Read next luminosity block Auxilary.

Definition at line 218 of file InputSource.cc.

References readLuminosityBlockAuxiliary_().

Referenced by nextItemType().

                                            {
    return callWithTryCatchAndPrint<boost::shared_ptr<LuminosityBlockAuxiliary> >( [this](){ return readLuminosityBlockAuxiliary_(); },
                                                                                   "Calling InputSource::readLuminosityBlockAuxiliary_" );
  }
virtual boost::shared_ptr<LuminosityBlockAuxiliary> edm::InputSource::readLuminosityBlockAuxiliary_ ( ) [private, pure virtual]
boost::shared_ptr< RunPrincipal > InputSource::readRun_ ( boost::shared_ptr< RunPrincipal rpCache) [private, virtual]

Reimplemented in DQMRootSource, and edm::PoolSource.

Definition at line 337 of file InputSource.cc.

Referenced by readAndCacheRun().

                                                             {
    // Note: For the moment, we do not support saving and restoring the state of the
    // random number generator if random numbers are generated during processing of runs
    // (e.g. beginRun(), endRun())
    rpCache->fillRunPrincipal();
    return rpCache;
  }
boost::shared_ptr< RunAuxiliary > InputSource::readRunAuxiliary ( )

Read next run Auxiliary.

Definition at line 224 of file InputSource.cc.

References readRunAuxiliary_().

Referenced by nextItemType().

                                {
    return callWithTryCatchAndPrint<boost::shared_ptr<RunAuxiliary> >( [this](){ return readRunAuxiliary_(); },
                                                                       "Calling InputSource::readRunAuxiliary_" );
  }
virtual boost::shared_ptr<RunAuxiliary> edm::InputSource::readRunAuxiliary_ ( ) [private, pure virtual]
ProcessHistoryID const & InputSource::reducedProcessHistoryID ( ) const

Accessor for the reduced process history ID of the current run. This is the ID of the input process history which does not include the current process.

Definition at line 600 of file InputSource.cc.

References instance, and runAuxiliary().

                                             {
    assert(runAuxiliary());
    return ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(runAuxiliary()->processHistoryID());
  }
void InputSource::registerProducts ( )
int edm::InputSource::remainingEvents ( ) const [inline]
int edm::InputSource::remainingLuminosityBlocks ( ) const [inline]

Accessor for remaining number of lumis to be read. -1 is used for unlimited.

Definition at line 178 of file InputSource.h.

References remainingLumis_.

Referenced by edm::RootInputFileSequence::remainingLuminosityBlocks(), and edm::ConfigurableInputSource::setRunAndEventInfo().

{return remainingLumis_;}
void edm::InputSource::repeat ( ) [inline]

Reset the remaining number of events/lumis to the maximum number.

Definition at line 158 of file InputSource.h.

References doneReadAhead_, maxEvents_, maxLumis_, remainingEvents_, and remainingLumis_.

Referenced by edm::ConfigurableInputSource::postForkReacquireResources().

void edm::InputSource::reset ( void  ) const [inline, protected]
void edm::InputSource::resetLuminosityBlockAuxiliary ( ) const [inline, protected]
void edm::InputSource::resetRunAuxiliary ( ) const [inline, protected]
ProcessingController::ReverseState InputSource::reverseState ( ) const

Definition at line 555 of file InputSource.cc.

References reverseState_().

                                  {
    return callWithTryCatchAndPrint<ProcessingController::ReverseState>( [this](){ return reverseState_(); },
                                                                         "Calling InputSource::reverseState__" );
  }
ProcessingController::ReverseState InputSource::reverseState_ ( ) const [private, virtual]

Reimplemented in edm::PoolSource.

Definition at line 595 of file InputSource.cc.

References edm::ProcessingController::kUnknownReverse.

Referenced by reverseState().

void InputSource::rewind ( )

Begin again at the first event.

Definition at line 407 of file InputSource.cc.

References doneReadAhead_, IsInvalid, maxEvents_, remainingEvents_, rewind_(), and state_.

Referenced by edm::ConfigurableInputSource::postForkReacquireResources().

                      {
    doneReadAhead_ = false;
    state_ = IsInvalid;
    remainingEvents_ = maxEvents_;
    callWithTryCatchAndPrint<void>( [this](){ rewind_(); }, "Calling InputSource::rewind_" );
  }
void InputSource::rewind_ ( ) [private, virtual]

Reimplemented in edm::ConfigurableInputSource, and edm::PoolSource.

Definition at line 474 of file InputSource.cc.

References Exception, and edm::errors::LogicError.

Referenced by rewind().

                       {
    throw Exception(errors::LogicError)
      << "InputSource::rewind()\n"
      << "Rewind is not implemented for this type of Input Source\n"
      << "Contact a Framework Developer\n";
  }
RunNumber_t InputSource::run ( void  ) const

Accessor for current run number.

Reimplemented in edm::ConfigurableInputSource.

Definition at line 606 of file InputSource.cc.

References runAuxiliary().

Referenced by edm::StreamerInputSource::deserializeEvent(), doBeginRun(), and doEndRun().

                         {
    assert(runAuxiliary());
    return runAuxiliary()->run();
  }
boost::shared_ptr<RunAuxiliary> edm::InputSource::runAuxiliary ( ) const [inline]
boost::shared_ptr< RunPrincipal > const InputSource::runPrincipal ( ) const [protected]

Definition at line 276 of file InputSource.cc.

References principalCache_, and edm::PrincipalCache::runPrincipalPtr().

                                  {
    return principalCache_->runPrincipalPtr();
  }
void InputSource::setLumi ( LuminosityBlockNumber_t  lb) [private, virtual]

Reimplemented in edm::ConfigurableInputSource, edm::EDInputSource, and edm::DaqSource.

Definition at line 449 of file InputSource.cc.

References Exception, and edm::errors::LogicError.

Referenced by setLuminosityBlockNumber_t().

                                              {
    throw Exception(errors::LogicError)
      << "InputSource::setLumi()\n"
      << "Luminosity Block ID cannot be modified for this type of Input Source\n"
      << "Contact a Framework Developer\n";
  }
void edm::InputSource::setLuminosityBlockAuxiliary ( LuminosityBlockAuxiliary lbp) [inline, protected]

Definition at line 298 of file InputSource.h.

References lumiAuxiliary_.

Referenced by edm::StreamerInputSource::deserializeEvent(), and edm::RawInputSource::makeEvent().

{lumiAuxiliary_.reset(lbp);}
void edm::InputSource::setLuminosityBlockNumber_t ( LuminosityBlockNumber_t  lb) [inline]

Set the luminosity block ID.

Definition at line 146 of file InputSource.h.

References setLumi().

Referenced by cond::EmptyIOVSource::setRunAndEventInfo(), and LmfSource::setRunAndEventInfo().

{setLumi(lb);}
void InputSource::setRun ( RunNumber_t  r) [private, virtual]

Reimplemented in edm::ConfigurableInputSource, edm::EDInputSource, edm::StreamerInputSource, and edm::DaqSource.

Definition at line 441 of file InputSource.cc.

References Exception, and edm::errors::LogicError.

Referenced by setRunNumber().

                                 {
    throw Exception(errors::LogicError)
      << "InputSource::setRun()\n"
      << "Run number cannot be modified for this type of Input Source\n"
      << "Contact a Framework Developer\n";
  }
void edm::InputSource::setRunAuxiliary ( RunAuxiliary rp) [inline, protected]

Definition at line 297 of file InputSource.h.

References runAuxiliary_.

Referenced by edm::StreamerInputSource::deserializeEvent(), and edm::RawInputSource::makeEvent().

{runAuxiliary_.reset(rp);}
void edm::InputSource::setRunNumber ( RunNumber_t  r) [inline]
void edm::InputSource::setTimestamp ( Timestamp const &  theTime) [inline, protected]

To set the current time, as seen by the input source.

Definition at line 293 of file InputSource.h.

References time_.

Referenced by edm::ConfigurableInputSource::ConfigurableInputSource(), edm::DaqSource::DaqSource(), edm::RawInputSource::RawInputSource(), and readEvent().

{time_ = theTime;}
void InputSource::skip ( int  ) [private, virtual]

Reimplemented in edm::ConfigurableInputSource, edm::RawInputSource, edm::PoolSource, and edm::DaqSource.

Definition at line 457 of file InputSource.cc.

References Exception, and edm::errors::LogicError.

Referenced by skipEvents().

                       {
    throw Exception(errors::LogicError)
      << "InputSource::skip()\n"
      << "Random access is not implemented for this type of Input Source\n"
      << "Contact a Framework Developer\n";
  }
void InputSource::skipEvents ( int  offset)

Skip the number of events specified. Offset may be negative.

Definition at line 395 of file InputSource.cc.

References doneReadAhead_, evf::evtn::offset(), and skip().

                                    {
    doneReadAhead_ = false;
    callWithTryCatchAndPrint<void>( [this,&offset](){ skip(offset); }, "Calling InputSource::skip" );
  }
ItemType edm::InputSource::state ( ) const [inline, protected]

Definition at line 296 of file InputSource.h.

References state_.

Referenced by edm::RawInputSource::getNextItemType().

{return state_;}
Timestamp const& edm::InputSource::timestamp ( ) const [inline]

Accessor for the current time, as seen by the input source.

Definition at line 215 of file InputSource.h.

References time_.

Referenced by edm::RawInputSource::readLuminosityBlockAuxiliary_(), and edm::RawInputSource::readRunAuxiliary_().

{return time_;}

Member Data Documentation

boost::shared_ptr<ActivityRegistry> edm::InputSource::actReg_ [private]

Definition at line 356 of file InputSource.h.

Referenced by actReg().

bool edm::InputSource::doneReadAhead_ [mutable, private]
boost::shared_ptr<LuminosityBlockAuxiliary> edm::InputSource::lumiAuxiliary_ [mutable, private]

Reimplemented in LmfSource.

Definition at line 358 of file InputSource.h.

Referenced by maxEvents(), repeat(), and rewind().

Definition at line 360 of file InputSource.h.

Referenced by maxLuminosityBlocks(), and repeat().

Definition at line 364 of file InputSource.h.

Referenced by moduleDescription().

bool const edm::InputSource::primary_ [private]

Definition at line 366 of file InputSource.h.

Referenced by InputSource(), and primary().

std::string edm::InputSource::processGUID_ [private]

Definition at line 367 of file InputSource.h.

Referenced by processGUID().

Definition at line 363 of file InputSource.h.

Referenced by InputSource(), and processingMode().

boost::shared_ptr<ProductRegistry const> edm::InputSource::productRegistry_ [private]

Definition at line 365 of file InputSource.h.

Referenced by productRegistry(), readAndCacheLumi(), and readAndCacheRun().

Definition at line 362 of file InputSource.h.

Referenced by issueReports(), and readEvent().

Definition at line 361 of file InputSource.h.

Referenced by lumiLimitReached(), markLumi(), remainingLuminosityBlocks(), and repeat().

boost::shared_ptr<RunAuxiliary> edm::InputSource::runAuxiliary_ [mutable, private]

Definition at line 371 of file InputSource.h.

Referenced by nextItemType(), resetRunAuxiliary(), runAuxiliary(), and setRunAuxiliary().

ItemType edm::InputSource::state_ [mutable, private]

Definition at line 370 of file InputSource.h.

Referenced by markLumi(), markRun(), nextItemType(), readEvent(), readFile(), reset(), rewind(), and state().

std::string edm::InputSource::statusFileName_ [private]

Definition at line 373 of file InputSource.h.

Referenced by InputSource(), and issueReports().

Definition at line 368 of file InputSource.h.

Referenced by doEndLumi(), doEndRun(), setTimestamp(), and timestamp().