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
HGCalTriggerDetId::kHGCalWaferUSignOffset
static const int kHGCalWaferUSignOffset
Definition: HGCalTriggerDetId.h:97
HGCalTriggerDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCalTriggerDetId.h:50
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
HGCalTriggerDetId::isEE
bool isEE() const
consistency check : no bits left => no overhead
Definition: HGCalTriggerDetId.h:85
HGCSiliconDetId.h
HGCalTriggerSubdetector
HGCalTriggerSubdetector
Definition: ForwardSubdetector.h:14
HGCalTriggerDetId::kHGCalSubdetMask
static const int kHGCalSubdetMask
Definition: HGCalTriggerDetId.h:110
HGCalTriggerDetId::cellV
std::vector< int > cellV() const
Definition: HGCalTriggerDetId.cc:104
HGCalTriggerDetId::isForward
bool isForward() const
Definition: HGCalTriggerDetId.h:87
HGCalTriggerDetId::cellU
std::vector< int > cellU() const
Definition: HGCalTriggerDetId.cc:74
HGCalTriggerDetId::cellUV
std::vector< std::pair< int, int > > cellUV() const
Definition: HGCalTriggerDetId.cc:134
HGCalHSiTrigger
Definition: ForwardSubdetector.h:14
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
HGCalTriggerDetId::HGCalTriggerDetId
HGCalTriggerDetId()
Definition: HGCalTriggerDetId.cc:8
HGCalTriggerDetId::kHGCalLayerOffset
static const int kHGCalLayerOffset
Definition: HGCalTriggerDetId.h:103
ForwardSubdetector.h
HGCalTriggerDetId::kHGCalWaferVSignMask
static const int kHGCalWaferVSignMask
Definition: HGCalTriggerDetId.h:102
DetId
Definition: DetId.h:17
HGCalTriggerDetId::triggerCellY
int triggerCellY() const
Definition: HGCalTriggerDetId.cc:61
HGCalTriggerDetId::kHGCalWaferUOffset
static const int kHGCalWaferUOffset
Definition: HGCalTriggerDetId.h:95
HGCalTriggerDetId::kHGCalZsideOffset
static const int kHGCalZsideOffset
Definition: HGCalTriggerDetId.h:107
HGCalTriggerDetId::triggerCellU
int triggerCellU() const
get the cell #'s in u,v or in x,y
Definition: HGCalTriggerDetId.h:62
HGCalTriggerDetId::layer
int layer() const
get the layer #
Definition: HGCalTriggerDetId.h:53
HGCalTriggerDetId::kHGCalCellVOffset
static const int kHGCalCellVOffset
Definition: HGCalTriggerDetId.h:93
HGCalTriggerDetId::kHGCalTypeOffset
static const int kHGCalTypeOffset
Definition: HGCalTriggerDetId.h:105
HGCalEETrigger
Definition: ForwardSubdetector.h:14
HGCalTriggerDetId::kHGCalWaferUSignMask
static const int kHGCalWaferUSignMask
Definition: HGCalTriggerDetId.h:98
HGCalTriggerDetId::waferVAbs
int waferVAbs() const
Definition: HGCalTriggerDetId.h:71
HGCalTriggerDetId::HGCalTriggerCell
static const int HGCalTriggerCell
Definition: HGCalTriggerDetId.h:28
HGCalTriggerDetId::kHGCalTypeMask
static const int kHGCalTypeMask
Definition: HGCalTriggerDetId.h:106
HGCalTriggerDetId::waferUAbs
int waferUAbs() const
get the wafer #'s in u,v or in x,y
Definition: HGCalTriggerDetId.h:70
HGCalTriggerDetId::triggerCellXY
std::pair< int, int > triggerCellXY() const
Definition: HGCalTriggerDetId.h:67
HGCalTriggerDetId
Definition: HGCalTriggerDetId.h:26
HGCalTriggerDetId::operator=
HGCalTriggerDetId & operator=(const DetId &id)
Definition: HGCalTriggerDetId.cc:38
HGCalTriggerDetId::kHGCalZsideMask
static const int kHGCalZsideMask
Definition: HGCalTriggerDetId.h:108
HGCalTriggerDetId::kHGCalWaferVMask
static const int kHGCalWaferVMask
Definition: HGCalTriggerDetId.h:100
HGCalTriggerDetId::triggerCellV
int triggerCellV() const
Definition: HGCalTriggerDetId.h:63
HGCalTriggerDetId::subdet
HGCalTriggerSubdetector subdet() const
get the subdetector
Definition: HGCalTriggerDetId.h:42
HGCalTriggerDetId::kHGCalWaferUMask
static const int kHGCalWaferUMask
Definition: HGCalTriggerDetId.h:96
HGCalTriggerDetId::waferU
int waferU() const
Definition: HGCalTriggerDetId.h:72
DetId::id_
uint32_t id_
Definition: DetId.h:69
HGCalTriggerDetId::triggerCellX
int triggerCellX() const
Definition: HGCalTriggerDetId.cc:49
HGCalTriggerDetId::kHGCalLayerMask
static const int kHGCalLayerMask
Definition: HGCalTriggerDetId.h:104
HGCalTriggerDetId::waferY
int waferY() const
Definition: HGCalTriggerDetId.h:76
HGCalTriggerDetId::kHGCalSubdetOffset
static const int kHGCalSubdetOffset
Definition: HGCalTriggerDetId.h:109
HGCalTriggerDetId::kHGCalCellVMask
static const int kHGCalCellVMask
Definition: HGCalTriggerDetId.h:94
HGCalTriggerDetId::isHSilicon
bool isHSilicon() const
Definition: HGCalTriggerDetId.h:86
operator<<
std::ostream & operator<<(std::ostream &, const HGCalTriggerDetId &id)
Definition: HGCalTriggerDetId.cc:144
HGCalTriggerDetId::Undefined
static const HGCalTriggerDetId Undefined
Definition: HGCalTriggerDetId.h:89
HGCalTriggerDetId::geometryCell
HGCSiliconDetId geometryCell() const
Definition: HGCalTriggerDetId.h:56
HGCalTriggerDetId::waferX
int waferX() const
Definition: HGCalTriggerDetId.h:75
type
type
Definition: HCALResponse.h:21
HGCalTriggerDetId::waferV
int waferV() const
Definition: HGCalTriggerDetId.h:73
DetId.h
HGCalTriggerDetId::kHGCalWaferVSignOffset
static const int kHGCalWaferVSignOffset
Definition: HGCalTriggerDetId.h:101
HGCalTriggerDetId::kHGCalCellUMask
static const int kHGCalCellUMask
Definition: HGCalTriggerDetId.h:92
HGCalTriggerDetId::type
int type() const
get the type
Definition: HGCalTriggerDetId.h:47
HGCalTriggerDetId::kHGCalWaferVOffset
static const int kHGCalWaferVOffset
Definition: HGCalTriggerDetId.h:99
HGCalTriggerDetId::waferXY
std::pair< int, int > waferXY() const
Definition: HGCalTriggerDetId.h:77
HGCalTriggerDetId::kHGCalCellUOffset
static const int kHGCalCellUOffset
Definition: HGCalTriggerDetId.h:91
HGCalTriggerDetId::waferUV
std::pair< int, int > waferUV() const
Definition: HGCalTriggerDetId.h:74
HGCalTriggerDetId::triggerCellUV
std::pair< int, int > triggerCellUV() const
Definition: HGCalTriggerDetId.h:64
HGCalTriggerDetId::moduleId
HGCSiliconDetId moduleId() const
Definition: HGCalTriggerDetId.h:57