CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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>
5 #include <vector>
8 
9 /* \brief description of the bit assigment
10  [0:8] iphi index wrt x-axis on +z side
11  [9:16] |ring| index (starting from a minimum radius depending on type)
12  [17:21] Layer #
13  [22] Trigger(1)/Detector(0) cell
14  [23] SiPM type (0 for 2mm: 1 for 4mm)
15  [24] Free
16  [25:25] z-side (0 for +z; 1 for -z)
17  [26:27] Tile granularity and type (0 fine divisions of scintillators;
18  1 coarse divisions of type "c";
19  2 coarse divisions of type "m")
20  [28:31] Detector type (HGCalHSc)
21 */
22 
23 class HGCScintillatorDetId : public DetId {
24 public:
28  HGCScintillatorDetId(uint32_t rawid);
30  HGCScintillatorDetId(int type, int layer, int ring, int iphi, bool trigger = false, int sipm = 0);
32  HGCScintillatorDetId(const DetId& id);
35 
38 
40  DetId::Detector subdet() const { return det(); }
41 
43  int type() const { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; }
44  void setType(int type);
45 
47  int zside() const { return (((id_ >> kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
48 
50  int layer() const { return (id_ >> kHGCalLayerOffset) & kHGCalLayerMask; }
51 
53  int ring() const;
54  int iradiusAbs() const { return ring(); }
55  int iradius() const { return zside() * ring(); }
56  int ietaAbs() const { return ring(); }
57  int ieta() const { return zside() * ring(); }
58 
60  int iphi() const;
61  std::pair<int, int> ietaphi() const { return std::pair<int, int>(ieta(), iphi()); }
62  std::pair<int, int> ringphi() const { return std::pair<int, int>(iradius(), iphi()); }
63 
65  int sipm() const { return (id_ >> kHGCalSiPMOffset) & kHGCalSiPMMask; }
66  void setSiPM(int sipm);
67 
69  std::vector<HGCScintillatorDetId> detectorCells() const;
70  bool trigger() const { return (((id_ >> kHGCalTriggerOffset) & kHGCalTriggerMask) == 1); }
72 
74  bool isEE() const { return false; }
75  bool isHE() const { return true; }
76  bool isForward() const { return true; }
77 
79 
80 public:
81  static const int kHGCalPhiOffset = 0;
82  static const int kHGCalPhiMask = 0x1FF;
83  static const int kHGCalRadiusOffset = 9;
84  static const int kHGCalRadiusMask = 0xFF;
85  static const int kHGCalLayerOffset = 17;
86  static const int kHGCalLayerMask = 0x1F;
87  static const int kHGCalTriggerOffset = 22;
88  static const int kHGCalTriggerMask = 0x1;
89  static const int kHGCalSiPMOffset = 23;
90  static const int kHGCalSiPMMask = 0x1;
91  static const int kHGCalSiPMMask0 = 0xFF7FFFFF;
92  static const int kHGCalZsideOffset = 25;
93  static const int kHGCalZsideMask = 0x1;
94  static const int kHGCalTypeOffset = 26;
95  static const int kHGCalTypeMask = 0x3;
96  static const int kHGCalTypeMask0 = 0xF3FFFFFF;
97 
98  int iradiusTriggerAbs() const;
99  int iradiusTrigger() const { return zside() * iradiusTriggerAbs(); }
100  int iphiTrigger() const;
101 };
102 
103 std::ostream& operator<<(std::ostream&, const HGCScintillatorDetId& id);
104 
105 #endif
static const int kHGCalTriggerOffset
std::pair< int, int > ringphi() const
static const int kHGCalTypeOffset
int type() const
get/set the type
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
DetId::Detector subdet() const
get the subdetector
std::pair< int, int > ietaphi() const
static const int kHGCalSiPMOffset
HGCScintillatorDetId & operator=(const DetId &id)
static const int kHGCalSiPMMask0
static const int kHGCalLayerMask
static const int kHGCalRadiusOffset
int sipm() const
get/set the sipm size
int iphi() const
get the phi index
static const int kHGCalTriggerMask
HGCScintillatorDetId geometryCell() const
int ring() const
get the eta index
std::vector< HGCScintillatorDetId > detectorCells() const
trigger or detector cell
static const HGCScintillatorDetId Undefined
Definition: DetId.h:17
static const int kHGCalRadiusMask
Detector
Definition: DetId.h:24
uint32_t id_
Definition: DetId.h:69
static const int kHGCalTypeMask0
bool isEE() const
consistency check : no bits left =&gt; 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 kHGCalSiPMMask
static const int kHGCalZsideMask
static const int kHGCalZsideOffset
static const int kHGCalLayerOffset
static const int kHGCalTypeMask
static const int kHGCalPhiOffset
HGCScintillatorDetId triggerCell() const
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46