CMS 3D CMS Logo

HGCalTriggerDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_ForwardDetId_HGCalTriggerDetId_H
2 #define DataFormats_ForwardDetId_HGCalTriggerDetId_H 1
3 
4 #include <iosfwd>
5 #include <vector>
9 
10 /* \brief description of the bit assigment
11  [0:3] u-coordinate of the cell (measured from the lower left
12  [4:7] v-coordinate of the cell corner of the wafer)
13  [8:11] abs(u) of the wafer (u-axis points along -x axis)
14  [12:12] sign of u (0:+u; 1:-u) (u=0 is at the center of beam line)
15  [13:16] abs(v) of the wafer (v-axis points 60-degree wrt x-axis)
16  [17:17] sign of v (0:+v; 1:-v) (v=0 is at the center of beam line)
17  [18:22] layer number
18  [23:24] Type (0 fine divisions of wafer with 120 mum thick silicon
19  1 coarse divisions of wafer with 200 mum thick silicon
20  2 coarse divisions of wafer with 300 mum thick silicon)
21  [25:26] Subdetector Type (HGCalEETrigger/HGCalHSiTrigger)
22  [27:27] z-side (0 for +z; 1 for -z)
23  [28:31] Detector type (HGCalTrigger)
24 */
25 
26 class HGCalTriggerDetId : public DetId {
27 public:
28  static const int HGCalTriggerCell = 4;
29 
33  HGCalTriggerDetId(uint32_t rawid);
35  HGCalTriggerDetId(int subdet, int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV);
37  HGCalTriggerDetId(const DetId& id);
39  HGCalTriggerDetId& operator=(const DetId& id);
40 
44  }
45 
47  int type() const { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; }
48 
50  int zside() const { return (((id_ >> kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
51 
53  int layer() const { return (id_ >> kHGCalLayerOffset) & kHGCalLayerMask; }
54 
56  HGCSiliconDetId geometryCell() const { return HGCSiliconDetId(det(), zside(), 0, layer(), waferU(), waferV(), 0, 0); }
58  return HGCSiliconDetId(det(), zside(), type(), layer(), waferU(), waferV(), 0, 0);
59  }
60 
62  int triggerCellU() const { return (id_ >> kHGCalCellUOffset) & kHGCalCellUMask; }
63  int triggerCellV() const { return (id_ >> kHGCalCellVOffset) & kHGCalCellVMask; }
64  std::pair<int, int> triggerCellUV() const { return std::pair<int, int>(triggerCellU(), triggerCellV()); }
65  int triggerCellX() const;
66  int triggerCellY() const;
67  std::pair<int, int> triggerCellXY() const { return std::pair<int, int>(triggerCellX(), triggerCellY()); }
68 
70  int waferUAbs() const { return (id_ >> kHGCalWaferUOffset) & kHGCalWaferUMask; }
71  int waferVAbs() const { return (id_ >> kHGCalWaferVOffset) & kHGCalWaferVMask; }
72  int waferU() const { return (((id_ >> kHGCalWaferUSignOffset) & kHGCalWaferUSignMask) ? -waferUAbs() : waferUAbs()); }
73  int waferV() const { return (((id_ >> kHGCalWaferVSignOffset) & kHGCalWaferVSignMask) ? -waferVAbs() : waferVAbs()); }
74  std::pair<int, int> waferUV() const { return std::pair<int, int>(waferU(), waferV()); }
75  int waferX() const { return (-2 * waferU() + waferV()); }
76  int waferY() const { return (2 * waferV()); }
77  std::pair<int, int> waferXY() const { return std::pair<int, int>(waferX(), waferY()); }
78 
79  // get trigger cell u,v
80  std::vector<int> cellU() const;
81  std::vector<int> cellV() const;
82  std::vector<std::pair<int, int> > cellUV() const;
83 
85  bool isEE() const { return (subdet() == HGCalEETrigger); }
86  bool isHSilicon() const { return (subdet() == HGCalHSiTrigger); }
87  bool isForward() const { return true; }
88 
90 
91  static const int kHGCalCellUOffset = 0;
92  static const int kHGCalCellUMask = 0xF;
93  static const int kHGCalCellVOffset = 4;
94  static const int kHGCalCellVMask = 0xF;
95  static const int kHGCalWaferUOffset = 8;
96  static const int kHGCalWaferUMask = 0xF;
97  static const int kHGCalWaferUSignOffset = 12;
98  static const int kHGCalWaferUSignMask = 0x1;
99  static const int kHGCalWaferVOffset = 13;
100  static const int kHGCalWaferVMask = 0xF;
101  static const int kHGCalWaferVSignOffset = 17;
102  static const int kHGCalWaferVSignMask = 0x1;
103  static const int kHGCalLayerOffset = 18;
104  static const int kHGCalLayerMask = 0x1F;
105  static const int kHGCalTypeOffset = 23;
106  static const int kHGCalTypeMask = 0x3;
107  static const int kHGCalZsideOffset = 27;
108  static const int kHGCalZsideMask = 0x1;
109  static const int kHGCalSubdetOffset = 25;
110  static const int kHGCalSubdetMask = 0x3;
111 };
112 
113 std::ostream& operator<<(std::ostream&, const HGCalTriggerDetId& id);
114 
115 #endif
HGCalTriggerSubdetector
std::pair< int, int > waferUV() const
static const int kHGCalSubdetMask
HGCSiliconDetId moduleId() const
std::vector< int > cellV() const
bool isForward() const
std::vector< int > cellU() const
std::pair< int, int > waferXY() const
bool isEE() const
consistency check : no bits left => no overhead
std::pair< int, int > triggerCellUV() const
static const int kHGCalWaferVSignMask
int zside() const
get the z-side of the cell (1/-1)
int triggerCellU() const
get the cell #&#39;s in u,v or in x,y
static const int kHGCalTypeOffset
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
static const int kHGCalLayerOffset
int layer() const
get the layer #
static const int kHGCalCellVOffset
static const int kHGCalZsideMask
static const int kHGCalWaferUSignMask
static const int HGCalTriggerCell
std::vector< std::pair< int, int > > cellUV() const
static const int kHGCalWaferUOffset
static const int kHGCalZsideOffset
int triggerCellX() const
static const int kHGCalWaferVMask
HGCalTriggerSubdetector subdet() const
get the subdetector
static const int kHGCalTypeMask
int triggerCellY() const
std::pair< int, int > triggerCellXY() const
static const int kHGCalSubdetOffset
static const int kHGCalCellVMask
bool isHSilicon() const
int waferUAbs() const
get the wafer #&#39;s in u,v or in x,y
static const HGCalTriggerDetId Undefined
Definition: DetId.h:17
HGCSiliconDetId geometryCell() const
HGCalTriggerDetId & operator=(const DetId &id)
int triggerCellV() const
static const int kHGCalWaferUMask
uint32_t id_
Definition: DetId.h:69
int type() const
get the type
std::ostream & operator<<(std::ostream &, const HGCalTriggerDetId &id)
static const int kHGCalLayerMask
static const int kHGCalWaferVSignOffset
static const int kHGCalCellUOffset
static const int kHGCalWaferVOffset
static const int kHGCalCellUMask
static const int kHGCalWaferUSignOffset