Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:52

0001 #ifndef TrackReco_TrackResiduals_h
0002 #define TrackReco_TrackResiduals_h
0003 
0004 #include <vector>
0005 
0006 namespace reco {
0007 
0008   class TrackResiduals {
0009   public:
0010     // In principle 8bits would suffice for histos...

0011     using StorageType = unsigned short;
0012 
0013     TrackResiduals() {}
0014     void resize(unsigned int nHits) { m_storage.resize(4 * nHits); }
0015     void setResidualXY(int idx, float residualX, float residualY);
0016     void setPullXY(int idx, float pullX, float pullY);
0017     /// get the residual of the ith hit

0018     float residualX(int i) const { return unpack_residual(m_storage[4 * i]); }
0019     float residualY(int i) const { return unpack_residual(m_storage[4 * i + 1]); }
0020     float pullX(int i) const { return unpack_pull(m_storage[4 * i + 2]); }
0021     float pullY(int i) const { return unpack_pull(m_storage[4 * i + 3]); }
0022 
0023   private:
0024     static float unpack_pull(StorageType);
0025     static StorageType pack_pull(float);
0026     static float unpack_residual(StorageType);
0027     static StorageType pack_residual(float);
0028 
0029   private:
0030     std::vector<StorageType> m_storage;
0031   };
0032 
0033 }  // namespace reco

0034 
0035 #endif