CMS 3D CMS Logo

edm::EventProcessor Class Reference

#include <FWCore/Framework/interface/EventProcessor.h>

Inheritance diagram for edm::EventProcessor:

edm::IEventProcessor

List of all members.

Public Member Functions

virtual bool alreadyHandlingException () const
void beginJob ()
 This should be called before the first call to 'run' If this is not called in time, it will automatically be called the first time 'run' is called.
virtual void beginLumi (int run, int lumi)
virtual void beginRun (int run)
void clearCounters ()
 Clears counters used by trigger report.
virtual void closeInputFile ()
virtual void closeOutputFiles ()
char const * currentStateName () const
 Member functions to support asynchronous interface.
void declareRunNumber (RunNumber_t runNumber)
virtual void deleteLumiFromCache (int run, int lumi)
virtual void deleteRunFromCache (int run)
virtual void doErrorStuff ()
void enableEndPaths (bool active)
 Turn end_paths "off" if "active" is false; turn end_paths "on" if "active" is true.
void endJob ()
 This should be called before the EventProcessor is destroyed throws if any module's endJob throws an exception.
virtual void endLumi (int run, int lumi)
virtual bool endOfLoop ()
bool endPathsEnabled () const
 Return true if end_paths are active, and false if they are inactive.
virtual void endRun (int run)
 EventProcessor (std::string const &config, bool isPython)
 meant for unit tests
 EventProcessor (boost::shared_ptr< edm::ProcessDesc > &processDesc, ServiceToken const &token, serviceregistry::ServiceLegacy legacy)
 EventProcessor (std::string const &config, std::vector< std::string > const &defaultServices, std::vector< std::string > const &forcedServices=std::vector< std::string >())
 EventProcessor (std::string const &config, ServiceToken const &token=ServiceToken(), serviceregistry::ServiceLegacy=serviceregistry::kOverlapIsError, std::vector< std::string > const &defaultServices=std::vector< std::string >(), std::vector< std::string > const &forcedServices=std::vector< std::string >())
std::vector< ModuleDescription
const * > 
getAllModuleDescriptions () const
 Return a vector allowing const access to all the ModuleDescriptions for this EventProccessor.
event_processor::State getState () const
ServiceToken getToken ()
void getTriggerReport (TriggerReport &rep) const
 Return the trigger report information on paths, modules-in-path, modules-in-endpath, and modules.
char const * msgName (event_processor::Msg m) const
virtual void openOutputFiles ()
ActivityRegistry::PostProcessEventpostProcessEventSignal ()
 signal is emitted after all modules have finished processing the Event
virtual void prepareForNextLoop ()
ActivityRegistry::PreProcessEventpreProcessEventSignal ()
 signal is emitted after the Event has been created by the InputSource but before any modules have seen the Event
virtual void processEvent ()
virtual int readAndCacheLumi ()
virtual int readAndCacheRun ()
virtual void readEvent ()
virtual void readFile ()
virtual void respondToCloseInputFile ()
virtual void respondToCloseOutputFiles ()
virtual void respondToOpenInputFile ()
virtual void respondToOpenOutputFiles ()
void rewind ()
virtual void rewindInput ()
StatusCode run (EventID const &id)
StatusCode run ()
StatusCode run (int numberEventsToProcess, bool repeatable=true)
void runAsync ()
virtual StatusCode runEventCount (int numberOfEventsToProcess)
virtual StatusCode runToCompletion (bool onlineStateTransitions)
virtual void setExceptionMessageFiles (std::string &message)
virtual void setExceptionMessageLumis (std::string &message)
virtual void setExceptionMessageRuns (std::string &message)
void setRunNumber (RunNumber_t runNumber)
virtual bool shouldWeCloseOutput () const
virtual bool shouldWeStop () const
StatusCode shutdownAsync (unsigned int timeout_secs=60 *2)
StatusCode skip (int numberToSkip)
virtual void startingNewLoop ()
char const * stateName (event_processor::State s) const
StatusCode statusAsync () const
StatusCode stopAsync (unsigned int timeout_secs=60 *2)
int totalEvents () const
 Return the number of events this EventProcessor has tried to process (inclues both successes and failures, including failures due to exceptions during processing).
int totalEventsFailed () const
 Return the number of events that have not passed any trigger.
int totalEventsPassed () const
 Return the number of events processed by this EventProcessor which have been passed by one or more trigger paths.
StatusCode waitTillDoneAsync (unsigned int timeout_seconds=0)
virtual void writeLumi (int run, int lumi)
virtual void writeLumiCache ()
virtual void writeRun (int run)
virtual void writeRunCache ()
 ~EventProcessor ()

Private Member Functions

void changeState (event_processor::Msg)
void connectSigs (EventProcessor *ep)
StatusCode doneAsync (event_processor::Msg m)
std::auto_ptr< EventPrincipaldoOneEvent (EventID const &id)
void errorState ()
void init (boost::shared_ptr< edm::ProcessDesc > &processDesc, ServiceToken const &token, serviceregistry::ServiceLegacy)
void procOneEvent (EventPrincipal *pep)
StatusCode runCommon (bool onlineStateTransitions, int numberOfEventsToProcess)
void setupSignal ()
void terminateMachine ()
StatusCode waitForAsyncCompletion (unsigned int timeout_seconds)

Static Private Member Functions

static void asyncRun (EventProcessor *)

Private Attributes

ActionTable act_table_
boost::shared_ptr
< ActivityRegistry
actReg_
bool alreadyHandlingException_
std::auto_ptr
< eventsetup::EventSetupProvider
esp_
boost::shared_ptr< boost::threadevent_loop_
volatile pthread_t event_loop_id_
std::string exceptionMessageFiles_
std::string exceptionMessageLumis_
std::string exceptionMessageRuns_
boost::shared_ptr< FileBlockfb_
std::string fileMode_
bool forceLooperToEnd_
bool handleEmptyLumis_
bool handleEmptyRuns_
volatile bool id_set_
boost::shared_ptr< InputSourceinput_
std::string last_error_text_
volatile Status last_rc_
boost::shared_ptr< EDLooperlooper_
std::auto_ptr
< statemachine::Machine
machine_
ParameterSet maxEventsPset_
ParameterSet maxLumisPset_
int my_sig_num_
ActivityRegistry::PostProcessEvent postProcessEventSignal_
SignallingProductRegistry preg_
ActivityRegistry::PreProcessEvent preProcessEventSignal_
PrincipalCache principalCache_
std::auto_ptr< Scheduleschedule_
ServiceToken serviceToken_
bool shouldWeStop_
std::auto_ptr< EventPrincipalsm_evp_
boost::condition starter_
volatile event_processor::State state_
boost::mutex state_lock_
bool stateMachineWasInErrorState_
volatile int stop_count_
boost::mutex stop_lock_
boost::condition stopper_
WorkerRegistry wreg_

Friends

class event_processor::StateSentry

Classes

struct  CommonParams


Detailed Description

Definition at line 65 of file EventProcessor.h.


Constructor & Destructor Documentation

edm::EventProcessor::EventProcessor ( std::string const &  config,
ServiceToken const &  token = ServiceToken(),
serviceregistry::ServiceLegacy  iLegacy = serviceregistry::kOverlapIsError,
std::vector< std::string > const &  defaultServices = std::vector<std::string>(),
std::vector< std::string > const &  forcedServices = std::vector<std::string>() 
) [explicit]

Definition at line 411 of file EventProcessor.cc.

References init().

00415                                                                             :
00416     preProcessEventSignal_(),
00417     postProcessEventSignal_(),
00418     maxEventsPset_(),
00419     maxLumisPset_(),
00420     actReg_(new ActivityRegistry),
00421     wreg_(actReg_),
00422     preg_(),
00423     serviceToken_(),
00424     input_(),
00425     schedule_(),
00426     esp_(),
00427     act_table_(),
00428     state_(sInit),
00429     event_loop_(),
00430     state_lock_(),
00431     stop_lock_(),
00432     stopper_(),
00433     stop_count_(-1),
00434     last_rc_(epSuccess),
00435     last_error_text_(),
00436     id_set_(false),
00437     event_loop_id_(),
00438     my_sig_num_(getSigNum()),
00439     fb_(),
00440     looper_(),
00441     shouldWeStop_(false),
00442     alreadyHandlingException_(false),
00443     forceLooperToEnd_(false)
00444   {
00445     boost::shared_ptr<edm::ProcessDesc> processDesc(new edm::ProcessDesc(config));
00446     processDesc->addServices(defaultServices, forcedServices);
00447     init(processDesc, iToken, iLegacy);
00448   }

edm::EventProcessor::EventProcessor ( std::string const &  config,
std::vector< std::string > const &  defaultServices,
std::vector< std::string > const &  forcedServices = std::vector<std::string>() 
)

Definition at line 450 of file EventProcessor.cc.

References init(), and edm::serviceregistry::kOverlapIsError.

00452                                                                             :
00453     preProcessEventSignal_(),
00454     postProcessEventSignal_(),
00455     maxEventsPset_(),
00456     maxLumisPset_(),
00457     actReg_(new ActivityRegistry),
00458     wreg_(actReg_),
00459     preg_(),
00460     serviceToken_(),
00461     input_(),
00462     schedule_(),
00463     esp_(),
00464     act_table_(),
00465     state_(sInit),
00466     event_loop_(),
00467     state_lock_(),
00468     stop_lock_(),
00469     stopper_(),
00470     stop_count_(-1),
00471     last_rc_(epSuccess),
00472     last_error_text_(),
00473     id_set_(false),
00474     event_loop_id_(),
00475     my_sig_num_(getSigNum()),
00476     fb_(),
00477     looper_(),
00478     shouldWeStop_(false),
00479     alreadyHandlingException_(false),
00480     forceLooperToEnd_(false)
00481   {
00482     boost::shared_ptr<edm::ProcessDesc> processDesc(new edm::ProcessDesc(config));
00483     processDesc->addServices(defaultServices, forcedServices);
00484     init(processDesc, ServiceToken(), serviceregistry::kOverlapIsError);
00485   }

edm::EventProcessor::EventProcessor ( boost::shared_ptr< edm::ProcessDesc > &  processDesc,
ServiceToken const &  token,
serviceregistry::ServiceLegacy  legacy 
)

Definition at line 487 of file EventProcessor.cc.

References init().

00489                                                       :
00490     preProcessEventSignal_(),
00491     postProcessEventSignal_(),
00492     maxEventsPset_(),
00493     maxLumisPset_(),
00494     actReg_(new ActivityRegistry),
00495     wreg_(actReg_),
00496     preg_(),
00497     serviceToken_(),
00498     input_(),
00499     schedule_(),
00500     esp_(),
00501     act_table_(),
00502     state_(sInit),
00503     event_loop_(),
00504     state_lock_(),
00505     stop_lock_(),
00506     stopper_(),
00507     stop_count_(-1),
00508     last_rc_(epSuccess),
00509     last_error_text_(),
00510     id_set_(false),
00511     event_loop_id_(),
00512     my_sig_num_(getSigNum()),
00513     fb_(),
00514     looper_(),
00515     shouldWeStop_(false),
00516     alreadyHandlingException_(false),
00517     forceLooperToEnd_(false)
00518   {
00519     init(processDesc, token, legacy);
00520   }

edm::EventProcessor::EventProcessor ( std::string const &  config,
bool  isPython 
)

meant for unit tests

Definition at line 523 of file EventProcessor.cc.

References init(), and edm::serviceregistry::kOverlapIsError.

00523                                                                       :
00524     preProcessEventSignal_(),
00525     postProcessEventSignal_(),
00526     maxEventsPset_(),
00527     maxLumisPset_(),
00528     actReg_(new ActivityRegistry),
00529     wreg_(actReg_),
00530     preg_(),
00531     serviceToken_(),
00532     input_(),
00533     schedule_(),
00534     esp_(),
00535     act_table_(),
00536     state_(sInit),
00537     event_loop_(),
00538     state_lock_(),
00539     stop_lock_(),
00540     stopper_(),
00541     stop_count_(-1),
00542     last_rc_(epSuccess),
00543     last_error_text_(),
00544     id_set_(false),
00545     event_loop_id_(),
00546     my_sig_num_(getSigNum()),
00547     fb_(),
00548     looper_(),
00549     shouldWeStop_(false),
00550     alreadyHandlingException_(false),
00551     forceLooperToEnd_(false)
00552   {
00553     if(isPython)
00554     {
00555       boost::shared_ptr<edm::ProcessDesc> processDesc = PythonProcessDesc(config).processDesc();
00556       init(processDesc, ServiceToken(), serviceregistry::kOverlapIsError);
00557     }
00558     else
00559     {
00560       boost::shared_ptr<edm::ProcessDesc> processDesc(new edm::ProcessDesc(config));
00561       init(processDesc, ServiceToken(), serviceregistry::kOverlapIsError);
00562     }
00563   }

edm::EventProcessor::~EventProcessor (  ) 

Definition at line 646 of file EventProcessor.cc.

References actReg_, changeState(), edm::WorkerRegistry::clear(), e, esp_, cms::Exception::explainSelf(), getToken(), input_, looper_, edm::event_processor::mDtor, schedule_, terminateMachine(), and wreg_.

00647   {
00648     // Make the services available while everything is being deleted.
00649     ServiceToken token = getToken();
00650     ServiceRegistry::Operate op(token); 
00651 
00652     // The state machine should have already been cleaned up
00653     // and destroyed at this point by a call to EndJob or
00654     // earlier when it completed processing events, but if it
00655     // has not been we'll take care of it here at the last moment.
00656     // This could cause problems if we are already handling an
00657     // exception and another one is thrown here ...  For a critical
00658     // executable the solution to this problem is for the code using
00659     // the EventProcessor to explicitly call EndJob or use runToCompletion,
00660     // then the next line of code is never executed.
00661     terminateMachine();
00662 
00663     try {
00664       changeState(mDtor);
00665     }
00666     catch(cms::Exception& e)
00667       {
00668         LogError("System")
00669           << e.explainSelf() << "\n";
00670       }
00671 
00672     // manually destroy all these thing that may need the services around
00673     esp_.reset();
00674     schedule_.reset();
00675     input_.reset();
00676     looper_.reset();
00677     wreg_.clear();
00678     actReg_.reset();
00679   }


Member Function Documentation

bool edm::EventProcessor::alreadyHandlingException (  )  const [virtual]

Implements edm::IEventProcessor.

Definition at line 1643 of file EventProcessor.cc.

References alreadyHandlingException_.

01643                                                       {
01644     return alreadyHandlingException_;
01645   }

void edm::EventProcessor::asyncRun ( EventProcessor me  )  [static, private]

Definition at line 1112 of file EventProcessor.cc.

References e, edm::IEventProcessor::epException, edm::IEventProcessor::epOther, event_loop_id_, exception, cms::Exception::explainSelf(), FDEBUG, id_set_, last_error_text_, last_rc_, runToCompletion(), sl, starter_, stop_count_, stop_lock_, and stopper_.

Referenced by runAsync().

01113   {
01114     // set up signals to allow for interruptions
01115     // ignore all other signals
01116     // make sure no exceptions escape out
01117 
01118     // temporary hack until we modify the input source to allow
01119     // wakeup calls from other threads.  This mimics the solution
01120     // in EventFilter/Processor, which I do not like.
01121     // allowing cancels means that the thread just disappears at
01122     // certain points.  This is bad for C++ stack variables.
01123     pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,0);
01124     //pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,0);
01125     pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,0);
01126     pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,0);
01127 
01128     {
01129       boost::mutex::scoped_lock(me->stop_lock_);
01130       me->event_loop_id_ = pthread_self();
01131       me->id_set_ = true;
01132       me->starter_.notify_all();
01133     }
01134 
01135     Status rc = epException;
01136     FDEBUG(2) << "asyncRun starting ......................\n";
01137 
01138     try {
01139       bool onlineStateTransitions = true;
01140       rc = me->runToCompletion(onlineStateTransitions);
01141     }
01142     catch (cms::Exception& e) {
01143       edm::LogError("FwkJob") << "cms::Exception caught in "
01144                               << "EventProcessor::asyncRun" 
01145                               << "\n"
01146                               << e.explainSelf();
01147       me->last_error_text_ = e.explainSelf();
01148     }
01149     catch (std::exception& e) {
01150       edm::LogError("FwkJob") << "Standard library exception caught in " 
01151                               << "EventProcessor::asyncRun" 
01152                               << "\n"
01153                               << e.what();
01154       me->last_error_text_ = e.what();
01155     }
01156     catch (...) {
01157       edm::LogError("FwkJob") << "Unknown exception caught in "
01158                               << "EventProcessor::asyncRun" 
01159                               << "\n";
01160       me->last_error_text_ = "Unknown exception caught";
01161       rc = epOther;
01162     }
01163 
01164     me->last_rc_ = rc;
01165 
01166     {
01167       // notify anyone waiting for exit that we are doing so now
01168       boost::mutex::scoped_lock sl(me->stop_lock_);
01169       ++me->stop_count_;
01170       me->stopper_.notify_all();
01171     }
01172     FDEBUG(2) << "asyncRun ending ......................\n";
01173   }

void edm::EventProcessor::beginJob ( void   ) 

This should be called before the first call to 'run' If this is not called in time, it will automatically be called the first time 'run' is called.

Definition at line 772 of file EventProcessor.cc.

References actReg_, bk::beginJob(), edm::IOVSyncValue::beginOfTime(), changeState(), e, esp_, exception, input_, looper_, edm::event_processor::mBeginJob, schedule_, serviceToken_, edm::event_processor::sInit, and state_.

Referenced by evf::FUEventProcessor::configuring(), declareRunNumber(), stor::EPRunner::dowork(), evf::FUEventProcessor::monitoring(), rewind(), run(), runAsync(), runCommon(), setRunNumber(), and skip().

00773   {
00774     if(state_ != sInit) return;
00775     bk::beginJob();
00776     // can only be run if in the initial state
00777     changeState(mBeginJob);
00778 
00779     // StateSentry toerror(this); // should we add this ? 
00780     //make the services available
00781     ServiceRegistry::Operate operate(serviceToken_);
00782     
00783     //NOTE:  This implementation assumes 'Job' means one call 
00784     // the EventProcessor::run
00785     // If it really means once per 'application' then this code will
00786     // have to be changed.
00787     // Also have to deal with case where have 'run' then new Module 
00788     // added and do 'run'
00789     // again.  In that case the newly added Module needs its 'beginJob'
00790     // to be called.
00791     EventSetup const& es =
00792       esp_->eventSetupForInstance(IOVSyncValue::beginOfTime());
00793     if(looper_) {
00794        looper_->beginOfJob(es);
00795     }
00796     try {
00797       input_->doBeginJob(es);
00798     } catch(cms::Exception& e) {
00799       LogError("BeginJob") << "A cms::Exception happened while processing the beginJob of the 'source'\n";
00800       e << "A cms::Exception happened while processing the beginJob of the 'source'\n";
00801       throw;
00802     } catch(std::exception& e) {
00803       LogError("BeginJob") << "A std::exception happened while processing the beginJob of the 'source'\n";
00804       throw;
00805     } catch(...) {
00806       LogError("BeginJob") << "An unknown exception happened while processing the beginJob of the 'source'\n";
00807       throw;
00808     }
00809     schedule_->beginJob(es);
00810     actReg_->postBeginJobSignal_();
00811     // toerror.succeeded(); // should we add this?
00812   }

void edm::EventProcessor::beginLumi ( int  run,
int  lumi 
) [virtual]

Implements edm::IEventProcessor.

Definition at line 1552 of file EventProcessor.cc.

References edm::LuminosityBlockPrincipal::beginTime(), esp_, FDEBUG, edm::LuminosityBlockPrincipal::luminosityBlock(), edm::PrincipalCache::lumiPrincipal(), principalCache_, edm::LuminosityBlockPrincipal::run(), and schedule_.

01552                                                   {
01553     LuminosityBlockPrincipal& lumiPrincipal = principalCache_.lumiPrincipal(run, lumi);
01554     // NOTE: Using 0 as the event number for the begin of a lumi block is a bad idea
01555     // lumi blocks know their start and end times why not also start and end events?
01556     IOVSyncValue ts(EventID(lumiPrincipal.run(),0), lumiPrincipal.luminosityBlock(), lumiPrincipal.beginTime());
01557     EventSetup const& es = esp_->eventSetupForInstance(ts);
01558     schedule_->processOneOccurrence<OccurrenceTraits<LuminosityBlockPrincipal, BranchActionBegin> >(lumiPrincipal, es);
01559     FDEBUG(1) << "\tbeginLumi " << run << "/" << lumi << "\n";
01560   }

void edm::EventProcessor::beginRun ( int  run  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1531 of file EventProcessor.cc.

References edm::RunPrincipal::beginTime(), esp_, FDEBUG, principalCache_, edm::RunPrincipal::run(), edm::PrincipalCache::runPrincipal(), and schedule_.

01531                                        {
01532     RunPrincipal& runPrincipal = principalCache_.runPrincipal(run);
01533     IOVSyncValue ts(EventID(runPrincipal.run(),0),
01534                     0,
01535                     runPrincipal.beginTime());
01536     EventSetup const& es = esp_->eventSetupForInstance(ts);
01537     schedule_->processOneOccurrence<OccurrenceTraits<RunPrincipal, BranchActionBegin> >(runPrincipal, es);
01538     FDEBUG(1) << "\tbeginRun " << run << "\n";
01539   }

void edm::EventProcessor::changeState ( event_processor::Msg  msg  )  [private]

Definition at line 1053 of file EventProcessor.cc.

References edm::TransEntry::current, Exception, FDEBUG, edm::TransEntry::final, edm::event_processor::mAny, edm::TransEntry::message, msgName(), edm::event_processor::sInvalid, sl, state_, state_lock_, stateName(), and edm::table.

Referenced by beginJob(), declareRunNumber(), doneAsync(), endJob(), rewind(), run(), runAsync(), runCommon(), setRunNumber(), shutdownAsync(), skip(), stopAsync(), waitTillDoneAsync(), ~EventProcessor(), and edm::event_processor::StateSentry::~StateSentry().

01054   {
01055     // most likely need to serialize access to this routine
01056 
01057     boost::mutex::scoped_lock sl(state_lock_);
01058     State curr = state_;
01059     int rc;
01060     // found if(not end of table) and 
01061     // (state == table.state && (msg == table.message || msg == any))
01062     for(rc = 0;
01063         table[rc].current != sInvalid && 
01064           (curr != table[rc].current || 
01065            (curr == table[rc].current && 
01066              msg != table[rc].message && table[rc].message != mAny));
01067         ++rc);
01068 
01069     if(table[rc].current == sInvalid)
01070       throw cms::Exception("BadState")
01071         << "A member function of EventProcessor has been called in an"
01072         << " inappropriate order.\n"
01073         << "Bad transition from " << stateName(curr) << " "
01074         << "using message " << msgName(msg) << "\n"
01075         << "No where to go from here.\n";
01076 
01077     FDEBUG(1) << "changeState: current=" << stateName(curr)
01078               << ", message=" << msgName(msg) 
01079               << " -> new=" << stateName(table[rc].final) << "\n";
01080 
01081     state_ = table[rc].final;
01082   }

void edm::EventProcessor::clearCounters (  ) 

Clears counters used by trigger report.

Definition at line 897 of file EventProcessor.cc.

References schedule_.

Referenced by evf::FUEventProcessor::enabling().

00898   {
00899     schedule_->clearCounters();
00900   }

void edm::EventProcessor::closeInputFile (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1435 of file EventProcessor.cc.

References FDEBUG, and input_.

01435                                       {
01436     input_->closeFile();
01437     FDEBUG(1) << "\tcloseInputFile\n";
01438   }

void edm::EventProcessor::closeOutputFiles (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1445 of file EventProcessor.cc.

References FDEBUG, and schedule_.

01445                                         {
01446     schedule_->closeOutputFiles();
01447     FDEBUG(1) << "\tcloseOutputFiles\n";
01448   }

void edm::EventProcessor::connectSigs ( EventProcessor ep  )  [private]

Definition at line 845 of file EventProcessor.cc.

References actReg_, postProcessEventSignal_, and preProcessEventSignal_.

Referenced by init().

00846   {
00847     // When the FwkImpl signals are given, pass them to the
00848     // appropriate EventProcessor signals so that the outside world
00849     // can see the signal.
00850     actReg_->preProcessEventSignal_.connect(ep->preProcessEventSignal_);
00851     actReg_->postProcessEventSignal_.connect(ep->postProcessEventSignal_);
00852   }

char const * edm::EventProcessor::currentStateName (  )  const

Member functions to support asynchronous interface.

Definition at line 903 of file EventProcessor.cc.

References getState(), and stateName().

Referenced by evf::FUEventProcessor::microState(), evf::FUEventProcessor::monitoring(), and evf::FUEventProcessor::stopping().

00904   {
00905     return stateName(getState());
00906   }

void edm::EventProcessor::declareRunNumber ( RunNumber_t  runNumber  ) 

Definition at line 949 of file EventProcessor.cc.

References beginJob(), changeState(), and edm::event_processor::mSetRun.

Referenced by evf::FUEventProcessor::enabling(), and evf::FUEventProcessor::monitoring().

00950   {
00951     // inside of beginJob there is a check to see if it has been called before
00952     beginJob();
00953     changeState(mSetRun);
00954 
00955     // interface not correct yet - wait for Bill to be done with run/lumi loop stuff 21-Jun-2007
00956     //input_->declareRunNumber(runNumber);
00957   }

void edm::EventProcessor::deleteLumiFromCache ( int  run,
int  lumi 
) [virtual]

Implements edm::IEventProcessor.

Definition at line 1602 of file EventProcessor.cc.

References edm::PrincipalCache::deleteLumi(), FDEBUG, and principalCache_.

01602                                                             {
01603     principalCache_.deleteLumi(run, lumi);
01604     FDEBUG(1) << "\tdeleteLumiFromCache " << run << "/" << lumi << "\n";
01605   }

void edm::EventProcessor::deleteRunFromCache ( int  run  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1592 of file EventProcessor.cc.

References edm::PrincipalCache::deleteRun(), FDEBUG, and principalCache_.

01592                                                  {
01593     principalCache_.deleteRun(run);
01594     FDEBUG(1) << "\tdeleteRunFromCache " << run << "\n";
01595   }

void edm::EventProcessor::doErrorStuff (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1520 of file EventProcessor.cc.

References FDEBUG, and stateMachineWasInErrorState_.

01520                                     {
01521     FDEBUG(1) << "\tdoErrorStuff\n";
01522     edm::LogError("StateMachine")
01523       << "The EventProcessor state machine encountered an unexpected event\n"
01524       << "and went to the error state\n"
01525       << "Will attempt to terminate processing normally\n"
01526       << "(IF using the looper the next loop will be attempted)\n"
01527       << "This likely indicates a bug in an input module or corrupted input or both\n";
01528     stateMachineWasInErrorState_ = true;
01529   }

EventProcessor::StatusCode edm::EventProcessor::doneAsync ( event_processor::Msg  m  )  [private]

Definition at line 1044 of file EventProcessor.cc.

References changeState(), and waitForAsyncCompletion().

01045   {
01046     // make sure to include a timeout here so we don't wait forever
01047     // I suspect there are still timing issues with thread startup
01048     // and the setting of the various control variables (stop_count,id_set)
01049     changeState(m);
01050     return waitForAsyncCompletion(60*2);
01051   }

std::auto_ptr< EventPrincipal > edm::EventProcessor::doOneEvent ( EventID const &  id  )  [private]

Definition at line 704 of file EventProcessor.cc.

References input_, and procOneEvent().

Referenced by run().

00704                                               {
00705     std::auto_ptr<EventPrincipal> pep;
00706     {
00707       pep = input_->readEvent(id);
00708     }
00709     procOneEvent(pep.get());
00710     return pep;
00711   }

void edm::EventProcessor::enableEndPaths ( bool  active  ) 

Turn end_paths "off" if "active" is false; turn end_paths "on" if "active" is true.

Definition at line 879 of file EventProcessor.cc.

References schedule_.

Referenced by evf::FUEventProcessor::actionPerformed(), and evf::FUEventProcessor::initEventProcessor().

00880   {
00881     schedule_->enableEndPaths(active);
00882   }

void edm::EventProcessor::endJob ( void   ) 

This should be called before the EventProcessor is destroyed throws if any module's endJob throws an exception.

Definition at line 815 of file EventProcessor.cc.

References actReg_, c, edm::ExceptionCollector::call(), changeState(), edm::InputSource::doEndJob(), edm::Schedule::endJob(), edm::EDLooper::endOfJob(), edm::ExceptionCollector::hasThrown(), input_, looper_, edm::event_processor::mEndJob, edm::ExceptionCollector::rethrow(), schedule_, serviceToken_, and terminateMachine().

Referenced by stor::EPRunner::dowork(), and evf::FUEventProcessor::halting().

00816   {
00817     // Collects exceptions, so we don't throw before all operations are performed.
00818     ExceptionCollector c;
00819 
00820     // only allowed to run if state is sIdle,sJobReady,sRunGiven
00821     c.call(boost::bind(&EventProcessor::changeState, this, mEndJob));
00822 
00823     //make the services available
00824     ServiceRegistry::Operate operate(serviceToken_);  
00825 
00826     c.call(boost::bind(&EventProcessor::terminateMachine, this));
00827     c.call(boost::bind(&Schedule::endJob, schedule_.get()));
00828     c.call(boost::bind(&InputSource::doEndJob, input_));
00829     if (looper_) {
00830       c.call(boost::bind(&EDLooper::endOfJob, looper_));
00831     }
00832     c.call(boost::bind(&ActivityRegistry::PostEndJob::operator(), &actReg_->postEndJobSignal_));
00833     if (c.hasThrown()) {
00834       c.rethrow();
00835     }
00836   }

void edm::EventProcessor::endLumi ( int  run,
int  lumi 
) [virtual]

Implements edm::IEventProcessor.

Definition at line 1562 of file EventProcessor.cc.

References edm::LuminosityBlockPrincipal::endTime(), esp_, FDEBUG, input_, edm::LuminosityBlockPrincipal::luminosityBlock(), edm::PrincipalCache::lumiPrincipal(), edm::EventID::maxEventNumber(), principalCache_, edm::LuminosityBlockPrincipal::run(), and schedule_.

01562                                                 {
01563     LuminosityBlockPrincipal& lumiPrincipal = principalCache_.lumiPrincipal(run, lumi);
01564     input_->doEndLumi(lumiPrincipal);
01565     //NOTE: Using the max event number for the end of a lumi block is a bad idea
01566     // lumi blocks know their start and end times why not also start and end events?
01567     IOVSyncValue ts(EventID(lumiPrincipal.run(),EventID::maxEventNumber()),
01568                     lumiPrincipal.luminosityBlock(),
01569                     lumiPrincipal.endTime());
01570     EventSetup const& es = esp_->eventSetupForInstance(ts);
01571     schedule_->processOneOccurrence<OccurrenceTraits<LuminosityBlockPrincipal, BranchActionEnd> >(lumiPrincipal, es);
01572     FDEBUG(1) << "\tendLumi " << run << "/" << lumi << "\n";
01573   }

bool edm::EventProcessor::endOfLoop (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1478 of file EventProcessor.cc.

References esp_, FDEBUG, forceLooperToEnd_, edm::EDLooper::kContinue, looper_, and StDecayID::status.

01478                                  {
01479     if (looper_) {
01480       EDLooper::Status status = looper_->doEndOfLoop(esp_->eventSetup());
01481       if (status != EDLooper::kContinue || forceLooperToEnd_) return true;
01482       else return false;
01483     }
01484     FDEBUG(1) << "\tendOfLoop\n";
01485     return true;
01486   }

bool edm::EventProcessor::endPathsEnabled (  )  const

Return true if end_paths are active, and false if they are inactive.

Definition at line 885 of file EventProcessor.cc.

References schedule_.

00886   {
00887     return schedule_->endPathsEnabled();
00888   }

void edm::EventProcessor::endRun ( int  run  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1541 of file EventProcessor.cc.

References edm::RunPrincipal::endTime(), esp_, FDEBUG, input_, edm::EventID::maxEventNumber(), edm::LuminosityBlockID::maxLuminosityBlockNumber(), principalCache_, edm::RunPrincipal::run(), edm::PrincipalCache::runPrincipal(), and schedule_.

01541                                      {
01542     RunPrincipal& runPrincipal = principalCache_.runPrincipal(run);
01543     input_->doEndRun(runPrincipal);
01544     IOVSyncValue ts(EventID(runPrincipal.run(),EventID::maxEventNumber()),
01545                     LuminosityBlockID::maxLuminosityBlockNumber(),
01546                     runPrincipal.endTime());
01547     EventSetup const& es = esp_->eventSetupForInstance(ts);
01548     schedule_->processOneOccurrence<OccurrenceTraits<RunPrincipal, BranchActionEnd> >(runPrincipal, es);
01549     FDEBUG(1) << "\tendRun " << run << "\n";
01550   }

void edm::EventProcessor::errorState (  )  [private]

Definition at line 1038 of file EventProcessor.cc.

References edm::event_processor::sError, and state_.

Referenced by shutdownAsync(), stopAsync(), and waitTillDoneAsync().

01039   {
01040     state_ = sError;
01041   }

std::vector< ModuleDescription const * > edm::EventProcessor::getAllModuleDescriptions (  )  const

Return a vector allowing const access to all the ModuleDescriptions for this EventProccessor.

*** N.B. *** Ownership of the ModuleDescriptions is *not* passed to the caller. Do not call delete on these pointers!

Definition at line 855 of file EventProcessor.cc.

References schedule_.

Referenced by evf::FUEventProcessor::initEventProcessor().

00856   {
00857     return schedule_->getAllModuleDescriptions();
00858   }

State edm::EventProcessor::getState (  )  const

Definition at line 918 of file EventProcessor.cc.

References state_.

Referenced by currentStateName(), evf::FUEventProcessor::enabling(), evf::FUEventProcessor::halting(), evf::FUEventProcessor::microState(), evf::FUEventProcessor::monitoring(), evf::FUEventProcessor::scalers(), and evf::FUEventProcessor::stopEventProcessor().

00919   {
00920     return state_;
00921   }

ServiceToken edm::EventProcessor::getToken (  ) 

Definition at line 839 of file EventProcessor.cc.

References serviceToken_.

Referenced by evf::FUEventProcessor::attachDqmToShm(), evf::FUEventProcessor::defaultWebPage(), evf::FUEventProcessor::detachDqmFromShm(), stor::EPRunner::getToken(), evf::FUEventProcessor::moduleWeb(), evf::FUEventProcessor::serviceWeb(), and ~EventProcessor().

00840   {
00841     return serviceToken_;
00842   }

void edm::EventProcessor::getTriggerReport ( TriggerReport rep  )  const

Return the trigger report information on paths, modules-in-path, modules-in-endpath, and modules.

Definition at line 891 of file EventProcessor.cc.

References schedule_.

Referenced by evf::FUEventProcessor::getTriggerReport(), evf::FUEventProcessor::monitoring(), and evf::FUEventProcessor::spotlightWebPage().

00892   {
00893     schedule_->getTriggerReport(rep);
00894   }

void edm::EventProcessor::init ( boost::shared_ptr< edm::ProcessDesc > &  processDesc,
ServiceToken const &  token,
serviceregistry::ServiceLegacy  iLegacy 
) [private]

Definition at line 566 of file EventProcessor.cc.

References act_table_, actReg_, connectSigs(), edm::ServiceToken::copySlotsTo(), edm::ServiceRegistry::createContaining(), edm::ServiceRegistry::createSet(), lat::endl(), esp_, FDEBUG, fileMode_, edm::fillEventSetupProvider(), edm::fillLooper(), edm::getPassID(), edm::getReleaseVersion(), edm::ParameterSet::getUntrackedParameter(), handleEmptyLumis_, handleEmptyRuns_, input_, edm::ServiceRegistry::instance(), edm::serviceregistry::kOverlapIsError, looper_, edm::makeEventSetupProvider(), edm::makeInput(), maxEventsPset_, maxLumisPset_, preg_, schedule_, serviceToken_, and wreg_.

Referenced by EventProcessor().

00568                                                               {
00569     // TODO: Fix const-correctness. The ParameterSets that are
00570     // returned here should be const, so that we can be sure they are
00571     // not modified.
00572 
00573     shared_ptr<ParameterSet> parameterSet = processDesc->getProcessPSet();
00574 
00575     ParameterSet optionsPset(parameterSet->getUntrackedParameter<ParameterSet>("options", ParameterSet()));
00576     fileMode_ = optionsPset.getUntrackedParameter<std::string>("fileMode", "");
00577     handleEmptyRuns_ = optionsPset.getUntrackedParameter<bool>("handleEmptyRuns", true);
00578     handleEmptyLumis_ = optionsPset.getUntrackedParameter<bool>("handleEmptyLumis", true);
00579 
00580     maxEventsPset_ = parameterSet->getUntrackedParameter<ParameterSet>("maxEvents", ParameterSet());
00581     maxLumisPset_ = parameterSet->getUntrackedParameter<ParameterSet>("maxLuminosityBlocks", ParameterSet());
00582 
00583     shared_ptr<std::vector<ParameterSet> > pServiceSets = processDesc->getServicesPSets();
00584     //makeParameterSets(config, parameterSet, pServiceSets);
00585 
00586     //create the services
00587     ServiceToken tempToken(ServiceRegistry::createSet(*pServiceSets, iToken, iLegacy));
00588 
00589     // Copy slots that hold all the registered callback functions like
00590     // PostBeginJob into an ActivityRegistry that is owned by EventProcessor
00591     tempToken.copySlotsTo(*actReg_); 
00592     
00593     //add the ProductRegistry as a service ONLY for the construction phase
00594     typedef serviceregistry::ServiceWrapper<ConstProductRegistry> w_CPR;
00595     shared_ptr<w_CPR>
00596       reg(new w_CPR(std::auto_ptr<ConstProductRegistry>(new ConstProductRegistry(preg_))));
00597     ServiceToken tempToken2(ServiceRegistry::createContaining(reg, 
00598                                                               tempToken, 
00599                                                               kOverlapIsError));
00600 
00601     // the next thing is ugly: pull out the trigger path pset and 
00602     // create a service and extra token for it
00603     std::string processName = parameterSet->getParameter<std::string>("@process_name");
00604 
00605     typedef edm::service::TriggerNamesService TNS;
00606     typedef serviceregistry::ServiceWrapper<TNS> w_TNS;
00607 
00608     shared_ptr<w_TNS> tnsptr
00609       (new w_TNS(std::auto_ptr<TNS>(new TNS(*parameterSet))));
00610 
00611     serviceToken_ = ServiceRegistry::createContaining(tnsptr, 
00612                                                     tempToken2, 
00613                                                     kOverlapIsError);
00614 
00615     //make the services available
00616     ServiceRegistry::Operate operate(serviceToken_);
00617      
00618     //parameterSet = builder.getProcessPSet();
00619     act_table_ = ActionTable(*parameterSet);
00620     CommonParams common = CommonParams(processName,
00621                            getReleaseVersion(),
00622                            getPassID(),
00623                            maxEventsPset_.getUntrackedParameter<int>("input", -1),
00624                            maxLumisPset_.getUntrackedParameter<int>("input", -1));
00625 
00626     esp_ = makeEventSetupProvider(*parameterSet);
00627     fillEventSetupProvider(*esp_, *parameterSet, common);
00628 
00629     looper_ = fillLooper(*esp_, *parameterSet, common);
00630     if (looper_) looper_->setActionTable(&act_table_);
00631     
00632     input_= makeInput(*parameterSet, common, preg_, actReg_);
00633     schedule_ = std::auto_ptr<Schedule>
00634       (new Schedule(*parameterSet,
00635                     ServiceRegistry::instance().get<TNS>(),
00636                     wreg_,
00637                     preg_,
00638                     act_table_,
00639                     actReg_));
00640 
00641     //   initialize(iToken,iLegacy);
00642     FDEBUG(2) << parameterSet->toString() << std::endl;
00643     connectSigs(this);
00644   }

char const * edm::EventProcessor::msgName ( event_processor::Msg  m  )  const

Definition at line 913 of file EventProcessor.cc.

References edm::msgNames.

Referenced by changeState().

00914   {
00915     return msgNames[m];
00916   }

void edm::EventProcessor::openOutputFiles (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1440 of file EventProcessor.cc.

References fb_, FDEBUG, and schedule_.

01440                                        {
01441     schedule_->openOutputFiles(*fb_);
01442     FDEBUG(1) << "\topenOutputFiles\n";
01443   }

ActivityRegistry::PostProcessEvent& edm::EventProcessor::postProcessEventSignal (  )  [inline]

signal is emitted after all modules have finished processing the Event

Definition at line 219 of file EventProcessor.h.

References postProcessEventSignal_.

00219 {return postProcessEventSignal_;}

void edm::EventProcessor::prepareForNextLoop (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1494 of file EventProcessor.cc.

References esp_, FDEBUG, and looper_.

01494                                           {
01495     looper_->prepareForNextLoop(esp_.get());
01496     FDEBUG(1) << "\tprepareForNextLoop\n";
01497   }

ActivityRegistry::PreProcessEvent& edm::EventProcessor::preProcessEventSignal (  )  [inline]

signal is emitted after the Event has been created by the InputSource but before any modules have seen the Event

Definition at line 214 of file EventProcessor.h.

References preProcessEventSignal_.

00214 {return preProcessEventSignal_;}

void edm::EventProcessor::processEvent (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1612 of file EventProcessor.cc.

References esp_, FDEBUG, edm::EDLooper::kContinue, looper_, schedule_, shouldWeStop_, sm_evp_, and StDecayID::status.

01612                                     {
01613     IOVSyncValue ts(sm_evp_->id(), sm_evp_->luminosityBlock(), sm_evp_->time());
01614     EventSetup const& es = esp_->eventSetupForInstance(ts);
01615     schedule_->processOneOccurrence<OccurrenceTraits<EventPrincipal, BranchActionBegin> >(*sm_evp_, es);
01616  
01617     if (looper_) {
01618       EDLooper::Status status = looper_->doDuringLoop(*sm_evp_, esp_->eventSetup());
01619       if (status != EDLooper::kContinue) shouldWeStop_ = true;
01620     }
01621 
01622     FDEBUG(1) << "\tprocessEvent\n";
01623   }

void edm::EventProcessor::procOneEvent ( EventPrincipal pep  )  [private]

Definition at line 714 of file EventProcessor.cc.

References esp_, edm::EventPrincipal::id(), edm::EventPrincipal::luminosityBlock(), schedule_, and edm::EventPrincipal::time().

Referenced by doOneEvent().

00714                                                   {
00715     if(0 != pep) {
00716       IOVSyncValue ts(pep->id(), pep->luminosityBlock(), pep->time());
00717       EventSetup const& es = esp_->eventSetupForInstance(ts);
00718       schedule_->processOneOccurrence<OccurrenceTraits<EventPrincipal, BranchActionBegin> >(*pep, es);
00719     }
00720   }

int edm::EventProcessor::readAndCacheLumi (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1581 of file EventProcessor.cc.

References FDEBUG, input_, edm::PrincipalCache::insert(), edm::LuminosityBlockPrincipal::luminosityBlock(), edm::PrincipalCache::lumiPrincipal(), principalCache_, and edm::PrincipalCache::runPrincipalPtr().

01581                                        {
01582     principalCache_.insert(input_->readLuminosityBlock(principalCache_.runPrincipalPtr()));
01583     FDEBUG(1) << "\treadAndCacheLumi " << "\n";
01584     return principalCache_.lumiPrincipal().luminosityBlock();
01585   }

int edm::EventProcessor::readAndCacheRun (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1575 of file EventProcessor.cc.

References FDEBUG, input_, edm::PrincipalCache::insert(), principalCache_, edm::RunPrincipal::run(), and edm::PrincipalCache::runPrincipal().

01575                                       {
01576     principalCache_.insert(input_->readRun());
01577     FDEBUG(1) << "\treadAndCacheRun " << "\n";
01578     return principalCache_.runPrincipal().run();
01579   }

void edm::EventProcessor::readEvent (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1607 of file EventProcessor.cc.

References FDEBUG, input_, edm::PrincipalCache::lumiPrincipalPtr(), principalCache_, and sm_evp_.

01607                                  {
01608     sm_evp_ = input_->readEvent(principalCache_.lumiPrincipalPtr());
01609     FDEBUG(1) << "\treadEvent\n";
01610   }

void edm::EventProcessor::readFile (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1430 of file EventProcessor.cc.

References fb_, FDEBUG, and input_.

01430                                 {
01431     FDEBUG(1) << " \treadFile\n";
01432     fb_ = input_->readFile();
01433   }

void edm::EventProcessor::respondToCloseInputFile (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1455 of file EventProcessor.cc.

References fb_, FDEBUG, and schedule_.

01455                                                {
01456     schedule_->respondToCloseInputFile(*fb_);
01457     FDEBUG(1) << "\trespondToCloseInputFile\n";
01458   }

void edm::EventProcessor::respondToCloseOutputFiles (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1465 of file EventProcessor.cc.

References fb_, FDEBUG, and schedule_.

01465                                                  {
01466     schedule_->respondToCloseOutputFiles(*fb_);
01467     FDEBUG(1) << "\trespondToCloseOutputFiles\n";
01468   }

void edm::EventProcessor::respondToOpenInputFile (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1450 of file EventProcessor.cc.

References fb_, FDEBUG, and schedule_.

01450                                               {
01451     schedule_->respondToOpenInputFile(*fb_);
01452     FDEBUG(1) << "\trespondToOpenInputFile\n";
01453   }

void edm::EventProcessor::respondToOpenOutputFiles (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1460 of file EventProcessor.cc.

References fb_, FDEBUG, and schedule_.

01460                                                 {
01461     schedule_->respondToOpenOutputFiles(*fb_);
01462     FDEBUG(1) << "\trespondToOpenOutputFiles\n";
01463   }

void edm::EventProcessor::rewind (  ) 

Definition at line 682 of file EventProcessor.cc.

References beginJob(), changeState(), input_, edm::event_processor::mCountComplete, edm::event_processor::mFinished, edm::event_processor::mInputRewind, edm::event_processor::mStopAsync, serviceToken_, and edm::event_processor::StateSentry::succeeded().

00683   {
00684     beginJob(); //make sure this was called
00685     changeState(mStopAsync);
00686     changeState(mInputRewind);
00687     {
00688       StateSentry toerror(this);
00689 
00690       //make the services available
00691       ServiceRegistry::Operate operate(serviceToken_);
00692       
00693       {
00694         input_->repeat();
00695         input_->rewind();
00696       }
00697       changeState(mCountComplete);
00698       toerror.succeeded();
00699     }
00700     changeState(mFinished);
00701   }

void edm::EventProcessor::rewindInput (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1488 of file EventProcessor.cc.

References FDEBUG, and input_.

01488                                    {
01489     input_->repeat();
01490     input_->rewind();
01491     FDEBUG(1) << "\trewind\n";
01492   }

EventProcessor::StatusCode edm::EventProcessor::run ( EventID const &  id  ) 

Definition at line 729 of file EventProcessor.cc.

References beginJob(), changeState(), doOneEvent(), edm::IEventProcessor::epInputComplete, edm::IEventProcessor::epSuccess, edm::event_processor::mCountComplete, edm::event_processor::mFinished, edm::event_processor::mInputExhausted, edm::event_processor::mRunID, serviceToken_, and edm::event_processor::StateSentry::succeeded().

00730   {
00731     beginJob(); //make sure this was called
00732     changeState(mRunID);
00733     StateSentry toerror(this);
00734     Status rc = epSuccess;
00735 
00736     //make the services available
00737     ServiceRegistry::Operate operate(serviceToken_);
00738 
00739     if(doOneEvent(id).get() == 0) {
00740       changeState(mInputExhausted);
00741     } else {
00742       changeState(mCountComplete);
00743       rc = epInputComplete;
00744     }
00745     toerror.succeeded();
00746     changeState(mFinished);
00747     return rc;
00748   }

EventProcessor::StatusCode edm::EventProcessor::run ( void   )  [inline]

Definition at line 432 of file EventProcessor.h.

00432                       {
00433     return run(-1, false);
00434   }

EventProcessor::StatusCode edm::EventProcessor::run ( int  numberEventsToProcess,
bool  repeatable = true 
)

Definition at line 723 of file EventProcessor.cc.

References runEventCount().

Referenced by stor::EPRunner::dowork().

00724   {
00725     return runEventCount(numberEventsToProcess);
00726   }

void edm::EventProcessor::runAsync (  ) 

Definition at line 1084 of file EventProcessor.cc.

References asyncRun(), beginJob(), changeState(), edm::IEventProcessor::epSuccess, err, event_loop_, Exception, id_set_, last_rc_, edm::event_processor::mRunAsync, sl, starter_, stop_count_, stop_lock_, thread, and lhef::timeout().

Referenced by evf::FUEventProcessor::enabling(), and evf::FUEventProcessor::monitoring().

01085   {
01086     using boost::thread;
01087     beginJob();
01088     {
01089       boost::mutex::scoped_lock sl(stop_lock_);
01090       if(id_set_==true) {
01091           std::string err("runAsync called while async event loop already running\n");
01092           edm::LogError("FwkJob") << err;
01093           throw cms::Exception("BadState") << err;
01094       }
01095 
01096       changeState(mRunAsync);
01097 
01098       stop_count_=0;
01099       last_rc_=epSuccess; // forget the last value!
01100       event_loop_.reset(new thread(boost::bind(EventProcessor::asyncRun,this)));
01101       boost::xtime timeout;
01102       boost::xtime_get(&timeout, boost::TIME_UTC); 
01103       timeout.sec += 60; // 60 seconds to start!!!!
01104       if(starter_.timed_wait(sl,timeout)==false) {
01105           // yikes - the thread did not start
01106           throw cms::Exception("BadState")
01107             << "Async run thread did not start in 60 seconds\n";
01108       }
01109     }
01110   }

edm::EventProcessor::StatusCode edm::EventProcessor::runCommon ( bool  onlineStateTransitions,
int  numberOfEventsToProcess 
) [private]

Definition at line 1209 of file EventProcessor.cc.

References alreadyHandlingException_, beginJob(), changeState(), edm::errors::Configuration, e, edm::IEventProcessor::epCountComplete, edm::IEventProcessor::epSignal, edm::IEventProcessor::epSuccess, exception, Exception, exceptionMessageFiles_, exceptionMessageLumis_, exceptionMessageRuns_, FDEBUG, harvestingCosmics_cfg::fileMode, fileMode_, forceLooperToEnd_, statemachine::FULLLUMIMERGE, statemachine::FULLMERGE, handleEmptyLumis_, handleEmptyRuns_, input_, edm::InputSource::IsEvent, edm::InputSource::IsFile, edm::InputSource::IsLumi, edm::InputSource::IsRun, edm::InputSource::IsStop, edm::errors::LogicError, machine_, statemachine::MERGE, edm::event_processor::mFinished, edm::event_processor::mInputExhausted, edm::event_processor::mRunCount, edm::event_processor::mShutdownSignal, statemachine::NOMERGE, serviceToken_, edm::shutdown_flag, sl, edm::event_processor::sShuttingDown, edm::event_processor::sStopping, state_, stateMachineWasInErrorState_, terminateMachine(), and edm::usr2_lock.

Referenced by runEventCount(), and runToCompletion().

01209                                                                                     {
01210 
01211     beginJob(); //make sure this was called
01212 
01213     if (!onlineStateTransitions) changeState(mRunCount);
01214 
01215     StatusCode returnCode = epSuccess;
01216     stateMachineWasInErrorState_ = false;
01217 
01218     // make the services available
01219     ServiceRegistry::Operate operate(serviceToken_);
01220 
01221     if (machine_.get() == 0) {
01222  
01223       statemachine::FileMode fileMode;
01224       if (fileMode_.empty()) fileMode = statemachine::FULLMERGE;
01225       else if (fileMode_ == std::string("MERGE")) fileMode = statemachine::MERGE;
01226       else if (fileMode_ == std::string("NOMERGE")) fileMode = statemachine::NOMERGE;
01227       else if (fileMode_ == std::string("FULLMERGE")) fileMode = statemachine::FULLMERGE;
01228       else if (fileMode_ == std::string("FULLLUMIMERGE")) fileMode = statemachine::FULLLUMIMERGE;
01229       else {
01230         throw edm::Exception(errors::Configuration, "Illegal fileMode parameter value: ")
01231             << fileMode_ << ".\n"
01232             << "Legal values are 'MERGE', 'NOMERGE', 'FULLMERGE', and 'FULLLUMIMERGE'.\n";
01233       }
01234 
01235       machine_.reset(new statemachine::Machine(this,
01236                                                fileMode,
01237                                                handleEmptyRuns_,
01238                                                handleEmptyLumis_));
01239 
01240       machine_->initiate();
01241     }
01242 
01243     try {
01244 
01245       InputSource::ItemType itemType;
01246 
01247       int iEvents = 0;
01248 
01249       while (true) {
01250 
01251         itemType = input_->nextItemType();
01252 
01253         FDEBUG(1) << "itemType = " << itemType << "\n";
01254 
01255         // These are used for asynchronous running only and
01256         // and are checking to see if stopAsync or shutdownAsync
01257         // were called from another thread.  In the future, we
01258         // may need to do something better than polling the state.
01259         // With the current code this is the simplest thing and
01260         // it should always work.  If the interaction between
01261         // threads becomes more complex this may cause problems.
01262         if (state_ == sStopping) {
01263           FDEBUG(1) << "In main processing loop, encountered sStopping state\n";
01264           forceLooperToEnd_ = true;
01265           machine_->process_event(statemachine::Stop());
01266           forceLooperToEnd_ = false;
01267           break;
01268         }
01269         else if (state_ == sShuttingDown) {
01270           FDEBUG(1) << "In main processing loop, encountered sShuttingDown state\n";
01271           forceLooperToEnd_ = true;
01272           machine_->process_event(statemachine::Stop());
01273           forceLooperToEnd_ = false;
01274           break;
01275         }
01276 
01277         // Look for a shutdown signal
01278         {
01279           boost::mutex::scoped_lock sl(usr2_lock);
01280           if (edm::shutdown_flag) {
01281             changeState(mShutdownSignal);
01282             returnCode = epSignal;
01283             forceLooperToEnd_ = true;
01284             machine_->process_event(statemachine::Stop());
01285             forceLooperToEnd_ = false;
01286             break;
01287           }
01288         }
01289 
01290         if (itemType == InputSource::IsStop) {
01291           machine_->process_event(statemachine::Stop());
01292         }
01293         else if (itemType == InputSource::IsFile) {
01294           machine_->process_event(statemachine::File());
01295         }
01296         else if (itemType == InputSource::IsRun) {
01297           machine_->process_event(statemachine::Run(input_->run()));
01298         }
01299         else if (itemType == InputSource::IsLumi) {
01300           machine_->process_event(statemachine::Lumi(input_->luminosityBlock()));
01301         }
01302         else if (itemType == InputSource::IsEvent) {
01303           machine_->process_event(statemachine::Event());
01304           ++iEvents;
01305           if (numberOfEventsToProcess > 0 && iEvents >= numberOfEventsToProcess) {
01306             returnCode = epCountComplete;            
01307             changeState(mInputExhausted);
01308             FDEBUG(1) << "Event count complete, pausing event loop\n";
01309             break;
01310           }
01311         }
01312         // This should be impossible
01313         else {
01314           throw edm::Exception(errors::LogicError)
01315             << "Unknown next item type passed to EventProcessor\n"
01316             << "Please report this error to the Framework group\n";
01317         }
01318 
01319         if (machine_->terminated()) {
01320           changeState(mInputExhausted);
01321           break;
01322         }
01323       }  // End of loop over state machine events
01324     } // Try block 
01325 
01326     // Some comments on exception handling related to the boost state machine:
01327     //
01328     // Some states used in the machine are special because they
01329     // perform actions while the machine is being terminated, actions
01330     // such as close files, call endRun, call endLumi etc ...  Each of these
01331     // states has two functions that perform these actions.  The functions
01332     // are almost identical.  The major difference is that one version
01333     // catches all exceptions and the other lets exceptions pass through.
01334     // The destructor catches them and the other function named "exit" lets
01335     // them pass through.  On a normal termination, boost will always call
01336     // "exit" and then the state destructor.  In our state classes, the
01337     // the destructors do nothing if the exit function already took
01338     // care of things.  Here's the interesting part.  When boost is
01339     // handling an exception the "exit" function is not called (a boost
01340     // feature).
01341     //
01342     // If an exception occurs while the boost machine is in control
01343     // (which usually means inside a process_event call), then
01344     // the boost state machine destroys its states and "terminates" itself.
01345     // This already done before we hit the catch blocks below. In this case
01346     // the call to terminateMachine below only destroys an already
01347     // terminated state machine.  Because exit is not called, the state destructors
01348     // handle cleaning up lumis, runs, and files.  The destructors swallow
01349     // all exceptions and only pass through the exceptions messages which
01350     // are tacked onto the original exception below.
01351     // 
01352     // If an exception occurs when the boost state machine is not
01353     // in control (outside the process_event functions), then boost
01354     // cannot destroy its own states.  The terminateMachine function
01355     // below takes care of that.  The flag "alreadyHandlingException"
01356     // is set true so that the state exit functions do nothing (and
01357     // cannot throw more exceptions while handling the first).  Then the
01358     // state destructors take care of this because exit did nothing.
01359     //
01360     // In both cases above, the EventProcessor::endOfLoop function is
01361     // not called because it can throw exceptions.
01362     //
01363     // One tricky aspect of the state machine is that things which can
01364     // throw should not be invoked by the state machine while another
01365     // exception is being handled.
01366     // Another tricky aspect is that it appears to be important to 
01367     // terminate the state machine before invoking its destructor.
01368     // We've seen crashes which are not understood when that is not
01369     // done.  Maintainers of this code should be careful about this.
01370 
01371     catch (cms::Exception& e) {
01372       alreadyHandlingException_ = true;
01373       terminateMachine();
01374       alreadyHandlingException_ = false;
01375       e << "cms::Exception caught in EventProcessor and rethrown\n";
01376       e << exceptionMessageLumis_;
01377       e << exceptionMessageRuns_;
01378       e << exceptionMessageFiles_;
01379       throw e;
01380     }
01381     catch (std::bad_alloc& e) {
01382       alreadyHandlingException_ = true;
01383       terminateMachine();
01384       alreadyHandlingException_ = false;
01385       throw cms::Exception("std::bad_alloc")
01386         << "The EventProcessor caught a std::bad_alloc exception and converted it to a cms::Exception\n"
01387         << "The job has probably exhausted the virtual memory available to the process.\n"
01388         << exceptionMessageLumis_
01389         << exceptionMessageRuns_
01390         << exceptionMessageFiles_;
01391     }
01392     catch (std::exception& e) {
01393       alreadyHandlingException_ = true;
01394       terminateMachine();
01395       alreadyHandlingException_ = false;
01396       throw cms::Exception("StdException")
01397         << "The EventProcessor caught a std::exception and converted it to a cms::Exception\n"
01398         << "Previous information:\n" << e.what() << "\n"
01399         << exceptionMessageLumis_
01400         << exceptionMessageRuns_
01401         << exceptionMessageFiles_;
01402     }
01403     catch (...) {
01404       alreadyHandlingException_ = true;
01405       terminateMachine();
01406       alreadyHandlingException_ = false;
01407       throw cms::Exception("Unknown")
01408         << "The EventProcessor caught an unknown exception type and converted it to a cms::Exception\n"
01409         << exceptionMessageLumis_
01410         << exceptionMessageRuns_
01411         << exceptionMessageFiles_;
01412     }
01413 
01414     if (machine_->terminated()) {
01415       FDEBUG(1) << "The state machine reports it has been terminated\n";
01416       machine_.reset();
01417     }
01418 
01419     if (!onlineStateTransitions) changeState(mFinished);
01420 
01421     if (stateMachineWasInErrorState_) {
01422       throw cms::Exception("BadState")
01423         << "The boost state machine in the EventProcessor exited after\n"
01424         << "entering the Error state.\n";
01425     }
01426 
01427     return returnCode;
01428   }

edm::EventProcessor::StatusCode edm::EventProcessor::runEventCount ( int  numberOfEventsToProcess  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1196 of file EventProcessor.cc.

References runCommon(), and edm::event_processor::StateSentry::succeeded().

Referenced by run().

01196                                                            {
01197 
01198     StateSentry toerror(this);
01199 
01200     bool onlineStateTransitions = false;
01201     StatusCode returnCode = runCommon(onlineStateTransitions, numberOfEventsToProcess);
01202 
01203     toerror.succeeded();
01204 
01205     return returnCode;
01206   }

edm::EventProcessor::StatusCode edm::EventProcessor::runToCompletion ( bool  onlineStateTransitions  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1177 of file EventProcessor.cc.

References edm::errors::LogicError, machine_, runCommon(), and edm::event_processor::StateSentry::succeeded().

Referenced by asyncRun().

01177                                                              {
01178 
01179     StateSentry toerror(this);
01180 
01181     int numberOfEventsToProcess = -1;
01182     StatusCode returnCode = runCommon(onlineStateTransitions, numberOfEventsToProcess);
01183 
01184     if (machine_.get() != 0) {
01185       throw edm::Exception(errors::LogicError)
01186         << "State machine not destroyed on exit from EventProcessor::runToCompletion\n"
01187         << "Please report this error to the Framework group\n";
01188     }
01189 
01190     toerror.succeeded();
01191 
01192     return returnCode;
01193   }

void edm::EventProcessor::setExceptionMessageFiles ( std::string &  message  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1631 of file EventProcessor.cc.

References exceptionMessageFiles_.

01631                                                                   {
01632     exceptionMessageFiles_ = message;
01633   }

void edm::EventProcessor::setExceptionMessageLumis ( std::string &  message  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1639 of file EventProcessor.cc.

References exceptionMessageLumis_.

01639                                                                   {
01640     exceptionMessageLumis_ = message;
01641   }

void edm::EventProcessor::setExceptionMessageRuns ( std::string &  message  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1635 of file EventProcessor.cc.

References exceptionMessageRuns_.

01635                                                                  {
01636     exceptionMessageRuns_ = message;
01637   }

void edm::EventProcessor::setRunNumber ( RunNumber_t  runNumber  ) 

Definition at line 931 of file EventProcessor.cc.

References beginJob(), changeState(), input_, and edm::event_processor::mSetRun.

Referenced by evf::FUEventProcessor::enabling(), and evf::FUEventProcessor::monitoring().

00932   {
00933     if (runNumber == 0) {
00934       runNumber = 1;
00935       LogWarning("Invalid Run")
00936         << "EventProcessor::setRunNumber was called with an invalid run number (0)\n"
00937         << "Run number was set to 1 instead\n";
00938     }
00939 
00940     // inside of beginJob there is a check to see if it has been called before
00941     beginJob();
00942     changeState(mSetRun);
00943 
00944     // interface not correct yet
00945     input_->setRunNumber(runNumber);
00946   }

void edm::EventProcessor::setupSignal (  )  [private]

bool edm::EventProcessor::shouldWeCloseOutput (  )  const [virtual]

Implements edm::IEventProcessor.

Definition at line 1515 of file EventProcessor.cc.

References FDEBUG, and schedule_.

01515                                                  {
01516     FDEBUG(1) << "\tshouldWeCloseOutput\n";
01517     return schedule_->shouldWeCloseOutput();
01518   }

bool edm::EventProcessor::shouldWeStop (  )  const [virtual]

Implements edm::IEventProcessor.

Definition at line 1625 of file EventProcessor.cc.

References FDEBUG, schedule_, and shouldWeStop_.

01625                                           {
01626     FDEBUG(1) << "\tshouldWeStop\n";
01627     if (shouldWeStop_) return true;
01628     return schedule_->terminate();
01629   }

EventProcessor::StatusCode edm::EventProcessor::shutdownAsync ( unsigned int  timeout_secs = 60*2  ) 

Definition at line 1029 of file EventProcessor.cc.

References changeState(), edm::IEventProcessor::epTimedOut, errorState(), edm::event_processor::mFinished, edm::event_processor::mShutdownAsync, and waitForAsyncCompletion().

01030   {
01031     changeState(mShutdownAsync);
01032     StatusCode rc = waitForAsyncCompletion(secs);
01033     if(rc!=epTimedOut) changeState(mFinished);
01034     else errorState();
01035     return rc;
01036   }

EventProcessor::StatusCode edm::EventProcessor::skip ( int  numberToSkip  ) 

Definition at line 751 of file EventProcessor.cc.

References beginJob(), changeState(), edm::IEventProcessor::epSuccess, input_, edm::event_processor::mCountComplete, edm::event_processor::mFinished, edm::event_processor::mSkip, serviceToken_, and edm::event_processor::StateSentry::succeeded().

00752   {
00753     beginJob(); //make sure this was called
00754     changeState(mSkip);
00755     {
00756       StateSentry toerror(this);
00757 
00758       //make the services available
00759       ServiceRegistry::Operate operate(serviceToken_);
00760       
00761       {
00762         input_->skipEvents(numberToSkip);
00763       }
00764       changeState(mCountComplete);
00765       toerror.succeeded();
00766     }
00767     changeState(mFinished);
00768     return epSuccess;
00769   }

void edm::EventProcessor::startingNewLoop (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1470 of file EventProcessor.cc.

References FDEBUG, looper_, and shouldWeStop_.

01470                                        {
01471     shouldWeStop_ = false;
01472     if (looper_) {
01473       looper_->doStartingNewLoop();
01474     }
01475     FDEBUG(1) << "\tstartingNewLoop\n";
01476   }

char const * edm::EventProcessor::stateName ( event_processor::State  s  )  const

Definition at line 908 of file EventProcessor.cc.

References edm::stateNames.

Referenced by changeState(), currentStateName(), evf::FUEventProcessor::initEventProcessor(), and evf::FUEventProcessor::stopEventProcessor().

00909   {
00910     return stateNames[s];
00911   }

EventProcessor::StatusCode edm::EventProcessor::statusAsync (  )  const

Definition at line 923 of file EventProcessor.cc.

References last_rc_.

Referenced by evf::FUEventProcessor::enabling(), and evf::FUEventProcessor::monitoring().

00924   {
00925     // the thread will record exception/error status in the event processor
00926     // for us to look at and report here
00927     return last_rc_;
00928   }

EventProcessor::StatusCode edm::EventProcessor::stopAsync ( unsigned int  timeout_secs = 60*2  ) 

Definition at line 1020 of file EventProcessor.cc.

References changeState(), edm::IEventProcessor::epTimedOut, errorState(), edm::event_processor::mFinished, edm::event_processor::mStopAsync, and waitForAsyncCompletion().

01021   {
01022     changeState(mStopAsync);
01023     StatusCode rc = waitForAsyncCompletion(secs);
01024     if(rc!=epTimedOut) changeState(mFinished);
01025     else errorState();
01026     return rc;
01027   }

void edm::EventProcessor::terminateMachine (  )  [private]

Definition at line 1647 of file EventProcessor.cc.

References FDEBUG, forceLooperToEnd_, and machine_.

Referenced by endJob(), runCommon(), and ~EventProcessor().

01647                                         {
01648     if (machine_.get() != 0) {
01649       if (!machine_->terminated()) {
01650         forceLooperToEnd_ = true;
01651         machine_->process_event(statemachine::Stop());
01652         forceLooperToEnd_ = false;
01653       }
01654       else {
01655         FDEBUG(1) << "EventProcess::terminateMachine  The state machine was already terminated \n";
01656       }
01657       if (machine_->terminated()) {
01658         FDEBUG(1) << "The state machine reports it has been terminated (3)\n";
01659       }
01660       machine_.reset();
01661     }
01662   }

int edm::EventProcessor::totalEvents (  )  const

Return the number of events this EventProcessor has tried to process (inclues both successes and failures, including failures due to exceptions during processing).

Definition at line 861 of file EventProcessor.cc.

References schedule_.

Referenced by evf::FUEventProcessor::getTriggerReport(), and evf::FUEventProcessor::monitoring().

00862   {
00863     return schedule_->totalEvents();
00864   }

int edm::EventProcessor::totalEventsFailed (  )  const

Return the number of events that have not passed any trigger.

(N.B. totalEventsFailed() + totalEventsPassed() == totalEvents()

Definition at line 873 of file EventProcessor.cc.

References schedule_.

00874   {
00875     return schedule_->totalEventsFailed();
00876   }

int edm::EventProcessor::totalEventsPassed (  )  const

Return the number of events processed by this EventProcessor which have been passed by one or more trigger paths.

Definition at line 867 of file EventProcessor.cc.

References schedule_.

Referenced by evf::FUEventProcessor::monitoring().

00868   {
00869     return schedule_->totalEventsPassed();
00870   }

EventProcessor::StatusCode edm::EventProcessor::waitForAsyncCompletion ( unsigned int  timeout_seconds  )  [private]

Definition at line 960 of file EventProcessor.cc.

References edm::IEventProcessor::epTimedOut, event_loop_, event_loop_id_, id_set_, last_rc_, sl, stop_count_, stop_lock_, stopper_, and lhef::timeout().

Referenced by doneAsync(), shutdownAsync(), stopAsync(), and waitTillDoneAsync().

00961   {
00962     bool rc = true;
00963     boost::xtime timeout;
00964     boost::xtime_get(&timeout, boost::TIME_UTC); 
00965     timeout.sec += timeout_seconds;
00966 
00967     // make sure to include a timeout here so we don't wait forever
00968     // I suspect there are still timing issues with thread startup
00969     // and the setting of the various control variables (stop_count,id_set)
00970     {
00971       boost::mutex::scoped_lock sl(stop_lock_);
00972 
00973       // look here - if runAsync not active, just return the last return code
00974       if(stop_count_ < 0) return last_rc_;
00975 
00976       if(timeout_seconds==0)
00977         while(stop_count_==0) stopper_.wait(sl);
00978       else
00979         while(stop_count_==0 &&
00980               (rc = stopper_.timed_wait(sl,timeout)) == true);
00981       
00982       if(rc == false)
00983         {
00984           // timeout occurred
00985           // if(id_set_) pthread_kill(event_loop_id_,my_sig_num_);
00986           // this is a temporary hack until we get the input source
00987           // upgraded to allow blocking input sources to be unblocked
00988 
00989           // the next line is dangerous and causes all sorts of trouble
00990           if(id_set_) pthread_cancel(event_loop_id_);
00991 
00992           // we will not do anything yet
00993           LogWarning("timeout")
00994             << "An asynchronous request was made to shut down "
00995             << "the event loop "
00996             << "and the event loop did not shutdown after "
00997             << timeout_seconds << " seconds\n";
00998         }
00999       else
01000         {
01001           event_loop_->join();
01002           event_loop_.reset();
01003           id_set_ = false;
01004           stop_count_ = -1;
01005         }
01006     }
01007     return rc==false?epTimedOut:last_rc_;
01008   }

EventProcessor::StatusCode edm::EventProcessor::waitTillDoneAsync ( unsigned int  timeout_seconds = 0  ) 

Definition at line 1011 of file EventProcessor.cc.

References changeState(), edm::IEventProcessor::epTimedOut, errorState(), edm::event_processor::mCountComplete, and waitForAsyncCompletion().

Referenced by evf::FUEventProcessor::stopEventProcessor().

01012   {
01013     StatusCode rc = waitForAsyncCompletion(timeout_value_secs);
01014     if(rc!=epTimedOut) changeState(mCountComplete);
01015     else errorState();
01016     return rc;
01017   }

void edm::EventProcessor::writeLumi ( int  run,
int  lumi 
) [virtual]

Implements edm::IEventProcessor.

Definition at line 1597 of file EventProcessor.cc.

References FDEBUG, edm::PrincipalCache::lumiPrincipal(), principalCache_, and schedule_.

01597                                                   {
01598     schedule_->writeLumi(principalCache_.lumiPrincipal(run, lumi));
01599     FDEBUG(1) << "\twriteLumi " << run << "/" << lumi << "\n";
01600   }

void edm::EventProcessor::writeLumiCache (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1499 of file EventProcessor.cc.

References edm::PrincipalCache::deleteLowestLumi(), FDEBUG, edm::PrincipalCache::lowestLumi(), edm::PrincipalCache::noMoreLumis(), principalCache_, and schedule_.

01499                                       {
01500     while (!principalCache_.noMoreLumis()) {
01501       schedule_->writeLumi(principalCache_.lowestLumi());
01502       principalCache_.deleteLowestLumi();      
01503     }
01504     FDEBUG(1) << "\twriteLumiCache\n";
01505   }

void edm::EventProcessor::writeRun ( int  run  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1587 of file EventProcessor.cc.

References FDEBUG, principalCache_, edm::PrincipalCache::runPrincipal(), and schedule_.

01587                                        {
01588     schedule_->writeRun(principalCache_.runPrincipal(run));
01589     FDEBUG(1) << "\twriteRun " << run << "\n";
01590   }

void edm::EventProcessor::writeRunCache (  )  [virtual]

Implements edm::IEventProcessor.

Definition at line 1507 of file EventProcessor.cc.

References edm::PrincipalCache::deleteLowestRun(), FDEBUG, edm::PrincipalCache::lowestRun(), edm::PrincipalCache::noMoreRuns(), principalCache_, and schedule_.

01507                                      {
01508     while (!principalCache_.noMoreRuns()) {
01509       schedule_->writeRun(principalCache_.lowestRun());
01510       principalCache_.deleteLowestRun();      
01511     }
01512     FDEBUG(1) << "\twriteRunCache\n";
01513   }


Friends And Related Function Documentation

friend class event_processor::StateSentry [friend]

Definition at line 425 of file EventProcessor.h.


Member Data Documentation

ActionTable edm::EventProcessor::act_table_ [private]

Definition at line 393 of file EventProcessor.h.

Referenced by init().

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

Definition at line 386 of file EventProcessor.h.

Referenced by beginJob(), connectSigs(), endJob(), init(), and ~EventProcessor().

bool edm::EventProcessor::alreadyHandlingException_ [private]

Definition at line 422 of file EventProcessor.h.

Referenced by alreadyHandlingException(), and runCommon().

std::auto_ptr<eventsetup::EventSetupProvider> edm::EventProcessor::esp_ [private]

Definition at line 392 of file EventProcessor.h.

Referenced by beginJob(), beginLumi(), beginRun(), endLumi(), endOfLoop(), endRun(), init(), prepareForNextLoop(), processEvent(), procOneEvent(), and ~EventProcessor().

boost::shared_ptr<boost::thread> edm::EventProcessor::event_loop_ [private]

Definition at line 396 of file EventProcessor.h.

Referenced by runAsync(), and waitForAsyncCompletion().

volatile pthread_t edm::EventProcessor::event_loop_id_ [private]

Definition at line 406 of file EventProcessor.h.

Referenced by asyncRun(), and waitForAsyncCompletion().

std::string edm::EventProcessor::exceptionMessageFiles_ [private]

Definition at line 419 of file EventProcessor.h.

Referenced by runCommon(), and setExceptionMessageFiles().

std::string edm::EventProcessor::exceptionMessageLumis_ [private]

Definition at line 421 of file EventProcessor.h.

Referenced by runCommon(), and setExceptionMessageLumis().

std::string edm::EventProcessor::exceptionMessageRuns_ [private]

Definition at line 420 of file EventProcessor.h.

Referenced by runCommon(), and setExceptionMessageRuns().

boost::shared_ptr<FileBlock> edm::EventProcessor::fb_ [private]

Definition at line 408 of file EventProcessor.h.

Referenced by openOutputFiles(), readFile(), respondToCloseInputFile(), respondToCloseOutputFiles(), respondToOpenInputFile(), and respondToOpenOutputFiles().

std::string edm::EventProcessor::fileMode_ [private]

Definition at line 416 of file EventProcessor.h.

Referenced by init(), and runCommon().

bool edm::EventProcessor::forceLooperToEnd_ [private]

Definition at line 423 of file EventProcessor.h.

Referenced by endOfLoop(), runCommon(), and terminateMachine().

bool edm::EventProcessor::handleEmptyLumis_ [private]

Definition at line 418 of file EventProcessor.h.

Referenced by init(), and runCommon().

bool edm::EventProcessor::handleEmptyRuns_ [private]

Definition at line 417 of file EventProcessor.h.

Referenced by init(), and runCommon().

volatile bool edm::EventProcessor::id_set_ [private]

Definition at line 405 of file EventProcessor.h.

Referenced by asyncRun(), runAsync(), and waitForAsyncCompletion().

boost::shared_ptr<InputSource> edm::EventProcessor::input_ [private]

Definition at line 390 of file EventProcessor.h.

Referenced by beginJob(), closeInputFile(), doOneEvent(), endJob(), endLumi(), endRun(), init(), readAndCacheLumi(), readAndCacheRun(), readEvent(), readFile(), rewind(), rewindInput(), runCommon(), setRunNumber(), skip(), and ~EventProcessor().

std::string edm::EventProcessor::last_error_text_ [private]

Definition at line 404 of file EventProcessor.h.

Referenced by asyncRun().

volatile Status edm::EventProcessor::last_rc_ [private]

Definition at line 403 of file EventProcessor.h.

Referenced by asyncRun(), runAsync(), statusAsync(), and waitForAsyncCompletion().

boost::shared_ptr<EDLooper> edm::EventProcessor::looper_ [private]

Definition at line 409 of file EventProcessor.h.

Referenced by beginJob(), endJob(), endOfLoop(), init(), prepareForNextLoop(), processEvent(), startingNewLoop(), and ~EventProcessor().

std::auto_ptr<statemachine::Machine> edm::EventProcessor::machine_ [private]

Definition at line 411 of file EventProcessor.h.

Referenced by runCommon(), runToCompletion(), and terminateMachine().

ParameterSet edm::EventProcessor::maxEventsPset_ [private]

Definition at line 384 of file EventProcessor.h.

Referenced by init().

ParameterSet edm::EventProcessor::maxLumisPset_ [private]

Definition at line 385 of file EventProcessor.h.

Referenced by init().

int edm::EventProcessor::my_sig_num_ [private]

Definition at line 407 of file EventProcessor.h.

ActivityRegistry::PostProcessEvent edm::EventProcessor::postProcessEventSignal_ [private]

Definition at line 383 of file EventProcessor.h.

Referenced by connectSigs(), and postProcessEventSignal().

SignallingProductRegistry edm::EventProcessor::preg_ [private]

Definition at line 388 of file EventProcessor.h.

Referenced by init().

ActivityRegistry::PreProcessEvent edm::EventProcessor::preProcessEventSignal_ [private]

Definition at line 382 of file EventProcessor.h.

Referenced by connectSigs(), and preProcessEventSignal().

PrincipalCache edm::EventProcessor::principalCache_ [private]

Definition at line 412 of file EventProcessor.h.

Referenced by beginLumi(), beginRun(), deleteLumiFromCache(), deleteRunFromCache(), endLumi(), endRun(), readAndCacheLumi(), readAndCacheRun(), readEvent(), writeLumi(), writeLumiCache(), writeRun(), and writeRunCache().

std::auto_ptr<Schedule> edm::EventProcessor::schedule_ [private]

Definition at line 391 of file EventProcessor.h.

Referenced by beginJob(), beginLumi(), beginRun(), clearCounters(), closeOutputFiles(), enableEndPaths(), endJob(), endLumi(), endPathsEnabled(), endRun(), getAllModuleDescriptions(), getTriggerReport(), init(), openOutputFiles(), processEvent(), procOneEvent(), respondToCloseInputFile(), respondToCloseOutputFiles(), respondToOpenInputFile(), respondToOpenOutputFiles(), shouldWeCloseOutput(), shouldWeStop(), totalEvents(), totalEventsFailed(), totalEventsPassed(), writeLumi(), writeLumiCache(), writeRun(), writeRunCache(), and ~EventProcessor().

ServiceToken edm::EventProcessor::serviceToken_ [private]

Definition at line 389 of file EventProcessor.h.

Referenced by beginJob(), endJob(), getToken(), init(), rewind(), run(), runCommon(), and skip().

bool edm::EventProcessor::shouldWeStop_ [private]

Definition at line 414 of file EventProcessor.h.

Referenced by processEvent(), shouldWeStop(), and startingNewLoop().

std::auto_ptr<EventPrincipal> edm::EventProcessor::sm_evp_ [private]

Definition at line 413 of file EventProcessor.h.

Referenced by processEvent(), and readEvent().

boost::condition edm::EventProcessor::starter_ [private]

Definition at line 401 of file EventProcessor.h.

Referenced by asyncRun(), and runAsync().

volatile event_processor::State edm::EventProcessor::state_ [private]

Definition at line 395 of file EventProcessor.h.

Referenced by beginJob(), changeState(), errorState(), getState(), and runCommon().

boost::mutex edm::EventProcessor::state_lock_ [private]

Definition at line 398 of file EventProcessor.h.

Referenced by changeState().

bool edm::EventProcessor::stateMachineWasInErrorState_ [private]

Definition at line 415 of file EventProcessor.h.

Referenced by doErrorStuff(), and runCommon().

volatile int edm::EventProcessor::stop_count_ [private]

Definition at line 402 of file EventProcessor.h.

Referenced by asyncRun(), runAsync(), and waitForAsyncCompletion().

boost::mutex edm::EventProcessor::stop_lock_ [private]

Definition at line 399 of file EventProcessor.h.

Referenced by asyncRun(), runAsync(), and waitForAsyncCompletion().

boost::condition edm::EventProcessor::stopper_ [private]

Definition at line 400 of file EventProcessor.h.

Referenced by asyncRun(), and waitForAsyncCompletion().

WorkerRegistry edm::EventProcessor::wreg_ [private]

Definition at line 387 of file EventProcessor.h.

Referenced by init(), and ~EventProcessor().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:40:54 2009 for CMSSW by  doxygen 1.5.4