CMS 3D CMS Logo

callAbilities.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_stream_callAbilities_h
2 #define FWCore_Framework_stream_callAbilities_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : callAbilities
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Sat, 03 Aug 2013 16:28:35 GMT
19 //
20 
21 // system include files
22 #include <memory>
23 #include <type_traits>
24 // user include files
26 
27 // forward declarations
28 namespace edm {
29  class Run;
30  class EventSetup;
31  class LuminosityBlock;
32  namespace stream {
33  //********************************
34  // CallGlobal
35  //********************************
36  namespace callGlobalDetail {
37  template <typename, typename = std::void_t<>>
38  struct has_globalBeginJob : std::false_type {};
39 
40  template <typename T>
41  struct has_globalBeginJob<T, std::void_t<decltype(T::globalBeginJob(nullptr))>> : std::true_type {};
42  } // namespace callGlobalDetail
43  template <typename T, bool>
44  struct CallGlobalImpl {
45  template <typename B>
46  static void set(B* iProd, typename T::GlobalCache const* iCache) {
47  static_cast<T*>(iProd)->setGlobalCache(iCache);
48  }
49  static void beginJob(typename T::GlobalCache* iCache) {
51  T::globalBeginJob(iCache);
52  }
53  }
54  static void endJob(typename T::GlobalCache* iCache) { T::globalEndJob(iCache); }
55  };
56  template <typename T>
57  struct CallGlobalImpl<T, false> {
58  static void set(void* iProd, void const* iCache) {}
59  static void beginJob(void* iCache) {}
60  static void endJob(void* iCache) {}
61  };
62 
63  template <typename T>
65  //********************************
66  // CallGlobalRun
67  //********************************
68  template <typename T, bool>
70  static void beginRun(edm::Run const& iRun,
71  edm::EventSetup const& iES,
72  typename T::GlobalCache const* iGC,
73  std::shared_ptr<typename T::RunCache const>& oCache) {
74  oCache = T::globalBeginRun(iRun, iES, iGC);
75  }
76 
77  template <typename B>
78  static void set(B* iProd, typename T::RunCache const* iCache) {
79  static_cast<T*>(iProd)->setRunCache(iCache);
80  }
81 
82  static void endRun(edm::Run const& iRun, edm::EventSetup const& iES, typename T::RunContext const* iContext) {
83  T::globalEndRun(iRun, iES, iContext);
84  }
85  };
86 
87  template <typename T>
89  static void beginRun(edm::Run const&, edm::EventSetup const&, typename T::GlobalCache const*, impl::dummy_ptr) {}
90  static void set(void* iProd, typename T::RunCache const* iCache) {}
91  static void endRun(edm::Run const&, edm::EventSetup const&, typename T::RunContext const*) {}
92  };
93 
94  template <typename T>
96 
97  //********************************
98  // CallGlobalRunSummary
99  //********************************
100  template <typename T, bool>
102  static void beginRun(edm::Run const& iRun,
103  edm::EventSetup const& iES,
104  typename T::RunContext const* iRC,
105  std::shared_ptr<typename T::RunSummaryCache>& oCache) {
106  oCache = T::globalBeginRunSummary(iRun, iES, iRC);
107  }
108  template <typename B>
109  static void streamEndRunSummary(B* iProd,
110  edm::Run const& iRun,
111  edm::EventSetup const& iES,
112  typename T::RunSummaryCache* iCache) {
113  static_cast<T*>(iProd)->endRunSummary(iRun, iES, iCache);
114  }
115 
116  static void globalEndRun(edm::Run const& iRun,
117  edm::EventSetup const& iES,
118  typename T::RunContext const* iContext,
119  typename T::RunSummaryCache* iCache) {
120  T::globalEndRunSummary(iRun, iES, iContext, iCache);
121  }
122  };
123 
124  template <typename T>
126  static void beginRun(edm::Run const&, edm::EventSetup const&, typename T::RunContext const*, impl::dummy_ptr) {}
127  static void streamEndRunSummary(void* iProd,
128  edm::Run const&,
129  edm::EventSetup const&,
130  typename T::RunSummaryCache const* iCache) {}
131  static void globalEndRun(edm::Run const&,
132  edm::EventSetup const&,
133  typename T::RunContext const*,
134  typename T::RunSummaryCache*) {}
135  };
136 
137  template <typename T>
139 
140  //********************************
141  // CallGlobalLuminosityBlock
142  //********************************
143  template <typename T, bool>
146  edm::EventSetup const& iES,
147  typename T::RunContext const* iRC,
148  std::shared_ptr<typename T::LuminosityBlockCache const>& oCache) {
149  oCache = T::globalBeginLuminosityBlock(Lumi, iES, iRC);
150  }
151 
152  template <typename B>
153  static void set(B* iProd, typename T::LuminosityBlockCache const* iCache) {
154  static_cast<T*>(iProd)->setLuminosityBlockCache(iCache);
155  }
156 
158  edm::EventSetup const& iES,
159  typename T::LuminosityBlockContext const* iContext) {
160  T::globalEndLuminosityBlock(Lumi, iES, iContext);
161  }
162  };
163 
164  template <typename T>
167  edm::EventSetup const&,
168  typename T::RunContext const*,
169  impl::dummy_ptr) {}
170  static void set(void* iProd, typename T::LuminosityBlockCache const* iCache) {}
172  edm::EventSetup const&,
173  typename T::LuminosityBlockContext const*) {}
174  };
175  template <typename T>
177 
178  //********************************
179  // CallGlobalLuminosityBlockSummary
180  //********************************
181  template <typename T, bool>
184  edm::EventSetup const& iES,
185  typename T::LuminosityBlockContext const* iRC,
186  std::shared_ptr<typename T::LuminosityBlockSummaryCache>& oCache) {
187  oCache = T::globalBeginLuminosityBlockSummary(Lumi, iES, iRC);
188  }
189  template <typename B>
190  static void streamEndLuminosityBlockSummary(B* iProd,
191  edm::LuminosityBlock const& iLumi,
192  edm::EventSetup const& iES,
193  typename T::LuminosityBlockSummaryCache* iCache) {
194  static_cast<T*>(iProd)->endLuminosityBlockSummary(iLumi, iES, iCache);
195  }
196 
198  edm::EventSetup const& iES,
199  typename T::LuminosityBlockContext const* iContext,
200  typename T::LuminosityBlockSummaryCache* iCache) {
201  T::globalEndLuminosityBlockSummary(Lumi, iES, iContext, iCache);
202  }
203  };
204 
205  template <typename T>
208  edm::EventSetup const&,
209  typename T::LuminosityBlockContext const*,
210  impl::dummy_ptr) {}
211  static void streamEndLuminosityBlockSummary(void* iProd,
212  edm::LuminosityBlock const&,
213  edm::EventSetup const&,
214  typename T::LuminosityBlockSummaryCache* iCache) {}
216  edm::EventSetup const&,
217  typename T::LuminosityBlockContext const*,
218  typename T::LuminosityBlockSummaryCache*) {}
219  };
220 
221  template <typename T>
224 
225  //********************************
226  // CallBeginRunProduce
227  //********************************
228  template <typename T, bool>
230  static void produce(edm::Run& iRun, edm::EventSetup const& iES, typename T::RunContext const* iRC) {
231  T::globalBeginRunProduce(iRun, iES, iRC);
232  }
233  };
234 
235  template <typename T>
237  static void produce(edm::Run& iRun, edm::EventSetup const& iES, typename T::RunContext const* iRC) {}
238  };
239 
240  template <typename T>
242 
243  //********************************
244  // CallEndRunProduce
245  //********************************
246  template <typename T, bool bProduce, bool bSummary>
248  static void produce(edm::Run&,
249  edm::EventSetup const&,
250  typename T::RunContext const*,
251  typename T::RunSummaryCache const*) {}
252  };
253 
254  template <typename T>
256  static void produce(edm::Run& iRun,
257  edm::EventSetup const& iES,
258  typename T::RunContext const* iRC,
259  typename T::RunSummaryCache const*) {
260  T::globalEndRunProduce(iRun, iES, iRC);
261  }
262  };
263 
264  template <typename T>
266  static void produce(edm::Run& iRun,
267  edm::EventSetup const& iES,
268  typename T::RunContext const* iRC,
269  typename T::RunSummaryCache const* iRS) {
270  T::globalEndRunProduce(iRun, iES, iRC, iRS);
271  }
272  };
273 
274  template <typename T>
276 
277  //********************************
278  // CallBeginLuminosityBlockProduce
279  //********************************
280  template <typename T, bool>
283  edm::EventSetup const& iES,
284  typename T::LuminosityBlockContext const* iRC) {
285  T::globalBeginLuminosityBlockProduce(Lumi, iES, iRC);
286  }
287  };
288 
289  template <typename T>
292  edm::EventSetup const& iES,
293  typename T::LuminosityBlockContext const* iRC) {}
294  };
295 
296  template <typename T>
299 
300  //********************************
301  // CallEndLuminosityBlockProduce
302  //********************************
303  template <typename T, bool bProduce, bool bSummary>
306  edm::EventSetup const&,
307  typename T::LuminosityBlockContext const*,
308  typename T::LuminosityBlockSummaryCache const*) {}
309  };
310 
311  template <typename T>
314  edm::EventSetup const& iES,
315  typename T::LuminosityBlockContext const* iRC,
316  typename T::LuminosityBlockSummaryCache const*) {
317  T::globalEndLuminosityBlockProduce(Lumi, iES, iRC);
318  }
319  };
320 
321  template <typename T>
324  edm::EventSetup const& iES,
325  typename T::LuminosityBlockContext const* iRC,
326  typename T::LuminosityBlockSummaryCache const* iRS) {
327  T::globalEndLuminosityBlockProduce(Lumi, iES, iRC, iRS);
328  }
329  };
330 
331  template <typename T>
333  CallEndLuminosityBlockProduceImpl<T,
334  T::HasAbility::kEndLuminosityBlockProducer,
336 
337  } // namespace stream
338 } // namespace edm
339 
340 #endif
edm::stream::CallGlobalImpl::endJob
static void endJob(typename T::GlobalCache *iCache)
Definition: callAbilities.h:54
edm::stream::CallGlobalLuminosityBlockSummary
CallGlobalLuminosityBlockSummaryImpl< T, T::HasAbility::kLuminosityBlockSummaryCache > CallGlobalLuminosityBlockSummary
Definition: callAbilities.h:223
edm::stream::CallGlobalLuminosityBlockImpl
Definition: callAbilities.h:144
edm::stream::CallEndRunProduceImpl::produce
static void produce(edm::Run &, edm::EventSetup const &, typename T::RunContext const *, typename T::RunSummaryCache const *)
Definition: callAbilities.h:248
funct::false
false
Definition: Factorize.h:34
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::stream::CallGlobalLuminosityBlockSummaryImpl
Definition: callAbilities.h:182
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::stream::CallGlobalRunSummaryImpl::streamEndRunSummary
static void streamEndRunSummary(B *iProd, edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunSummaryCache *iCache)
Definition: callAbilities.h:109
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
edm::stream::CallGlobalLuminosityBlockImpl::beginLuminosityBlock
static void beginLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::RunContext const *iRC, std::shared_ptr< typename T::LuminosityBlockCache const > &oCache)
Definition: callAbilities.h:145
edm::stream::CallGlobalImpl< T, false >::set
static void set(void *iProd, void const *iCache)
Definition: callAbilities.h:58
edm::stream::CallGlobalRunSummaryImpl
Definition: callAbilities.h:101
edm::stream::CallGlobalImpl::set
static void set(B *iProd, typename T::GlobalCache const *iCache)
Definition: callAbilities.h:46
edm::stream::CallGlobalRunImpl::set
static void set(B *iProd, typename T::RunCache const *iCache)
Definition: callAbilities.h:78
edm::stream::CallEndLuminosityBlockProduceImpl::produce
static void produce(edm::LuminosityBlock &, edm::EventSetup const &, typename T::LuminosityBlockContext const *, typename T::LuminosityBlockSummaryCache const *)
Definition: callAbilities.h:305
edm::stream::CallGlobalLuminosityBlockSummaryImpl< T, false >::streamEndLuminosityBlockSummary
static void streamEndLuminosityBlockSummary(void *iProd, edm::LuminosityBlock const &, edm::EventSetup const &, typename T::LuminosityBlockSummaryCache *iCache)
Definition: callAbilities.h:211
edm::stream::CallBeginLuminosityBlockProduceImpl
Definition: callAbilities.h:281
edm::stream::CallGlobalLuminosityBlockImpl::endLuminosityBlock
static void endLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iContext)
Definition: callAbilities.h:157
edm::stream::callGlobalDetail::has_globalBeginJob
Definition: callAbilities.h:38
edm::stream::CallGlobalRunSummaryImpl< T, false >::streamEndRunSummary
static void streamEndRunSummary(void *iProd, edm::Run const &, edm::EventSetup const &, typename T::RunSummaryCache const *iCache)
Definition: callAbilities.h:127
edm::stream::CallBeginLuminosityBlockProduce
CallBeginLuminosityBlockProduceImpl< T, T::HasAbility::kBeginLuminosityBlockProducer > CallBeginLuminosityBlockProduce
Definition: callAbilities.h:298
edm::stream::CallBeginLuminosityBlockProduceImpl::produce
static void produce(edm::LuminosityBlock &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iRC)
Definition: callAbilities.h:282
edm::stream::CallGlobalRunImpl::endRun
static void endRun(edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunContext const *iContext)
Definition: callAbilities.h:82
edm::stream::CallGlobalImpl::beginJob
static void beginJob(typename T::GlobalCache *iCache)
Definition: callAbilities.h:49
edm::stream::CallBeginRunProduceImpl< T, false >::produce
static void produce(edm::Run &iRun, edm::EventSetup const &iES, typename T::RunContext const *iRC)
Definition: callAbilities.h:237
edm::stream::CallGlobalImpl< T, false >::endJob
static void endJob(void *iCache)
Definition: callAbilities.h:60
edm::stream::CallBeginRunProduceImpl::produce
static void produce(edm::Run &iRun, edm::EventSetup const &iES, typename T::RunContext const *iRC)
Definition: callAbilities.h:230
edm::stream::CallBeginRunProduceImpl
Definition: callAbilities.h:229
edm::stream::CallGlobalLuminosityBlockSummaryImpl::globalEndLuminosityBlock
static void globalEndLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iContext, typename T::LuminosityBlockSummaryCache *iCache)
Definition: callAbilities.h:197
edm::stream::CallGlobalRunImpl< T, false >::beginRun
static void beginRun(edm::Run const &, edm::EventSetup const &, typename T::GlobalCache const *, impl::dummy_ptr)
Definition: callAbilities.h:89
mix_E10TeV_L13E31_BX432_cfi.Lumi
Lumi
Definition: mix_E10TeV_L13E31_BX432_cfi.py:24
LuminosityBlock
edm::stream::CallEndLuminosityBlockProduceImpl
Definition: callAbilities.h:304
edm::stream::CallEndLuminosityBlockProduceImpl< T, true, true >::produce
static void produce(edm::LuminosityBlock &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iRC, typename T::LuminosityBlockSummaryCache const *iRS)
Definition: callAbilities.h:323
edm::stream::CallGlobalImpl
Definition: callAbilities.h:44
edm::stream::impl::dummy_ptr
Definition: dummy_helpers.h:32
edm::stream::CallGlobalLuminosityBlockSummaryImpl< T, false >::globalEndLuminosityBlock
static void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &, typename T::LuminosityBlockContext const *, typename T::LuminosityBlockSummaryCache *)
Definition: callAbilities.h:215
edm::stream::CallGlobalRunImpl< T, false >::endRun
static void endRun(edm::Run const &, edm::EventSetup const &, typename T::RunContext const *)
Definition: callAbilities.h:91
edm::stream::CallGlobalRunSummaryImpl::beginRun
static void beginRun(edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunContext const *iRC, std::shared_ptr< typename T::RunSummaryCache > &oCache)
Definition: callAbilities.h:102
funct::true
true
Definition: Factorize.h:173
edm::stream::CallEndRunProduceImpl
Definition: callAbilities.h:247
edm::stream::CallGlobalRunSummaryImpl::globalEndRun
static void globalEndRun(edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunContext const *iContext, typename T::RunSummaryCache *iCache)
Definition: callAbilities.h:116
edm::stream::CallGlobalLuminosityBlockSummaryImpl< T, false >::beginLuminosityBlock
static void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &, typename T::LuminosityBlockContext const *, impl::dummy_ptr)
Definition: callAbilities.h:207
edm::EventSetup
Definition: EventSetup.h:57
edm::stream::CallGlobalLuminosityBlockImpl< T, false >::endLuminosityBlock
static void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &, typename T::LuminosityBlockContext const *)
Definition: callAbilities.h:171
edm::stream::CallGlobalLuminosityBlockImpl< T, false >::beginLuminosityBlock
static void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &, typename T::RunContext const *, impl::dummy_ptr)
Definition: callAbilities.h:166
edm::stream::CallEndRunProduceImpl< T, true, false >::produce
static void produce(edm::Run &iRun, edm::EventSetup const &iES, typename T::RunContext const *iRC, typename T::RunSummaryCache const *)
Definition: callAbilities.h:256
edm::stream::CallGlobalRunSummaryImpl< T, false >::beginRun
static void beginRun(edm::Run const &, edm::EventSetup const &, typename T::RunContext const *, impl::dummy_ptr)
Definition: callAbilities.h:126
edm::stream::CallGlobalRunImpl< T, false >::set
static void set(void *iProd, typename T::RunCache const *iCache)
Definition: callAbilities.h:90
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
edm::stream::CallGlobalLuminosityBlockImpl::set
static void set(B *iProd, typename T::LuminosityBlockCache const *iCache)
Definition: callAbilities.h:153
std
Definition: JetResolutionObject.h:76
edm::stream::CallEndLuminosityBlockProduce
CallEndLuminosityBlockProduceImpl< T, T::HasAbility::kEndLuminosityBlockProducer, T::HasAbility::kLuminosityBlockSummaryCache > CallEndLuminosityBlockProduce
Definition: callAbilities.h:335
T
long double T
Definition: Basic3DVectorLD.h:48
edm::stream::CallGlobalRunImpl::beginRun
static void beginRun(edm::Run const &iRun, edm::EventSetup const &iES, typename T::GlobalCache const *iGC, std::shared_ptr< typename T::RunCache const > &oCache)
Definition: callAbilities.h:70
edm::stream::CallGlobalRunSummaryImpl< T, false >::globalEndRun
static void globalEndRun(edm::Run const &, edm::EventSetup const &, typename T::RunContext const *, typename T::RunSummaryCache *)
Definition: callAbilities.h:131
edm::module::AbilityBits::kLuminosityBlockSummaryCache
Definition: moduleAbilityEnums.h:56
edm::stream::CallEndRunProduceImpl< T, true, true >::produce
static void produce(edm::Run &iRun, edm::EventSetup const &iES, typename T::RunContext const *iRC, typename T::RunSummaryCache const *iRS)
Definition: callAbilities.h:266
dummy_helpers.h
edm::stream::CallGlobalLuminosityBlockImpl< T, false >::set
static void set(void *iProd, typename T::LuminosityBlockCache const *iCache)
Definition: callAbilities.h:170
EventSetup
edm::stream::CallGlobalLuminosityBlockSummaryImpl::streamEndLuminosityBlockSummary
static void streamEndLuminosityBlockSummary(B *iProd, edm::LuminosityBlock const &iLumi, edm::EventSetup const &iES, typename T::LuminosityBlockSummaryCache *iCache)
Definition: callAbilities.h:190
edm::stream::CallGlobalLuminosityBlockSummaryImpl::beginLuminosityBlock
static void beginLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iRC, std::shared_ptr< typename T::LuminosityBlockSummaryCache > &oCache)
Definition: callAbilities.h:183
edm::stream::CallGlobalImpl< T, false >::beginJob
static void beginJob(void *iCache)
Definition: callAbilities.h:59
edm::stream::CallBeginLuminosityBlockProduceImpl< T, false >::produce
static void produce(edm::LuminosityBlock &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iRC)
Definition: callAbilities.h:291
edm::stream::CallEndLuminosityBlockProduceImpl< T, true, false >::produce
static void produce(edm::LuminosityBlock &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iRC, typename T::LuminosityBlockSummaryCache const *)
Definition: callAbilities.h:313
edm::stream::CallGlobalRunImpl
Definition: callAbilities.h:69
Run