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 constexpr branchType_ = InEvent;
38  static bool constexpr begin_ = true;
39  static bool constexpr 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  static const char* transitionName() {
61  return "Event";
62  }
63  };
64 
65  template <>
67  public:
70  static BranchType constexpr branchType_ = InRun;
71  static bool constexpr begin_ = true;
72  static bool constexpr isEvent_ = false;
73 
74  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
76  LuminosityBlockID(principal.run(), 0),
77  principal.index(),
79  principal.beginTime(),
80  processContext);
81  }
82 
83  static void preScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
84  a->preGlobalBeginRunSignal_(*globalContext);
85  }
86  static void postScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
87  a->postGlobalBeginRunSignal_(*globalContext);
88  }
89  static void prePathSignal(ActivityRegistry *, PathContext const* ) {
90  }
91  static void postPathSignal(ActivityRegistry *, HLTPathStatus const& , PathContext const* ) {
92  }
93  static void preModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
94  a->preModuleGlobalBeginRunSignal_(*globalContext, *moduleCallingContext);
95  }
96  static void postModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
97  a->postModuleGlobalBeginRunSignal_(*globalContext, *moduleCallingContext);
98  }
99  static const char* transitionName() {
100  return "global begin Run";
101  }
102  };
103 
104  template <>
106  public:
109  static BranchType constexpr branchType_ = InRun;
110  static bool constexpr begin_ = true;
111  static bool constexpr isEvent_ = false;
112 
113  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
115  streamContext.setEventID(EventID(principal.run(), 0, 0));
116  streamContext.setRunIndex(principal.index());
118  streamContext.setTimestamp(principal.beginTime());
119  }
120 
121  static void preScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
122  a->preStreamBeginRunSignal_(*streamContext);
123  }
124  static void postScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
125  a->postStreamBeginRunSignal_(*streamContext);
126  }
127  static void prePathSignal(ActivityRegistry *, PathContext const* ) {
128  }
129  static void postPathSignal(ActivityRegistry *, HLTPathStatus const& , PathContext const*) {
130  }
131  static void preModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
132  a->preModuleStreamBeginRunSignal_(*streamContext, *moduleCallingContext);
133  }
134  static void postModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
135  a->postModuleStreamBeginRunSignal_(*streamContext, *moduleCallingContext);
136  }
137  static const char* transitionName() {
138  return "stream begin Run";
139  }
140  };
141 
142  template <>
144  public:
147  static BranchType constexpr branchType_ = InRun;
148  static bool constexpr begin_ = false;
149  static bool constexpr isEvent_ = false;
150 
151  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
153  streamContext.setEventID(EventID(principal.run(), 0, 0));
154  streamContext.setRunIndex(principal.index());
156  streamContext.setTimestamp(principal.endTime());
157  }
158 
159  static void preScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
160  a->preStreamEndRunSignal_(*streamContext);
161  }
162  static void postScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
163  a->postStreamEndRunSignal_(*streamContext);
164  }
165  static void prePathSignal(ActivityRegistry *, PathContext const* ) {
166  }
167  static void postPathSignal(ActivityRegistry *, HLTPathStatus const& , PathContext const* ) {
168  }
169  static void preModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
170  a->preModuleStreamEndRunSignal_(*streamContext, *moduleCallingContext);
171  }
172  static void postModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
173  a->postModuleStreamEndRunSignal_(*streamContext, *moduleCallingContext);
174  }
175  static const char* transitionName() {
176  return "stream end Run";
177  }
178  };
179 
180  template <>
182  public:
185  static BranchType constexpr branchType_ = InRun;
186  static bool constexpr begin_ = false;
187  static bool constexpr isEvent_ = false;
188 
189  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
191  LuminosityBlockID(principal.run(), 0),
192  principal.index(),
194  principal.endTime(),
195  processContext);
196  }
197 
198  static void preScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
199  a->preGlobalEndRunSignal_(*globalContext);
200  }
201  static void postScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
202  a->postGlobalEndRunSignal_(*globalContext);
203  }
204  static void prePathSignal(ActivityRegistry *, PathContext const*) {
205  }
206  static void postPathSignal(ActivityRegistry *, HLTPathStatus const& , PathContext const* ) {
207  }
208  static void preModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
209  a->preModuleGlobalEndRunSignal_(*globalContext, *moduleCallingContext);
210  }
211  static void postModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
212  a->postModuleGlobalEndRunSignal_(*globalContext, *moduleCallingContext);
213  }
214  static const char* transitionName() {
215  return "global end Run";
216  }
217  };
218 
219  template <>
221  public:
224  static BranchType constexpr branchType_ = InLumi;
225  static bool constexpr begin_ = true;
226  static bool constexpr isEvent_ = false;
227 
228  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
230  principal.id(),
231  principal.runPrincipal().index(),
232  principal.index(),
233  principal.beginTime(),
234  processContext);
235  }
236 
237  static void preScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
238  a->preGlobalBeginLumiSignal_(*globalContext);
239  }
240  static void postScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
241  a->postGlobalBeginLumiSignal_(*globalContext);
242  }
243  static void prePathSignal(ActivityRegistry *, PathContext const*) {
244  }
245  static void postPathSignal(ActivityRegistry *, HLTPathStatus const&, PathContext const*) {
246  }
247  static void preModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
248  a->preModuleGlobalBeginLumiSignal_(*globalContext, *moduleCallingContext);
249  }
250  static void postModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
251  a->postModuleGlobalBeginLumiSignal_(*globalContext, *moduleCallingContext);
252  }
253  static const char* transitionName() {
254  return "global begin LuminosityBlock";
255  }
256  };
257 
258  template <>
260  public:
263  static BranchType constexpr branchType_ = InLumi;
264  static bool constexpr begin_ = true;
265  static bool constexpr isEvent_ = false;
266 
267  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
269  streamContext.setEventID(EventID(principal.run(), principal.luminosityBlock(), 0));
270  streamContext.setRunIndex(principal.runPrincipal().index());
271  streamContext.setLuminosityBlockIndex(principal.index());
272  streamContext.setTimestamp(principal.beginTime());
273  }
274 
275  static void preScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
276  a->preStreamBeginLumiSignal_(*streamContext);
277  }
278  static void postScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
279  a->postStreamBeginLumiSignal_(*streamContext);
280  }
281  static void prePathSignal(ActivityRegistry *, PathContext const*) {
282  }
283  static void postPathSignal(ActivityRegistry *, HLTPathStatus const&, PathContext const*) {
284  }
285  static void preModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
286  a->preModuleStreamBeginLumiSignal_(*streamContext, *moduleCallingContext);
287  }
288  static void postModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
289  a->postModuleStreamBeginLumiSignal_(*streamContext, *moduleCallingContext);
290  }
291  static const char* transitionName() {
292  return "stream begin LuminosityBlock";
293  }
294  };
295 
296  template <>
298  public:
301  static BranchType constexpr branchType_ = InLumi;
302  static bool constexpr begin_ = false;
303  static bool constexpr isEvent_ = false;
304 
305  static StreamContext const* context(StreamContext const* s, GlobalContext const*) { return s; }
306 
307  static void setStreamContext(StreamContext& streamContext, MyPrincipal const& principal) {
309  streamContext.setEventID(EventID(principal.run(), principal.luminosityBlock(), 0));
310  streamContext.setRunIndex(principal.runPrincipal().index());
311  streamContext.setLuminosityBlockIndex(principal.index());
312  streamContext.setTimestamp(principal.endTime());
313  }
314 
315  static void preScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
316  a->preStreamEndLumiSignal_(*streamContext);
317  }
318  static void postScheduleSignal(ActivityRegistry *a, StreamContext const* streamContext) {
319  a->postStreamEndLumiSignal_(*streamContext);
320  }
321  static void prePathSignal(ActivityRegistry *, PathContext const* ) {
322  }
323  static void postPathSignal(ActivityRegistry *, HLTPathStatus const&, PathContext const*) {
324  }
325  static void preModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
326  a->preModuleStreamEndLumiSignal_(*streamContext, *moduleCallingContext);
327  }
328  static void postModuleSignal(ActivityRegistry *a, StreamContext const* streamContext, ModuleCallingContext const* moduleCallingContext) {
329  a->postModuleStreamEndLumiSignal_(*streamContext, *moduleCallingContext);
330  }
331  static const char* transitionName() {
332  return "end stream LuminosityBlock";
333  }
334  };
335 
336  template <>
338  public:
341  static BranchType constexpr branchType_ = InLumi;
342  static bool constexpr begin_ = false;
343  static bool constexpr isEvent_ = false;
344 
345  static GlobalContext makeGlobalContext(MyPrincipal const& principal, ProcessContext const* processContext) {
347  principal.id(),
348  principal.runPrincipal().index(),
349  principal.index(),
350  principal.beginTime(),
351  processContext);
352  }
353 
354  static void preScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
355  a->preGlobalEndLumiSignal_(*globalContext);
356  }
357  static void postScheduleSignal(ActivityRegistry *a, GlobalContext const* globalContext) {
358  a->postGlobalEndLumiSignal_(*globalContext);
359  }
360  static void prePathSignal(ActivityRegistry *, PathContext const*) {
361  }
362  static void postPathSignal(ActivityRegistry *, HLTPathStatus const& , PathContext const* ) {
363  }
364  static void preModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
365  a->preModuleGlobalEndLumiSignal_(*globalContext, *moduleCallingContext);
366  }
367  static void postModuleSignal(ActivityRegistry *a, GlobalContext const* globalContext, ModuleCallingContext const* moduleCallingContext) {
368  a->postModuleGlobalEndLumiSignal_(*globalContext, *moduleCallingContext);
369  }
370  static const char* transitionName() {
371  return "end global LuminosityBlock";
372  }
373  };
374 }
375 #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)
#define constexpr
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)