diff --git a/DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h b/DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h index 67dd80692d463..c8b5200333d56 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h +++ b/DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h @@ -17,27 +17,33 @@ //---------------------------------------------------------------------------------------------------- -class CTPPSDiamondLocalTrack : public CTPPSTimingLocalTrack { -public: - CTPPSDiamondLocalTrack(); - CTPPSDiamondLocalTrack( - const math::XYZPoint& pos0, const math::XYZPoint& pos0_sigma, float t, float t_sigma, int oot_idx, int mult_hits); - - bool containsHit(const CTPPSDiamondRecHit& recHit, float tolerance = 0.1) const; - - //--- temporal set'ters - - inline void setOOTIndex(int i) { ts_index_ = i; } - inline int ootIndex() const { return ts_index_; } - - inline void setMultipleHits(int i) { mh_ = i; } - inline int multipleHits() const { return mh_; } - -private: - /// Time slice index - int ts_index_; - /// Multiple hits counter - int mh_; -}; - +namespace io_v1 { + class CTPPSDiamondLocalTrack : public CTPPSTimingLocalTrack { + public: + CTPPSDiamondLocalTrack(); + CTPPSDiamondLocalTrack(const math::XYZPoint& pos0, + const math::XYZPoint& pos0_sigma, + float t, + float t_sigma, + int oot_idx, + int mult_hits); + + bool containsHit(const CTPPSDiamondRecHit& recHit, float tolerance = 0.1) const; + + //--- temporal set'ters + + inline void setOOTIndex(int i) { ts_index_ = i; } + inline int ootIndex() const { return ts_index_; } + + inline void setMultipleHits(int i) { mh_ = i; } + inline int multipleHits() const { return mh_; } + + private: + /// Time slice index + int ts_index_; + /// Multiple hits counter + int mh_; + }; +} // namespace io_v1 +using CTPPSDiamondLocalTrack = io_v1::CTPPSDiamondLocalTrack; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSDiamondRecHit.h b/DataFormats/CTPPSReco/interface/CTPPSDiamondRecHit.h index 6c3b92ad5710a..1e549622f45ea 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSDiamondRecHit.h +++ b/DataFormats/CTPPSReco/interface/CTPPSDiamondRecHit.h @@ -14,56 +14,58 @@ #include "DataFormats/CTPPSReco/interface/CTPPSTimingRecHit.h" /// Reconstructed hit in diamond detectors. -class CTPPSDiamondRecHit : public CTPPSTimingRecHit { -public: - CTPPSDiamondRecHit() : CTPPSTimingRecHit(), tot_(0), tPrecision_(0), tsIndex_(0), hptdcErr_(0), mh_(false) {} - CTPPSDiamondRecHit(float x, - float xWidth, - float y, - float yWidth, - float z, - float zWidth, - float t, - float tot, - float tPrecision, - int ootIdx, - const HPTDCErrorFlags &hptdcErr, - const bool mh) - : CTPPSTimingRecHit(x, xWidth, y, yWidth, z, zWidth, t), - tot_(tot), - tPrecision_(tPrecision), - tsIndex_(ootIdx), - hptdcErr_(hptdcErr), - mh_(mh) {} +namespace io_v1 { + class CTPPSDiamondRecHit : public CTPPSTimingRecHit { + public: + CTPPSDiamondRecHit() : CTPPSTimingRecHit(), tot_(0), tPrecision_(0), tsIndex_(0), hptdcErr_(0), mh_(false) {} + CTPPSDiamondRecHit(float x, + float xWidth, + float y, + float yWidth, + float z, + float zWidth, + float t, + float tot, + float tPrecision, + int ootIdx, + const HPTDCErrorFlags &hptdcErr, + const bool mh) + : CTPPSTimingRecHit(x, xWidth, y, yWidth, z, zWidth, t), + tot_(tot), + tPrecision_(tPrecision), + tsIndex_(ootIdx), + hptdcErr_(hptdcErr), + mh_(mh) {} - static constexpr int TIMESLICE_WITHOUT_LEADING = -10; + static constexpr int TIMESLICE_WITHOUT_LEADING = -10; - inline void setToT(float tot) { tot_ = tot; } - inline float toT() const { return tot_; } + inline void setToT(float tot) { tot_ = tot; } + inline float toT() const { return tot_; } - inline void setTPrecision(float tPrecision) { tPrecision_ = tPrecision; } - inline float tPrecision() const { return tPrecision_; } + inline void setTPrecision(float tPrecision) { tPrecision_ = tPrecision; } + inline float tPrecision() const { return tPrecision_; } - inline void setOOTIndex(int i) { tsIndex_ = i; } - inline int ootIndex() const { return tsIndex_; } + inline void setOOTIndex(int i) { tsIndex_ = i; } + inline int ootIndex() const { return tsIndex_; } - inline void setMultipleHits(bool mh) { mh_ = mh; } - inline bool multipleHits() const { return mh_; } + inline void setMultipleHits(bool mh) { mh_ = mh; } + inline bool multipleHits() const { return mh_; } - inline void setHPTDCErrorFlags(const HPTDCErrorFlags &err) { hptdcErr_ = err; } - inline HPTDCErrorFlags hptdcErrorFlags() const { return hptdcErr_; } - -private: - /// Time over threshold - float tot_; - /// Expected timing precision - float tPrecision_; - /// Time slice index - int tsIndex_; - /// List of error flags encountered by the HPTDC - HPTDCErrorFlags hptdcErr_; - /// Multiple hits detected - bool mh_; -}; + inline void setHPTDCErrorFlags(const HPTDCErrorFlags &err) { hptdcErr_ = err; } + inline HPTDCErrorFlags hptdcErrorFlags() const { return hptdcErr_; } + private: + /// Time over threshold + float tot_; + /// Expected timing precision + float tPrecision_; + /// Time slice index + int tsIndex_; + /// List of error flags encountered by the HPTDC + HPTDCErrorFlags hptdcErr_; + /// Multiple hits detected + bool mh_; + }; +} // namespace io_v1 +using CTPPSDiamondRecHit = io_v1::CTPPSDiamondRecHit; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLite.h b/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLite.h index 4c35d9cf7dd38..07e44200418c5 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLite.h +++ b/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLite.h @@ -16,138 +16,140 @@ /** *\brief Local (=single RP) track with essential information only. **/ -class CTPPSLocalTrackLite { -public: - CTPPSLocalTrackLite() - : rp_id_(0), - x_(0.), - x_unc_(-1.), - y_(0.), - y_unc_(-1.), - tx_(999.), - tx_unc_(-1.), - ty_(999.), - ty_unc_(-1.), - chi2_norm_(-1.), - pixel_track_reco_info_(CTPPSpixelLocalTrackReconstructionInfo::invalid), - num_points_fit_(0), - time_(0.), - time_unc_(-1.) {} - - CTPPSLocalTrackLite(uint32_t pid, - float px, - float pxu, - float py, - float pyu, - float ptx, - float ptxu, - float pty, - float ptyu, - float pchiSquaredOverNDF, - CTPPSpixelLocalTrackReconstructionInfo ppixelTrack_reco_info, - unsigned short pNumberOfPointsUsedForFit, - float pt, - float ptu) - : rp_id_(pid), - x_(px), - x_unc_(pxu), - y_(py), - y_unc_(pyu), - tx_(ptx), - tx_unc_(ptxu), - ty_(pty), - ty_unc_(ptyu), - chi2_norm_(pchiSquaredOverNDF), - pixel_track_reco_info_(ppixelTrack_reco_info), - num_points_fit_(pNumberOfPointsUsedForFit), - time_(pt), - time_unc_(ptu) {} - - /// returns the RP id - inline uint32_t rpId() const { return rp_id_; } - - /// returns the horizontal track position - inline float x() const { return x_; } - - /// returns the horizontal track position uncertainty - inline float xUnc() const { return x_unc_; } - - /// returns the vertical track position - inline float y() const { return y_; } - - /// returns the vertical track position uncertainty - inline float yUnc() const { return y_unc_; } - - /// returns the track time - inline float time() const { return time_; } - - /// returns the track time uncertainty - inline float timeUnc() const { return time_unc_; } - - /// returns the track horizontal angle - inline float tx() const { return tx_; } - - /// returns the track horizontal angle uncertainty - inline float txUnc() const { return tx_unc_; } - - /// returns the track vertical angle - inline float ty() const { return ty_; } - - /// returns the track vertical angle uncertainty - inline float tyUnc() const { return ty_unc_; } - - /// returns the track fit chi Squared over NDF - inline float chiSquaredOverNDF() const { return chi2_norm_; } - - /// returns the track reconstruction info byte - inline CTPPSpixelLocalTrackReconstructionInfo pixelTrackRecoInfo() const { return pixel_track_reco_info_; } - - /// returns the number of points used for fit - inline unsigned short numberOfPointsUsedForFit() const { return num_points_fit_; } - -protected: - /// RP id - uint32_t rp_id_; - - /// local track parameterization - /// x = x0 + tx*(z-z0), y = y0 + ty*(z-z0) - /// x0, y0, z-z0 in mm - /// z0: position of the reference scoring plane (in the middle of the RP) - - /// horizontal hit position, mm - float x_; - /// uncertainty on horizontal hit position, mm - float x_unc_; - /// vertical hit position, mm - float y_; - /// uncertainty on vertical hit position, mm - float y_unc_; - /// horizontal angle, x = x0 + tx*(z-z0) - float tx_; - /// uncertainty on horizontal angle - float tx_unc_; - /// vertical angle, y = y0 + ty*(z-z0) - float ty_; - /// uncertainty on vertical angle - float ty_unc_; - /// fit \f$\chi^2\f$/NDF - float chi2_norm_; - - /// Track information byte for bx-shifted runs: - /// * notShiftedRun -> Default value for tracks reconstructed in non-bx-shifted ROCs - /// * allShiftedPlanes -> Track reconstructed in a bx-shifted ROC with bx-shifted planes only - /// * noShiftedPlanes -> Track reconstructed in a bx-shifted ROC with non-bx-shifted planes only - /// * mixedPlanes -> Track reconstructed in a bx-shifted ROC both with bx-shifted and non-bx-shifted planes - /// * invalid -> Dummy value. Assigned when pixelTrack_reco_info is not computed (i.e. non-pixel tracks) - CTPPSpixelLocalTrackReconstructionInfo pixel_track_reco_info_; - - /// number of points used for fit - unsigned short num_points_fit_; - - /// time information, ns - float time_; - /// uncertainty on time information, ns - float time_unc_; -}; - +namespace io_v1 { + class CTPPSLocalTrackLite { + public: + CTPPSLocalTrackLite() + : rp_id_(0), + x_(0.), + x_unc_(-1.), + y_(0.), + y_unc_(-1.), + tx_(999.), + tx_unc_(-1.), + ty_(999.), + ty_unc_(-1.), + chi2_norm_(-1.), + pixel_track_reco_info_(CTPPSpixelLocalTrackReconstructionInfo::invalid), + num_points_fit_(0), + time_(0.), + time_unc_(-1.) {} + + CTPPSLocalTrackLite(uint32_t pid, + float px, + float pxu, + float py, + float pyu, + float ptx, + float ptxu, + float pty, + float ptyu, + float pchiSquaredOverNDF, + CTPPSpixelLocalTrackReconstructionInfo ppixelTrack_reco_info, + unsigned short pNumberOfPointsUsedForFit, + float pt, + float ptu) + : rp_id_(pid), + x_(px), + x_unc_(pxu), + y_(py), + y_unc_(pyu), + tx_(ptx), + tx_unc_(ptxu), + ty_(pty), + ty_unc_(ptyu), + chi2_norm_(pchiSquaredOverNDF), + pixel_track_reco_info_(ppixelTrack_reco_info), + num_points_fit_(pNumberOfPointsUsedForFit), + time_(pt), + time_unc_(ptu) {} + + /// returns the RP id + inline uint32_t rpId() const { return rp_id_; } + + /// returns the horizontal track position + inline float x() const { return x_; } + + /// returns the horizontal track position uncertainty + inline float xUnc() const { return x_unc_; } + + /// returns the vertical track position + inline float y() const { return y_; } + + /// returns the vertical track position uncertainty + inline float yUnc() const { return y_unc_; } + + /// returns the track time + inline float time() const { return time_; } + + /// returns the track time uncertainty + inline float timeUnc() const { return time_unc_; } + + /// returns the track horizontal angle + inline float tx() const { return tx_; } + + /// returns the track horizontal angle uncertainty + inline float txUnc() const { return tx_unc_; } + + /// returns the track vertical angle + inline float ty() const { return ty_; } + + /// returns the track vertical angle uncertainty + inline float tyUnc() const { return ty_unc_; } + + /// returns the track fit chi Squared over NDF + inline float chiSquaredOverNDF() const { return chi2_norm_; } + + /// returns the track reconstruction info byte + inline CTPPSpixelLocalTrackReconstructionInfo pixelTrackRecoInfo() const { return pixel_track_reco_info_; } + + /// returns the number of points used for fit + inline unsigned short numberOfPointsUsedForFit() const { return num_points_fit_; } + + protected: + /// RP id + uint32_t rp_id_; + + /// local track parameterization + /// x = x0 + tx*(z-z0), y = y0 + ty*(z-z0) + /// x0, y0, z-z0 in mm + /// z0: position of the reference scoring plane (in the middle of the RP) + + /// horizontal hit position, mm + float x_; + /// uncertainty on horizontal hit position, mm + float x_unc_; + /// vertical hit position, mm + float y_; + /// uncertainty on vertical hit position, mm + float y_unc_; + /// horizontal angle, x = x0 + tx*(z-z0) + float tx_; + /// uncertainty on horizontal angle + float tx_unc_; + /// vertical angle, y = y0 + ty*(z-z0) + float ty_; + /// uncertainty on vertical angle + float ty_unc_; + /// fit \f$\chi^2\f$/NDF + float chi2_norm_; + + /// Track information byte for bx-shifted runs: + /// * notShiftedRun -> Default value for tracks reconstructed in non-bx-shifted ROCs + /// * allShiftedPlanes -> Track reconstructed in a bx-shifted ROC with bx-shifted planes only + /// * noShiftedPlanes -> Track reconstructed in a bx-shifted ROC with non-bx-shifted planes only + /// * mixedPlanes -> Track reconstructed in a bx-shifted ROC both with bx-shifted and non-bx-shifted planes + /// * invalid -> Dummy value. Assigned when pixelTrack_reco_info is not computed (i.e. non-pixel tracks) + CTPPSpixelLocalTrackReconstructionInfo pixel_track_reco_info_; + + /// number of points used for fit + unsigned short num_points_fit_; + + /// time information, ns + float time_; + /// uncertainty on time information, ns + float time_unc_; + }; +} // namespace io_v1 +using CTPPSLocalTrackLite = io_v1::CTPPSLocalTrackLite; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h b/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h index 4835de7f08cf6..7dc31e99906dc 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h +++ b/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h @@ -16,7 +16,10 @@ #include -class CTPPSLocalTrackLite; +namespace io_v1 { + class CTPPSLocalTrackLite; +} +using CTPPSLocalTrackLite = io_v1::CTPPSLocalTrackLite; /// Collection of CTPPSLocalTrackLite objects typedef std::vector CTPPSLocalTrackLiteCollection; /// Persistent reference to a CTPPSLocalTrackLite diff --git a/DataFormats/CTPPSReco/interface/CTPPSPixelCluster.h b/DataFormats/CTPPSReco/interface/CTPPSPixelCluster.h index 7151044d46295..9d85ba8a54904 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSPixelCluster.h +++ b/DataFormats/CTPPSReco/interface/CTPPSPixelCluster.h @@ -11,114 +11,116 @@ #include #include -class CTPPSPixelCluster { -public: - CTPPSPixelCluster() {} - static constexpr uint8_t MAXSPAN = 255; - static constexpr uint8_t MAXCOL = 155; - static constexpr uint8_t MAXROW = 159; - - CTPPSPixelCluster(uint16_t isize, uint16_t* adcs, uint8_t const* rowpos, uint8_t const* colpos) - : thePixelOffset( - 2 * - isize), // the pixel offset is the pixel position inside the cluster wrt rowmin (even positions) and colmin (odd positions) - thePixelADC(adcs, adcs + isize) { - uint8_t maxCol = 0; - uint8_t maxRow = 0; - uint8_t rowmin = MAXROW; - uint8_t colmin = MAXCOL; - for (unsigned int j = 0; j != isize; ++j) { - rowmin = std::min(rowpos[j], rowmin); - colmin = std::min(colpos[j], colmin); +namespace io_v1 { + class CTPPSPixelCluster { + public: + CTPPSPixelCluster() {} + static constexpr uint8_t MAXSPAN = 255; + static constexpr uint8_t MAXCOL = 155; + static constexpr uint8_t MAXROW = 159; + + CTPPSPixelCluster(uint16_t isize, uint16_t* adcs, uint8_t const* rowpos, uint8_t const* colpos) + : thePixelOffset( + 2 * + isize), // the pixel offset is the pixel position inside the cluster wrt rowmin (even positions) and colmin (odd positions) + thePixelADC(adcs, adcs + isize) { + uint8_t maxCol = 0; + uint8_t maxRow = 0; + uint8_t rowmin = MAXROW; + uint8_t colmin = MAXCOL; + for (unsigned int j = 0; j != isize; ++j) { + rowmin = std::min(rowpos[j], rowmin); + colmin = std::min(colpos[j], colmin); + } + for (unsigned int i = 0; i != isize; ++i) { + uint8_t rowoffset = rowpos[i] - rowmin; + uint8_t coloffset = colpos[i] - colmin; + thePixelOffset[i * 2] = std::min(MAXSPAN, rowoffset); + thePixelOffset[i * 2 + 1] = std::min(MAXSPAN, coloffset); + if (rowoffset > maxRow) + maxRow = rowoffset; + if (coloffset > maxCol) + maxCol = coloffset; + } + + theMinPixelRow = rowmin; + thePixelRowSpan = std::min(maxRow, MAXSPAN); + + theMinPixelCol = colmin; + thePixelColSpan = std::min(maxCol, MAXSPAN); } - for (unsigned int i = 0; i != isize; ++i) { - uint8_t rowoffset = rowpos[i] - rowmin; - uint8_t coloffset = colpos[i] - colmin; - thePixelOffset[i * 2] = std::min(MAXSPAN, rowoffset); - thePixelOffset[i * 2 + 1] = std::min(MAXSPAN, coloffset); - if (rowoffset > maxRow) - maxRow = rowoffset; - if (coloffset > maxCol) - maxCol = coloffset; - } - - theMinPixelRow = rowmin; - thePixelRowSpan = std::min(maxRow, MAXSPAN); - - theMinPixelCol = colmin; - thePixelColSpan = std::min(maxCol, MAXSPAN); - } - // barycenter + // barycenter - float avg_row() const { - float qm = 0.0; - unsigned int isize = thePixelADC.size(); - for (unsigned int i = 0; i < isize; ++i) - qm += float(thePixelADC[i]) * (thePixelOffset[i * 2] + theMinPixelRow + 0.5f); - return qm / charge(); - } + float avg_row() const { + float qm = 0.0; + unsigned int isize = thePixelADC.size(); + for (unsigned int i = 0; i < isize; ++i) + qm += float(thePixelADC[i]) * (thePixelOffset[i * 2] + theMinPixelRow + 0.5f); + return qm / charge(); + } - float avg_col() const { - float qm = 0.0; - unsigned int isize = thePixelADC.size(); - for (unsigned int i = 0; i < isize; ++i) - qm += float(thePixelADC[i]) * (thePixelOffset[i * 2 + 1] + theMinPixelCol + 0.5f); - return qm / charge(); - } + float avg_col() const { + float qm = 0.0; + unsigned int isize = thePixelADC.size(); + for (unsigned int i = 0; i < isize; ++i) + qm += float(thePixelADC[i]) * (thePixelOffset[i * 2 + 1] + theMinPixelCol + 0.5f); + return qm / charge(); + } - //cluster charge + //cluster charge - inline float charge() const { - float qm = 0.0; - unsigned int isize = thePixelADC.size(); - for (unsigned int i = 0; i < isize; ++i) - qm += float(thePixelADC[i]); - return qm; - } + inline float charge() const { + float qm = 0.0; + unsigned int isize = thePixelADC.size(); + for (unsigned int i = 0; i < isize; ++i) + qm += float(thePixelADC[i]); + return qm; + } - // Return number of pixels. - unsigned int size() const { return thePixelADC.size(); } + // Return number of pixels. + unsigned int size() const { return thePixelADC.size(); } - // Return cluster dimension in rows - unsigned int sizeRow() const { return thePixelRowSpan + 1; } + // Return cluster dimension in rows + unsigned int sizeRow() const { return thePixelRowSpan + 1; } - // Return cluster dimension in columns - unsigned int sizeCol() const { return thePixelColSpan + 1; } + // Return cluster dimension in columns + unsigned int sizeCol() const { return thePixelColSpan + 1; } - inline unsigned int minPixelRow() const { return theMinPixelRow; } - inline unsigned int minPixelCol() const { return theMinPixelCol; } + inline unsigned int minPixelRow() const { return theMinPixelRow; } + inline unsigned int minPixelCol() const { return theMinPixelCol; } - inline unsigned int colSpan() const { return thePixelColSpan; } - inline unsigned int rowSpan() const { return thePixelRowSpan; } + inline unsigned int colSpan() const { return thePixelColSpan; } + inline unsigned int rowSpan() const { return thePixelRowSpan; } - const std::vector& pixelOffset() const { return thePixelOffset; } - const std::vector& pixelADC() const { return thePixelADC; } + const std::vector& pixelOffset() const { return thePixelOffset; } + const std::vector& pixelADC() const { return thePixelADC; } - unsigned int pixelRow(unsigned int i) const { return theMinPixelRow + thePixelOffset[i * 2]; } - unsigned int pixelCol(unsigned int i) const { return theMinPixelCol + thePixelOffset[i * 2 + 1]; } - unsigned int pixelADC(unsigned int i) const { return thePixelADC[i]; } + unsigned int pixelRow(unsigned int i) const { return theMinPixelRow + thePixelOffset[i * 2]; } + unsigned int pixelCol(unsigned int i) const { return theMinPixelCol + thePixelOffset[i * 2 + 1]; } + unsigned int pixelADC(unsigned int i) const { return thePixelADC[i]; } -private: - std::vector thePixelOffset; - std::vector thePixelADC; + private: + std::vector thePixelOffset; + std::vector thePixelADC; - uint8_t theMinPixelRow = MAXROW; - uint8_t theMinPixelCol = MAXCOL; - uint8_t thePixelRowSpan = 0; - uint8_t thePixelColSpan = 0; -}; + uint8_t theMinPixelRow = MAXROW; + uint8_t theMinPixelCol = MAXCOL; + uint8_t thePixelRowSpan = 0; + uint8_t thePixelColSpan = 0; + }; -inline bool operator<(const CTPPSPixelCluster& one, const CTPPSPixelCluster& two) { - if (one.minPixelRow() < two.minPixelRow()) { - return true; - } else if (one.minPixelRow() > two.minPixelRow()) { - return false; - } else if (one.minPixelCol() < two.minPixelCol()) { - return true; - } else { - return false; + inline bool operator<(const CTPPSPixelCluster& one, const CTPPSPixelCluster& two) { + if (one.minPixelRow() < two.minPixelRow()) { + return true; + } else if (one.minPixelRow() > two.minPixelRow()) { + return false; + } else if (one.minPixelCol() < two.minPixelCol()) { + return true; + } else { + return false; + } } -} - +} // namespace io_v1 +using CTPPSPixelCluster = io_v1::CTPPSPixelCluster; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h b/DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h index fb0799687b23d..bd704ea8debcc 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h +++ b/DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h @@ -27,191 +27,194 @@ #include "DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrackRecoInfo.h" //---------------------------------------------------------------------------------------------------- -class CTPPSPixelFittedRecHit : public CTPPSPixelRecHit { -public: - CTPPSPixelFittedRecHit(const CTPPSPixelRecHit& hit, - const GlobalPoint& space_point_on_det, - const LocalPoint& residual, - const LocalPoint& pull) - : CTPPSPixelRecHit(hit), - space_point_on_det_(space_point_on_det), - residual_(residual), - pull_(pull), - isUsedForFit_(false), - isRealHit_(false) {} - - CTPPSPixelFittedRecHit() - : CTPPSPixelRecHit(), - residual_(LocalPoint(0, 0)), - pull_(LocalPoint(0, 0)), - isUsedForFit_(false), - isRealHit_(false) {} - - virtual ~CTPPSPixelFittedRecHit() {} - - inline const GlobalPoint& globalCoordinates() const { return space_point_on_det_; } - inline float xResidual() const { return residual_.x(); } - inline float yResidual() const { return residual_.y(); } - - inline float xPull() const { return pull_.x(); } - inline float yPull() const { return pull_.y(); } - - inline float xPullNormalization() const { return residual_.x() / pull_.x(); } - inline float yPullNormalization() const { return residual_.y() / pull_.y(); } - - inline void setIsUsedForFit(bool usedForFit) { - if (usedForFit) - isRealHit_ = true; - isUsedForFit_ = usedForFit; - } - inline bool isUsedForFit() const { return isUsedForFit_; } - - inline void setIsRealHit(bool realHit) { - if (!realHit) - isUsedForFit_ = false; - isRealHit_ = realHit; - } - inline bool isRealHit() const { return isRealHit_; } - -private: - GlobalPoint space_point_on_det_; ///< mm - LocalPoint residual_; ///< mm - LocalPoint pull_; ///< normalised residual - bool isUsedForFit_; - bool isRealHit_; -}; - -class CTPPSPixelLocalTrack { -public: - enum class TrackPar { x0 = 0, y0 = 1, tx = 2, ty = 3 }; - - ///< parameter vector size - static constexpr int dimension = 4; - typedef math::Error::type CovarianceMatrix; - typedef math::Vector::type ParameterVector; - - ///< covariance matrix size - static constexpr int covarianceSize = dimension * dimension; - - CTPPSPixelLocalTrack() - : z0_(0), - chiSquared_(0), - valid_(false), - numberOfPointsUsedForFit_(0), - recoInfo_(CTPPSpixelLocalTrackReconstructionInfo::invalid) {} - - CTPPSPixelLocalTrack(float z0, - const ParameterVector& track_params_vector, - const CovarianceMatrix& par_covariance_matrix, - float chiSquared); - - ~CTPPSPixelLocalTrack() {} - - inline const edm::DetSetVector& hits() const { return track_hits_vector_; } - inline void addHit(unsigned int detId, const CTPPSPixelFittedRecHit& hit) { - track_hits_vector_.find_or_insert(detId).push_back(hit); - if (hit.isUsedForFit()) - ++numberOfPointsUsedForFit_; - } - - inline float x0() const { return track_params_vector_[(unsigned int)TrackPar::x0]; } - inline float x0Sigma() const { - return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::x0][(unsigned int)TrackPar::x0]); - } - inline float x0Variance() const { - return par_covariance_matrix_[(unsigned int)TrackPar::x0][(unsigned int)TrackPar::x0]; - } - - inline float y0() const { return track_params_vector_[(unsigned int)TrackPar::y0]; } - inline float y0Sigma() const { - return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::y0][(unsigned int)TrackPar::y0]); - } - inline float y0Variance() const { - return par_covariance_matrix_[(unsigned int)TrackPar::y0][(unsigned int)TrackPar::y0]; - } - - inline float z0() const { return z0_; } - inline void setZ0(float z0) { z0_ = z0; } - - inline float tx() const { return track_params_vector_[(unsigned int)TrackPar::tx]; } - inline float txSigma() const { - return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::tx][(unsigned int)TrackPar::tx]); - } - - inline float ty() const { return track_params_vector_[(unsigned int)TrackPar::ty]; } - inline float tySigma() const { - return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::ty][(unsigned int)TrackPar::ty]); - } - - inline GlobalVector directionVector() const { - GlobalVector vect(tx(), ty(), 1); - return vect.unit(); - } +namespace io_v1 { + class CTPPSPixelFittedRecHit : public CTPPSPixelRecHit { + public: + CTPPSPixelFittedRecHit(const CTPPSPixelRecHit& hit, + const GlobalPoint& space_point_on_det, + const LocalPoint& residual, + const LocalPoint& pull) + : CTPPSPixelRecHit(hit), + space_point_on_det_(space_point_on_det), + residual_(residual), + pull_(pull), + isUsedForFit_(false), + isRealHit_(false) {} + + CTPPSPixelFittedRecHit() + : CTPPSPixelRecHit(), + residual_(LocalPoint(0, 0)), + pull_(LocalPoint(0, 0)), + isUsedForFit_(false), + isRealHit_(false) {} + + virtual ~CTPPSPixelFittedRecHit() {} + + inline const GlobalPoint& globalCoordinates() const { return space_point_on_det_; } + inline float xResidual() const { return residual_.x(); } + inline float yResidual() const { return residual_.y(); } + + inline float xPull() const { return pull_.x(); } + inline float yPull() const { return pull_.y(); } + + inline float xPullNormalization() const { return residual_.x() / pull_.x(); } + inline float yPullNormalization() const { return residual_.y() / pull_.y(); } + + inline void setIsUsedForFit(bool usedForFit) { + if (usedForFit) + isRealHit_ = true; + isUsedForFit_ = usedForFit; + } + inline bool isUsedForFit() const { return isUsedForFit_; } + + inline void setIsRealHit(bool realHit) { + if (!realHit) + isUsedForFit_ = false; + isRealHit_ = realHit; + } + inline bool isRealHit() const { return isRealHit_; } + + private: + GlobalPoint space_point_on_det_; ///< mm + LocalPoint residual_; ///< mm + LocalPoint pull_; ///< normalised residual + bool isUsedForFit_; + bool isRealHit_; + }; + + class CTPPSPixelLocalTrack { + public: + enum class TrackPar { x0 = 0, y0 = 1, tx = 2, ty = 3 }; + + ///< parameter vector size + static constexpr int dimension = 4; + typedef math::Error::type CovarianceMatrix; + typedef math::Vector::type ParameterVector; + + ///< covariance matrix size + static constexpr int covarianceSize = dimension * dimension; + + CTPPSPixelLocalTrack() + : z0_(0), + chiSquared_(0), + valid_(false), + numberOfPointsUsedForFit_(0), + recoInfo_(CTPPSpixelLocalTrackReconstructionInfo::invalid) {} + + CTPPSPixelLocalTrack(float z0, + const ParameterVector& track_params_vector, + const CovarianceMatrix& par_covariance_matrix, + float chiSquared); + + ~CTPPSPixelLocalTrack() {} + + inline const edm::DetSetVector& hits() const { return track_hits_vector_; } + inline void addHit(unsigned int detId, const CTPPSPixelFittedRecHit& hit) { + track_hits_vector_.find_or_insert(detId).push_back(hit); + if (hit.isUsedForFit()) + ++numberOfPointsUsedForFit_; + } + + inline float x0() const { return track_params_vector_[(unsigned int)TrackPar::x0]; } + inline float x0Sigma() const { + return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::x0][(unsigned int)TrackPar::x0]); + } + inline float x0Variance() const { + return par_covariance_matrix_[(unsigned int)TrackPar::x0][(unsigned int)TrackPar::x0]; + } + + inline float y0() const { return track_params_vector_[(unsigned int)TrackPar::y0]; } + inline float y0Sigma() const { + return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::y0][(unsigned int)TrackPar::y0]); + } + inline float y0Variance() const { + return par_covariance_matrix_[(unsigned int)TrackPar::y0][(unsigned int)TrackPar::y0]; + } + + inline float z0() const { return z0_; } + inline void setZ0(float z0) { z0_ = z0; } + + inline float tx() const { return track_params_vector_[(unsigned int)TrackPar::tx]; } + inline float txSigma() const { + return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::tx][(unsigned int)TrackPar::tx]); + } + + inline float ty() const { return track_params_vector_[(unsigned int)TrackPar::ty]; } + inline float tySigma() const { + return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::ty][(unsigned int)TrackPar::ty]); + } + + inline GlobalVector directionVector() const { + GlobalVector vect(tx(), ty(), 1); + return vect.unit(); + } + + inline const ParameterVector& parameterVector() const { return track_params_vector_; } + + inline const CovarianceMatrix& covarianceMatrix() const { return par_covariance_matrix_; } + + inline float chiSquared() const { return chiSquared_; } + + inline float chiSquaredOverNDF() const { + if (numberOfPointsUsedForFit_ <= dimension / 2) + return -999.; + else + return chiSquared_ / (2 * numberOfPointsUsedForFit_ - dimension); + } + + inline int ndf() const { return (2 * numberOfPointsUsedForFit_ - dimension); } + + /// returns the point from which the track is passing by at the selected z + inline GlobalPoint trackPoint(float z) const { + float delta_z = z - z0_; + return GlobalPoint( + track_params_vector_[(unsigned int)TrackPar::x0] + track_params_vector_[(unsigned int)TrackPar::tx] * delta_z, + track_params_vector_[(unsigned int)TrackPar::y0] + track_params_vector_[(unsigned int)TrackPar::ty] * delta_z, + z); + } + + inline GlobalPoint trackCentrePoint() { + return GlobalPoint( + track_params_vector_[(unsigned int)TrackPar::x0], track_params_vector_[(unsigned int)TrackPar::y0], z0_); + } + + AlgebraicSymMatrix22 trackPointInterpolationCovariance(float z) const; - inline const ParameterVector& parameterVector() const { return track_params_vector_; } - - inline const CovarianceMatrix& covarianceMatrix() const { return par_covariance_matrix_; } + inline bool isValid() const { return valid_; } - inline float chiSquared() const { return chiSquared_; } - - inline float chiSquaredOverNDF() const { - if (numberOfPointsUsedForFit_ <= dimension / 2) - return -999.; - else - return chiSquared_ / (2 * numberOfPointsUsedForFit_ - dimension); - } - - inline int ndf() const { return (2 * numberOfPointsUsedForFit_ - dimension); } - - /// returns the point from which the track is passing by at the selected z - inline GlobalPoint trackPoint(float z) const { - float delta_z = z - z0_; - return GlobalPoint( - track_params_vector_[(unsigned int)TrackPar::x0] + track_params_vector_[(unsigned int)TrackPar::tx] * delta_z, - track_params_vector_[(unsigned int)TrackPar::y0] + track_params_vector_[(unsigned int)TrackPar::ty] * delta_z, - z); - } + inline void setValid(bool valid) { valid_ = valid; } - inline GlobalPoint trackCentrePoint() { - return GlobalPoint( - track_params_vector_[(unsigned int)TrackPar::x0], track_params_vector_[(unsigned int)TrackPar::y0], z0_); - } + bool operator<(const CTPPSPixelLocalTrack& r); - AlgebraicSymMatrix22 trackPointInterpolationCovariance(float z) const; + inline CTPPSpixelLocalTrackReconstructionInfo recoInfo() const { return recoInfo_; } + inline void setRecoInfo(CTPPSpixelLocalTrackReconstructionInfo recoInfo) { recoInfo_ = recoInfo; } - inline bool isValid() const { return valid_; } + inline unsigned short numberOfPointsUsedForFit() const { return numberOfPointsUsedForFit_; } - inline void setValid(bool valid) { valid_ = valid; } + private: + edm::DetSetVector track_hits_vector_; - bool operator<(const CTPPSPixelLocalTrack& r); + /// track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ... + ParameterVector track_params_vector_; - inline CTPPSpixelLocalTrackReconstructionInfo recoInfo() const { return recoInfo_; } - inline void setRecoInfo(CTPPSpixelLocalTrackReconstructionInfo recoInfo) { recoInfo_ = recoInfo; } + /// z where x0 and y0 are evaluated. + /// filled from TotemRPGeometry::GetRPGlobalTranslation + float z0_; - inline unsigned short numberOfPointsUsedForFit() const { return numberOfPointsUsedForFit_; } + CovarianceMatrix par_covariance_matrix_; -private: - edm::DetSetVector track_hits_vector_; + /// fit chi^2 + float chiSquared_; - /// track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ... - ParameterVector track_params_vector_; + /// fit valid? + bool valid_; - /// z where x0 and y0 are evaluated. - /// filled from TotemRPGeometry::GetRPGlobalTranslation - float z0_; - - CovarianceMatrix par_covariance_matrix_; - - /// fit chi^2 - float chiSquared_; - - /// fit valid? - bool valid_; - - /// number of points used for the track fit - int numberOfPointsUsedForFit_; - - CTPPSpixelLocalTrackReconstructionInfo recoInfo_; -}; + /// number of points used for the track fit + int numberOfPointsUsedForFit_; + CTPPSpixelLocalTrackReconstructionInfo recoInfo_; + }; +} // namespace io_v1 +using CTPPSPixelLocalTrack = io_v1::CTPPSPixelLocalTrack; +using CTPPSPixelFittedRecHit = io_v1::CTPPSPixelFittedRecHit; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h b/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h index b032212b5323b..b9ffa9400501d 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h +++ b/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h @@ -17,67 +17,69 @@ // Reconstructed hits in CTPPS Pixel detector -class CTPPSPixelRecHit { -public: - CTPPSPixelRecHit(LocalPoint lp = LocalPoint(0., 0., 0.), - LocalError le = LocalError(0., 0., 0.), - bool edge = false, - bool bad = false, - bool rocs = false, - int minrow = 0, - int mincol = 0, - int size = 0, - int rowsize = 0, - int colsize = 0) - : thePoint_(lp), - theError_(le), - isOnEdge_(edge), - hasBadPixels_(bad), - spanTwoRocs_(rocs), - minPixelRow_(minrow), - minPixelCol_(mincol), - clusterSize_(size), - clusterSizeRow_(rowsize), - clusterSizeCol_(colsize) {} - - LocalPoint point() const { return thePoint_; } - LocalError error() const { return theError_; } - - bool isOnEdge() const { return isOnEdge_; } - bool hasBadPixels() const { return hasBadPixels_; } - bool spanTwoRocs() const { return spanTwoRocs_; } - - unsigned int minPixelRow() const { return minPixelRow_; } - unsigned int minPixelCol() const { return minPixelCol_; } - - unsigned int clusterSize() const { return clusterSize_; } - unsigned int clusterSizeRow() const { return clusterSizeRow_; } - unsigned int clusterSizeCol() const { return clusterSizeCol_; } - - float sort_key() const { return thePoint_.mag2(); } - -private: - LocalPoint thePoint_; - LocalError theError_; - - bool isOnEdge_; - bool hasBadPixels_; - bool spanTwoRocs_; - - unsigned int minPixelRow_; - unsigned int minPixelCol_; - - unsigned int clusterSize_; - unsigned int clusterSizeRow_; - unsigned int clusterSizeCol_; -}; - -inline bool operator<(CTPPSPixelRecHit const& a, CTPPSPixelRecHit const& b) { - float a_key = a.sort_key(); - float b_key = b.sort_key(); - assert(edm::isFinite(a_key)); - assert(edm::isFinite(b_key)); - return a_key < b_key; -} - +namespace io_v1 { + class CTPPSPixelRecHit { + public: + CTPPSPixelRecHit(LocalPoint lp = LocalPoint(0., 0., 0.), + LocalError le = LocalError(0., 0., 0.), + bool edge = false, + bool bad = false, + bool rocs = false, + int minrow = 0, + int mincol = 0, + int size = 0, + int rowsize = 0, + int colsize = 0) + : thePoint_(lp), + theError_(le), + isOnEdge_(edge), + hasBadPixels_(bad), + spanTwoRocs_(rocs), + minPixelRow_(minrow), + minPixelCol_(mincol), + clusterSize_(size), + clusterSizeRow_(rowsize), + clusterSizeCol_(colsize) {} + + LocalPoint point() const { return thePoint_; } + LocalError error() const { return theError_; } + + bool isOnEdge() const { return isOnEdge_; } + bool hasBadPixels() const { return hasBadPixels_; } + bool spanTwoRocs() const { return spanTwoRocs_; } + + unsigned int minPixelRow() const { return minPixelRow_; } + unsigned int minPixelCol() const { return minPixelCol_; } + + unsigned int clusterSize() const { return clusterSize_; } + unsigned int clusterSizeRow() const { return clusterSizeRow_; } + unsigned int clusterSizeCol() const { return clusterSizeCol_; } + + float sort_key() const { return thePoint_.mag2(); } + + private: + LocalPoint thePoint_; + LocalError theError_; + + bool isOnEdge_; + bool hasBadPixels_; + bool spanTwoRocs_; + + unsigned int minPixelRow_; + unsigned int minPixelCol_; + + unsigned int clusterSize_; + unsigned int clusterSizeRow_; + unsigned int clusterSizeCol_; + }; + + inline bool operator<(CTPPSPixelRecHit const& a, CTPPSPixelRecHit const& b) { + float a_key = a.sort_key(); + float b_key = b.sort_key(); + assert(edm::isFinite(a_key)); + assert(edm::isFinite(b_key)); + return a_key < b_key; + } +} // namespace io_v1 +using CTPPSPixelRecHit = io_v1::CTPPSPixelRecHit; #endif // DataFormats_CTPPSReco_interface_CTPPSPixelRecHit_h diff --git a/DataFormats/CTPPSReco/interface/CTPPSTimingLocalTrack.h b/DataFormats/CTPPSReco/interface/CTPPSTimingLocalTrack.h index 8052bd773705a..a9abbc46a43d8 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSTimingLocalTrack.h +++ b/DataFormats/CTPPSReco/interface/CTPPSTimingLocalTrack.h @@ -16,76 +16,78 @@ //---------------------------------------------------------------------------------------------------- -class CTPPSTimingLocalTrack { -public: - CTPPSTimingLocalTrack(); - CTPPSTimingLocalTrack(const math::XYZPoint& pos0, const math::XYZPoint& pos0_sigma, float t, float t_sigma); +namespace io_v1 { + class CTPPSTimingLocalTrack { + public: + CTPPSTimingLocalTrack(); + CTPPSTimingLocalTrack(const math::XYZPoint& pos0, const math::XYZPoint& pos0_sigma, float t, float t_sigma); - enum class CheckDimension { x, y, all }; - bool containsHit(const CTPPSTimingRecHit& recHit, - float tolerance = 0.1f, - CheckDimension check = CheckDimension::all) const; + enum class CheckDimension { x, y, all }; + bool containsHit(const CTPPSTimingRecHit& recHit, + float tolerance = 0.1f, + CheckDimension check = CheckDimension::all) const; - //--- spatial get'ters + //--- spatial get'ters - inline float x0() const { return pos0_.x(); } - inline float x0Sigma() const { return pos0_sigma_.x(); } + inline float x0() const { return pos0_.x(); } + inline float x0Sigma() const { return pos0_sigma_.x(); } - inline float y0() const { return pos0_.y(); } - inline float y0Sigma() const { return pos0_sigma_.y(); } + inline float y0() const { return pos0_.y(); } + inline float y0Sigma() const { return pos0_sigma_.y(); } - inline float z0() const { return pos0_.z(); } - inline float z0Sigma() const { return pos0_sigma_.z(); } + inline float z0() const { return pos0_.z(); } + inline float z0Sigma() const { return pos0_sigma_.z(); } - inline int numberOfHits() const { return num_hits_; } - inline int numberOfPlanes() const { return num_planes_; } + inline int numberOfHits() const { return num_hits_; } + inline int numberOfPlanes() const { return num_planes_; } - //--- spatial set'ters + //--- spatial set'ters - inline void setPosition(const math::XYZPoint& pos0) { pos0_ = pos0; } - inline void setPositionSigma(const math::XYZPoint& pos0_sigma) { pos0_sigma_ = pos0_sigma; } + inline void setPosition(const math::XYZPoint& pos0) { pos0_ = pos0; } + inline void setPositionSigma(const math::XYZPoint& pos0_sigma) { pos0_sigma_ = pos0_sigma; } - inline void setNumOfHits(int num_hits) { num_hits_ = num_hits; } - inline void setNumOfPlanes(int num_planes) { num_planes_ = num_planes; } + inline void setNumOfHits(int num_hits) { num_hits_ = num_hits; } + inline void setNumOfPlanes(int num_planes) { num_planes_ = num_planes; } - //--- validity related members + //--- validity related members - inline bool isValid() const { return valid_; } - inline void setValid(bool valid) { valid_ = valid; } + inline bool isValid() const { return valid_; } + inline void setValid(bool valid) { valid_ = valid; } - //--- temporal get'ters + //--- temporal get'ters - inline float time() const { return t_; } - inline float timeSigma() const { return t_sigma_; } + inline float time() const { return t_; } + inline float timeSigma() const { return t_sigma_; } - //--- temporal set'ters + //--- temporal set'ters - inline void setTime(float t) { t_ = t; } - inline void setTimeSigma(float t_sigma) { t_sigma_ = t_sigma; } + inline void setTime(float t) { t_ = t; } + inline void setTimeSigma(float t_sigma) { t_sigma_ = t_sigma; } -private: - //--- spatial information + private: + //--- spatial information - /// initial track position - math::XYZPoint pos0_; - /// error on the initial track position - math::XYZPoint pos0_sigma_; + /// initial track position + math::XYZPoint pos0_; + /// error on the initial track position + math::XYZPoint pos0_sigma_; - /// number of hits participating in the track - int num_hits_; + /// number of hits participating in the track + int num_hits_; - /// number of planes participating in the track - int num_planes_; + /// number of planes participating in the track + int num_planes_; - /// fit valid? - bool valid_; + /// fit valid? + bool valid_; - //--- timing information - float t_; - float t_sigma_; -}; - -/// Comparison operator -bool operator<(const CTPPSTimingLocalTrack& lhs, const CTPPSTimingLocalTrack& rhs); + //--- timing information + float t_; + float t_sigma_; + }; + /// Comparison operator + bool operator<(const CTPPSTimingLocalTrack& lhs, const CTPPSTimingLocalTrack& rhs); +} // namespace io_v1 +using CTPPSTimingLocalTrack = io_v1::CTPPSTimingLocalTrack; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSTimingRecHit.h b/DataFormats/CTPPSReco/interface/CTPPSTimingRecHit.h index 248ce1df7321a..06895326642bd 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSTimingRecHit.h +++ b/DataFormats/CTPPSReco/interface/CTPPSTimingRecHit.h @@ -11,45 +11,47 @@ #define DataFormats_CTPPSReco_CTPPSTimingRecHit /// Reconstructed hit in timing detectors. -class CTPPSTimingRecHit { -public: - CTPPSTimingRecHit() : x_(0.), xWidth_(0.), y_(0.), yWidth_(0.), z_(0.), zWidth_(0.), t_(0.) {} - CTPPSTimingRecHit(float x, float xWidth, float y, float yWidth, float z, float zWidth, float t) - : x_(x), xWidth_(xWidth), y_(y), yWidth_(yWidth), z_(z), zWidth_(zWidth), t_(t) {} +namespace io_v1 { + class CTPPSTimingRecHit { + public: + CTPPSTimingRecHit() : x_(0.), xWidth_(0.), y_(0.), yWidth_(0.), z_(0.), zWidth_(0.), t_(0.) {} + CTPPSTimingRecHit(float x, float xWidth, float y, float yWidth, float z, float zWidth, float t) + : x_(x), xWidth_(xWidth), y_(y), yWidth_(yWidth), z_(z), zWidth_(zWidth), t_(t) {} - inline void setX(float x) { x_ = x; } - inline float x() const { return x_; } + inline void setX(float x) { x_ = x; } + inline float x() const { return x_; } - inline void setY(float y) { y_ = y; } - inline float y() const { return y_; } + inline void setY(float y) { y_ = y; } + inline float y() const { return y_; } - inline void setZ(float z) { z_ = z; } - inline float z() const { return z_; } + inline void setZ(float z) { z_ = z; } + inline float z() const { return z_; } - inline void setXWidth(float xWidth) { xWidth_ = xWidth; } - inline float xWidth() const { return xWidth_; } + inline void setXWidth(float xWidth) { xWidth_ = xWidth; } + inline float xWidth() const { return xWidth_; } - inline void setYWidth(float yWidth) { yWidth_ = yWidth; } - inline float yWidth() const { return yWidth_; } + inline void setYWidth(float yWidth) { yWidth_ = yWidth; } + inline float yWidth() const { return yWidth_; } - inline void setZWidth(float zWidth) { zWidth_ = zWidth; } - inline float zWidth() const { return zWidth_; } + inline void setZWidth(float zWidth) { zWidth_ = zWidth; } + inline float zWidth() const { return zWidth_; } - inline void setTime(float t) { t_ = t; } - inline float time() const { return t_; } + inline void setTime(float t) { t_ = t; } + inline float time() const { return t_; } -protected: - float x_, xWidth_; - float y_, yWidth_; - float z_, zWidth_; - float t_; -}; + protected: + float x_, xWidth_; + float y_, yWidth_; + float z_, zWidth_; + float t_; + }; -//---------------------------------------------------------------------------------------------------- - -inline bool operator<(const CTPPSTimingRecHit &l, const CTPPSTimingRecHit &r) { - // only sort by leading edge time - return (l.time() < r.time()); -} + //---------------------------------------------------------------------------------------------------- + inline bool operator<(const CTPPSTimingRecHit &l, const CTPPSTimingRecHit &r) { + // only sort by leading edge time + return (l.time() < r.time()); + } +} // namespace io_v1 +using CTPPSTimingRecHit = io_v1::CTPPSTimingRecHit; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemRPCluster.h b/DataFormats/CTPPSReco/interface/TotemRPCluster.h index 46976be6090ac..f13f65891d19d 100644 --- a/DataFormats/CTPPSReco/interface/TotemRPCluster.h +++ b/DataFormats/CTPPSReco/interface/TotemRPCluster.h @@ -15,37 +15,39 @@ /** *\brief Cluster of TOTEM RP strip hits. **/ -class TotemRPCluster { -public: - TotemRPCluster(unsigned short str_beg = 0, unsigned short str_end = 0) : str_beg_(str_beg), str_end_(str_end) {} +namespace io_v1 { + class TotemRPCluster { + public: + TotemRPCluster(unsigned short str_beg = 0, unsigned short str_end = 0) : str_beg_(str_beg), str_end_(str_end) {} - inline uint16_t stripBegin() const { return str_beg_; } - inline void setStripBegin(unsigned short str_beg) { str_beg_ = str_beg; } + inline uint16_t stripBegin() const { return str_beg_; } + inline void setStripBegin(unsigned short str_beg) { str_beg_ = str_beg; } - inline uint16_t stripEnd() const { return str_end_; } - inline void setStripEnd(unsigned short str_end) { str_end_ = str_end; } + inline uint16_t stripEnd() const { return str_end_; } + inline void setStripEnd(unsigned short str_end) { str_end_ = str_end; } - inline int numberOfStrips() const { return str_end_ - str_beg_ + 1; } + inline int numberOfStrips() const { return str_end_ - str_beg_ + 1; } - inline double centerStripPosition() const { return (str_beg_ + str_end_) / 2.; } + inline double centerStripPosition() const { return (str_beg_ + str_end_) / 2.; } -private: - uint16_t str_beg_; - uint16_t str_end_; -}; + private: + uint16_t str_beg_; + uint16_t str_end_; + }; -//---------------------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------------------- -inline bool operator<(const TotemRPCluster& l, const TotemRPCluster& r) { - if (l.stripBegin() < r.stripBegin()) - return true; - if (l.stripBegin() > r.stripBegin()) - return false; - - if (l.stripEnd() < r.stripEnd()) - return true; + inline bool operator<(const TotemRPCluster& l, const TotemRPCluster& r) { + if (l.stripBegin() < r.stripBegin()) + return true; + if (l.stripBegin() > r.stripBegin()) + return false; - return false; -} + if (l.stripEnd() < r.stripEnd()) + return true; + return false; + } +} // namespace io_v1 +using TotemRPCluster = io_v1::TotemRPCluster; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h b/DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h index 8dc833eca8400..3494486eba7a2 100644 --- a/DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h +++ b/DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h @@ -28,129 +28,133 @@ * x any y refer to the global (x, y) system with the beam at (x = 0, y = 0). * Only VALID tracks (IsValid()==true) can be later used for physics reconstruction! **/ -class TotemRPLocalTrack { -public: - class FittedRecHit : public TotemRPRecHit { +namespace io_v1 { + class TotemRPLocalTrack { public: - FittedRecHit(const TotemRPRecHit &hit, const TVector3 &space_point_on_det, double residual, double pull) - : TotemRPRecHit(hit), space_point_on_det_(space_point_on_det), residual_(residual), pull_(pull) {} + class FittedRecHit : public TotemRPRecHit { + public: + FittedRecHit(const TotemRPRecHit &hit, const TVector3 &space_point_on_det, double residual, double pull) + : TotemRPRecHit(hit), space_point_on_det_(space_point_on_det), residual_(residual), pull_(pull) {} - FittedRecHit() : TotemRPRecHit(), residual_(0), pull_(0) {} + FittedRecHit() : TotemRPRecHit(), residual_(0), pull_(0) {} - virtual ~FittedRecHit() {} + virtual ~FittedRecHit() {} - inline const TVector3 &globalCoordinates() const { return space_point_on_det_; } - inline void setGlobalCoordinates(const TVector3 &space_point_on_det) { space_point_on_det_ = space_point_on_det; } + inline const TVector3 &globalCoordinates() const { return space_point_on_det_; } + inline void setGlobalCoordinates(const TVector3 &space_point_on_det) { space_point_on_det_ = space_point_on_det; } - inline double residual() const { return residual_; } - inline void setResidual(double residual) { residual_ = residual; } + inline double residual() const { return residual_; } + inline void setResidual(double residual) { residual_ = residual; } - inline double pull() const { return pull_; } - inline void setPull(double pull) { pull_ = pull; } + inline double pull() const { return pull_; } + inline void setPull(double pull) { pull_ = pull; } - inline double pullNormalization() const { return residual_ / pull_; } + inline double pullNormalization() const { return residual_ / pull_; } - private: - TVector3 space_point_on_det_; ///< mm - double residual_; ///< mm - double pull_; ///< normalised residual - }; - -public: - ///< parameter vector size - static const int dimension = 4; + private: + TVector3 space_point_on_det_; ///< mm + double residual_; ///< mm + double pull_; ///< normalised residual + }; - ///< covariance matrix size - static const int covarianceSize = dimension * dimension; + public: + ///< parameter vector size + static const int dimension = 4; - TotemRPLocalTrack() : z0_(0), chiSquared_(0), valid_(false) {} + ///< covariance matrix size + static const int covarianceSize = dimension * dimension; - TotemRPLocalTrack(double z0, - const TVectorD &track_params_vector, - const TMatrixD &par_covariance_matrix, - double chiSquared); + TotemRPLocalTrack() : z0_(0), chiSquared_(0), valid_(false) {} - virtual ~TotemRPLocalTrack() {} + TotemRPLocalTrack(double z0, + const TVectorD &track_params_vector, + const TMatrixD &par_covariance_matrix, + double chiSquared); - inline const edm::DetSetVector &hits() const { return track_hits_vector_; } - inline void addHit(unsigned int detId, const FittedRecHit &hit) { - track_hits_vector_.find_or_insert(detId).push_back(hit); - } + virtual ~TotemRPLocalTrack() {} - inline double x0() const { return track_params_vector_[0]; } - inline double x0Sigma() const { return sqrt(CovarianceMatrixElement(0, 0)); } - inline double x0Variance() const { return CovarianceMatrixElement(0, 0); } + inline const edm::DetSetVector &hits() const { return track_hits_vector_; } + inline void addHit(unsigned int detId, const FittedRecHit &hit) { + track_hits_vector_.find_or_insert(detId).push_back(hit); + } - inline double y0() const { return track_params_vector_[1]; } - inline double y0Sigma() const { return sqrt(CovarianceMatrixElement(1, 1)); } - inline double y0Variance() const { return CovarianceMatrixElement(1, 1); } + inline double x0() const { return track_params_vector_[0]; } + inline double x0Sigma() const { return sqrt(CovarianceMatrixElement(0, 0)); } + inline double x0Variance() const { return CovarianceMatrixElement(0, 0); } - inline double z0() const { return z0_; } - inline void setZ0(double z0) { z0_ = z0; } + inline double y0() const { return track_params_vector_[1]; } + inline double y0Sigma() const { return sqrt(CovarianceMatrixElement(1, 1)); } + inline double y0Variance() const { return CovarianceMatrixElement(1, 1); } - inline double tx() const { return track_params_vector_[2]; } - inline double txSigma() const { return sqrt(CovarianceMatrixElement(2, 2)); } + inline double z0() const { return z0_; } + inline void setZ0(double z0) { z0_ = z0; } - inline double ty() const { return track_params_vector_[3]; } - inline double tySigma() const { return sqrt(CovarianceMatrixElement(3, 3)); } + inline double tx() const { return track_params_vector_[2]; } + inline double txSigma() const { return sqrt(CovarianceMatrixElement(2, 2)); } - inline TVector3 directionVector() const { - TVector3 vect(tx(), ty(), 1); - vect.SetMag(1.0); - return vect; - } + inline double ty() const { return track_params_vector_[3]; } + inline double tySigma() const { return sqrt(CovarianceMatrixElement(3, 3)); } - TVectorD parameterVector() const; - void setParameterVector(const TVectorD &track_params_vector); + inline TVector3 directionVector() const { + TVector3 vect(tx(), ty(), 1); + vect.SetMag(1.0); + return vect; + } - TMatrixD covarianceMatrix() const; - void setCovarianceMatrix(const TMatrixD &par_covariance_matrix); + TVectorD parameterVector() const; + void setParameterVector(const TVectorD &track_params_vector); - inline double chiSquared() const { return chiSquared_; } - inline void setChiSquared(double &chiSquared) { chiSquared_ = chiSquared; } + TMatrixD covarianceMatrix() const; + void setCovarianceMatrix(const TMatrixD &par_covariance_matrix); - inline double chiSquaredOverNDF() const { return chiSquared_ / (track_hits_vector_.size() - 4); } + inline double chiSquared() const { return chiSquared_; } + inline void setChiSquared(double &chiSquared) { chiSquared_ = chiSquared; } - inline unsigned short numberOfPointsUsedForFit() const { return track_hits_vector_.size(); } + inline double chiSquaredOverNDF() const { return chiSquared_ / (track_hits_vector_.size() - 4); } - /// returns (x, y) vector - inline TVector2 trackPoint(double z) const { - double delta_z = z - z0_; - return TVector2(track_params_vector_[0] + track_params_vector_[2] * delta_z, - track_params_vector_[1] + track_params_vector_[3] * delta_z); - } + inline unsigned short numberOfPointsUsedForFit() const { return track_hits_vector_.size(); } - inline TVector3 trackCentrePoint() { return TVector3(track_params_vector_[0], track_params_vector_[1], z0_); } + /// returns (x, y) vector + inline TVector2 trackPoint(double z) const { + double delta_z = z - z0_; + return TVector2(track_params_vector_[0] + track_params_vector_[2] * delta_z, + track_params_vector_[1] + track_params_vector_[3] * delta_z); + } - TMatrixD trackPointInterpolationCovariance(double z) const; + inline TVector3 trackCentrePoint() { return TVector3(track_params_vector_[0], track_params_vector_[1], z0_); } - inline bool isValid() const { return valid_; } + TMatrixD trackPointInterpolationCovariance(double z) const; - inline void setValid(bool valid) { valid_ = valid; } + inline bool isValid() const { return valid_; } - friend bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r); + inline void setValid(bool valid) { valid_ = valid; } -private: - inline const double &CovarianceMatrixElement(int i, int j) const { return par_covariance_matrix_[i * dimension + j]; } + friend bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r); - inline double &CovarianceMatrixElement(int i, int j) { return par_covariance_matrix_[i * dimension + j]; } + private: + inline const double &CovarianceMatrixElement(int i, int j) const { + return par_covariance_matrix_[i * dimension + j]; + } - edm::DetSetVector track_hits_vector_; + inline double &CovarianceMatrixElement(int i, int j) { return par_covariance_matrix_[i * dimension + j]; } - /// track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ... - double track_params_vector_[dimension]; + edm::DetSetVector track_hits_vector_; - /// z where x0 and y0 are evaluated. - /// filled from CTPPSGeometry::getRPTranslation - double z0_; + /// track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ... + double track_params_vector_[dimension]; - double par_covariance_matrix_[covarianceSize]; + /// z where x0 and y0 are evaluated. + /// filled from CTPPSGeometry::getRPTranslation + double z0_; - /// fit chi^2 - double chiSquared_; + double par_covariance_matrix_[covarianceSize]; - /// fit valid? - bool valid_; -}; + /// fit chi^2 + double chiSquared_; + /// fit valid? + bool valid_; + }; +} // namespace io_v1 +using TotemRPLocalTrack = io_v1::TotemRPLocalTrack; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemRPRecHit.h b/DataFormats/CTPPSReco/interface/TotemRPRecHit.h index 8f3dbe448367e..a335d3aedcac8 100644 --- a/DataFormats/CTPPSReco/interface/TotemRPRecHit.h +++ b/DataFormats/CTPPSReco/interface/TotemRPRecHit.h @@ -15,36 +15,39 @@ * * Basically a cluster (TotemRPCluster), the position of which has been converted into actual geometry (in mm). **/ -class TotemRPRecHit { -public: - TotemRPRecHit(double position = 0, double sigma = 0) : position_(position), sigma_(sigma) {} +namespace io_v1 { + class TotemRPRecHit { + public: + TotemRPRecHit(double position = 0, double sigma = 0) : position_(position), sigma_(sigma) {} - inline double position() const { return position_; } - inline void setPosition(double position) { position_ = position; } + inline double position() const { return position_; } + inline void setPosition(double position) { position_ = position; } - inline double sigma() const { return sigma_; } - inline void setSigma(double sigma) { sigma_ = sigma; } + inline double sigma() const { return sigma_; } + inline void setSigma(double sigma) { sigma_ = sigma; } -private: - /// position of the hit in mm, wrt detector center (see RPTopology::GetHitPositionInReadoutDirection) - double position_; + private: + /// position of the hit in mm, wrt detector center (see RPTopology::GetHitPositionInReadoutDirection) + double position_; - /// position uncertainty, in mm - double sigma_; -}; + /// position uncertainty, in mm + double sigma_; + }; -//---------------------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------------------- -inline bool operator<(const TotemRPRecHit &l, const TotemRPRecHit &r) { - if (l.position() < r.position()) - return true; - if (l.position() > r.position()) - return false; + inline bool operator<(const TotemRPRecHit &l, const TotemRPRecHit &r) { + if (l.position() < r.position()) + return true; + if (l.position() > r.position()) + return false; - if (l.sigma() < r.sigma()) - return true; + if (l.sigma() < r.sigma()) + return true; - return false; -} + return false; + } +} // namespace io_v1 +using TotemRPRecHit = io_v1::TotemRPRecHit; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemRPUVPattern.h b/DataFormats/CTPPSReco/interface/TotemRPUVPattern.h index b064d2822c739..3baecc87d7572 100644 --- a/DataFormats/CTPPSReco/interface/TotemRPUVPattern.h +++ b/DataFormats/CTPPSReco/interface/TotemRPUVPattern.h @@ -20,45 +20,47 @@ * The global coordinate system is used (wrt. the beam). This is the same convention * as for the 1-RP track fits. **/ -class TotemRPUVPattern { -public: - enum ProjectionType { projInvalid, projU, projV }; +namespace io_v1 { + class TotemRPUVPattern { + public: + enum ProjectionType { projInvalid, projU, projV }; - TotemRPUVPattern() : projection_(projInvalid), a_(0.), b_(0.), w_(0.), fittable_(false) {} + TotemRPUVPattern() : projection_(projInvalid), a_(0.), b_(0.), w_(0.), fittable_(false) {} - ProjectionType projection() const { return projection_; } - void setProjection(ProjectionType type) { projection_ = type; } + ProjectionType projection() const { return projection_; } + void setProjection(ProjectionType type) { projection_ = type; } - double a() const { return a_; } - void setA(double a) { a_ = a; } + double a() const { return a_; } + void setA(double a) { a_ = a; } - double b() const { return b_; } - void setB(double b) { b_ = b; } + double b() const { return b_; } + void setB(double b) { b_ = b; } - double w() const { return w_; } - void setW(double w) { w_ = w; } + double w() const { return w_; } + void setW(double w) { w_ = w; } - bool fittable() const { return fittable_; } - void setFittable(bool fittable) { fittable_ = fittable; } + bool fittable() const { return fittable_; } + void setFittable(bool fittable) { fittable_ = fittable; } - void addHit(edm::det_id_type detId, const TotemRPRecHit &hit) { hits_.find_or_insert(detId).push_back(hit); } + void addHit(edm::det_id_type detId, const TotemRPRecHit &hit) { hits_.find_or_insert(detId).push_back(hit); } - const edm::DetSetVector &hits() const { return hits_; } + const edm::DetSetVector &hits() const { return hits_; } - friend bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r); + friend bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r); -private: - ProjectionType projection_; ///< projection - double a_; ///< slope in rad - double b_; ///< intercept in mm - double w_; ///< weight - bool fittable_; ///< whether this pattern is worth including in track fits + private: + ProjectionType projection_; ///< projection + double a_; ///< slope in rad + double b_; ///< intercept in mm + double w_; ///< weight + bool fittable_; ///< whether this pattern is worth including in track fits - edm::DetSetVector hits_; ///< hits associated with the pattern -}; + edm::DetSetVector hits_; ///< hits associated with the pattern + }; -//---------------------------------------------------------------------------------------------------- - -extern bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r); + //---------------------------------------------------------------------------------------------------- + extern bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r); +} // namespace io_v1 +using TotemRPUVPattern = io_v1::TotemRPUVPattern; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h b/DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h index fb9ec86c0b748..c134c7c48bdc9 100644 --- a/DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h +++ b/DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h @@ -14,10 +14,12 @@ //---------------------------------------------------------------------------------------------------- -class TotemTimingLocalTrack : public CTPPSTimingLocalTrack { -public: - using CTPPSTimingLocalTrack::CTPPSTimingLocalTrack; - // no specific class members yet -}; - +namespace io_v1 { + class TotemTimingLocalTrack : public CTPPSTimingLocalTrack { + public: + using CTPPSTimingLocalTrack::CTPPSTimingLocalTrack; + // no specific class members yet + }; +} // namespace io_v1 +using TotemTimingLocalTrack = io_v1::TotemTimingLocalTrack; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemTimingRecHit.h b/DataFormats/CTPPSReco/interface/TotemTimingRecHit.h index 0c8433ac2e4cb..60f04cd520424 100644 --- a/DataFormats/CTPPSReco/interface/TotemTimingRecHit.h +++ b/DataFormats/CTPPSReco/interface/TotemTimingRecHit.h @@ -14,52 +14,54 @@ /// Reconstructed hit in Totem UFSDetectors. /// \note t: time computed using algorithm timingAlgorithm() -class TotemTimingRecHit : public CTPPSTimingRecHit { -public: - enum TimingAlgorithm { NOT_SET, CFD, SMART, SIMPLE }; - static constexpr int NO_T_AVAILABLE = -100; +namespace io_v1 { + class TotemTimingRecHit : public CTPPSTimingRecHit { + public: + enum TimingAlgorithm { NOT_SET, CFD, SMART, SIMPLE }; + static constexpr int NO_T_AVAILABLE = -100; - TotemTimingRecHit() - : CTPPSTimingRecHit(), sampicThresholdTime_(0), tPrecision_(0), amplitude_(0), baselineRMS_(0), mode_(NOT_SET) {} + TotemTimingRecHit() + : CTPPSTimingRecHit(), sampicThresholdTime_(0), tPrecision_(0), amplitude_(0), baselineRMS_(0), mode_(NOT_SET) {} - TotemTimingRecHit(float x, - float xWidth, - float y, - float yWidth, - float z, - float zWidth, - float t, - float sampicThresholdTime, - float tPrecision, - float amplitude, - float baselineRMS, - TimingAlgorithm mode) - : CTPPSTimingRecHit(x, xWidth, y, yWidth, z, zWidth, t), - sampicThresholdTime_(sampicThresholdTime), - tPrecision_(tPrecision), - amplitude_(amplitude), - baselineRMS_(baselineRMS), - mode_(mode) {} + TotemTimingRecHit(float x, + float xWidth, + float y, + float yWidth, + float z, + float zWidth, + float t, + float sampicThresholdTime, + float tPrecision, + float amplitude, + float baselineRMS, + TimingAlgorithm mode) + : CTPPSTimingRecHit(x, xWidth, y, yWidth, z, zWidth, t), + sampicThresholdTime_(sampicThresholdTime), + tPrecision_(tPrecision), + amplitude_(amplitude), + baselineRMS_(baselineRMS), + mode_(mode) {} - inline void setSampicThresholdTime(float stt) { sampicThresholdTime_ = stt; } - inline float sampicThresholdTime() const { return sampicThresholdTime_; } + inline void setSampicThresholdTime(float stt) { sampicThresholdTime_ = stt; } + inline float sampicThresholdTime() const { return sampicThresholdTime_; } - inline void setTPrecision(float tPrecision) { tPrecision_ = tPrecision; } - inline float tPrecision() const { return tPrecision_; } + inline void setTPrecision(float tPrecision) { tPrecision_ = tPrecision; } + inline float tPrecision() const { return tPrecision_; } - inline void setAmplitude(float amplitude) { amplitude_ = amplitude; } - inline float amplitude() const { return amplitude_; } + inline void setAmplitude(float amplitude) { amplitude_ = amplitude; } + inline float amplitude() const { return amplitude_; } - inline void setBaselineRMS(float brms) { baselineRMS_ = brms; } - inline float baselineRMS() const { return baselineRMS_; } + inline void setBaselineRMS(float brms) { baselineRMS_ = brms; } + inline float baselineRMS() const { return baselineRMS_; } - inline TimingAlgorithm timingAlgorithm() const { return mode_; } - -private: - float sampicThresholdTime_, tPrecision_; - float amplitude_; - float baselineRMS_; - TimingAlgorithm mode_; -}; + inline TimingAlgorithm timingAlgorithm() const { return mode_; } + private: + float sampicThresholdTime_, tPrecision_; + float amplitude_; + float baselineRMS_; + TimingAlgorithm mode_; + }; +} // namespace io_v1 +using TotemTimingRecHit = io_v1::TotemTimingRecHit; #endif diff --git a/DataFormats/CTPPSReco/src/CTPPSTimingLocalTrack.cc b/DataFormats/CTPPSReco/src/CTPPSTimingLocalTrack.cc index e8da56c919f34..bf2adc85e2281 100644 --- a/DataFormats/CTPPSReco/src/CTPPSTimingLocalTrack.cc +++ b/DataFormats/CTPPSReco/src/CTPPSTimingLocalTrack.cc @@ -48,23 +48,24 @@ bool CTPPSTimingLocalTrack::containsHit(const CTPPSTimingRecHit& recHit, float t //==================================================================================================== // Other methods implementation //==================================================================================================== - -bool operator<(const CTPPSTimingLocalTrack& lhs, const CTPPSTimingLocalTrack& rhs) { - // start to sort by temporal coordinate - if (lhs.time() < rhs.time()) - return true; - if (lhs.time() > rhs.time()) - return false; - // then sort by x-position - if (lhs.x0() < rhs.x0()) - return true; - if (lhs.x0() > rhs.x0()) - return false; - // ...and y-position - if (lhs.y0() < rhs.y0()) - return true; - if (lhs.y0() > rhs.y0()) - return false; - // ...and z-position - return (lhs.z0() < rhs.z0()); -} +namespace io_v1 { + bool operator<(const CTPPSTimingLocalTrack& lhs, const CTPPSTimingLocalTrack& rhs) { + // start to sort by temporal coordinate + if (lhs.time() < rhs.time()) + return true; + if (lhs.time() > rhs.time()) + return false; + // then sort by x-position + if (lhs.x0() < rhs.x0()) + return true; + if (lhs.x0() > rhs.x0()) + return false; + // ...and y-position + if (lhs.y0() < rhs.y0()) + return true; + if (lhs.y0() > rhs.y0()) + return false; + // ...and z-position + return (lhs.z0() < rhs.z0()); + } +} // namespace io_v1 diff --git a/DataFormats/CTPPSReco/src/TotemRPLocalTrack.cc b/DataFormats/CTPPSReco/src/TotemRPLocalTrack.cc index 04807f6f48467..34f36d0f3692e 100644 --- a/DataFormats/CTPPSReco/src/TotemRPLocalTrack.cc +++ b/DataFormats/CTPPSReco/src/TotemRPLocalTrack.cc @@ -84,18 +84,20 @@ void TotemRPLocalTrack::setCovarianceMatrix(const TMatrixD &par_covariance_matri //---------------------------------------------------------------------------------------------------- -bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r) { - if (l.z0_ < r.z0_) - return true; - if (l.z0_ > r.z0_) - return true; - - for (int i = 0; i < TotemRPLocalTrack::dimension; ++i) { - if (l.track_params_vector_[i] < r.track_params_vector_[i]) +namespace io_v1 { + bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r) { + if (l.z0_ < r.z0_) return true; - if (l.track_params_vector_[i] > r.track_params_vector_[i]) + if (l.z0_ > r.z0_) return true; - } - return false; -} + for (int i = 0; i < TotemRPLocalTrack::dimension; ++i) { + if (l.track_params_vector_[i] < r.track_params_vector_[i]) + return true; + if (l.track_params_vector_[i] > r.track_params_vector_[i]) + return true; + } + + return false; + } +} // namespace io_v1 diff --git a/DataFormats/CTPPSReco/src/TotemRPUVPattern.cc b/DataFormats/CTPPSReco/src/TotemRPUVPattern.cc index 099a97d155a69..4ff79f4287b66 100644 --- a/DataFormats/CTPPSReco/src/TotemRPUVPattern.cc +++ b/DataFormats/CTPPSReco/src/TotemRPUVPattern.cc @@ -9,32 +9,33 @@ #include "DataFormats/CTPPSReco/interface/TotemRPUVPattern.h" //---------------------------------------------------------------------------------------------------- +namespace io_v1 { + bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r) { + if (l.projection_ < r.projection_) + return true; + if (l.projection_ > r.projection_) + return false; + + if (l.a_ < r.a_) + return true; + if (l.a_ > r.a_) + return false; + + if (l.b_ < r.b_) + return true; + if (l.b_ > r.b_) + return false; + + if (l.w_ < r.w_) + return true; + if (l.w_ > r.w_) + return false; + + if (l.fittable_ < r.fittable_) + return true; + if (l.fittable_ > r.fittable_) + return false; -bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r) { - if (l.projection_ < r.projection_) - return true; - if (l.projection_ > r.projection_) return false; - - if (l.a_ < r.a_) - return true; - if (l.a_ > r.a_) - return false; - - if (l.b_ < r.b_) - return true; - if (l.b_ > r.b_) - return false; - - if (l.w_ < r.w_) - return true; - if (l.w_ > r.w_) - return false; - - if (l.fittable_ < r.fittable_) - return true; - if (l.fittable_ > r.fittable_) - return false; - - return false; -} + } +} // namespace io_v1 diff --git a/DataFormats/CTPPSReco/src/classes_def.xml b/DataFormats/CTPPSReco/src/classes_def.xml index 16d468db30fef..756fe2f35fd25 100644 --- a/DataFormats/CTPPSReco/src/classes_def.xml +++ b/DataFormats/CTPPSReco/src/classes_def.xml @@ -2,255 +2,183 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + diff --git a/DataFormats/ProtonReco/src/classes_def.xml b/DataFormats/ProtonReco/src/classes_def.xml index a1427c404e1c8..7ab8ec92a7c85 100644 --- a/DataFormats/ProtonReco/src/classes_def.xml +++ b/DataFormats/ProtonReco/src/classes_def.xml @@ -1,6 +1,6 @@ - +