Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DataFormats_L1THGCal_HGCalTowerID_h
0002 #define DataFormats_L1THGCal_HGCalTowerID_h
0003 
0004 #include <cstdint>
0005 
0006 // NOTE: in the current implementation HGCalTowerID can only
0007 // accomodate 127 bins per coordinate x2 zsides
0008 
0009 namespace l1t {
0010   class HGCalTowerID {
0011   public:
0012     HGCalTowerID() : HGCalTowerID(0) {}
0013 
0014     HGCalTowerID(uint32_t rawId) : rawId_(rawId) {}
0015 
0016     HGCalTowerID(short subdetIsNode, short zside, unsigned short coord1, unsigned short coord2) {
0017       rawId_ = (((subdetIsNode & subDetMask) << subDetShift) | ((coord1 & coordMask) << coord1Shift) |
0018                 ((coord2 & coordMask) << coord2Shift) | ((zside > 0) & zsideMask) << zsideShift);
0019     }
0020 
0021     short subdet() const { return (rawId_ >> subDetShift) & subDetMask; }
0022 
0023     short zside() const { return ((rawId_ >> zsideShift) & zsideMask) ? 1 : -1; }
0024 
0025     unsigned short iEta() const { return (rawId_ >> coord1Shift) & coordMask; }
0026 
0027     unsigned short iPhi() const { return (rawId_ >> coord2Shift) & coordMask; }
0028 
0029     unsigned short rawId() const { return rawId_; }
0030 
0031     static const int subDetMask = 0x1;  // two for now 0 is HGC and 1 is HFNose
0032     static const int subDetShift = 16;
0033     static const int zsideMask = 0x1;
0034     static const int zsideShift = 15;
0035     static const int coordMask = 0x007F;
0036     static const int coord1Shift = 7;
0037     static const int coord2Shift = 0;
0038 
0039   private:
0040     uint32_t rawId_;
0041   };
0042 
0043   struct HGCalTowerCoord {
0044     HGCalTowerCoord(uint32_t rawId, float eta, float phi) : rawId(rawId), eta(eta), phi(phi) {}
0045 
0046     const uint32_t rawId;
0047     const float eta;
0048     const float phi;
0049   };
0050 }  // namespace l1t
0051 
0052 #endif