Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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   /// Destructor
0052   virtual ~DTBtiId() {}
0053 
0054   /// Returns wheel number
0055   inline int wheel() const { return _suplId.wheel(); }
0056   /// Returns station number
0057   inline int station() const { return _suplId.station(); }
0058   /// Returns sector number
0059   inline int sector() const { return _suplId.sector(); }
0060   /// Returns the superlayer
0061   inline int superlayer() const { return _suplId.superlayer(); }
0062   /// Returns the bti
0063   inline int bti() const { return _bti; }
0064   /// Returns the superlayer id
0065   inline DTSuperLayerId SLId() const { return _suplId; }
0066 
0067   bool operator==(const DTBtiId& id) const {
0068     if (wheel() != id.wheel())
0069       return false;
0070     if (sector() != id.sector())
0071       return false;
0072     if (station() != id.station())
0073       return false;
0074     if (superlayer() != id.superlayer())
0075       return false;
0076     if (_bti != id.bti())
0077       return false;
0078     return true;
0079   }
0080 
0081   bool operator<(const DTBtiId& id) const {
0082     if (wheel() < id.wheel())
0083       return true;
0084     if (wheel() > id.wheel())
0085       return false;
0086 
0087     if (station() < id.station())
0088       return true;
0089     if (station() > id.station())
0090       return false;
0091 
0092     if (sector() < id.sector())
0093       return true;
0094     if (sector() > id.sector())
0095       return false;
0096 
0097     if (superlayer() < id.superlayer())
0098       return true;
0099     if (superlayer() > id.superlayer())
0100       return false;
0101 
0102     if (bti() < id.bti())
0103       return true;
0104     if (bti() > id.bti())
0105       return false;
0106 
0107     return false;
0108   }
0109 
0110 private:
0111   DTSuperLayerId _suplId;  // this is 4 bytes
0112   int _bti;
0113 };
0114 
0115 #endif