Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DataFormats_ForwardDetId_HGCHEDetId_H
0002 #define DataFormats_ForwardDetId_HGCHEDetId_H 1
0003 
0004 #include <iosfwd>
0005 #include "DataFormats/DetId/interface/DetId.h"
0006 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
0007 
0008 class HGCHEDetId : public DetId {
0009 public:
0010   static const int kHGCHECellOffset = 0;
0011   static const int kHGCHECellMask = 0xFFF;
0012   static const int kHGCHESectorOffset = 12;
0013   static const int kHGCHESectorMask = 0x3F;
0014   static const int kHGCHESubSectorOffset = 18;
0015   static const int kHGCHESubSectorMask = 0x1;
0016   static const int kHGCHELayerOffset = 19;
0017   static const int kHGCHELayerMask = 0x1F;
0018   static const int kHGCHEZsideOffset = 24;
0019   static const int kHGCHEZsideMask = 0x1;
0020   /** Create a null cellid*/
0021   HGCHEDetId();
0022   /** Create cellid from raw id (0=invalid tower id) */
0023   HGCHEDetId(uint32_t rawid);
0024   /** Constructor from subdetector, zplus, layer, module, cell numbers */
0025   HGCHEDetId(ForwardSubdetector subdet, int zp, int lay, int mod, int subsec, int cell);
0026   /** Constructor from a generic cell id */
0027   HGCHEDetId(const DetId& id);
0028   /** Assignment from a generic cell id */
0029   HGCHEDetId& operator=(const DetId& id);
0030 
0031   /** Converter for a geometry cell id
0032    * @param id full EKDetId 
0033    */
0034   HGCHEDetId geometryCell() const;
0035 
0036   /// get the subdetector
0037   ForwardSubdetector subdet() const { return (ForwardSubdetector)(subdetId()); }
0038 
0039   /// get the absolute value of the cell #'s in x and y
0040   int cell() const { return id_ & kHGCHECellMask; }
0041 
0042   /// get the sector #
0043   int sector() const { return (id_ >> kHGCHESectorOffset) & kHGCHESectorMask; }
0044 
0045   /// get the degree subsector
0046   int subsector() const { return ((id_ >> kHGCHESubSectorOffset) & kHGCHESubSectorMask ? 1 : -1); }
0047 
0048   /// get the layer #
0049   int layer() const { return (id_ >> kHGCHELayerOffset) & kHGCHELayerMask; }
0050 
0051   /// get the z-side of the cell (1/-1)
0052   int zside() const { return ((id_ >> kHGCHEZsideOffset) & kHGCHEZsideMask ? 1 : -1); }
0053 
0054   /// consistency check
0055   bool isHE() const { return true; }
0056   bool isForward() const { return true; }
0057 
0058   static const HGCHEDetId Undefined;
0059 };
0060 
0061 std::ostream& operator<<(std::ostream&, const HGCHEDetId& id);
0062 
0063 #endif