CMS 3D CMS Logo

OccurrenceTraits.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_OccurrenceTraits_h
2 #define FWCore_Framework_OccurrenceTraits_h
3 
4 /*----------------------------------------------------------------------
5 
6 OccurrenceTraits:
7 
8 ----------------------------------------------------------------------*/
9 
23 
24 #include<string>
25 
26 namespace edm {
27 
28  class ProcessContext;
29 
30  template <typename T, BranchActionType B> class OccurrenceTraits;
31 
32  template <>
34  public:
37  static BranchType const branchType_ = InEvent;
38  static bool const begin_ = true;
39  static bool const isEvent_ = true;
40 
41  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
43  streamContext.setEventID(principal.id());
44  streamContext.setTimestamp(principal.time());
45  }
46 
47  static void preScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
48  a->preEventSignal_(*streamContext);
49  }
50  static void postScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
51  a->postEventSignal_(*streamContext);
52  }
53  static void prePathSignal(ActivityRegistry *a, PathContext const* pathContext) {
54  a->prePathEventSignal_(*pathContext->streamContext(), *pathContext);
55  }
56  static void postPathSignal(ActivityRegistry *a, HLTPathStatus const& status, PathContext const* pathContext) {
57  a->postPathEventSignal_(*pathContext->streamContext(), *pathContext, status);
58  }
59  };
60 
61  template <>
63  public:
66  static BranchType const branchType_ = InRun;
67  static bool const begin_ = true;
68  static bool const isEvent_ = false;
69 
70  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
72  LuminosityBlockID(principal.run(), 0),
73  principal.index(),
75  principal.beginTime(),
76  processContext);
77  }
78 
79  static void preScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
80  a->preGlobalBeginRunSignal_(*globalContext);
81  }
82  static void postScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
83  a->postGlobalBeginRunSignal_(*globalContext);
84  }
85  static void prePathSignal(ActivityRegistry *, PathContext const* ) {
86  }
87  static void postPathSignal(ActivityRegistry *, HLTPathStatus const& , PathContext const* ) {
88  }
89  static void preModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
90  a->preModuleGlobalBeginRunSignal_(*globalContext, *moduleCallingContext);
91  }
92  static void postModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
93  a->postModuleGlobalBeginRunSignal_(*globalContext, *moduleCallingContext);
94  }
95  };
96 
97  template <>
99  public:
102  static BranchType const branchType_ = InRun;
103  static bool const begin_ = true;
104  static bool const isEvent_ = false;
105 
106  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
108  streamContext.setEventID(EventID(principal.run(), 0, 0));
109  streamContext.setRunIndex(principal.index());
111  streamContext.setTimestamp(principal.beginTime());
112  }
113 
114  static void preScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
115  a->preStreamBeginRunSignal_(*streamContext);
116  }
117  static void postScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
118  a->postStreamBeginRunSignal_(*streamContext);
119  }
120  static void prePathSignal(ActivityRegistry *, PathContext const* ) {
121  }
122  static void postPathSignal(ActivityRegistry *, HLTPathStatus const& , PathContext const*) {
123  }
124  static void preModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
125  a->preModuleStreamBeginRunSignal_(*streamContext, *moduleCallingContext);
126  }
127  static void postModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
128  a->postModuleStreamBeginRunSignal_(*streamContext, *moduleCallingContext);
129  }
130  };
131 
132  template <>
134  public:
137  static BranchType const branchType_ = InRun;
138  static bool const begin_ = false;
139  static bool const isEvent_ = false;
140 
141  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
143  streamContext.setEventID(EventID(principal.run(), 0, 0));
144  streamContext.setRunIndex(principal.index());
146  streamContext.setTimestamp(principal.endTime());
147  }
148 
149  static void preScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
150  a->preStreamEndRunSignal_(*streamContext);
151  }
152  static void postScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
153  a->postStreamEndRunSignal_(*streamContext);
154  }
155  static void prePathSignal(ActivityRegistry *, PathContext const* ) {
156  }
157  static void postPathSignal(ActivityRegistry *, HLTPathStatus const& , PathContext const* ) {
158  }
159  static void preModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
160  a->preModuleStreamEndRunSignal_(*streamContext, *moduleCallingContext);
161  }
162  static void postModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
163  a->postModuleStreamEndRunSignal_(*streamContext, *moduleCallingContext);
164  }
165  };
166 
167  template <>
169  public:
172  static BranchType const branchType_ = InRun;
173  static bool const begin_ = false;
174  static bool const isEvent_ = false;
175 
176  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
178  LuminosityBlockID(principal.run(), 0),
179  principal.index(),
181  principal.endTime(),
182  processContext);
183  }
184 
185  static void preScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
186  a->preGlobalEndRunSignal_(*globalContext);
187  }
188  static void postScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
189  a->postGlobalEndRunSignal_(*globalContext);
190  }
191  static void prePathSignal(ActivityRegistry *, PathContext const*) {
192  }
193  static void postPathSignal(ActivityRegistry *, HLTPathStatus const& , PathContext const* ) {
194  }
195  static void preModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
196  a->preModuleGlobalEndRunSignal_(*globalContext, *moduleCallingContext);
197  }
198  static void postModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
199  a->postModuleGlobalEndRunSignal_(*globalContext, *moduleCallingContext);
200  }
201  };
202 
203  template <>
205  public:
208  static BranchType const branchType_ = InLumi;
209  static bool const begin_ = true;
210  static bool const isEvent_ = false;
211 
212  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
214  principal.id(),
215  principal.runPrincipal().index(),
216  principal.index(),
217  principal.beginTime(),
218  processContext);
219  }
220 
221  static void preScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
222  a->preGlobalBeginLumiSignal_(*globalContext);
223  }
224  static void postScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
225  a->postGlobalBeginLumiSignal_(*globalContext);
226  }
227  static void prePathSignal(ActivityRegistry *, PathContext const*) {
228  }
229  static void postPathSignal(ActivityRegistry *, HLTPathStatus const&, PathContext const*) {
230  }
231  static void preModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
232  a->preModuleGlobalBeginLumiSignal_(*globalContext, *moduleCallingContext);
233  }
234  static void postModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
235  a->postModuleGlobalBeginLumiSignal_(*globalContext, *moduleCallingContext);
236  }
237  };
238 
239  template <>
241  public:
244  static BranchType const branchType_ = InLumi;
245  static bool const begin_ = true;
246  static bool const isEvent_ = false;
247 
248  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
250  streamContext.setEventID(EventID(principal.run(), principal.luminosityBlock(), 0));
251  streamContext.setRunIndex(principal.runPrincipal().index());
252  streamContext.setLuminosityBlockIndex(principal.index());
253  streamContext.setTimestamp(principal.beginTime());
254  }
255 
256  static void preScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
257  a->preStreamBeginLumiSignal_(*streamContext);
258  }
259  static void postScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
260  a->postStreamBeginLumiSignal_(*streamContext);
261  }
262  static void prePathSignal(ActivityRegistry *, PathContext const*) {
263  }
264  static void postPathSignal(ActivityRegistry *, HLTPathStatus const&, PathContext const*) {
265  }
266  static void preModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
267  a->preModuleStreamBeginLumiSignal_(*streamContext, *moduleCallingContext);
268  }
269  static void postModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
270  a->postModuleStreamBeginLumiSignal_(*streamContext, *moduleCallingContext);
271  }
272  };
273 
274  template <>
276  public:
279  static BranchType const branchType_ = InLumi;
280  static bool const begin_ = false;
281  static bool const isEvent_ = false;
282 
283  static StreamContext const* context(StreamContext const* s, GlobalContext const*) { return s; }
284 
285  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
287  streamContext.setEventID(EventID(principal.run(), principal.luminosityBlock(), 0));
288  streamContext.setRunIndex(principal.runPrincipal().index());
289  streamContext.setLuminosityBlockIndex(principal.index());
290  streamContext.setTimestamp(principal.endTime());
291  }
292 
293  static void preScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
294  a->preStreamEndLumiSignal_(*streamContext);
295  }
296  static void postScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
297  a->postStreamEndLumiSignal_(*streamContext);
298  }
299  static void prePathSignal(ActivityRegistry *, PathContext const* ) {
300  }
301  static void postPathSignal(ActivityRegistry *, HLTPathStatus const&, PathContext const*) {
302  }
303  static void preModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
304  a->preModuleStreamEndLumiSignal_(*streamContext, *moduleCallingContext);
305  }
306  static void postModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
307  a->postModuleStreamEndLumiSignal_(*streamContext, *moduleCallingContext);
308  }
309  };
310 
311  template <>
313  public:
316  static BranchType const branchType_ = InLumi;
317  static bool const begin_ = false;
318  static bool const isEvent_ = false;
319 
320  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
322  principal.id(),
323  principal.runPrincipal().index(),
324  principal.index(),
325  principal.beginTime(),
326  processContext);
327  }
328 
329  static void preScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
330  a->preGlobalEndLumiSignal_(*globalContext);
331  }
332  static void postScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
333  a->postGlobalEndLumiSignal_(*globalContext);
334  }
335  static void prePathSignal(ActivityRegistry *, PathContext const*) {
336  }
337  static void postPathSignal(ActivityRegistry *, HLTPathStatus const& , PathContext const* ) {
338  }
339  static void preModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
340  a->preModuleGlobalEndLumiSignal_(*globalContext, *moduleCallingContext);
341  }
342  static void postModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
343  a->postModuleGlobalEndLumiSignal_(*globalContext, *moduleCallingContext);
344  }
345  };
346 }
347 #endif
RunPrincipal const & runPrincipal() const
PreModuleStreamBeginRun preModuleStreamBeginRunSignal_
static void postScheduleSignal(ActivityRegistry *a, GlobalContext const *globalContext)
static StreamContext const * context(StreamContext const *s, GlobalContext const *)
PreStreamBeginRun preStreamBeginRunSignal_
static void postPathSignal(ActivityRegistry *, HLTPathStatus const &, PathContext const *)
static void prePathSignal(ActivityRegistry *, PathContext const *)
PostModuleStreamEndRun postModuleStreamEndRunSignal_
static void postModuleSignal(ActivityRegistry *a, StreamContext const *streamContext, ModuleCallingContext const *moduleCallingContext)
void setTimestamp(Timestamp const &v)
Definition: StreamContext.h:69
static void preScheduleSignal(ActivityRegistry *a, GlobalContext const *globalContext)
static void preModuleSignal(ActivityRegistry *a, GlobalContext const *globalContext, ModuleCallingContext const *moduleCallingContext)
PrePathEvent prePathEventSignal_
Timestamp const & beginTime() const
PostModuleGlobalBeginRun postModuleGlobalBeginRunSignal_
static void preScheduleSignal(ActivityRegistry *a, GlobalContext const *globalContext)
PreGlobalBeginRun preGlobalBeginRunSignal_
signal is emitted after the Run has been created by the InputSource but before any modules have seen ...
static void preScheduleSignal(ActivityRegistry *a, StreamContext const *streamContext)
static void postModuleSignal(ActivityRegistry *a, GlobalContext const *globalContext, ModuleCallingContext const *moduleCallingContext)
static void postModuleSignal(ActivityRegistry *a, GlobalContext const *globalContext, ModuleCallingContext const *moduleCallingContext)
PreGlobalEndRun preGlobalEndRunSignal_
PostEvent postEventSignal_
signal is emitted after all modules have finished processing the Event
PostStreamEndLumi postStreamEndLumiSignal_
PostGlobalBeginRun postGlobalBeginRunSignal_
Timestamp const & endTime() const
EventID const & id() const
static void preModuleSignal(ActivityRegistry *a, GlobalContext const *globalContext, ModuleCallingContext const *moduleCallingContext)
static void setStreamContext(StreamContext &streamContext, MyPrincipal const &principal)
static void preModuleSignal(ActivityRegistry *a, StreamContext const *streamContext, ModuleCallingContext const *moduleCallingContext)
static void prePathSignal(ActivityRegistry *, PathContext const *)
LuminosityBlockIndex index() const
PostModuleStreamBeginLumi postModuleStreamBeginLumiSignal_
static void prePathSignal(ActivityRegistry *, PathContext const *)
RunNumber_t run() const
Definition: RunPrincipal.h:61
static void postScheduleSignal(ActivityRegistry *a, GlobalContext const *globalContext)
static void setStreamContext(StreamContext &streamContext, MyPrincipal const &principal)
static void postModuleSignal(ActivityRegistry *a, GlobalContext const *globalContext, ModuleCallingContext const *moduleCallingContext)
static void postModuleSignal(ActivityRegistry *a, GlobalContext const *globalContext, ModuleCallingContext const *moduleCallingContext)
BranchType
Definition: BranchType.h:11
PreModuleStreamEndLumi preModuleStreamEndLumiSignal_
void setTransition(Transition v)
Definition: StreamContext.h:65
PostGlobalEndLumi postGlobalEndLumiSignal_
Timestamp const & time() const
static GlobalContext makeGlobalContext(MyPrincipal const &principal, ProcessContext const *processContext)
PreGlobalBeginLumi preGlobalBeginLumiSignal_
static void postScheduleSignal(ActivityRegistry *a, StreamContext const *streamContext)
static void postPathSignal(ActivityRegistry *, HLTPathStatus const &, PathContext const *)
def principal(options)
LuminosityBlockNumber_t luminosityBlock() const
PostModuleGlobalEndRun postModuleGlobalEndRunSignal_
void setLuminosityBlockIndex(LuminosityBlockIndex const &v)
Definition: StreamContext.h:68
PostModuleGlobalEndLumi postModuleGlobalEndLumiSignal_
Timestamp const & beginTime() const
Definition: RunPrincipal.h:73
static void postScheduleSignal(ActivityRegistry *a, StreamContext const *streamContext)
PreModuleStreamEndRun preModuleStreamEndRunSignal_
PostStreamEndRun postStreamEndRunSignal_
PreStreamEndRun preStreamEndRunSignal_
static void postPathSignal(ActivityRegistry *, HLTPathStatus const &, PathContext const *)
static void preScheduleSignal(ActivityRegistry *a, GlobalContext const *globalContext)
Timestamp const & endTime() const
Definition: RunPrincipal.h:77
PreGlobalEndLumi preGlobalEndLumiSignal_
static void postScheduleSignal(ActivityRegistry *a, StreamContext const *streamContext)
static GlobalContext makeGlobalContext(MyPrincipal const &principal, ProcessContext const *processContext)
static void prePathSignal(ActivityRegistry *, PathContext const *)
static void postPathSignal(ActivityRegistry *, HLTPathStatus const &, PathContext const *)
static LuminosityBlockIndex invalidLuminosityBlockIndex()
static void preModuleSignal(ActivityRegistry *a, GlobalContext const *globalContext, ModuleCallingContext const *moduleCallingContext)
PreStreamBeginLumi preStreamBeginLumiSignal_
PreModuleStreamBeginLumi preModuleStreamBeginLumiSignal_
PostStreamBeginRun postStreamBeginRunSignal_
PreModuleGlobalBeginRun preModuleGlobalBeginRunSignal_
static void preModuleSignal(ActivityRegistry *a, StreamContext const *streamContext, ModuleCallingContext const *moduleCallingContext)
static void setStreamContext(StreamContext &streamContext, MyPrincipal const &principal)
static void postPathSignal(ActivityRegistry *, HLTPathStatus const &, PathContext const *)
static void postScheduleSignal(ActivityRegistry *a, GlobalContext const *globalContext)
static void postPathSignal(ActivityRegistry *, HLTPathStatus const &, PathContext const *)
static GlobalContext makeGlobalContext(MyPrincipal const &principal, ProcessContext const *processContext)
PreModuleGlobalBeginLumi preModuleGlobalBeginLumiSignal_
static void postModuleSignal(ActivityRegistry *a, StreamContext const *streamContext, ModuleCallingContext const *moduleCallingContext)
static void postPathSignal(ActivityRegistry *, HLTPathStatus const &, PathContext const *)
static void preModuleSignal(ActivityRegistry *a, StreamContext const *streamContext, ModuleCallingContext const *moduleCallingContext)
PreModuleGlobalEndLumi preModuleGlobalEndLumiSignal_
static void postModuleSignal(ActivityRegistry *a, StreamContext const *streamContext, ModuleCallingContext const *moduleCallingContext)
PostGlobalEndRun postGlobalEndRunSignal_
static void preScheduleSignal(ActivityRegistry *a, StreamContext const *streamContext)
static void prePathSignal(ActivityRegistry *, PathContext const *)
RunIndex index() const
Definition: RunPrincipal.h:53
static void prePathSignal(ActivityRegistry *, PathContext const *)
static void preModuleSignal(ActivityRegistry *a, StreamContext const *streamContext, ModuleCallingContext const *moduleCallingContext)
PostGlobalBeginLumi postGlobalBeginLumiSignal_
StreamContext const * streamContext() const
Definition: PathContext.h:38
void setEventID(EventID const &v)
Definition: StreamContext.h:66
HLT enums.
static void preScheduleSignal(ActivityRegistry *a, GlobalContext const *globalContext)
static void setStreamContext(StreamContext &streamContext, MyPrincipal const &principal)
double a
Definition: hdecay.h:121
static GlobalContext makeGlobalContext(MyPrincipal const &principal, ProcessContext const *processContext)
PostPathEvent postPathEventSignal_
PostStreamBeginLumi postStreamBeginLumiSignal_
static void preScheduleSignal(ActivityRegistry *a, StreamContext const *streamContext)
PreStreamEndLumi preStreamEndLumiSignal_
static void postScheduleSignal(ActivityRegistry *a, GlobalContext const *globalContext)
static void postPathSignal(ActivityRegistry *a, HLTPathStatus const &status, PathContext const *pathContext)
PostModuleStreamEndLumi postModuleStreamEndLumiSignal_
static void postScheduleSignal(ActivityRegistry *a, StreamContext const *streamContext)
PreModuleGlobalEndRun preModuleGlobalEndRunSignal_
static void prePathSignal(ActivityRegistry *, PathContext const *)
static void preScheduleSignal(ActivityRegistry *a, StreamContext const *streamContext)
static void setStreamContext(StreamContext &streamContext, MyPrincipal const &principal)
PreEvent preEventSignal_
signal is emitted after the Event has been created by the InputSource but before any modules have see...
PostModuleStreamBeginRun postModuleStreamBeginRunSignal_
static void preScheduleSignal(ActivityRegistry *a, StreamContext const *streamContext)
static void preModuleSignal(ActivityRegistry *a, GlobalContext const *globalContext, ModuleCallingContext const *moduleCallingContext)
void setRunIndex(RunIndex const &v)
Definition: StreamContext.h:67
static void prePathSignal(ActivityRegistry *a, PathContext const *pathContext)
static void postPathSignal(ActivityRegistry *, HLTPathStatus const &, PathContext const *)
static void postScheduleSignal(ActivityRegistry *a, StreamContext const *streamContext)
static void prePathSignal(ActivityRegistry *, PathContext const *)
PostModuleGlobalBeginLumi postModuleGlobalBeginLumiSignal_
static void postModuleSignal(ActivityRegistry *a, StreamContext const *streamContext, ModuleCallingContext const *moduleCallingContext)