CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EventSetupInitTrait.h
Go to the documentation of this file.
1 #ifndef UtilAlgos_EventSetupInitTrait_h
2 #define UtilAlgos_EventSetupInitTrait_h
5 
6 namespace edm {
7  class EventSetup;
8  class Event;
9 } // namespace edm
10 
11 namespace helpers {
12  struct NullAndOperand;
13 }
14 
15 namespace reco {
16  namespace modules {
18  template <typename T>
20  static void init(T&, const edm::Event&, const edm::EventSetup&) {}
21  };
22 
26  template <typename Selector>
27  static void init(Selector& selector, const edm::Event& evt, const edm::EventSetup& es) {
28  selector.newEvent(evt, es);
29  }
30  };
31 
32  template <typename T>
33  struct EventSetupInit {
35  };
36 
37  template <typename T1,
38  typename T2,
39  typename T3 = helpers::NullAndOperand,
40  typename T4 = helpers::NullAndOperand,
41  typename T5 = helpers::NullAndOperand>
43  template <template <typename, typename, typename, typename, typename> class SelectorT>
44  static void init(SelectorT<T1, T2, T3, T4, T5>& selector, const edm::Event& evt, const edm::EventSetup& es) {
45  EventSetupInit<T1>::type::init(selector.s1_, evt, es);
46  EventSetupInit<T2>::type::init(selector.s2_, evt, es);
47  EventSetupInit<T3>::type::init(selector.s3_, evt, es);
48  EventSetupInit<T4>::type::init(selector.s4_, evt, es);
49  EventSetupInit<T5>::type::init(selector.s5_, evt, es);
50  }
51  };
52 
53  template <typename T1, typename T2, typename T3, typename T4>
54  struct CombinedEventSetupInit<T1, T2, T3, T4, helpers::NullAndOperand> {
55  template <template <typename, typename, typename, typename, typename> class SelectorT>
56  static void init(SelectorT<T1, T2, T3, T4, helpers::NullAndOperand>& selector,
57  const edm::Event& evt,
58  const edm::EventSetup& es) {
59  EventSetupInit<T1>::type::init(selector.s1_, evt, es);
60  EventSetupInit<T2>::type::init(selector.s2_, evt, es);
61  EventSetupInit<T3>::type::init(selector.s3_, evt, es);
62  EventSetupInit<T4>::type::init(selector.s4_, evt, es);
63  }
64  };
65 
66  template <typename T1, typename T2, typename T3>
67  struct CombinedEventSetupInit<T1, T2, T3, helpers::NullAndOperand, helpers::NullAndOperand> {
68  template <template <typename, typename, typename, typename, typename> class SelectorT>
69  static void init(SelectorT<T1, T2, T3, helpers::NullAndOperand, helpers::NullAndOperand>& selector,
70  const edm::Event& evt,
71  const edm::EventSetup& es) {
72  EventSetupInit<T1>::type::init(selector.s1_, evt, es);
73  EventSetupInit<T2>::type::init(selector.s2_, evt, es);
74  EventSetupInit<T3>::type::init(selector.s3_, evt, es);
75  }
76  };
77 
78  template <typename T1, typename T2>
79  struct CombinedEventSetupInit<T1, T2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand> {
80  template <template <typename, typename, typename, typename, typename> class SelectorT>
81  static void init(
82  SelectorT<T1, T2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand>& selector,
83  const edm::Event& evt,
84  const edm::EventSetup& es) {
85  EventSetupInit<T1>::type::init(selector.s1_, evt, es);
86  EventSetupInit<T2>::type::init(selector.s2_, evt, es);
87  }
88  };
89 
90  template <typename T1, typename T2, typename T3, typename T4, typename T5>
91  struct EventSetupInit<AndSelector<T1, T2, T3, T4, T5> > {
93  };
94 
95  template <typename T1, typename T2, typename T3, typename T4, typename T5>
96  struct EventSetupInit<OrSelector<T1, T2, T3, T4, T5> > {
98  };
99 
100  } // namespace modules
101 } // namespace reco
102 
103 #define EVENTSETUP_STD_INIT(SELECTOR) \
104  namespace reco { \
105  namespace modules { \
106  template <> \
107  struct EventSetupInit<SELECTOR> { \
108  typedef CommonSelectorEventSetupInit type; \
109  }; \
110  } \
111  } \
112  struct __useless_ignoreme
113 
114 #define EVENTSETUP_STD_INIT_T1(SELECTOR) \
115  namespace reco { \
116  namespace modules { \
117  template <typename T1> \
118  struct EventSetupInit<SELECTOR<T1> > { \
119  typedef CommonSelectorEventSetupInit type; \
120  }; \
121  } \
122  } \
123  struct __useless_ignoreme
124 
125 #define EVENTSETUP_STD_INIT_T2(SELECTOR) \
126  namespace reco { \
127  namespace modules { \
128  template <typename T1, typename T2> \
129  struct EventSetupInit<SELECTOR<T1, T2> > { \
130  typedef CommonSelectorEventSetupInit type; \
131  }; \
132  } \
133  } \
134  struct __useless_ignoreme
135 
136 #define EVENTSETUP_STD_INIT_T3(SELECTOR) \
137  namespace reco { \
138  namespace modules { \
139  template <typename T1, typename T2, typename T3> \
140  struct EventSetupInit<SELECTOR<T1, T2, T3> > { \
141  typedef CommonSelectorEventSetupInit type; \
142  }; \
143  } \
144  } \
145  struct __useless_ignoreme
146 
147 #endif
static void init(SelectorT< T1, T2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand > &selector, const edm::Event &evt, const edm::EventSetup &es)
static void init(SelectorT< T1, T2, T3, T4, helpers::NullAndOperand > &selector, const edm::Event &evt, const edm::EventSetup &es)
take no action (default)
static void init(SelectorT< T1, T2, T3, helpers::NullAndOperand, helpers::NullAndOperand > &selector, const edm::Event &evt, const edm::EventSetup &es)
static void init(T &, const edm::Event &, const edm::EventSetup &)
Functor that operates on &lt;T&gt;
Definition: Selector.h:22
static void init(SelectorT< T1, T2, T3, T4, T5 > &selector, const edm::Event &evt, const edm::EventSetup &es)
static void init(Selector &selector, const edm::Event &evt, const edm::EventSetup &es)
long double T