Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:21

0001 #ifndef DataFormats_MTDDetId_MTDDetId_h
0002 #define DataFormats_MTDDetId_MTDDetId_h
0003 
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
0006 #include <ostream>
0007 
0008 /** 
0009     @class MTDDetId
0010     @brief Detector identifier base class for the MIP Timing Layer.
0011 
0012     bit 31-28: Detector Forward
0013     bit 27-25: Subdetctor FastTiming
0014 
0015     bit 24-23: MTD subdetector BTL/ETL
0016     bit 22   : side (positive = 1, negative = 0)
0017     bit 21-16: rod/ring sequential number
0018 
0019 */
0020 
0021 class MTDDetId : public DetId {
0022 public:
0023   /** Enumerated type for Forward sub-deteector systems. */
0024   enum SubDetector { subUNKNOWN = 0, FastTime = 1 };
0025 
0026   /** Enumerated type for MTD sub-deteector systems. */
0027   enum MTDType { typeUNKNOWN = 0, BTL = 1, ETL = 2 };
0028 
0029   static const uint32_t kMTDsubdOffset = 23;
0030   static const uint32_t kMTDsubdMask = 0x3;
0031   static const uint32_t kZsideOffset = 22;
0032   static const uint32_t kZsideMask = 0x1;
0033   static const uint32_t kRodRingOffset = 16;
0034   static const uint32_t kRodRingMask = 0x3F;
0035 
0036   // ---------- Constructors, enumerated types ----------
0037 
0038   /** Construct a null id */
0039   MTDDetId() : DetId() { ; }
0040 
0041   /** Construct from a raw value */
0042   MTDDetId(const uint32_t& raw_id) : DetId(raw_id) { ; }
0043 
0044   /** Construct from generic DetId */
0045   MTDDetId(const DetId& det_id) : DetId(det_id.rawId()) { ; }
0046 
0047   /** Construct and fill only the det and sub-det fields. */
0048   MTDDetId(Detector det, int subdet) : DetId(det, subdet) { ; }
0049 
0050   // ---------- Common methods ----------
0051 
0052   /** Returns enumerated type specifying MTD sub-detector. */
0053   inline SubDetector subDetector() const { return static_cast<MTDDetId::SubDetector>(subdetId()); }
0054 
0055   /** Returns enumerated type specifying MTD sub-detector, i.e. BTL or ETL. */
0056   inline int mtdSubDetector() const { return (id_ >> kMTDsubdOffset) & kMTDsubdMask; }
0057 
0058   /** Returns MTD side, i.e. Z-=0 or Z+=1. */
0059   inline int mtdSide() const { return (id_ >> kZsideOffset) & kZsideMask; }
0060   /** Return MTD side, i.e. Z-=-1 or Z+=1. */
0061   inline int zside() const { return (mtdSide() == 1 ? (1) : (-1)); }
0062 
0063   /** Returns MTD rod/ring number. */
0064   inline int mtdRR() const { return (id_ >> kRodRingOffset) & kRodRingMask; }
0065 };
0066 
0067 std::ostream& operator<<(std::ostream&, const MTDDetId&);
0068 
0069 #endif  // DataFormats_MTDDetId_MTDDetId_h