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 id_ & 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
HGCalDetId::kHGCalWaferTypeMask
static const int kHGCalWaferTypeMask
Definition: HGCalDetId.h:15
HGCalDetId::operator=
HGCalDetId & operator=(const DetId &id)
Definition: HGCalDetId.cc:35
HGCalDetId::kHGCalWaferOffset
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
HGCalDetId::isForward
bool isForward() const
Definition: HGCalDetId.h:53
HGCalDetId::HGCalDetId
HGCalDetId()
Definition: HGCalDetId.cc:6
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
HGCalDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCalDetId.h:49
HGCalDetId::kHGCalZsideMask
static const int kHGCalZsideMask
Definition: HGCalDetId.h:19
HGCalDetId::layer
int layer() const
get the layer #
Definition: HGCalDetId.h:46
HGCalDetId::kHGCalMaskCell
static const int kHGCalMaskCell
Definition: HGCalDetId.h:20
HGCalDetId::isValid
static bool isValid(ForwardSubdetector subdet, int zp, int lay, int wafertype, int wafer, int cell)
Definition: HGCalDetId.cc:40
ForwardSubdetector.h
HGCalDetId::kHGCalZsideOffset
static const int kHGCalZsideOffset
Definition: HGCalDetId.h:18
HGCalDetId::kHGCalWaferMask
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
DetId
Definition: DetId.h:17
HGCalDetId::isHGCal
bool isHGCal() const
consistency check : no bits left => no overhead
Definition: HGCalDetId.h:52
HGCalDetId::waferType
int waferType() const
get the wafer type
Definition: HGCalDetId.h:43
HGCalDetId::kHGCalLayerOffset
static const int kHGCalLayerOffset
Definition: HGCalDetId.h:16
HGCalDetId::Undefined
static const HGCalDetId Undefined
Definition: HGCalDetId.h:56
DetId::id_
uint32_t id_
Definition: DetId.h:69
operator<<
std::ostream & operator<<(std::ostream &, const HGCalDetId &id)
Definition: HGCalDetId.cc:55
HGCalDetId::kHGCalWaferTypeOffset
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:14
HGCalDetId::wafer
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
HGCalDetId
Definition: HGCalDetId.h:8
HGCalDetId::kHGCalCellMask
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
HGCalDetId::geometryCell
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:34
HGCalDetId::kHGCalLayerMask
static const int kHGCalLayerMask
Definition: HGCalDetId.h:17
DetId.h
HGCalDetId::kHGCalCellOffset
static const int kHGCalCellOffset
Definition: HGCalDetId.h:10
HGCalDetId::cell
int cell() const
get the absolute value of the cell #'s in x and y
Definition: HGCalDetId.h:37