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 } // 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
Selector
Functor that operates on <T>
Definition: Selector.h:22
reco::modules::CommonSelectorEventSetupInit
Definition: EventSetupInitTrait.h:25
AndSelector
Definition: AndSelector.h:26
modules
Definition: MuonCleanerBySegments.cc:35
edm
HLT enums.
Definition: AlignableModifier.h:19
OrSelector
Definition: OrSelector.h:26
reco::modules::EventSetupInit< OrSelector< T1, T2, T3, T4, T5 > >::type
CombinedEventSetupInit< T1, T2, T3, T4, T5 > type
Definition: EventSetupInitTrait.h:97
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::modules::EventSetupInit
Definition: EventSetupInitTrait.h:33
Event
reco::modules::CombinedEventSetupInit< T1, T2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand >::init
static void init(SelectorT< T1, T2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand > &selector, const edm::Event &evt, const edm::EventSetup &es)
Definition: EventSetupInitTrait.h:81
reco::modules::CombinedEventSetupInit::init
static void init(SelectorT< T1, T2, T3, T4, T5 > &selector, const edm::Event &evt, const edm::EventSetup &es)
Definition: EventSetupInitTrait.h:44
reco::modules::NoEventSetupInit
take no action (default)
Definition: EventSetupInitTrait.h:19
helpers
Definition: makeCompositeCandidate.h:8
edm::EventSetup
Definition: EventSetup.h:58
reco::modules::CommonSelectorEventSetupInit::init
static void init(Selector &selector, const edm::Event &evt, const edm::EventSetup &es)
Definition: EventSetupInitTrait.h:27
OrSelector.h
reco::modules::NoEventSetupInit::init
static void init(T &, const edm::Event &, const edm::EventSetup &)
Definition: EventSetupInitTrait.h:20
reco::modules::CombinedEventSetupInit< T1, T2, T3, T4, helpers::NullAndOperand >::init
static void init(SelectorT< T1, T2, T3, T4, helpers::NullAndOperand > &selector, const edm::Event &evt, const edm::EventSetup &es)
Definition: EventSetupInitTrait.h:56
AndSelector.h
reco::modules::EventSetupInit::type
NoEventSetupInit< T > type
Definition: EventSetupInitTrait.h:34
T
long double T
Definition: Basic3DVectorLD.h:48
reco::modules::CombinedEventSetupInit< T1, T2, T3, helpers::NullAndOperand, helpers::NullAndOperand >::init
static void init(SelectorT< T1, T2, T3, helpers::NullAndOperand, helpers::NullAndOperand > &selector, const edm::Event &evt, const edm::EventSetup &es)
Definition: EventSetupInitTrait.h:69
EventSetup
edm::Event
Definition: Event.h:73
reco::modules::EventSetupInit< AndSelector< T1, T2, T3, T4, T5 > >::type
CombinedEventSetupInit< T1, T2, T3, T4, T5 > type
Definition: EventSetupInitTrait.h:92
reco::modules::CombinedEventSetupInit
Definition: EventSetupInitTrait.h:42