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) { return fact * x + min; }
15 
16  constexpr float pmin = -32; // overkill
17  constexpr float pmult = 1000; // overkill
18  constexpr float pdiv = 1. / pmult;
19  constexpr float rmin = -3.2; // (in cm)
20  constexpr float rmult = 10000; // micron
21  constexpr float rdiv = 1. / rmult;
22 
23  } // namespace
24 
25  float TrackResiduals::unpack_pull(StorageType x) { return unpack(x, pmin, pdiv); }
26  TrackResiduals::StorageType TrackResiduals::pack_pull(float x) { return pack(x, pmin, pmult); }
27  float TrackResiduals::unpack_residual(StorageType x) { return unpack(x, rmin, rdiv); }
28  TrackResiduals::StorageType TrackResiduals::pack_residual(float x) { return pack(x, rmin, rmult); }
29 
30  void TrackResiduals::setResidualXY(int idx, float residualX, float residualY) {
33  }
34  void TrackResiduals::setPullXY(int idx, float pullX, float pullY) {
35  m_storage[4 * idx + 2] = pack_pull(pullX);
36  m_storage[4 * idx + 3] = pack_pull(pullY);
37  }
38 
39 } // namespace reco
reco::TrackResiduals::residualY
float residualY(int i) const
Definition: TrackResiduals.h:19
SiPixelPI::unpack
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
Definition: SiPixelPayloadInspectorHelper.h:44
reco::TrackResiduals::StorageType
unsigned short StorageType
Definition: TrackResiduals.h:11
min
T min(T a, T b)
Definition: MathUtil.h:58
reco::TrackResiduals::pullY
float pullY(int i) const
Definition: TrackResiduals.h:21
reco::TrackResiduals::setPullXY
void setPullXY(int idx, float pullX, float pullY)
Definition: TrackResiduals.cc:34
charmTagsComputerCvsB_cfi.idx
idx
Definition: charmTagsComputerCvsB_cfi.py:108
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::TrackResiduals::residualX
float residualX(int i) const
get the residual of the ith hit
Definition: TrackResiduals.h:18
vertices_cff.x
x
Definition: vertices_cff.py:29
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
reco::TrackResiduals::m_storage
std::vector< StorageType > m_storage
Definition: TrackResiduals.h:30
fact
const double fact
Definition: NuclearInteractionFTFSimulator.cc:74
timeUnitHelper.pack
def pack(high, low)
Definition: timeUnitHelper.py:3
reco::TrackResiduals::unpack_pull
static float unpack_pull(StorageType)
Definition: TrackResiduals.cc:25
reco::TrackResiduals::setResidualXY
void setResidualXY(int idx, float residualX, float residualY)
Definition: TrackResiduals.cc:30
TrackResiduals.h
reco::TrackResiduals::pack_pull
static StorageType pack_pull(float)
Definition: TrackResiduals.cc:26
reco::TrackResiduals::unpack_residual
static float unpack_residual(StorageType)
Definition: TrackResiduals.cc:27
reco::TrackResiduals::pack_residual
static StorageType pack_residual(float)
Definition: TrackResiduals.cc:28
reco::TrackResiduals::pullX
float pullX(int i) const
Definition: TrackResiduals.h:20