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 &, StreamID streamID, typename T::Context const *context)
 
void setPathContext (PathContext const *v)
 
std::pair< double, double > timeCpuReal () const
 
int timesExcept () const
 
int timesFailed () const
 
int timesPassed () const
 
int timesVisited () const
 
void useStopwatch ()
 
 WorkerInPath (Worker *, FilterAction theAction, unsigned int placeInPath)
 

Private Attributes

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

Detailed Description

Definition at line 24 of file WorkerInPath.h.

Member Enumeration Documentation

Enumerator
Normal 
Ignore 
Veto 

Definition at line 26 of file WorkerInPath.h.

Constructor & Destructor Documentation

edm::WorkerInPath::WorkerInPath ( Worker w,
FilterAction  theAction,
unsigned int  placeInPath 
)

Definition at line 6 of file WorkerInPath.cc.

6  :
7  stopwatch_(),
9  timesPassed_(),
10  timesFailed_(),
11  timesExcept_(),
12  filterAction_(theFilterAction),
13  worker_(w),
14  placeInPathContext_(placeInPath)
15  {
16  }
FilterAction filterAction_
Definition: WorkerInPath.h:65
PlaceInPathContext placeInPathContext_
Definition: WorkerInPath.h:68
RunStopwatch::StopwatchPointer stopwatch_
Definition: WorkerInPath.h:58
T w() const

Member Function Documentation

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

Definition at line 52 of file WorkerInPath.h.

References filterAction_.

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

Definition at line 53 of file WorkerInPath.h.

References worker_.

53 { return worker_; }
template<typename T >
bool edm::WorkerInPath::runWorker ( typename T::MyPrincipal &  ep,
EventSetup const &  es,
StreamID  streamID,
typename T::Context const *  context 
)

Definition at line 72 of file WorkerInPath.h.

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

74  {
75 
76  if (T::isEvent_) {
77  ++timesVisited_;
78  }
79  bool rc = true;
80 
81  try {
82  // may want to change the return value from the worker to be
83  // the Worker::FilterAction so conditions in the path will be easier to
84  // identify
85  if(T::isEvent_) {
86  ParentContext parentContext(&placeInPathContext_);
87  rc = worker_->doWork<T>(ep, es, stopwatch_.get(),streamID, parentContext, context);
88  } else {
89  ParentContext parentContext(context);
90  rc = worker_->doWork<T>(ep, es, stopwatch_.get(),streamID, parentContext, context);
91  }
92  // Ignore return code for non-event (e.g. run, lumi) calls
93  if (!T::isEvent_) rc = true;
94  else if (filterAction_ == Veto) rc = !rc;
95  else if (filterAction_ == Ignore) rc = true;
96 
97  if (T::isEvent_) {
98  if(rc) ++timesPassed_; else ++timesFailed_;
99  }
100  }
101  catch(...) {
102  if (T::isEvent_) ++timesExcept_;
103  throw;
104  }
105 
106  return rc;
107  }
bool doWork(typename T::MyPrincipal &, EventSetup const &c, CPUTimer *const timer, StreamID stream, ParentContext const &parentContext, typename T::Context const *context)
Definition: Worker.h:397
FilterAction filterAction_
Definition: WorkerInPath.h:65
PlaceInPathContext placeInPathContext_
Definition: WorkerInPath.h:68
RunStopwatch::StopwatchPointer stopwatch_
Definition: WorkerInPath.h:58
long double T
void edm::WorkerInPath::setPathContext ( PathContext const *  v)
inline

Definition at line 55 of file WorkerInPath.h.

References placeInPathContext_, and edm::PlaceInPathContext::setPathContext().

void setPathContext(PathContext const *v)
PlaceInPathContext placeInPathContext_
Definition: WorkerInPath.h:68
std::pair<double,double> edm::WorkerInPath::timeCpuReal ( ) const
inline

Definition at line 35 of file WorkerInPath.h.

References stopwatch_.

35  {
36  if(stopwatch_) {
37  return std::pair<double,double>(stopwatch_->cpuTime(),stopwatch_->realTime());
38  }
39  return std::pair<double,double>(0.,0.);
40  }
RunStopwatch::StopwatchPointer stopwatch_
Definition: WorkerInPath.h:58
int edm::WorkerInPath::timesExcept ( ) const
inline

Definition at line 50 of file WorkerInPath.h.

References timesExcept_.

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

Definition at line 49 of file WorkerInPath.h.

References timesFailed_.

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

Definition at line 48 of file WorkerInPath.h.

References timesPassed_.

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

Definition at line 47 of file WorkerInPath.h.

References timesVisited_.

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

Definition at line 19 of file WorkerInPath.cc.

References stopwatch_.

19  {
20  stopwatch_.reset(new RunStopwatch::StopwatchPointer::element_type);
21  }
RunStopwatch::StopwatchPointer stopwatch_
Definition: WorkerInPath.h:58

Member Data Documentation

FilterAction edm::WorkerInPath::filterAction_
private

Definition at line 65 of file WorkerInPath.h.

Referenced by filterAction(), and runWorker().

PlaceInPathContext edm::WorkerInPath::placeInPathContext_
private

Definition at line 68 of file WorkerInPath.h.

Referenced by runWorker(), and setPathContext().

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

Definition at line 58 of file WorkerInPath.h.

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

int edm::WorkerInPath::timesExcept_
private

Definition at line 63 of file WorkerInPath.h.

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

int edm::WorkerInPath::timesFailed_
private

Definition at line 62 of file WorkerInPath.h.

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

int edm::WorkerInPath::timesPassed_
private

Definition at line 61 of file WorkerInPath.h.

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

int edm::WorkerInPath::timesVisited_
private

Definition at line 60 of file WorkerInPath.h.

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

Worker* edm::WorkerInPath::worker_
private

Definition at line 66 of file WorkerInPath.h.

Referenced by getWorker(), and runWorker().