Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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