Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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