CMS 3D CMS Logo

HGCScintillatorDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_ForwardDetId_HGCScintillatorDetId_H
2 #define DataFormats_ForwardDetId_HGCScintillatorDetId_H 1
3 
4 #include <iosfwd>
7 
8 /* \brief description of the bit assigment
9  [0:8] iphi index wrt x-axis on +z side
10  [9:16] |ieta| index (starting from |etamin|)
11  [17:21] Layer #
12  [22:22] z-side (0 for +z; 1 for -z)
13  [23:23] Type (0 fine divisions; 1 for coarse division)
14  [24:24] Reserved for future extension
15  [28:31] Detector type (HGCalHSc)
16 */
17 
18 class HGCScintillatorDetId : public DetId {
19 
20 public:
21 
25  HGCScintillatorDetId(uint32_t rawid);
27  HGCScintillatorDetId(int type, int layer, int ieta, int iphi);
29  HGCScintillatorDetId(const DetId& id);
32 
35 
37  ForwardSubdetector subdet() const { return HGCHEB; }
38 
40  int type() const { return (id_>>kHGCalTypeOffset)&kHGCalTypeMask; }
41 
43  int zside() const { return (((id_>>kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
44 
46  int layer() const { return (id_>>kHGCalLayerOffset)&kHGCalLayerMask; }
47 
49  int ietaAbs() const { return (id_>>kHGCalEtaOffset)&kHGCalEtaMask; }
50  int ieta() const { return zside()*ietaAbs(); }
51 
53  int iphi() const { return (id_>>kHGCalPhiOffset)&kHGCalPhiMask; }
54  std::pair<int,int> ietaphi() const { return std::pair<int,int>(ieta(),iphi()); }
55 
57  bool isEE() const { return false; }
58  bool isHE() const { return true; }
59  bool isForward() const { return true; }
60 
62 
63 private:
64 
65  static const int kHGCalPhiOffset = 0;
66  static const int kHGCalPhiMask = 0x1FF;
67  static const int kHGCalEtaOffset = 9;
68  static const int kHGCalEtaMask = 0xFF;
69  static const int kHGCalLayerOffset = 17;
70  static const int kHGCalLayerMask = 0x1F;
71  static const int kHGCalZsideOffset = 22;
72  static const int kHGCalZsideMask = 0x1;
73  static const int kHGCalZsideMask2 = 0x400000;
74  static const int kHGCalTypeOffset = 23;
75  static const int kHGCalTypeMask = 0x1;
76 };
77 
78 std::ostream& operator<<(std::ostream&,const HGCScintillatorDetId& id);
79 
80 #endif
type
Definition: HCALResponse.h:21
ForwardSubdetector subdet() const
get the subdetector
int ietaAbs() const
get the eta index
static const int kHGCalTypeOffset
int type() const
get the type
ForwardSubdetector
static const int kHGCalZsideMask2
static const int kHGCalEtaOffset
HGCScintillatorDetId & operator=(const DetId &id)
std::pair< int, int > ietaphi() const
static const int kHGCalLayerMask
int iphi() const
get the phi index
HGCScintillatorDetId geometryCell() const
static const int kHGCalEtaMask
static const HGCScintillatorDetId Undefined
Definition: DetId.h:18
std::ostream & operator<<(std::ostream &, const HGCScintillatorDetId &id)
uint32_t id_
Definition: DetId.h:56
bool isEE() const
consistency check : no bits left => no overhead
static const int kHGCalPhiMask
int layer() const
get the layer #
int zside() const
get the z-side of the cell (1/-1)
static const int kHGCalZsideMask
static const int kHGCalZsideOffset
static const int kHGCalLayerOffset
static const int kHGCalTypeMask
static const int kHGCalPhiOffset