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<uint32_t (T::*)() const> struct tester;
100  typedef char One;
101  typedef struct {char a[2];} Two;
102  template<typename C> static One test(tester<&C::auxHBHE>*);
103  template<typename C> static Two test(...);
104 
105  public:
106  enum {value = sizeof(HasAuxRecHitGetterHelper<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 uint32_t getAuxRecHit(const T&, uint32_t v) {return v;}
125  };
126 
127  template<typename T>
129  {
130  inline static uint32_t getAuxRecHit(const T& h, uint32_t) {return h.auxHBHE();}
131  };
132 }
133 
134 // Function for setting the raw energy in a code templated
135 // upon the rechit type. The function call will be ignored
136 // in case the HcalRecHit type does not have a member function
137 // "void setRawEnergy(float)".
138 template <typename HcalRecHit>
139 inline void setRawEnergy(HcalRecHit& h, float e)
140 {
142 }
143 
144 // Function for getting the raw energy in a code templated
145 // upon the rechit type. This function will return "valueIfNoSuchMember"
146 // in case the HcalRecHit type does not have a member function
147 // "float eraw() const".
148 template <typename HcalRecHit>
149 inline float getRawEnergy(const HcalRecHit& h, float valueIfNoSuchMember=-1.0e20)
150 {
152 }
153 
154 // Function for getting the auxiliary word in a code templated
155 // upon the rechit type. This function will return "valueIfNoSuchMember"
156 // in case the HcalRecHit type does not have a member function
157 // "uint32_t auxHBHE() const".
158 template <typename HcalRecHit>
159 inline uint32_t getAuxRecHitWord(const HcalRecHit& h, uint32_t valueIfNoSuchMember=4294967295U)
160 {
162 }
163 
164 #endif // RecoLocalCalo_HcalRecAlgos_rawEnergy_h
uint32_t getAuxRecHitWord(const HcalRecHit &h, uint32_t valueIfNoSuchMember=4294967295U)
Definition: rawEnergy.h:159
static uint32_t getAuxRecHit(const T &h, uint32_t)
Definition: rawEnergy.h:130
static void setRawEnergy(T &, float)
Definition: rawEnergy.h:48
void setRawEnergy(HcalRecHit &h, float e)
Definition: rawEnergy.h:139
static One test(tester<&C::setRawEnergy > *)
static void setRawEnergy(T &h, float e)
Definition: rawEnergy.h:54
static One test(tester<&C::auxHBHE > *)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static One test(tester<&C::eraw > *)
double a
Definition: hdecay.h:121
static float getRawEnergy(const T &h, float)
Definition: rawEnergy.h:92
static uint32_t getAuxRecHit(const T &, uint32_t v)
Definition: rawEnergy.h:124
float getRawEnergy(const HcalRecHit &h, float valueIfNoSuchMember=-1.0e20)
Definition: rawEnergy.h:149
long double T
static float getRawEnergy(const T &, float v)
Definition: rawEnergy.h:86