CMS 3D CMS Logo

TrackResiduals.cc
Go to the documentation of this file.
1 #include<cmath>
2 #include<limits>
4 
5 namespace reco {
6 
7  namespace {
8 
9  inline TrackResiduals::StorageType pack(float x, float min, float fact) {
11  return std::min(std::round(fact*(x-min)),amax);
12  }
13 
14  inline float unpack(TrackResiduals::StorageType x, float min, float fact) {
15  return fact*x+min;
16  }
17 
18  constexpr float pmin = -32; // overkill
19  constexpr float pmult = 1000; // overkill
20  constexpr float pdiv = 1./pmult;
21  constexpr float rmin = -3.2; // (in cm)
22  constexpr float rmult = 10000; // micron
23  constexpr float rdiv = 1./rmult;
24 
25  } // anon nm
26 
27  float TrackResiduals::unpack_pull(StorageType x) { return unpack(x,pmin,pdiv); }
29  float TrackResiduals::unpack_residual(StorageType x) { return unpack(x,rmin,rdiv); }
31 
33  m_storage[4*idx] = pack_residual(residualX);
34  m_storage[4*idx+1] = pack_residual(residualY);
35  }
36  void TrackResiduals::setPullXY(int idx, float pullX, float pullY) {
37  m_storage[4*idx+2] = pack_pull(pullX);
38  m_storage[4*idx+3] = pack_pull(pullY);
39  }
40 
41 
42 
43 } // reco nm
44 
float residualX(int i) const
get the residual of the ith hit
def pack(high, low)
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)
static float unpack_pull(StorageType)
float pullX(int i) const
T min(T a, T b)
Definition: MathUtil.h:58
static StorageType pack_residual(float)
unsigned short StorageType
const double fact
fixed size matrix
float pullY(int i) const
void setPullXY(int idx, float pullX, float pullY)
#define constexpr