Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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   /// Destructor
0050   virtual ~DTTracoId() {}
0051 
0052   /// Returns wheel number
0053   inline int wheel() const { return _statId.wheel(); }
0054   /// Returns station number
0055   inline int station() const { return _statId.station(); }
0056   /// Returns sector number
0057   inline int sector() const { return _statId.sector(); }
0058   /// Returns the traco
0059   inline int traco() const { return _traco; }
0060   /// Returns the chamber id
0061   inline DTChamberId ChamberId() const { return _statId; }
0062 
0063   bool operator==(const DTTracoId& id) const {
0064     if (wheel() != id.wheel())
0065       return false;
0066     if (sector() != id.sector())
0067       return false;
0068     if (station() != id.station())
0069       return false;
0070     if (_traco != id.traco())
0071       return false;
0072     return true;
0073   }
0074 
0075   bool operator<(const DTTracoId& id) const {
0076     if (wheel() < id.wheel())
0077       return true;
0078     if (wheel() > id.wheel())
0079       return false;
0080 
0081     if (station() < id.station())
0082       return true;
0083     if (station() > id.station())
0084       return false;
0085 
0086     if (sector() < id.sector())
0087       return true;
0088     if (sector() > id.sector())
0089       return false;
0090 
0091     if (traco() < id.traco())
0092       return true;
0093     if (traco() > id.traco())
0094       return false;
0095 
0096     return false;
0097   }
0098 
0099 private:
0100   DTChamberId _statId;  // this is 3 bytes
0101   int _traco;
0102 };
0103 
0104 #endif