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 >)
 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)
 Called by framework at end of lumi block.
void doEndRun (RunPrincipal &rp)
 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 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.
ProcessHistoryID const & processHistoryID () const
 Accessor for the input process history ID of the current run.
ProcessingMode processingMode () const
 RunsLumisAndEvents (default), RunsAndLumis, or Runs.
boost::shared_ptr
< ProductRegistry const > 
productRegistry () const
 Accessor for product registry.
bool randomAccess () const
void readAndCacheLumi ()
 Read next luminosity block.
void readAndCacheRun ()
 Read next run.
EventPrincipalreadEvent (boost::shared_ptr< LuminosityBlockPrincipal > lbCache)
EventPrincipalreadEvent (EventID const &)
 Read a specific event.
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.
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.
void wakeUp ()
 Wake up 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)

Protected Member Functions

void decreaseRemainingEventsBy (int iSkipped)
EventPrincipal *const eventPrincipalCache ()
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 setLumiPrematurelyRead ()
void setRunAuxiliary (RunAuxiliary *rp)
void setRunPrematurelyRead ()
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)
virtual void wakeUp_ ()

Private Attributes

boost::shared_ptr
< ActivityRegistry
actReg_
bool doneReadAhead_
boost::shared_ptr
< LuminosityBlockAuxiliary
lumiAuxiliary_
bool lumiPrematurelyRead_
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_
bool runPrematurelyRead_
ItemType state_
std::string statusFileName_
Timestamp time_

Detailed Description

Definition at line 67 of file InputSource.h.


Member Typedef Documentation

Reimplemented from edm::ProductRegistryHelper.

Definition at line 85 of file InputSource.h.


Member Enumeration Documentation

Enumerator:
IsInvalid 
IsStop 
IsFile 
IsRun 
IsLumi 
IsEvent 
IsRepeat 

Definition at line 69 of file InputSource.h.

Enumerator:
Runs 
RunsAndLumis 
RunsLumisAndEvents 

Definition at line 79 of file InputSource.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 74 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_(),
      runPrematurelyRead_(false),
      lumiPrematurelyRead_(false),
      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 129 of file InputSource.cc.

{}

Member Function Documentation

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

Accessor for Activity Registry.

Definition at line 236 of file InputSource.h.

References actReg_.

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

Definition at line 141 of file InputSource.cc.

References edm::kBaseType().

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

Reimplemented in EcalSimpleSource.

Definition at line 549 of file InputSource.cc.

Referenced by doBeginJob().

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

Reimplemented in ErrorStreamSource, and edm::ConfigurableInputSource.

Definition at line 537 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 543 of file InputSource.cc.

Referenced by doBeginRun().

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

close current file

Definition at line 260 of file InputSource.cc.

References closeFile_().

                                                      {
    fb->close();
    closeFile_();
    return;
  }
virtual void edm::InputSource::closeFile_ ( ) [inline, private, virtual]

Reimplemented in DQMRootSource, and edm::PoolSource.

Definition at line 342 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 472 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 232 of file InputSource.cc.

References beginJob().

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

Called by framework at beginning of lumi block.

Definition at line 508 of file InputSource.cc.

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

                                                        {
    LuminosityBlock lb(lbp, moduleDescription());
    beginLuminosityBlock(lb);
    lb.commit_();
  }
void InputSource::doBeginRun ( RunPrincipal rp)

Called by framework at beginning of run.

Definition at line 492 of file InputSource.cc.

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

                                          {
    Run run(rp, moduleDescription());
    beginRun(run);
    run.commit_();
  }
void InputSource::doEndJob ( )

Called by framework at end of job.

Definition at line 237 of file InputSource.cc.

References endJob().

Referenced by edm::PileUp::endJob(), and edm::EventProcessor::endJob().

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

Called by framework at end of lumi block.

Definition at line 515 of file InputSource.cc.

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

                                                      {
    lbp.setEndTime(time_);
    LuminosityBlock lb(lbp, moduleDescription());
    endLuminosityBlock(lb);
    lb.commit_();
    lumiPrematurelyRead_ = false;
  }
void InputSource::doEndRun ( RunPrincipal rp)

Called by framework at end of run.

Definition at line 499 of file InputSource.cc.

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

                                        {
    rp.setEndTime(time_);
    Run run(rp, moduleDescription());
    endRun(run);
    run.commit_();
    runPrematurelyRead_ = false;
  }
void InputSource::doPostForkReacquireResources ( boost::shared_ptr< multicore::MessageReceiverForSource iReceiver)

Definition at line 529 of file InputSource.cc.

References postForkReacquireResources().

                                                                                                        {
    postForkReacquireResources(iReceiver);
  }
void InputSource::doPreForkReleaseResources ( )

Called by the framework before forking the process.

Definition at line 524 of file InputSource.cc.

References preForkReleaseResources().

void InputSource::endJob ( void  ) [private, virtual]

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

Definition at line 552 of file InputSource.cc.

Referenced by doEndJob().

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

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

Definition at line 540 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 546 of file InputSource.cc.

Referenced by doEndRun().

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

Definition at line 329 of file InputSource.h.

References remainingEvents_.

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

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

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

Definition at line 146 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 132 of file InputSource.cc.

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

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

Definition at line 245 of file InputSource.h.

References forwardState_().

{ return forwardState_(); }
ProcessingController::ForwardState InputSource::forwardState_ ( ) const [private, virtual]

Reimplemented in edm::PoolSource.

Definition at line 566 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 398 of file InputSource.cc.

References doneReadAhead_, and goToEvent_().

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

Reimplemented in edm::PoolSource.

Definition at line 454 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 404 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 331 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 330 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 588 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 328 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 300 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 172 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 180 of file InputSource.h.

References maxLumis_.

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

Definition at line 183 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 169 of file InputSource.cc.

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

Referenced by nextItemType().

                             {
    ItemType itemType = getNextItemType();
    if(itemType == IsEvent && processingMode() != RunsLumisAndEvents) {
      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 558 of file InputSource.cc.

Referenced by doPostForkReacquireResources().

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

Definition at line 484 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 555 of file InputSource.cc.

Referenced by doPreForkReleaseResources().

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

Accessor for primary input source flag.

Definition at line 193 of file InputSource.h.

References primary_.

Referenced by edm::RootInputFileSequence::primary().

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

Definition at line 317 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 196 of file InputSource.h.

References processGUID_.

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

{return processGUID_;}
ProcessHistoryID const & InputSource::processHistoryID ( ) const

Accessor for the input process history ID of the current run.

Definition at line 576 of file InputSource.cc.

References runAuxiliary().

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

Accessor for product registry.

Definition at line 161 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 299 of file InputSource.h.

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

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

Definition at line 244 of file InputSource.h.

References randomAccess_().

{ return randomAccess_(); }
bool InputSource::randomAccess_ ( ) const [private, virtual]

Reimplemented in edm::PoolSource.

Definition at line 561 of file InputSource.cc.

Referenced by randomAccess().

                                   {
    return false;
  }
void InputSource::readAndCacheLumi ( )
void InputSource::readAndCacheRun ( )

Read next run.

Definition at line 285 of file InputSource.cc.

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

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

                               {
    if(runPrematurelyRead_) {
      runPrematurelyRead_ = false;
      return;
    }
    RunSourceSentry(*this);
    bool merged = principalCache_->merge(runAuxiliary(), productRegistry_);
    if(!merged) {
      boost::shared_ptr<RunPrincipal> rp(new RunPrincipal(runAuxiliary(), productRegistry_, processConfiguration()));
      principalCache_->insert(rp);
    }
    readRun_(principalCache_->runPrincipalPtr());
  }
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 354 of file InputSource.cc.

References doneReadAhead_, event(), eventLimitReached(), edm::EventPrincipal::id(), IsEvent, issueReports(), edm::EventPrincipal::luminosityBlock(), 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 = readEvent_();
    if(result != 0) {
      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 375 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 = readIt(eventID);
      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 250 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 = readFile_();
    return fb;
  }
boost::shared_ptr< FileBlock > InputSource::readFile_ ( ) [private, virtual]

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

Definition at line 270 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 422 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 348 of file InputSource.cc.

Referenced by readAndCacheLumi().

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

Read next luminosity block Auxilary.

Definition at line 106 of file InputSource.h.

References readLuminosityBlockAuxiliary_().

Referenced by nextItemType().

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 339 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> edm::InputSource::readRunAuxiliary ( ) [inline]

Read next run Auxiliary.

Definition at line 111 of file InputSource.h.

References readRunAuxiliary_().

Referenced by nextItemType().

{return readRunAuxiliary_();}
virtual boost::shared_ptr<RunAuxiliary> edm::InputSource::readRunAuxiliary_ ( ) [private, pure virtual]
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 184 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 164 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 edm::InputSource::reverseState ( ) const [inline]

Definition at line 246 of file InputSource.h.

References reverseState_().

{ return reverseState_(); }
ProcessingController::ReverseState InputSource::reverseState_ ( ) const [private, virtual]

Reimplemented in edm::PoolSource.

Definition at line 571 of file InputSource.cc.

References edm::ProcessingController::kUnknownReverse.

Referenced by reverseState().

void edm::InputSource::rewind ( ) [inline]

Begin again at the first event.

Definition at line 138 of file InputSource.h.

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

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

void InputSource::rewind_ ( ) [private, virtual]

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

Definition at line 464 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 582 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 275 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 438 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 302 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 152 of file InputSource.h.

References setLumi().

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

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

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

Definition at line 430 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 301 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::setRunPrematurelyRead ( ) [inline, protected]
void edm::InputSource::setTimestamp ( Timestamp const &  theTime) [inline, protected]

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

Definition at line 297 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 446 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 392 of file InputSource.cc.

References doneReadAhead_, and skip().

                                    {
    doneReadAhead_ = false;
    this->skip(offset);
  }
ItemType edm::InputSource::state ( ) const [inline, protected]

Definition at line 300 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 221 of file InputSource.h.

References time_.

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

{return time_;}
void edm::InputSource::wakeUp ( ) [inline]

Wake up the input source.

Definition at line 146 of file InputSource.h.

References wakeUp_().

{wakeUp_();}
void InputSource::wakeUp_ ( ) [private, virtual]

Definition at line 534 of file InputSource.cc.

Referenced by wakeUp().

{}

Member Data Documentation

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

Definition at line 364 of file InputSource.h.

Referenced by actReg().

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

Definition at line 382 of file InputSource.h.

Referenced by doEndLumi(), readAndCacheLumi(), and setLumiPrematurelyRead().

Reimplemented in LmfSource.

Definition at line 366 of file InputSource.h.

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

Definition at line 368 of file InputSource.h.

Referenced by maxLuminosityBlocks(), and repeat().

Definition at line 372 of file InputSource.h.

Referenced by moduleDescription().

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

Definition at line 374 of file InputSource.h.

Referenced by InputSource(), and primary().

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

Definition at line 375 of file InputSource.h.

Referenced by processGUID().

Definition at line 371 of file InputSource.h.

Referenced by InputSource(), and processingMode().

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

Definition at line 373 of file InputSource.h.

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

Definition at line 370 of file InputSource.h.

Referenced by issueReports(), and readEvent().

Definition at line 369 of file InputSource.h.

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

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

Definition at line 379 of file InputSource.h.

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

Definition at line 381 of file InputSource.h.

Referenced by doEndRun(), readAndCacheRun(), and setRunPrematurelyRead().

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

Definition at line 378 of file InputSource.h.

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

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

Definition at line 383 of file InputSource.h.

Referenced by InputSource(), and issueReports().

Definition at line 376 of file InputSource.h.

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