test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
FWCore
Framework
src
WorkerInPath.h
Go to the documentation of this file.
1
#ifndef FWCore_Framework_WorkerInPath_h
2
#define FWCore_Framework_WorkerInPath_h
3
4
/*
5
6
Author: Jim Kowalkowski 28-01-06
7
8
9
A wrapper around a Worker, so that statistics can be managed
10
per path. A Path holds Workers as these things.
11
12
*/
13
14
#include "
FWCore/Framework/src/Worker.h
"
15
#include "
FWCore/ServiceRegistry/interface/ParentContext.h
"
16
#include "
FWCore/ServiceRegistry/interface/PlaceInPathContext.h
"
17
18
namespace
edm {
19
20
class
PathContext;
21
class
StreamID;
22
23
class
WorkerInPath
{
24
public
:
25
enum
FilterAction
{
Normal
=0,
Ignore
,
Veto
};
26
27
WorkerInPath
(
Worker
*,
FilterAction
theAction,
unsigned
int
placeInPath);
28
29
template
<
typename
T>
30
bool
runWorker
(
typename
T::MyPrincipal
const
&,
EventSetup
const
&,
31
StreamID
streamID,
32
typename
T::Context
const
* context);
33
34
void
clearCounters
() {
35
timesVisited_
=
timesPassed_
=
timesFailed_
=
timesExcept_
= 0;
36
}
37
38
int
timesVisited
()
const
{
return
timesVisited_
; }
39
int
timesPassed
()
const
{
return
timesPassed_
; }
40
int
timesFailed
()
const
{
return
timesFailed_
; }
41
int
timesExcept
()
const
{
return
timesExcept_
; }
42
43
FilterAction
filterAction
()
const
{
return
filterAction_
; }
44
Worker
*
getWorker
()
const
{
return
worker_
; }
45
46
void
setPathContext
(
PathContext
const
*
v
) {
placeInPathContext_
.
setPathContext
(v); }
47
48
private
:
49
int
timesVisited_
;
50
int
timesPassed_
;
51
int
timesFailed_
;
52
int
timesExcept_
;
53
54
FilterAction
filterAction_
;
55
Worker
*
worker_
;
56
57
PlaceInPathContext
placeInPathContext_
;
58
};
59
60
template
<
typename
T>
61
bool
WorkerInPath::runWorker
(
typename
T::MyPrincipal
const
& ep,
EventSetup
const
& es,
62
StreamID
streamID,
63
typename
T::Context
const
* context) {
64
65
if
(T::isEvent_) {
66
++
timesVisited_
;
67
}
68
bool
rc =
true
;
69
70
try
{
71
// may want to change the return value from the worker to be
72
// the Worker::FilterAction so conditions in the path will be easier to
73
// identify
74
if
(T::isEvent_) {
75
ParentContext
parentContext(&
placeInPathContext_
);
76
rc =
worker_
->
doWork
<
T
>(ep, es,streamID, parentContext, context);
77
}
else
{
78
ParentContext
parentContext(context);
79
rc =
worker_
->
doWork
<
T
>(ep, es,streamID, parentContext, context);
80
}
81
// Ignore return code for non-event (e.g. run, lumi) calls
82
if
(!T::isEvent_) rc =
true
;
83
else
if
(
filterAction_
==
Veto
) rc = !rc;
84
else
if
(
filterAction_
==
Ignore
) rc =
true
;
85
86
if
(T::isEvent_) {
87
if
(rc) ++
timesPassed_
;
else
++
timesFailed_
;
88
}
89
}
90
catch
(...) {
91
if
(T::isEvent_) ++
timesExcept_
;
92
throw
;
93
}
94
95
return
rc;
96
}
97
98
}
99
100
#endif
101
Worker.h
edm::WorkerInPath::timesVisited
int timesVisited() const
Definition:
WorkerInPath.h:38
edm::WorkerInPath::worker_
Worker * worker_
Definition:
WorkerInPath.h:55
edm::PlaceInPathContext::setPathContext
void setPathContext(PathContext const *v)
Definition:
PlaceInPathContext.h:28
edm::WorkerInPath::timesExcept
int timesExcept() const
Definition:
WorkerInPath.h:41
edm::WorkerInPath
Definition:
WorkerInPath.h:23
edm::WorkerInPath::runWorker
bool runWorker(typename T::MyPrincipal const &, EventSetup const &, StreamID streamID, typename T::Context const *context)
Definition:
WorkerInPath.h:61
edm::StreamID
Definition:
StreamID.h:30
edm::WorkerInPath::Veto
Definition:
WorkerInPath.h:25
edm::WorkerInPath::FilterAction
FilterAction
Definition:
WorkerInPath.h:25
edm::Worker::doWork
bool doWork(typename T::MyPrincipal const &, EventSetup const &c, StreamID stream, ParentContext const &parentContext, typename T::Context const *context)
Definition:
Worker.h:452
edm::PlaceInPathContext
Definition:
PlaceInPathContext.h:19
findQualityFiles.v
v
Definition:
findQualityFiles.py:177
edm::WorkerInPath::filterAction
FilterAction filterAction() const
Definition:
WorkerInPath.h:43
edm::WorkerInPath::timesExcept_
int timesExcept_
Definition:
WorkerInPath.h:52
edm::PathContext
Definition:
PathContext.h:24
edm::WorkerInPath::setPathContext
void setPathContext(PathContext const *v)
Definition:
WorkerInPath.h:46
ParentContext.h
edm::WorkerInPath::getWorker
Worker * getWorker() const
Definition:
WorkerInPath.h:44
edm::EventSetup
Definition:
EventSetup.h:45
edm::WorkerInPath::timesVisited_
int timesVisited_
Definition:
WorkerInPath.h:49
edm::WorkerInPath::timesPassed_
int timesPassed_
Definition:
WorkerInPath.h:50
edm::WorkerInPath::filterAction_
FilterAction filterAction_
Definition:
WorkerInPath.h:54
edm::WorkerInPath::placeInPathContext_
PlaceInPathContext placeInPathContext_
Definition:
WorkerInPath.h:57
edm::WorkerInPath::timesFailed_
int timesFailed_
Definition:
WorkerInPath.h:51
edm::WorkerInPath::timesFailed
int timesFailed() const
Definition:
WorkerInPath.h:40
edm::WorkerInPath::Normal
Definition:
WorkerInPath.h:25
edm::WorkerInPath::clearCounters
void clearCounters()
Definition:
WorkerInPath.h:34
PlaceInPathContext.h
edm::WorkerInPath::WorkerInPath
WorkerInPath(Worker *, FilterAction theAction, unsigned int placeInPath)
Definition:
WorkerInPath.cc:6
edm::WorkerInPath::timesPassed
int timesPassed() const
Definition:
WorkerInPath.h:39
T
long double T
Definition:
Basic3DVectorLD.h:57
edm::ParentContext
Definition:
ParentContext.h:27
edm::WorkerInPath::Ignore
Definition:
WorkerInPath.h:25
edm::Worker
Definition:
Worker.h:68
Generated for CMSSW Reference Manual by
1.8.5