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 high density wafer with depltetion thickness of 120 mum
19  1 low density wafer with depletion thickness of 200 mum
20  2 low density wafer with depletion thickness of 300 mum
21  3 high density wafer with depletion thickness of 200 mum)
22  [25:26] Subdetector Type (HGCalEETrigger/HGCalHSiTrigger)
23  [27:27] z-side (0 for +z; 1 for -z)
24  [28:31] Detector type (HGCalTrigger)
25 */
26 
27 class HGCalTriggerDetId : public DetId {
28 public:
29  static const int HGCalTriggerCell = 4;
30 
34  HGCalTriggerDetId(uint32_t rawid);
36  HGCalTriggerDetId(int subdet, int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV);
38  HGCalTriggerDetId(const DetId& id);
40  HGCalTriggerDetId& operator=(const DetId& id);
41 
45  }
46 
48  int type() const { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; }
49 
51  int zside() const { return (((id_ >> kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
52 
54  int layer() const { return (id_ >> kHGCalLayerOffset) & kHGCalLayerMask; }
55 
57  HGCSiliconDetId geometryCell() const { return HGCSiliconDetId(det(), zside(), 0, layer(), waferU(), waferV(), 0, 0); }
59  return HGCSiliconDetId(det(), zside(), type(), layer(), waferU(), waferV(), 0, 0);
60  }
61 
63  int triggerCellU() const { return (id_ >> kHGCalCellUOffset) & kHGCalCellUMask; }
64  int triggerCellV() const { return (id_ >> kHGCalCellVOffset) & kHGCalCellVMask; }
65  std::pair<int, int> triggerCellUV() const { return std::pair<int, int>(triggerCellU(), triggerCellV()); }
66  int triggerCellX() const;
67  int triggerCellY() const;
68  std::pair<int, int> triggerCellXY() const { return std::pair<int, int>(triggerCellX(), triggerCellY()); }
69 
71  int waferUAbs() const { return (id_ >> kHGCalWaferUOffset) & kHGCalWaferUMask; }
72  int waferVAbs() const { return (id_ >> kHGCalWaferVOffset) & kHGCalWaferVMask; }
73  int waferU() const { return (((id_ >> kHGCalWaferUSignOffset) & kHGCalWaferUSignMask) ? -waferUAbs() : waferUAbs()); }
74  int waferV() const { return (((id_ >> kHGCalWaferVSignOffset) & kHGCalWaferVSignMask) ? -waferVAbs() : waferVAbs()); }
75  std::pair<int, int> waferUV() const { return std::pair<int, int>(waferU(), waferV()); }
76  int waferX() const { return (-2 * waferU() + waferV()); }
77  int waferY() const { return (2 * waferV()); }
78  std::pair<int, int> waferXY() const { return std::pair<int, int>(waferX(), waferY()); }
79 
80  // get trigger cell u,v
81  std::vector<int> cellU() const;
82  std::vector<int> cellV() const;
83  std::vector<std::pair<int, int> > cellUV() const;
84 
86  bool isEE() const { return (subdet() == HGCalEETrigger); }
87  bool isHSilicon() const { return (subdet() == HGCalHSiTrigger); }
88  bool isForward() const { return true; }
89 
91 
92  static const int kHGCalCellUOffset = 0;
93  static const int kHGCalCellUMask = 0xF;
94  static const int kHGCalCellVOffset = 4;
95  static const int kHGCalCellVMask = 0xF;
96  static const int kHGCalWaferUOffset = 8;
97  static const int kHGCalWaferUMask = 0xF;
98  static const int kHGCalWaferUSignOffset = 12;
99  static const int kHGCalWaferUSignMask = 0x1;
100  static const int kHGCalWaferVOffset = 13;
101  static const int kHGCalWaferVMask = 0xF;
102  static const int kHGCalWaferVSignOffset = 17;
103  static const int kHGCalWaferVSignMask = 0x1;
104  static const int kHGCalLayerOffset = 18;
105  static const int kHGCalLayerMask = 0x1F;
106  static const int kHGCalTypeOffset = 23;
107  static const int kHGCalTypeMask = 0x3;
108  static const int kHGCalZsideOffset = 27;
109  static const int kHGCalZsideMask = 0x1;
110  static const int kHGCalSubdetOffset = 25;
111  static const int kHGCalSubdetMask = 0x3;
112 };
113 
114 std::ostream& operator<<(std::ostream&, const HGCalTriggerDetId& id);
115 
116 #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