CMS 3D CMS Logo

EventSetupInitTrait.h
Go to the documentation of this file.
1 #ifndef UtilAlgos_EventSetupInitTrait_h
2 #define UtilAlgos_EventSetupInitTrait_h
6 
7 namespace edm {
8  class EventSetup;
9  class Event;
10 } // namespace edm
11 
12 namespace helpers {
13  struct NullAndOperand;
14 }
15 
16 namespace reco {
17  namespace modules {
19  template <typename T>
22  NoEventSetupInit() = delete;
23  void init(T&, const edm::Event&, const edm::EventSetup&) {}
24  };
25 
31  template <typename Selector>
32  void init(Selector& selector, const edm::Event& evt, const edm::EventSetup& es) {
33  selector.newEvent(evt, es);
34  }
35  };
36 
37  template <typename T>
38  struct EventSetupInit {
40  };
41 
42  template <typename T1,
43  typename T2,
44  typename T3 = helpers::NullAndOperand,
45  typename T4 = helpers::NullAndOperand,
46  typename T5 = helpers::NullAndOperand>
48  explicit CombinedEventSetupInit(edm::ConsumesCollector iC) : t1_(iC), t2_(iC), t3_(iC), t4_(iC), t5_(iC) {}
49  template <template <typename, typename, typename, typename, typename> class SelectorT>
50  void init(SelectorT<T1, T2, T3, T4, T5>& selector, const edm::Event& evt, const edm::EventSetup& es) {
51  t1_.init(selector.s1_, evt, es);
52  t2_.init(selector.s2_, evt, es);
53  t3_.init(selector.s3_, evt, es);
54  t4_.init(selector.s4_, evt, es);
55  t5_.init(selector.s5_, evt, es);
56  }
62  };
63 
64  template <typename T1, typename T2, typename T3, typename T4>
65  struct CombinedEventSetupInit<T1, T2, T3, T4, helpers::NullAndOperand> {
66  explicit CombinedEventSetupInit(edm::ConsumesCollector iC) : t1_(iC), t2_(iC), t3_(iC), t4_(iC) {}
67  template <template <typename, typename, typename, typename, typename> class SelectorT>
68  void init(SelectorT<T1, T2, T3, T4, helpers::NullAndOperand>& selector,
69  const edm::Event& evt,
70  const edm::EventSetup& es) {
71  t1_.init(selector.s1_, evt, es);
72  t2_.init(selector.s2_, evt, es);
73  t3_.init(selector.s3_, evt, es);
74  t4_.init(selector.s4_, evt, es);
75  }
80  };
81 
82  template <typename T1, typename T2, typename T3>
83  struct CombinedEventSetupInit<T1, T2, T3, helpers::NullAndOperand, helpers::NullAndOperand> {
84  explicit CombinedEventSetupInit(edm::ConsumesCollector iC) : t1_(iC), t2_(iC), t3_(iC) {}
85  template <template <typename, typename, typename, typename, typename> class SelectorT>
86  void init(SelectorT<T1, T2, T3, helpers::NullAndOperand, helpers::NullAndOperand>& selector,
87  const edm::Event& evt,
88  const edm::EventSetup& es) {
89  t1_.init(selector.s1_, evt, es);
90  t2_.init(selector.s2_, evt, es);
91  t3_.init(selector.s3_, evt, es);
92  }
96  };
97 
98  template <typename T1, typename T2>
99  struct CombinedEventSetupInit<T1, T2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand> {
101  template <template <typename, typename, typename, typename, typename> class SelectorT>
102  void init(SelectorT<T1, T2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand>& selector,
103  const edm::Event& evt,
104  const edm::EventSetup& es) {
105  t1_.init(selector.s1_, evt, es);
106  t2_.init(selector.s2_, evt, es);
107  }
110  };
111 
112  template <typename T1, typename T2, typename T3, typename T4, typename T5>
113  struct EventSetupInit<AndSelector<T1, T2, T3, T4, T5> > {
115  };
116 
117  template <typename T1, typename T2, typename T3, typename T4, typename T5>
118  struct EventSetupInit<OrSelector<T1, T2, T3, T4, T5> > {
120  };
121 
122  } // namespace modules
123 } // namespace reco
124 
125 #define EVENTSETUP_STD_INIT(SELECTOR) \
126  namespace reco { \
127  namespace modules { \
128  template <> \
129  struct EventSetupInit<SELECTOR> { \
130  typedef CommonSelectorEventSetupInit type; \
131  }; \
132  } \
133  } \
134  struct __useless_ignoreme
135 
136 #define EVENTSETUP_STD_INIT_T1(SELECTOR) \
137  namespace reco { \
138  namespace modules { \
139  template <typename T1> \
140  struct EventSetupInit<SELECTOR<T1> > { \
141  typedef CommonSelectorEventSetupInit type; \
142  }; \
143  } \
144  } \
145  struct __useless_ignoreme
146 
147 #define EVENTSETUP_STD_INIT_T2(SELECTOR) \
148  namespace reco { \
149  namespace modules { \
150  template <typename T1, typename T2> \
151  struct EventSetupInit<SELECTOR<T1, T2> > { \
152  typedef CommonSelectorEventSetupInit type; \
153  }; \
154  } \
155  } \
156  struct __useless_ignoreme
157 
158 #define EVENTSETUP_STD_INIT_T3(SELECTOR) \
159  namespace reco { \
160  namespace modules { \
161  template <typename T1, typename T2, typename T3> \
162  struct EventSetupInit<SELECTOR<T1, T2, T3> > { \
163  typedef CommonSelectorEventSetupInit type; \
164  }; \
165  } \
166  } \
167  struct __useless_ignoreme
168 
169 #endif
void init(Selector &selector, const edm::Event &evt, const edm::EventSetup &es)
void init(T &, const edm::Event &, const edm::EventSetup &)
void init(SelectorT< T1, T2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand > &selector, const edm::Event &evt, const edm::EventSetup &es)
void init(SelectorT< T1, T2, T3, T4, T5 > &selector, const edm::Event &evt, const edm::EventSetup &es)
take no action (default)
Functor that operates on <T>
Definition: Selector.h:22
void init(SelectorT< T1, T2, T3, T4, helpers::NullAndOperand > &selector, const edm::Event &evt, const edm::EventSetup &es)
NoEventSetupInit(edm::ConsumesCollector)
fixed size matrix
HLT enums.
CombinedEventSetupInit(edm::ConsumesCollector iC)
long double T
void init(SelectorT< T1, T2, T3, helpers::NullAndOperand, helpers::NullAndOperand > &selector, const edm::Event &evt, const edm::EventSetup &es)