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>
32 
33  template <>
35  public:
38  static BranchType constexpr branchType_ = InEvent;
39  static bool constexpr begin_ = true;
40  static bool constexpr isEvent_ = true;
41 
42  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
44  streamContext.setEventID(principal.id());
45  streamContext.setTimestamp(principal.time());
46  }
47 
48  static void preScheduleSignal(ActivityRegistry* a, StreamContext const* streamContext) {
49  a->preEventSignal_(*streamContext);
50  }
51  static void postScheduleSignal(ActivityRegistry* a, StreamContext const* streamContext) {
52  a->postEventSignal_(*streamContext);
53  }
54  static void prePathSignal(ActivityRegistry* a, PathContext const* pathContext) {
55  a->prePathEventSignal_(*pathContext->streamContext(), *pathContext);
56  }
57  static void postPathSignal(ActivityRegistry* a, HLTPathStatus const& status, PathContext const* pathContext) {
58  a->postPathEventSignal_(*pathContext->streamContext(), *pathContext, status);
59  }
60 
61  static const char* transitionName() { return "Event"; }
62  };
63 
64  template <>
66  public:
69  static BranchType constexpr branchType_ = InRun;
70  static bool constexpr begin_ = true;
71  static bool constexpr isEvent_ = false;
72 
73  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
75  LuminosityBlockID(principal.run(), 0),
76  principal.index(),
78  principal.beginTime(),
79  processContext);
80  }
81 
82  static void preScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) {
83  a->preGlobalBeginRunSignal_(*globalContext);
84  }
85  static void postScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) {
86  a->postGlobalBeginRunSignal_(*globalContext);
87  }
88  static void prePathSignal(ActivityRegistry*, PathContext const*) {}
89  static void postPathSignal(ActivityRegistry*, HLTPathStatus const&, PathContext const*) {}
91  GlobalContext const* globalContext,
92  ModuleCallingContext const* moduleCallingContext) {
93  a->preModuleGlobalBeginRunSignal_(*globalContext, *moduleCallingContext);
94  }
96  GlobalContext const* globalContext,
97  ModuleCallingContext const* moduleCallingContext) {
98  a->postModuleGlobalBeginRunSignal_(*globalContext, *moduleCallingContext);
99  }
100  static const char* transitionName() { return "global begin Run"; }
101  };
102 
103  template <>
105  public:
108  static BranchType constexpr branchType_ = InRun;
109  static bool constexpr begin_ = true;
110  static bool constexpr isEvent_ = false;
111 
112  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
114  streamContext.setEventID(EventID(principal.run(), 0, 0));
115  streamContext.setRunIndex(principal.index());
117  streamContext.setTimestamp(principal.beginTime());
118  }
119 
120  static void preScheduleSignal(ActivityRegistry* a, StreamContext const* streamContext) {
121  a->preStreamBeginRunSignal_(*streamContext);
122  }
123  static void postScheduleSignal(ActivityRegistry* a, StreamContext const* streamContext) {
124  a->postStreamBeginRunSignal_(*streamContext);
125  }
126  static void prePathSignal(ActivityRegistry*, PathContext const*) {}
127  static void postPathSignal(ActivityRegistry*, HLTPathStatus const&, PathContext const*) {}
129  StreamContext const* streamContext,
130  ModuleCallingContext const* moduleCallingContext) {
131  a->preModuleStreamBeginRunSignal_(*streamContext, *moduleCallingContext);
132  }
134  StreamContext const* streamContext,
135  ModuleCallingContext const* moduleCallingContext) {
136  a->postModuleStreamBeginRunSignal_(*streamContext, *moduleCallingContext);
137  }
138  static const char* transitionName() { return "stream begin Run"; }
139  };
140 
141  template <>
143  public:
146  static BranchType constexpr branchType_ = InRun;
147  static bool constexpr begin_ = false;
148  static bool constexpr isEvent_ = false;
149 
150  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
152  streamContext.setEventID(EventID(principal.run(), 0, 0));
153  streamContext.setRunIndex(principal.index());
155  streamContext.setTimestamp(principal.endTime());
156  }
157 
158  static void preScheduleSignal(ActivityRegistry* a, StreamContext const* streamContext) {
159  a->preStreamEndRunSignal_(*streamContext);
160  }
161  static void postScheduleSignal(ActivityRegistry* a, StreamContext const* streamContext) {
162  a->postStreamEndRunSignal_(*streamContext);
163  }
164  static void prePathSignal(ActivityRegistry*, PathContext const*) {}
165  static void postPathSignal(ActivityRegistry*, HLTPathStatus const&, PathContext const*) {}
167  StreamContext const* streamContext,
168  ModuleCallingContext const* moduleCallingContext) {
169  a->preModuleStreamEndRunSignal_(*streamContext, *moduleCallingContext);
170  }
172  StreamContext const* streamContext,
173  ModuleCallingContext const* moduleCallingContext) {
174  a->postModuleStreamEndRunSignal_(*streamContext, *moduleCallingContext);
175  }
176  static const char* transitionName() { return "stream end Run"; }
177  };
178 
179  template <>
181  public:
184  static BranchType constexpr branchType_ = InRun;
185  static bool constexpr begin_ = false;
186  static bool constexpr isEvent_ = false;
187 
188  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
190  LuminosityBlockID(principal.run(), 0),
191  principal.index(),
193  principal.endTime(),
194  processContext);
195  }
196 
197  static void preScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) {
198  a->preGlobalEndRunSignal_(*globalContext);
199  }
200  static void postScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) {
201  a->postGlobalEndRunSignal_(*globalContext);
202  }
203  static void prePathSignal(ActivityRegistry*, PathContext const*) {}
204  static void postPathSignal(ActivityRegistry*, HLTPathStatus const&, PathContext const*) {}
206  GlobalContext const* globalContext,
207  ModuleCallingContext const* moduleCallingContext) {
208  a->preModuleGlobalEndRunSignal_(*globalContext, *moduleCallingContext);
209  }
211  GlobalContext const* globalContext,
212  ModuleCallingContext const* moduleCallingContext) {
213  a->postModuleGlobalEndRunSignal_(*globalContext, *moduleCallingContext);
214  }
215  static const char* transitionName() { return "global end Run"; }
216  };
217 
218  template <>
220  public:
223  static BranchType constexpr branchType_ = InLumi;
224  static bool constexpr begin_ = true;
225  static bool constexpr isEvent_ = false;
226 
227  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
229  principal.id(),
230  principal.runPrincipal().index(),
231  principal.index(),
232  principal.beginTime(),
233  processContext);
234  }
235 
236  static void preScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) {
237  a->preGlobalBeginLumiSignal_(*globalContext);
238  }
239  static void postScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) {
240  a->postGlobalBeginLumiSignal_(*globalContext);
241  }
242  static void prePathSignal(ActivityRegistry*, PathContext const*) {}
243  static void postPathSignal(ActivityRegistry*, HLTPathStatus const&, PathContext const*) {}
245  GlobalContext const* globalContext,
246  ModuleCallingContext const* moduleCallingContext) {
247  a->preModuleGlobalBeginLumiSignal_(*globalContext, *moduleCallingContext);
248  }
250  GlobalContext const* globalContext,
251  ModuleCallingContext const* moduleCallingContext) {
252  a->postModuleGlobalBeginLumiSignal_(*globalContext, *moduleCallingContext);
253  }
254  static const char* transitionName() { return "global begin LuminosityBlock"; }
255  };
256 
257  template <>
259  public:
262  static BranchType constexpr branchType_ = InLumi;
263  static bool constexpr begin_ = true;
264  static bool constexpr isEvent_ = false;
265 
266  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
268  streamContext.setEventID(EventID(principal.run(), principal.luminosityBlock(), 0));
269  streamContext.setRunIndex(principal.runPrincipal().index());
270  streamContext.setLuminosityBlockIndex(principal.index());
271  streamContext.setTimestamp(principal.beginTime());
272  }
273 
274  static void preScheduleSignal(ActivityRegistry* a, StreamContext const* streamContext) {
275  a->preStreamBeginLumiSignal_(*streamContext);
276  }
277  static void postScheduleSignal(ActivityRegistry* a, StreamContext const* streamContext) {
278  a->postStreamBeginLumiSignal_(*streamContext);
279  }
280  static void prePathSignal(ActivityRegistry*, PathContext const*) {}
281  static void postPathSignal(ActivityRegistry*, HLTPathStatus const&, PathContext const*) {}
283  StreamContext const* streamContext,
284  ModuleCallingContext const* moduleCallingContext) {
285  a->preModuleStreamBeginLumiSignal_(*streamContext, *moduleCallingContext);
286  }
288  StreamContext const* streamContext,
289  ModuleCallingContext const* moduleCallingContext) {
290  a->postModuleStreamBeginLumiSignal_(*streamContext, *moduleCallingContext);
291  }
292  static const char* transitionName() { return "stream begin LuminosityBlock"; }
293  };
294 
295  template <>
297  public:
300  static BranchType constexpr branchType_ = InLumi;
301  static bool constexpr begin_ = false;
302  static bool constexpr isEvent_ = false;
303 
304  static StreamContext const* context(StreamContext const* s, GlobalContext const*) { return s; }
305 
306  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
308  streamContext.setEventID(EventID(principal.run(), principal.luminosityBlock(), 0));
309  streamContext.setRunIndex(principal.runPrincipal().index());
310  streamContext.setLuminosityBlockIndex(principal.index());
311  streamContext.setTimestamp(principal.endTime());
312  }
313 
314  static void preScheduleSignal(ActivityRegistry* a, StreamContext const* streamContext) {
315  a->preStreamEndLumiSignal_(*streamContext);
316  }
317  static void postScheduleSignal(ActivityRegistry* a, StreamContext const* streamContext) {
318  a->postStreamEndLumiSignal_(*streamContext);
319  }
320  static void prePathSignal(ActivityRegistry*, PathContext const*) {}
321  static void postPathSignal(ActivityRegistry*, HLTPathStatus const&, PathContext const*) {}
323  StreamContext const* streamContext,
324  ModuleCallingContext const* moduleCallingContext) {
325  a->preModuleStreamEndLumiSignal_(*streamContext, *moduleCallingContext);
326  }
328  StreamContext const* streamContext,
329  ModuleCallingContext const* moduleCallingContext) {
330  a->postModuleStreamEndLumiSignal_(*streamContext, *moduleCallingContext);
331  }
332  static const char* transitionName() { return "end stream LuminosityBlock"; }
333  };
334 
335  template <>
337  public:
340  static BranchType constexpr branchType_ = InLumi;
341  static bool constexpr begin_ = false;
342  static bool constexpr isEvent_ = false;
343 
344  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
346  principal.id(),
347  principal.runPrincipal().index(),
348  principal.index(),
349  principal.beginTime(),
350  processContext);
351  }
352 
353  static void preScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) {
354  a->preGlobalEndLumiSignal_(*globalContext);
355  }
356  static void postScheduleSignal(ActivityRegistry* a, GlobalContext const* globalContext) {
357  a->postGlobalEndLumiSignal_(*globalContext);
358  }
359  static void prePathSignal(ActivityRegistry*, PathContext const*) {}
360  static void postPathSignal(ActivityRegistry*, HLTPathStatus const&, PathContext const*) {}
362  GlobalContext const* globalContext,
363  ModuleCallingContext const* moduleCallingContext) {
364  a->preModuleGlobalEndLumiSignal_(*globalContext, *moduleCallingContext);
365  }
367  GlobalContext const* globalContext,
368  ModuleCallingContext const* moduleCallingContext) {
369  a->postModuleGlobalEndLumiSignal_(*globalContext, *moduleCallingContext);
370  }
371  static const char* transitionName() { return "end global LuminosityBlock"; }
372  };
373 } // namespace edm
374 #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:60
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:66
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:68
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:56
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:31
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)
#define constexpr
static void prePathSignal(ActivityRegistry *, PathContext const *)
PostModuleGlobalBeginLumi postModuleGlobalBeginLumiSignal_
static void postModuleSignal(ActivityRegistry *a, StreamContext const *streamContext, ModuleCallingContext const *moduleCallingContext)