CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
edm::WorkerInPath Class Reference

#include <WorkerInPath.h>

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.

Constructor & Destructor Documentation

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

Definition at line 17 of file WorkerInPath.cc.

17  :
18  stopwatch_(new RunStopwatch::StopwatchPointer::element_type),
19  timesVisited_(),
20  timesPassed_(),
21  timesFailed_(),
22  timesExcept_(),
24  worker_(w)
25  {
26  }
FilterAction filterAction_
Definition: WorkerInPath.h:59
RunStopwatch::StopwatchPointer stopwatch_
Definition: WorkerInPath.h:52
T w() const
edm::WorkerInPath::WorkerInPath ( Worker w,
FilterAction  theAction 
)

Definition at line 6 of file WorkerInPath.cc.

6  :
7  stopwatch_(),
9  timesPassed_(),
10  timesFailed_(),
11  timesExcept_(),
12  filterAction_(theFilterAction),
13  worker_(w)
14  {
15  }
FilterAction filterAction_
Definition: WorkerInPath.h:59
RunStopwatch::StopwatchPointer stopwatch_
Definition: WorkerInPath.h:52
T w() const

Member Function Documentation

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

Definition at line 48 of file WorkerInPath.h.

References filterAction_.

48 { return filterAction_; }
FilterAction filterAction_
Definition: WorkerInPath.h:59
Worker* edm::WorkerInPath::getWorker ( ) const
inline

Definition at line 49 of file WorkerInPath.h.

References worker_.

49 { 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_.

65  {
66 
67  if (T::isEvent_) {
68  ++timesVisited_;
69  }
70  bool rc = true;
71 
72  try {
73  // may want to change the return value from the worker to be
74  // the Worker::FilterAction so conditions in the path will be easier to
75  // identify
76  rc = worker_->doWork<T>(ep, es, cpc,stopwatch_.get());
77 
78  // Ignore return code for non-event (e.g. run, lumi) calls
79  if (!T::isEvent_) rc = true;
80  else if (filterAction_ == Veto) rc = !rc;
81  else if (filterAction_ == Ignore) rc = true;
82 
83  if (T::isEvent_) {
84  if(rc) ++timesPassed_; else ++timesFailed_;
85  }
86  }
87  catch(...) {
88  if (T::isEvent_) ++timesExcept_;
89  throw;
90  }
91 
92  return rc;
93  }
FilterAction filterAction_
Definition: WorkerInPath.h:59
RunStopwatch::StopwatchPointer stopwatch_
Definition: WorkerInPath.h:52
bool doWork(typename T::MyPrincipal &, EventSetup const &c, CurrentProcessingContext const *cpc, CPUTimer *const timer)
Definition: Worker.h:204
long double T
std::pair<double,double> edm::WorkerInPath::timeCpuReal ( ) const
inline

Definition at line 31 of file WorkerInPath.h.

References stopwatch_.

31  {
32  if(stopwatch_) {
33  return std::pair<double,double>(stopwatch_->cpuTime(),stopwatch_->realTime());
34  }
35  return std::pair<double,double>(0.,0.);
36  }
RunStopwatch::StopwatchPointer stopwatch_
Definition: WorkerInPath.h:52
int edm::WorkerInPath::timesExcept ( ) const
inline

Definition at line 46 of file WorkerInPath.h.

References timesExcept_.

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

Definition at line 45 of file WorkerInPath.h.

References timesFailed_.

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

Definition at line 44 of file WorkerInPath.h.

References timesPassed_.

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

Definition at line 43 of file WorkerInPath.h.

References timesVisited_.

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

Definition at line 29 of file WorkerInPath.cc.

References stopwatch_.

29  {
30  stopwatch_.reset(new RunStopwatch::StopwatchPointer::element_type);
31  }
RunStopwatch::StopwatchPointer stopwatch_
Definition: WorkerInPath.h:52

Member Data Documentation

FilterAction edm::WorkerInPath::filterAction_
private

Definition at line 59 of file WorkerInPath.h.

Referenced by filterAction(), and runWorker().

RunStopwatch::StopwatchPointer edm::WorkerInPath::stopwatch_
private

Definition at line 52 of file WorkerInPath.h.

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

int edm::WorkerInPath::timesExcept_
private

Definition at line 57 of file WorkerInPath.h.

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

int edm::WorkerInPath::timesFailed_
private

Definition at line 56 of file WorkerInPath.h.

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

int edm::WorkerInPath::timesPassed_
private

Definition at line 55 of file WorkerInPath.h.

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

int edm::WorkerInPath::timesVisited_
private

Definition at line 54 of file WorkerInPath.h.

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

Worker* edm::WorkerInPath::worker_
private

Definition at line 60 of file WorkerInPath.h.

Referenced by getWorker(), and runWorker().