CMS 3D CMS Logo

HGCSiliconDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_ForwardDetId_HGCSiliconDetId_H
2 #define DataFormats_ForwardDetId_HGCSiliconDetId_H 1
3 
4 #include <iosfwd>
7 
8 /* \brief description of the bit assigment
9  [0:4] u-coordinate of the cell (measured from the lower left
10  [5:9] v-coordinate of the cell corner of the wafer)
11  [10:13] abs(u) of the wafer (u-axis points along -x axis)
12  [14:14] sign of u (0:+u; 1:-u) (u=0 is at the center of beam line)
13  [15:18] abs(v) of the wafer (v-axis points 60-degree wrt x-axis)
14  [19:19] sign of v (0:+v; 1:-v) (v=0 is at the center of beam line)
15  [20:24] layer number
16  [25:25] z-side (0 for +z; 1 for -z)
17  [26:27] Type (0 fine divisions of wafer with 120 mum thick silicon
18  1 coarse divisions of wafer with 200 mum thick silicon
19  2 coarse divisions of wafer with 300 mum thick silicon)
20  [28:31] Detector type (HGCalEE or HGCalHSi)
21 */
22 class HGCSiliconDetId : public DetId {
23 public:
25  static const int HGCalFineN = 12;
26  static const int HGCalCoarseN = 8;
27  static const int HGCalFineTrigger = 3;
28  static const int HGCalCoarseTrigger = 2;
29 
33  HGCSiliconDetId(uint32_t rawid);
35  HGCSiliconDetId(DetId::Detector det, int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV);
37  HGCSiliconDetId(const DetId& id);
39  HGCSiliconDetId& operator=(const DetId& id);
40 
42  HGCSiliconDetId geometryCell() const { return HGCSiliconDetId(det(), zside(), 0, layer(), waferU(), waferV(), 0, 0); }
44  return HGCSiliconDetId(det(), zside(), type(), layer(), waferU(), waferV(), 0, 0);
45  }
46 
48  DetId::Detector subdet() const { return det(); }
49 
51  int type() const { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; }
52 
54  int zside() const { return (((id_ >> kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
55 
57  int layer() const { return (id_ >> kHGCalLayerOffset) & kHGCalLayerMask; }
58 
60  int cellU() const { return (id_ >> kHGCalCellUOffset) & kHGCalCellUMask; }
61  int cellV() const { return (id_ >> kHGCalCellVOffset) & kHGCalCellVMask; }
62  std::pair<int, int> cellUV() const { return std::pair<int, int>(cellU(), cellV()); }
63  int cellX() const {
64  int N = (type() == HGCalFine) ? HGCalFineN : HGCalCoarseN;
65  return (3 * (cellV() - N) + 2);
66  }
67  int cellY() const {
68  int N = (type() == HGCalFine) ? HGCalFineN : HGCalCoarseN;
69  return (2 * cellU() - (N + cellV()));
70  }
71  std::pair<int, int> cellXY() const { return std::pair<int, int>(cellX(), cellY()); }
72 
74  int waferUAbs() const { return (id_ >> kHGCalWaferUOffset) & kHGCalWaferUMask; }
75  int waferVAbs() const { return (id_ >> kHGCalWaferVOffset) & kHGCalWaferVMask; }
76  int waferU() const { return (((id_ >> kHGCalWaferUSignOffset) & kHGCalWaferUSignMask) ? -waferUAbs() : waferUAbs()); }
77  int waferV() const { return (((id_ >> kHGCalWaferVSignOffset) & kHGCalWaferVSignMask) ? -waferVAbs() : waferVAbs()); }
78  std::pair<int, int> waferUV() const { return std::pair<int, int>(waferU(), waferV()); }
79  int waferX() const { return (-2 * waferU() + waferV()); }
80  int waferY() const { return (2 * waferV()); }
81  std::pair<int, int> waferXY() const { return std::pair<int, int>(waferX(), waferY()); }
82 
83  // get trigger cell u,v
84  int triggerCellU() const {
85  int N = (type() == HGCalFine) ? HGCalFineN : HGCalCoarseN;
87  return (cellU() >= N && cellV() >= N)
88  ? cellU() / NT
89  : ((cellU() < N && cellU() <= cellV()) ? cellU() / NT : (1 + (cellU() - (cellV() % NT + 1)) / NT));
90  }
91  int triggerCellV() const {
92  int N = (type() == HGCalFine) ? HGCalFineN : HGCalCoarseN;
94  return (cellU() >= N && cellV() >= N)
95  ? cellV() / NT
96  : ((cellU() < N && cellU() <= cellV()) ? ((cellV() - cellU()) / NT + cellU() / NT) : cellV() / NT);
97  }
98  std::pair<int, int> triggerCellUV() const { return std::pair<int, int>(triggerCellU(), triggerCellV()); }
99 
101  bool isEE() const { return (det() == HGCalEE); }
102  bool isHE() const { return (det() == HGCalHSi); }
103  bool isForward() const { return true; }
104 
106 
107 public:
108  static const int kHGCalCellUOffset = 0;
109  static const int kHGCalCellUMask = 0x1F;
110  static const int kHGCalCellVOffset = 5;
111  static const int kHGCalCellVMask = 0x1F;
112  static const int kHGCalWaferUOffset = 10;
113  static const int kHGCalWaferUMask = 0xF;
114  static const int kHGCalWaferUSignOffset = 14;
115  static const int kHGCalWaferUSignMask = 0x1;
116  static const int kHGCalWaferVOffset = 15;
117  static const int kHGCalWaferVMask = 0xF;
118  static const int kHGCalWaferVSignOffset = 19;
119  static const int kHGCalWaferVSignMask = 0x1;
120  static const int kHGCalLayerOffset = 20;
121  static const int kHGCalLayerMask = 0x1F;
122  static const int kHGCalZsideOffset = 25;
123  static const int kHGCalZsideMask = 0x1;
124  static const int kHGCalTypeOffset = 26;
125  static const int kHGCalTypeMask = 0x3;
126 };
127 
128 std::ostream& operator<<(std::ostream&, const HGCSiliconDetId& id);
129 
130 #endif
HGCSiliconDetId::kHGCalWaferUMask
static const int kHGCalWaferUMask
Definition: HGCSiliconDetId.h:113
HGCSiliconDetId::waferY
int waferY() const
Definition: HGCSiliconDetId.h:80
operator<<
std::ostream & operator<<(std::ostream &, const HGCSiliconDetId &id)
Definition: HGCSiliconDetId.cc:49
HGCSiliconDetId::HGCalCoarseTrigger
static const int HGCalCoarseTrigger
Definition: HGCSiliconDetId.h:28
HGCSiliconDetId::kHGCalCellVMask
static const int kHGCalCellVMask
Definition: HGCSiliconDetId.h:111
HGCSiliconDetId::kHGCalLayerOffset
static const int kHGCalLayerOffset
Definition: HGCSiliconDetId.h:120
HGCSiliconDetId::HGCalCoarseN
static const int HGCalCoarseN
Definition: HGCSiliconDetId.h:26
HGCSiliconDetId::triggerCellV
int triggerCellV() const
Definition: HGCSiliconDetId.h:91
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
HGCSiliconDetId::kHGCalWaferUOffset
static const int kHGCalWaferUOffset
Definition: HGCSiliconDetId.h:112
HGCSiliconDetId::kHGCalWaferUSignMask
static const int kHGCalWaferUSignMask
Definition: HGCSiliconDetId.h:115
HGCSiliconDetId::waferUV
std::pair< int, int > waferUV() const
Definition: HGCSiliconDetId.h:78
HGCSiliconDetId::kHGCalCellUMask
static const int kHGCalCellUMask
Definition: HGCSiliconDetId.h:109
HGCSiliconDetId::kHGCalTypeMask
static const int kHGCalTypeMask
Definition: HGCSiliconDetId.h:125
HGCSiliconDetId::HGCalCoarseThin
Definition: HGCSiliconDetId.h:24
HGCSiliconDetId::HGCalFineN
static const int HGCalFineN
Definition: HGCSiliconDetId.h:25
HGCSiliconDetId::cellY
int cellY() const
Definition: HGCSiliconDetId.h:67
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
HGCSiliconDetId::HGCalCoarseThick
Definition: HGCSiliconDetId.h:24
ForwardSubdetector.h
HGCSiliconDetId::triggerCellU
int triggerCellU() const
Definition: HGCSiliconDetId.h:84
HGCSiliconDetId::cellX
int cellX() const
Definition: HGCSiliconDetId.h:63
DetId
Definition: DetId.h:17
DetId::HGCalHSi
Definition: DetId.h:33
DetId::HGCalEE
Definition: DetId.h:32
HGCSiliconDetId::kHGCalWaferVMask
static const int kHGCalWaferVMask
Definition: HGCSiliconDetId.h:117
HGCSiliconDetId::cellXY
std::pair< int, int > cellXY() const
Definition: HGCSiliconDetId.h:71
HGCSiliconDetId::isForward
bool isForward() const
Definition: HGCSiliconDetId.h:103
N
#define N
Definition: blowfish.cc:9
HGCSiliconDetId::moduleId
HGCSiliconDetId moduleId() const
Definition: HGCSiliconDetId.h:43
HGCSiliconDetId::kHGCalWaferVSignOffset
static const int kHGCalWaferVSignOffset
Definition: HGCSiliconDetId.h:118
HGCSiliconDetId::HGCalFine
Definition: HGCSiliconDetId.h:24
HGCSiliconDetId::kHGCalWaferVSignMask
static const int kHGCalWaferVSignMask
Definition: HGCSiliconDetId.h:119
HGCSiliconDetId::waferVAbs
int waferVAbs() const
Definition: HGCSiliconDetId.h:75
HGCSiliconDetId::waferX
int waferX() const
Definition: HGCSiliconDetId.h:79
DetId::id_
uint32_t id_
Definition: DetId.h:69
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
HGCSiliconDetId::kHGCalZsideOffset
static const int kHGCalZsideOffset
Definition: HGCSiliconDetId.h:122
HGCSiliconDetId::operator=
HGCSiliconDetId & operator=(const DetId &id)
Definition: HGCSiliconDetId.cc:38
DetId::Detector
Detector
Definition: DetId.h:24
HGCSiliconDetId::Undefined
static const HGCSiliconDetId Undefined
Definition: HGCSiliconDetId.h:105
HGCSiliconDetId::kHGCalWaferVOffset
static const int kHGCalWaferVOffset
Definition: HGCSiliconDetId.h:116
HGCSiliconDetId::kHGCalTypeOffset
static const int kHGCalTypeOffset
Definition: HGCSiliconDetId.h:124
HGCSiliconDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCSiliconDetId.h:54
HGCSiliconDetId::waferType
waferType
Definition: HGCSiliconDetId.h:24
HGCSiliconDetId::triggerCellUV
std::pair< int, int > triggerCellUV() const
Definition: HGCSiliconDetId.h:98
HGCSiliconDetId::cellV
int cellV() const
Definition: HGCSiliconDetId.h:61
HGCSiliconDetId::cellU
int cellU() const
get the cell #'s in u,v or in x,y
Definition: HGCSiliconDetId.h:60
HGCSiliconDetId::geometryCell
HGCSiliconDetId geometryCell() const
Definition: HGCSiliconDetId.h:42
HGCSiliconDetId::kHGCalLayerMask
static const int kHGCalLayerMask
Definition: HGCSiliconDetId.h:121
DetId.h
HGCSiliconDetId::waferXY
std::pair< int, int > waferXY() const
Definition: HGCSiliconDetId.h:81
HGCSiliconDetId::HGCalFineTrigger
static const int HGCalFineTrigger
Definition: HGCSiliconDetId.h:27
HGCSiliconDetId::type
int type() const
get the type
Definition: HGCSiliconDetId.h:51
HGCSiliconDetId::waferU
int waferU() const
Definition: HGCSiliconDetId.h:76
HGCSiliconDetId::isHE
bool isHE() const
Definition: HGCSiliconDetId.h:102
HGCSiliconDetId::subdet
DetId::Detector subdet() const
get the subdetector
Definition: HGCSiliconDetId.h:48
HGCSiliconDetId::kHGCalWaferUSignOffset
static const int kHGCalWaferUSignOffset
Definition: HGCSiliconDetId.h:114
HGCSiliconDetId::isEE
bool isEE() const
consistency check : no bits left => no overhead
Definition: HGCSiliconDetId.h:101
HGCSiliconDetId::kHGCalCellVOffset
static const int kHGCalCellVOffset
Definition: HGCSiliconDetId.h:110
HGCSiliconDetId::HGCSiliconDetId
HGCSiliconDetId()
Definition: HGCSiliconDetId.cc:8
HGCSiliconDetId::cellUV
std::pair< int, int > cellUV() const
Definition: HGCSiliconDetId.h:62
HGCSiliconDetId::kHGCalZsideMask
static const int kHGCalZsideMask
Definition: HGCSiliconDetId.h:123
HGCSiliconDetId::waferUAbs
int waferUAbs() const
get the wafer #'s in u,v or in x,y
Definition: HGCSiliconDetId.h:74
HGCSiliconDetId::waferV
int waferV() const
Definition: HGCSiliconDetId.h:77
HGCSiliconDetId::kHGCalCellUOffset
static const int kHGCalCellUOffset
Definition: HGCSiliconDetId.h:108
HGCSiliconDetId::layer
int layer() const
get the layer #
Definition: HGCSiliconDetId.h:57