CMS 3D CMS Logo

TrackResiduals.h
Go to the documentation of this file.
1 #ifndef TrackReco_TrackResiduals_h
2 #define TrackReco_TrackResiduals_h
3 
4 #include<vector>
5 
6 namespace reco
7 {
8 
10 public:
11 
12  // In principle 8bits would suffice for histos...
13  using StorageType = unsigned short;
14 
16  void resize(unsigned int nHits) { m_storage.resize(4*nHits); }
17  void setResidualXY(int idx, float residualX, float residualY);
18  void setPullXY(int idx, float pullX, float pullY);
20  float residualX(int i) const { return unpack_residual(m_storage[4*i]); }
21  float residualY(int i) const { return unpack_residual(m_storage[4*i+1]); }
22  float pullX(int i) const { return unpack_pull(m_storage[4*i+2]); }
23  float pullY(int i) const{ return unpack_pull(m_storage[4*i+3]); }
24 
25 private:
26  static float unpack_pull(StorageType);
27  static StorageType pack_pull(float);
28  static float unpack_residual(StorageType);
29  static StorageType pack_residual(float);
30 
31 private:
32  std::vector<StorageType> m_storage;
33 };
34 
35 } // namespace reco
36 
37 #endif
38 
float residualX(int i) const
get the residual of the ith hit
float residualY(int i) const
std::vector< StorageType > m_storage
static StorageType pack_pull(float)
void setResidualXY(int idx, float residualX, float residualY)
static float unpack_residual(StorageType)
void resize(unsigned int nHits)
static float unpack_pull(StorageType)
float pullX(int i) const
static StorageType pack_residual(float)
unsigned short StorageType
fixed size matrix
float pullY(int i) const
void setPullXY(int idx, float pullX, float pullY)