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:24] Reserved for future extension
13  [25:25] z-side (0 for +z; 1 for -z)
14  [26:27] Type (0 fine divisions of scintillators;
15  1 coarse divisions of scintillators)
16  [28:31] Detector type (HGCalHSc)
17 */
18 
19 class HGCScintillatorDetId : public DetId {
20 
21 public:
22 
26  HGCScintillatorDetId(uint32_t rawid);
28  HGCScintillatorDetId(int type, int layer, int ieta, int iphi);
30  HGCScintillatorDetId(const DetId& id);
33 
36 
38  DetId::Detector subdet() const { return det(); }
39 
41  int type() const { return (id_>>kHGCalTypeOffset)&kHGCalTypeMask; }
42 
44  int zside() const { return (((id_>>kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
45 
47  int layer() const { return (id_>>kHGCalLayerOffset)&kHGCalLayerMask; }
48 
50  int ietaAbs() const { return (id_>>kHGCalEtaOffset)&kHGCalEtaMask; }
51  int ieta() const { return zside()*ietaAbs(); }
52 
54  int iphi() const { return (id_>>kHGCalPhiOffset)&kHGCalPhiMask; }
55  std::pair<int,int> ietaphi() const { return std::pair<int,int>(ieta(),iphi()); }
56 
58  bool isEE() const { return false; }
59  bool isHE() const { return true; }
60  bool isForward() const { return true; }
61 
63 
64 private:
65 
66  static const int kHGCalPhiOffset = 0;
67  static const int kHGCalPhiMask = 0x1FF;
68  static const int kHGCalEtaOffset = 9;
69  static const int kHGCalEtaMask = 0xFF;
70  static const int kHGCalLayerOffset = 17;
71  static const int kHGCalLayerMask = 0x1F;
72  static const int kHGCalZsideOffset = 25;
73  static const int kHGCalZsideMask = 0x1;
74  static const int kHGCalTypeOffset = 26;
75  static const int kHGCalTypeMask = 0x3;
76 };
77 
78 std::ostream& operator<<(std::ostream&,const HGCScintillatorDetId& id);
79 
80 #endif
type
Definition: HCALResponse.h:21
int ietaAbs() const
get the eta index
static const int kHGCalTypeOffset
int type() const
get the type
DetId::Detector subdet() const
get the subdetector
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)
Detector
Definition: DetId.h:26
uint32_t id_
Definition: DetId.h:59
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
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39