Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:46

0001 //-------------------------------------------------
0002 //
0003 /**  \class DTTracoId
0004  *    TRACO Identifier
0005  *
0006  *   \author C.Grandi
0007  */
0008 //
0009 //--------------------------------------------------
0010 #ifndef DT_TRACO_ID_H_
0011 #define DT_TRACO_ID_H_
0012 
0013 //------------------------------------
0014 // Collaborating Class Declarations --
0015 //------------------------------------
0016 
0017 //----------------------
0018 // Base Class Headers --
0019 //----------------------
0020 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
0021 
0022 //---------------
0023 // C++ Headers --
0024 //---------------
0025 
0026 //---------------------------------------------------
0027 //                      DTTracoChip
0028 //---------------------------------------------------
0029 
0030 //              ---------------------
0031 //              -- Class Interface --
0032 //              ---------------------
0033 
0034 class DTTracoId {
0035 public:
0036   ///  Constructor
0037   DTTracoId() : _traco(0) {}
0038 
0039   ///  Constructor
0040   DTTracoId(const DTChamberId& mu_stat_id, const int traco_id) : _statId(mu_stat_id), _traco(traco_id) {}
0041 
0042   ///  Constructor
0043   DTTracoId(const int wheel_id, const int station_id, const int sector_id, const int traco_id)
0044       : _statId(wheel_id, station_id, sector_id), _traco(traco_id) {}
0045 
0046   ///  Constructor
0047   DTTracoId(const DTTracoId& tracoId) : _statId(tracoId._statId), _traco(tracoId._traco) {}
0048 
0049   // Assignment Operator
0050   DTTracoId& operator=(const DTTracoId& tracoId) = default;
0051 
0052   /// Destructor
0053   virtual ~DTTracoId() {}
0054 
0055   /// Returns wheel number
0056   inline int wheel() const { return _statId.wheel(); }
0057   /// Returns station number
0058   inline int station() const { return _statId.station(); }
0059   /// Returns sector number
0060   inline int sector() const { return _statId.sector(); }
0061   /// Returns the traco
0062   inline int traco() const { return _traco; }
0063   /// Returns the chamber id
0064   inline DTChamberId ChamberId() const { return _statId; }
0065 
0066   bool operator==(const DTTracoId& id) const {
0067     if (wheel() != id.wheel())
0068       return false;
0069     if (sector() != id.sector())
0070       return false;
0071     if (station() != id.station())
0072       return false;
0073     if (_traco != id.traco())
0074       return false;
0075     return true;
0076   }
0077 
0078   bool operator<(const DTTracoId& id) const {
0079     if (wheel() < id.wheel())
0080       return true;
0081     if (wheel() > id.wheel())
0082       return false;
0083 
0084     if (station() < id.station())
0085       return true;
0086     if (station() > id.station())
0087       return false;
0088 
0089     if (sector() < id.sector())
0090       return true;
0091     if (sector() > id.sector())
0092       return false;
0093 
0094     if (traco() < id.traco())
0095       return true;
0096     if (traco() > id.traco())
0097       return false;
0098 
0099     return false;
0100   }
0101 
0102 private:
0103   DTChamberId _statId;  // this is 3 bytes
0104   int _traco;
0105 };
0106 
0107 #endif