CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

edm::WorkerInPath Class Reference

#include <WorkerInPath.h>

List of all members.

Public Types

enum  FilterAction { Normal = 0, Ignore, Veto }

Public Member Functions

void clearCounters ()
FilterAction filterAction () const
WorkergetWorker () const
template<typename T >
bool runWorker (typename T::MyPrincipal &, EventSetup const &, CurrentProcessingContext const *cpc)
std::pair< double, double > timeCpuReal () const
int timesExcept () const
int timesFailed () const
int timesPassed () const
int timesVisited () const
void useStopwatch ()
 WorkerInPath (Worker *)
 WorkerInPath (Worker *, FilterAction theAction)

Private Attributes

FilterAction filterAction_
RunStopwatch::StopwatchPointer stopwatch_
int timesExcept_
int timesFailed_
int timesPassed_
int timesVisited_
Workerworker_

Detailed Description

Definition at line 20 of file WorkerInPath.h.


Member Enumeration Documentation

Enumerator:
Normal 
Ignore 
Veto 

Definition at line 22 of file WorkerInPath.h.

{ Normal=0, Ignore, Veto };

Constructor & Destructor Documentation

edm::WorkerInPath::WorkerInPath ( Worker w) [explicit]

Definition at line 17 of file WorkerInPath.cc.

                                     :
    stopwatch_(new RunStopwatch::StopwatchPointer::element_type),
    timesVisited_(),
    timesPassed_(),
    timesFailed_(),
    timesExcept_(),
    filterAction_(Normal),
    worker_(w)
  {
  }
edm::WorkerInPath::WorkerInPath ( Worker w,
FilterAction  theAction 
)

Definition at line 6 of file WorkerInPath.cc.


Member Function Documentation

void edm::WorkerInPath::clearCounters ( ) [inline]
FilterAction edm::WorkerInPath::filterAction ( ) const [inline]

Definition at line 48 of file WorkerInPath.h.

References filterAction_.

{ return filterAction_; }
Worker* edm::WorkerInPath::getWorker ( ) const [inline]

Definition at line 49 of file WorkerInPath.h.

References worker_.

{ return worker_; }
template<typename T >
bool edm::WorkerInPath::runWorker ( typename T::MyPrincipal &  ep,
EventSetup const &  es,
CurrentProcessingContext const *  cpc 
)

Definition at line 64 of file WorkerInPath.h.

References edm::Worker::doWork(), filterAction_, Ignore, stopwatch_, timesExcept_, timesFailed_, timesPassed_, timesVisited_, Veto, and worker_.

                                                                    {

    if (T::isEvent_) {
      ++timesVisited_;
    }
    bool rc = true;

    try {
        // may want to change the return value from the worker to be 
        // the Worker::FilterAction so conditions in the path will be easier to 
        // identify
        rc = worker_->doWork<T>(ep, es, cpc,stopwatch_.get());

        // Ignore return code for non-event (e.g. run, lumi) calls
        if (!T::isEvent_) rc = true;
        else if (filterAction_ == Veto) rc = !rc;
        else if (filterAction_ == Ignore) rc = true;

        if (T::isEvent_) {
          if(rc) ++timesPassed_; else ++timesFailed_;
        }
    }
    catch(...) {
        if (T::isEvent_) ++timesExcept_;
        throw;
    }

    return rc;
  }
std::pair<double,double> edm::WorkerInPath::timeCpuReal ( ) const [inline]

Definition at line 31 of file WorkerInPath.h.

References stopwatch_.

                                               {
      if(stopwatch_) {
        return std::pair<double,double>(stopwatch_->cpuTime(),stopwatch_->realTime());
      }
      return std::pair<double,double>(0.,0.);
    }
int edm::WorkerInPath::timesExcept ( ) const [inline]

Definition at line 46 of file WorkerInPath.h.

References timesExcept_.

{ return timesExcept_; }
int edm::WorkerInPath::timesFailed ( ) const [inline]

Definition at line 45 of file WorkerInPath.h.

References timesFailed_.

{ return timesFailed_; }
int edm::WorkerInPath::timesPassed ( ) const [inline]

Definition at line 44 of file WorkerInPath.h.

References timesPassed_.

{ return timesPassed_; }
int edm::WorkerInPath::timesVisited ( ) const [inline]

Definition at line 43 of file WorkerInPath.h.

References timesVisited_.

{ return timesVisited_; }
void edm::WorkerInPath::useStopwatch ( )

Definition at line 29 of file WorkerInPath.cc.

References stopwatch_.

                              {
      stopwatch_.reset(new RunStopwatch::StopwatchPointer::element_type);
   }

Member Data Documentation

Definition at line 59 of file WorkerInPath.h.

Referenced by filterAction(), and runWorker().

Definition at line 52 of file WorkerInPath.h.

Referenced by runWorker(), timeCpuReal(), and useStopwatch().

Definition at line 57 of file WorkerInPath.h.

Referenced by clearCounters(), runWorker(), and timesExcept().

Definition at line 56 of file WorkerInPath.h.

Referenced by clearCounters(), runWorker(), and timesFailed().

Definition at line 55 of file WorkerInPath.h.

Referenced by clearCounters(), runWorker(), and timesPassed().

Definition at line 54 of file WorkerInPath.h.

Referenced by clearCounters(), runWorker(), and timesVisited().

Definition at line 60 of file WorkerInPath.h.

Referenced by getWorker(), and runWorker().