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