test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
rawEnergy.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_HcalRecAlgos_rawEnergy_h
2 #define RecoLocalCalo_HcalRecAlgos_rawEnergy_h
3 
4 #include "boost/cstdint.hpp"
5 
6 namespace HcalRecAlgosPrivate {
7  template <typename T>
8  class IsClassType
9  {
10  typedef char One;
11  typedef struct {char a[2];} Two;
12  template<typename C> static One test(int C::*);
13  template<typename C> static Two test(...);
14 
15  public:
16  enum {value = sizeof(IsClassType<T>::template test<T>(0)) == 1};
17  };
18 
19  template <typename T>
21  {
22  private:
23  template<void (T::*)(float)> struct tester;
24  typedef char One;
25  typedef struct {char a[2];} Two;
26  template<typename C> static One test(tester<&C::setRawEnergy>*);
27  template<typename C> static Two test(...);
28 
29  public:
30  enum {value = sizeof(HasRawEnergySetterHelper<T>::template test<T>(0)) == 1};
31  };
32 
35  {
36  enum {value = false};
37  };
38 
39  template<typename T>
41  {
43  };
44 
45  template<typename T, bool>
47  {
48  inline static void setRawEnergy(T&, float) {}
49  };
50 
51  template<typename T>
53  {
54  inline static void setRawEnergy(T& h, float e) {h.setRawEnergy(e);}
55  };
56 
57  template <typename T>
59  {
60  private:
61  template<float (T::*)() const> struct tester;
62  typedef char One;
63  typedef struct {char a[2];} Two;
64  template<typename C> static One test(tester<&C::eraw>*);
65  template<typename C> static Two test(...);
66 
67  public:
68  enum {value = sizeof(HasRawEnergyGetterHelper<T>::template test<T>(0)) == 1};
69  };
70 
73  {
74  enum {value = false};
75  };
76 
77  template<typename T>
79  {
81  };
82 
83  template<typename T, bool>
85  {
86  inline static float getRawEnergy(const T&, float v) {return v;}
87  };
88 
89  template<typename T>
91  {
92  inline static float getRawEnergy(const T& h, float) {return h.eraw();}
93  };
94 
95  template <typename T>
97  {
98  private:
99  template<void (T::*)(float)> struct tester;
100  typedef char One;
101  typedef struct {char a[2];} Two;
102  template<typename C> static One test(tester<&C::setAuxEnergy>*);
103  template<typename C> static Two test(...);
104 
105  public:
106  enum {value = sizeof(HasAuxEnergySetterHelper<T>::template test<T>(0)) == 1};
107  };
108 
111  {
112  enum {value = false};
113  };
114 
115  template<typename T>
117  {
119  };
120 
121  template<typename T, bool>
123  {
124  inline static void setAuxEnergy(T&, float) {}
125  };
126 
127  template<typename T>
129  {
130  inline static void setAuxEnergy(T& h, float e) {h.setAuxEnergy(e);}
131  };
132 
133  template <typename T>
135  {
136  private:
137  template<float (T::*)() const> struct tester;
138  typedef char One;
139  typedef struct {char a[2];} Two;
140  template<typename C> static One test(tester<&C::eaux>*);
141  template<typename C> static Two test(...);
142 
143  public:
144  enum {value = sizeof(HasAuxEnergyGetterHelper<T>::template test<T>(0)) == 1};
145  };
146 
149  {
150  enum {value = false};
151  };
152 
153  template<typename T>
155  {
157  };
158 
159  template<typename T, bool>
161  {
162  inline static float getAuxEnergy(const T&, float v) {return v;}
163  };
164 
165  template<typename T>
167  {
168  inline static float getAuxEnergy(const T& h, float) {return h.eaux();}
169  };
170 
171  template <typename T>
173  {
174  private:
175  template<uint32_t (T::*)() const> struct tester;
176  typedef char One;
177  typedef struct {char a[2];} Two;
178  template<typename C> static One test(tester<&C::auxHBHE>*);
179  template<typename C> static Two test(...);
180 
181  public:
182  enum {value = sizeof(HasAuxRecHitGetterHelper<T>::template test<T>(0)) == 1};
183  };
184 
187  {
188  enum {value = false};
189  };
190 
191  template<typename T>
193  {
195  };
196 
197  template<typename T, bool>
199  {
200  inline static uint32_t getAuxRecHit(const T&, uint32_t v) {return v;}
201  };
202 
203  template<typename T>
205  {
206  inline static uint32_t getAuxRecHit(const T& h, uint32_t) {return h.auxHBHE();}
207  };
208 }
209 
210 // Function for setting the raw energy in a code templated
211 // upon the rechit type. The function call will be ignored
212 // in case the HcalRecHit type does not have a member function
213 // "void setRawEnergy(float)".
214 template <typename HcalRecHit>
215 inline void setRawEnergy(HcalRecHit& h, float e)
216 {
218 }
219 
220 // Function for getting the raw energy in a code templated
221 // upon the rechit type. This function will return "valueIfNoSuchMember"
222 // in case the HcalRecHit type does not have a member function
223 // "float eraw() const".
224 template <typename HcalRecHit>
225 inline float getRawEnergy(const HcalRecHit& h, float valueIfNoSuchMember=-1.0e20)
226 {
228 }
229 
230 // Similar functions for aux energy
231 template <typename HcalRecHit>
232 inline void setAuxEnergy(HcalRecHit& h, float e)
233 {
235 }
236 
237 template <typename HcalRecHit>
238 inline float getAuxEnergy(const HcalRecHit& h, float valueIfNoSuchMember=-1.0e20)
239 {
241 }
242 
243 // Function for getting the auxiliary word in a code templated
244 // upon the rechit type. This function will return "valueIfNoSuchMember"
245 // in case the HcalRecHit type does not have a member function
246 // "uint32_t auxHBHE() const".
247 template <typename HcalRecHit>
248 inline uint32_t getAuxRecHitWord(const HcalRecHit& h, uint32_t valueIfNoSuchMember=4294967295U)
249 {
251 }
252 
253 #endif // RecoLocalCalo_HcalRecAlgos_rawEnergy_h
static void setAuxEnergy(T &h, float e)
Definition: rawEnergy.h:130
uint32_t getAuxRecHitWord(const HcalRecHit &h, uint32_t valueIfNoSuchMember=4294967295U)
Definition: rawEnergy.h:248
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
static uint32_t getAuxRecHit(const T &h, uint32_t)
Definition: rawEnergy.h:206
static void setRawEnergy(T &, float)
Definition: rawEnergy.h:48
void setRawEnergy(HcalRecHit &h, float e)
Definition: rawEnergy.h:215
static One test(tester<&C::setRawEnergy > *)
static One test(tester<&C::eaux > *)
static One test(tester<&C::setAuxEnergy > *)
static void setRawEnergy(T &h, float e)
Definition: rawEnergy.h:54
float getAuxEnergy(const HcalRecHit &h, float valueIfNoSuchMember=-1.0e20)
Definition: rawEnergy.h:238
static One test(tester<&C::auxHBHE > *)
static void setAuxEnergy(T &, float)
Definition: rawEnergy.h:124
static float getAuxEnergy(const T &, float v)
Definition: rawEnergy.h:162
static One test(tester<&C::eraw > *)
double a
Definition: hdecay.h:121
static float getRawEnergy(const T &h, float)
Definition: rawEnergy.h:92
static float getAuxEnergy(const T &h, float)
Definition: rawEnergy.h:168
static uint32_t getAuxRecHit(const T &, uint32_t v)
Definition: rawEnergy.h:200
float getRawEnergy(const HcalRecHit &h, float valueIfNoSuchMember=-1.0e20)
Definition: rawEnergy.h:225
long double T
void setAuxEnergy(HcalRecHit &h, float e)
Definition: rawEnergy.h:232
static float getRawEnergy(const T &, float v)
Definition: rawEnergy.h:86