Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef MuonDetId_RPCCompDetId_h
0002 #define MuonDetId_RPCCompDetId_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     MuonDetId
0006 // Class  :     RPCCompDetId
0007 //
0008 /**\class RPCCompDetId RPCCompDetId.h DataFormats/MuonDetId/interface/RPCCompDetId.h
0009 
0010  Description: DetId for composite RPC objects
0011 
0012 */
0013 //
0014 // Author:      Marcello Maggi
0015 // Created:     Wed Nov  2 12:09:10 CET 2011
0016 //
0017 #include <DataFormats/DetId/interface/DetId.h>
0018 #include <FWCore/Utilities/interface/Exception.h>
0019 #include <string>
0020 
0021 class RPCCompDetId : public DetId {
0022 public:
0023   RPCCompDetId();
0024 
0025   /// Construct from a packed id. It is required that the Detector part of
0026   /// id is Muon and the SubDet part is RPC, otherwise an exception is thrown.
0027   RPCCompDetId(uint32_t id);
0028   RPCCompDetId(DetId id);
0029 
0030   /// Construct from fully qualified identifier.
0031   RPCCompDetId(int region, int ring, int station, int sector, int layer, int subsector, int type);
0032 
0033   /// Construct from name stored in DB
0034   RPCCompDetId(const std::string& dbname, int type);
0035 
0036   /// Sort Operator based on the name
0037   bool operator<(const RPCCompDetId& r) const;
0038 
0039   int region() const;
0040   int ring() const;
0041   int wheel() const;
0042   int station() const;
0043   int disk() const;
0044   int sector() const;
0045   int layer() const;
0046   int subsector() const;
0047   int type() const;
0048   std::string dbname() const;
0049 
0050   static const int minRegionId = -1;
0051   static const int maxRegionId = 1;
0052   static const int allRegionId = minRegionId - 1;
0053 
0054   static const int minRingForwardId = 1;
0055   static const int maxRingForwardId = 3;
0056   static const int minRingBarrelId = -2;
0057   static const int maxRingBarrelId = 2;
0058   static const int RingBarrelOffSet = 3;
0059   static const int allRingId = minRingBarrelId - 1;
0060 
0061   static const int minStationId = 1;
0062   static const int maxStationId = 4;
0063   static const int allStationId = minStationId - 1;
0064 
0065   static const int minSectorId = 1;
0066   static const int maxSectorId = 36;
0067   static const int minSectorBarrelId = 1;
0068   static const int maxSectorBarrelId = 12;
0069   static const int minSectorForwardId = 1;
0070   static const int maxSectorForwardId = 36;
0071   static const int allSectorId = minSectorId - 1;
0072 
0073   static const int minLayerId = 1;
0074   static const int maxLayerId = 2;
0075   static const int allLayerId = minLayerId - 1;
0076 
0077   static const int minSubSectorId = 1;
0078   static const int maxSubSectorId = 2;
0079   static const int allSubSectorId = minSubSectorId - 1;
0080 
0081 private:
0082   static const int RegionNumBits_ = 2;
0083   static const int RegionStartBit_ = 0;
0084   static const int RegionMask_ = 0X3;
0085 
0086   static const int RingNumBits_ = 3;
0087   static const int RingStartBit_ = RegionStartBit_ + RegionNumBits_;
0088   static const unsigned int RingMask_ = 0X7;
0089 
0090   static const int StationNumBits_ = 3;
0091   static const int StationStartBit_ = RingStartBit_ + RingNumBits_;
0092   static const unsigned int StationMask_ = 0X7;
0093 
0094   static const int SectorNumBits_ = 6;
0095   static const int SectorStartBit_ = StationStartBit_ + StationNumBits_;
0096   static const unsigned int SectorMask_ = 0X3F;
0097 
0098   static const int LayerNumBits_ = 2;
0099   static const int LayerStartBit_ = SectorStartBit_ + SectorNumBits_;
0100   static const unsigned int LayerMask_ = 0X3;
0101 
0102   static const int SubSectorNumBits_ = 2;
0103   static const int SubSectorStartBit_ = LayerStartBit_ + LayerNumBits_;
0104   static const unsigned int SubSectorMask_ = 0X3;
0105 
0106 private:
0107   void init(int region, int ring, int station, int sector, int layer, int subsector);
0108 
0109   void init();
0110   void initGas();
0111   std::string gasDBname() const;
0112 
0113 private:
0114   std::string _dbname;
0115   int _type;
0116 
0117 };  // RPCCompDetId
0118 
0119 std::ostream& operator<<(std::ostream& os, const RPCCompDetId& id);
0120 
0121 #endif