CMS 3D CMS Logo

HGCalDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_ForwardDetId_HGCalDetId_H
2 #define DataFormats_ForwardDetId_HGCalDetId_H 1
3 
4 #include <iosfwd>
7 
8 class HGCalDetId : public DetId {
9 public:
10  static const int kHGCalCellOffset = 0;
11  static const int kHGCalCellMask = 0xFF;
12  static const int kHGCalWaferOffset = 8;
13  static const int kHGCalWaferMask = 0x3FF;
14  static const int kHGCalWaferTypeOffset = 18;
15  static const int kHGCalWaferTypeMask = 0x1;
16  static const int kHGCalLayerOffset = 19;
17  static const int kHGCalLayerMask = 0x1F;
18  static const int kHGCalZsideOffset = 24;
19  static const int kHGCalZsideMask = 0x1;
20  static const int kHGCalMaskCell = 0xFFFBFF00;
21 
23  HGCalDetId();
25  HGCalDetId(uint32_t rawid);
27  HGCalDetId(ForwardSubdetector subdet, int zp, int lay, int wafertype, int wafer, int cell);
29  HGCalDetId(const DetId& id);
31  HGCalDetId& operator=(const DetId& id);
32 
34  HGCalDetId geometryCell() const { return HGCalDetId(id_ & static_cast<uint32_t>(kHGCalMaskCell)); }
35 
37  int cell() const { return id_ & kHGCalCellMask; }
38 
40  int wafer() const { return (id_ >> kHGCalWaferOffset) & kHGCalWaferMask; }
41 
43  int waferType() const { return ((id_ >> kHGCalWaferTypeOffset) & kHGCalWaferTypeMask ? 1 : -1); }
44 
46  int layer() const { return (id_ >> kHGCalLayerOffset) & kHGCalLayerMask; }
47 
49  int zside() const { return ((id_ >> kHGCalZsideOffset) & kHGCalZsideMask ? 1 : -1); }
50 
52  bool isHGCal() const { return true; }
53  bool isForward() const { return true; }
54  static bool isValid(ForwardSubdetector subdet, int zp, int lay, int wafertype, int wafer, int cell);
55 
56  static const HGCalDetId Undefined;
57 };
58 
59 std::ostream& operator<<(std::ostream&, const HGCalDetId& id);
60 
61 #endif
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
static const int kHGCalLayerOffset
Definition: HGCalDetId.h:16
int waferType() const
get the wafer type
Definition: HGCalDetId.h:43
static const int kHGCalLayerMask
Definition: HGCalDetId.h:17
static const HGCalDetId Undefined
Definition: HGCalDetId.h:56
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:14
ForwardSubdetector
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:34
std::ostream & operator<<(std::ostream &, const HGCalDetId &id)
Definition: HGCalDetId.cc:55
static const int kHGCalCellOffset
Definition: HGCalDetId.h:10
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
static const int kHGCalWaferTypeMask
Definition: HGCalDetId.h:15
bool isForward() const
Definition: HGCalDetId.h:53
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCalDetId.h:49
int cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCalDetId.h:37
static const int kHGCalMaskCell
Definition: HGCalDetId.h:20
Definition: DetId.h:17
HGCalDetId & operator=(const DetId &id)
Definition: HGCalDetId.cc:35
static const int kHGCalZsideMask
Definition: HGCalDetId.h:19
uint32_t id_
Definition: DetId.h:69
int layer() const
get the layer #
Definition: HGCalDetId.h:46
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
static bool isValid(ForwardSubdetector subdet, int zp, int lay, int wafertype, int wafer, int cell)
Definition: HGCalDetId.cc:40
static const int kHGCalZsideOffset
Definition: HGCalDetId.h:18
bool isHGCal() const
consistency check : no bits left => no overhead
Definition: HGCalDetId.h:52
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13