Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:12

0001 /****************************************************************************
0002 *
0003 * This is a part of TOTEM offline software.
0004 * Authors:
0005 *   Hubert Niewiadomski
0006 *   Jan Kašpar (jan.kaspar@gmail.com)
0007 *
0008 ****************************************************************************/
0009 
0010 #ifndef DataFormats_CTPPSReco_TotemRPCluster
0011 #define DataFormats_CTPPSReco_TotemRPCluster
0012 
0013 #include <cstdint>
0014 
0015 /**
0016  *\brief Cluster of TOTEM RP strip hits.
0017  **/
0018 class TotemRPCluster {
0019 public:
0020   TotemRPCluster(unsigned short str_beg = 0, unsigned short str_end = 0) : str_beg_(str_beg), str_end_(str_end) {}
0021 
0022   inline uint16_t stripBegin() const { return str_beg_; }
0023   inline void setStripBegin(unsigned short str_beg) { str_beg_ = str_beg; }
0024 
0025   inline uint16_t stripEnd() const { return str_end_; }
0026   inline void setStripEnd(unsigned short str_end) { str_end_ = str_end; }
0027 
0028   inline int numberOfStrips() const { return str_end_ - str_beg_ + 1; }
0029 
0030   inline double centerStripPosition() const { return (str_beg_ + str_end_) / 2.; }
0031 
0032 private:
0033   uint16_t str_beg_;
0034   uint16_t str_end_;
0035 };
0036 
0037 //----------------------------------------------------------------------------------------------------
0038 
0039 inline bool operator<(const TotemRPCluster& l, const TotemRPCluster& r) {
0040   if (l.stripBegin() < r.stripBegin())
0041     return true;
0042   if (l.stripBegin() > r.stripBegin())
0043     return false;
0044 
0045   if (l.stripEnd() < r.stripEnd())
0046     return true;
0047 
0048   return false;
0049 }
0050 
0051 #endif