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  class TrackResiduals {
9  public:
10  // In principle 8bits would suffice for histos...
11  using StorageType = unsigned short;
12 
14  void resize(unsigned int nHits) { m_storage.resize(4 * nHits); }
15  void setResidualXY(int idx, float residualX, float residualY);
16  void setPullXY(int idx, float pullX, float pullY);
18  float residualX(int i) const { return unpack_residual(m_storage[4 * i]); }
19  float residualY(int i) const { return unpack_residual(m_storage[4 * i + 1]); }
20  float pullX(int i) const { return unpack_pull(m_storage[4 * i + 2]); }
21  float pullY(int i) const { return unpack_pull(m_storage[4 * i + 3]); }
22 
23  private:
24  static float unpack_pull(StorageType);
25  static StorageType pack_pull(float);
26  static float unpack_residual(StorageType);
27  static StorageType pack_residual(float);
28 
29  private:
30  std::vector<StorageType> m_storage;
31  };
32 
33 } // namespace reco
34 
35 #endif
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)