CMS 3D CMS Logo

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 }
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,
28  const edm::Event & evt,
29  const edm::EventSetup& es ) {
30  selector.newEvent(evt, es);
31  }
32  };
33 
34  template<typename T>
35  struct EventSetupInit {
37  };
38 
39  template<typename T1, typename T2, typename T3 = helpers::NullAndOperand,
40  typename T4 = helpers::NullAndOperand, typename T5 = helpers::NullAndOperand>
42  template<template<typename, typename, typename, typename, typename> class SelectorT>
43  static void init(SelectorT<T1, T2, T3, T4, T5>& selector,
44  const edm::Event & evt,
45  const edm::EventSetup& es) {
46  EventSetupInit<T1>::type::init(selector.s1_, evt, es);
47  EventSetupInit<T2>::type::init(selector.s2_, evt, es);
48  EventSetupInit<T3>::type::init(selector.s3_, evt, es);
49  EventSetupInit<T4>::type::init(selector.s4_, evt, es);
50  EventSetupInit<T5>::type::init(selector.s5_, evt, es);
51  }
52  };
53 
54  template<typename T1, typename T2, typename T3, typename T4>
55  struct CombinedEventSetupInit<T1, T2, T3, T4, helpers::NullAndOperand> {
56  template<template<typename, typename, typename, typename, typename> class SelectorT>
57  static void init(SelectorT<T1, T2, T3, T4, helpers::NullAndOperand>& selector,
58  const edm::Event & evt,
59  const edm::EventSetup& es) {
60  EventSetupInit<T1>::type::init(selector.s1_, evt, es);
61  EventSetupInit<T2>::type::init(selector.s2_, evt, es);
62  EventSetupInit<T3>::type::init(selector.s3_, evt, es);
63  EventSetupInit<T4>::type::init(selector.s4_, evt, es);
64  }
65  };
66 
67  template<typename T1, typename T2, typename T3>
68  struct CombinedEventSetupInit<T1, T2, T3, helpers::NullAndOperand, helpers::NullAndOperand> {
69  template<template<typename, typename, typename, typename, typename> class SelectorT>
70  static void init(SelectorT<T1, T2, T3, helpers::NullAndOperand, helpers::NullAndOperand>& selector,
71  const edm::Event & evt,
72  const edm::EventSetup& es) {
73  EventSetupInit<T1>::type::init(selector.s1_, evt, es);
74  EventSetupInit<T2>::type::init(selector.s2_, evt, es);
75  EventSetupInit<T3>::type::init(selector.s3_, evt, es);
76  }
77  };
78 
79  template<typename T1, typename T2>
80  struct CombinedEventSetupInit<T1, T2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand> {
81  template<template<typename, typename, typename, typename, typename> class SelectorT>
82  static void init(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  }
101 }
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 
148 #endif
149 
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 &)
static void init(SelectorT< T1, T2, T3, T4, T5 > &selector, const edm::Event &evt, const edm::EventSetup &es)
fixed size matrix
HLT enums.
static void init(Selector &selector, const edm::Event &evt, const edm::EventSetup &es)
long double T