CMS 3D CMS Logo

HFNoseDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_ForwardDetId_HFNoseDetId_H
2 #define DataFormats_ForwardDetId_HFNoseDetId_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:22] layer number - 1
16  [23:23] z-side (0 for +z; 1 for -z)
17  [24:24] Type (0 fine divisions of wafer with 120 mum thick silicon
18  1 coarse divisions of wafer with 200 mum thick silicon)
19  [25:27] Subdetector type (HFNose)
20  [28:31] Detector type (Forward)
21 */
22 class HFNoseDetId : public DetId {
23 public:
25  static const int HFNoseFineN = 12;
26  static const int HFNoseCoarseN = 8;
27  static const int HFNoseFineTrigger = 3;
28  static const int HFNoseCoarseTrigger = 2;
29  static const int HFNoseLayerEEmax = 6;
30 
32  HFNoseDetId();
34  HFNoseDetId(uint32_t rawid);
36  HFNoseDetId(int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV);
38  HFNoseDetId(const DetId& id);
40  HFNoseDetId& operator=(const DetId& id);
41 
43  ForwardSubdetector subdet() const { return HFNose; }
44 
46  HFNoseDetId geometryCell() const { return HFNoseDetId(zside(), 0, layer(), waferU(), waferV(), 0, 0); }
47  HFNoseDetId moduleId() const { return HFNoseDetId(zside(), type(), layer(), waferU(), waferV(), 0, 0); }
48 
50  int type() const { return (id_ >> kHFNoseTypeOffset) & kHFNoseTypeMask; }
51 
53  int zside() const { return (((id_ >> kHFNoseZsideOffset) & kHFNoseZsideMask) ? -1 : 1); }
54 
56  int layer() const { return ((id_ >> kHFNoseLayerOffset) & kHFNoseLayerMask) + 1; }
57 
59  int cellU() const { return (id_ >> kHFNoseCellUOffset) & kHFNoseCellUMask; }
60  int cellV() const { return (id_ >> kHFNoseCellVOffset) & kHFNoseCellVMask; }
61  std::pair<int, int> cellUV() const { return std::pair<int, int>(cellU(), cellV()); }
62  int cellX() const {
63  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
64  return (3 * (cellV() - N) + 2);
65  }
66  int cellY() const {
67  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
68  return (2 * cellU() - (N + cellV()));
69  }
70  std::pair<int, int> cellXY() const { return std::pair<int, int>(cellX(), cellY()); }
71 
73  int waferUAbs() const { return (id_ >> kHFNoseWaferUOffset) & kHFNoseWaferUMask; }
74  int waferVAbs() const { return (id_ >> kHFNoseWaferVOffset) & kHFNoseWaferVMask; }
75  int waferU() const {
77  }
78  int waferV() const {
80  }
81  std::pair<int, int> waferUV() const { return std::pair<int, int>(waferU(), waferV()); }
82  int waferX() const { return (-2 * waferU() + waferV()); }
83  int waferY() const { return (2 * waferV()); }
84  std::pair<int, int> waferXY() const { return std::pair<int, int>(waferX(), waferY()); }
85 
86  // get trigger cell u,v
87  int triggerCellU() const {
88  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
90  return (cellU() >= N && cellV() >= N)
91  ? cellU() / NT
92  : ((cellU() < N && cellU() <= cellV()) ? cellU() / NT : (1 + (cellU() - (cellV() % NT + 1)) / NT));
93  }
94  int triggerCellV() const {
95  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
97  return (cellU() >= N && cellV() >= N)
98  ? cellV() / NT
99  : ((cellU() < N && cellU() <= cellV()) ? ((cellV() - cellU()) / NT + cellU() / NT) : cellV() / NT);
100  }
101  std::pair<int, int> triggerCellUV() const { return std::pair<int, int>(triggerCellU(), triggerCellV()); }
102 
104  bool isEE() const { return (layer() <= HFNoseLayerEEmax); }
105  bool isHE() const { return (layer() > HFNoseLayerEEmax); }
106  bool isForward() const { return true; }
107 
108  static const HFNoseDetId Undefined;
109 
110 private:
111  static const int kHFNoseCellUOffset = 0;
112  static const int kHFNoseCellUMask = 0x1F;
113  static const int kHFNoseCellVOffset = 5;
114  static const int kHFNoseCellVMask = 0x1F;
115  static const int kHFNoseWaferUOffset = 10;
116  static const int kHFNoseWaferUMask = 0xF;
117  static const int kHFNoseWaferUSignOffset = 14;
118  static const int kHFNoseWaferUSignMask = 0x1;
119  static const int kHFNoseWaferVOffset = 15;
120  static const int kHFNoseWaferVMask = 0xF;
121  static const int kHFNoseWaferVSignOffset = 19;
122  static const int kHFNoseWaferVSignMask = 0x1;
123  static const int kHFNoseLayerOffset = 20;
124  static const int kHFNoseLayerMask = 0x7;
125  static const int kHFNoseZsideOffset = 23;
126  static const int kHFNoseZsideMask = 0x1;
127  static const int kHFNoseTypeOffset = 24;
128  static const int kHFNoseTypeMask = 0x1;
129 };
130 
131 std::ostream& operator<<(std::ostream&, const HFNoseDetId& id);
132 
133 #endif
HFNoseDetId::waferY
int waferY() const
Definition: HFNoseDetId.h:83
HFNoseDetId::moduleId
HFNoseDetId moduleId() const
Definition: HFNoseDetId.h:47
HFNoseDetId::kHFNoseWaferUOffset
static const int kHFNoseWaferUOffset
Definition: HFNoseDetId.h:115
HFNoseDetId::waferX
int waferX() const
Definition: HFNoseDetId.h:82
HFNoseDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HFNoseDetId.h:53
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
HFNoseDetId::Undefined
static const HFNoseDetId Undefined
Definition: HFNoseDetId.h:108
HFNoseDetId::layer
int layer() const
get the layer #
Definition: HFNoseDetId.h:56
HFNoseDetId::kHFNoseCellUMask
static const int kHFNoseCellUMask
Definition: HFNoseDetId.h:112
HFNoseDetId::HFNoseDetId
HFNoseDetId()
Definition: HFNoseDetId.cc:8
HFNoseDetId::kHFNoseTypeOffset
static const int kHFNoseTypeOffset
Definition: HFNoseDetId.h:127
HFNoseDetId::hfNoseWaferType
hfNoseWaferType
Definition: HFNoseDetId.h:24
HFNoseDetId::HFNoseCoarseTrigger
static const int HFNoseCoarseTrigger
Definition: HFNoseDetId.h:28
HFNoseDetId
Definition: HFNoseDetId.h:22
HFNoseDetId::kHFNoseZsideMask
static const int kHFNoseZsideMask
Definition: HFNoseDetId.h:126
ForwardSubdetector.h
operator<<
std::ostream & operator<<(std::ostream &, const HFNoseDetId &id)
Definition: HFNoseDetId.cc:48
HFNoseDetId::waferU
int waferU() const
Definition: HFNoseDetId.h:75
DetId
Definition: DetId.h:17
HFNoseDetId::kHFNoseLayerMask
static const int kHFNoseLayerMask
Definition: HFNoseDetId.h:124
HFNoseDetId::kHFNoseWaferUMask
static const int kHFNoseWaferUMask
Definition: HFNoseDetId.h:116
HFNoseDetId::kHFNoseTypeMask
static const int kHFNoseTypeMask
Definition: HFNoseDetId.h:128
HFNoseDetId::kHFNoseWaferUSignOffset
static const int kHFNoseWaferUSignOffset
Definition: HFNoseDetId.h:117
HFNoseDetId::kHFNoseWaferVOffset
static const int kHFNoseWaferVOffset
Definition: HFNoseDetId.h:119
HFNose
Definition: ForwardSubdetector.h:11
HFNoseDetId::isHE
bool isHE() const
Definition: HFNoseDetId.h:105
HFNoseDetId::waferXY
std::pair< int, int > waferXY() const
Definition: HFNoseDetId.h:84
HFNoseDetId::HFNoseFineN
static const int HFNoseFineN
Definition: HFNoseDetId.h:25
N
#define N
Definition: blowfish.cc:9
HFNoseDetId::HFNoseFineTrigger
static const int HFNoseFineTrigger
Definition: HFNoseDetId.h:27
HFNoseDetId::geometryCell
HFNoseDetId geometryCell() const
Definition: HFNoseDetId.h:46
HFNoseDetId::triggerCellU
int triggerCellU() const
Definition: HFNoseDetId.h:87
HFNoseDetId::kHFNoseCellVMask
static const int kHFNoseCellVMask
Definition: HFNoseDetId.h:114
HFNoseDetId::waferUV
std::pair< int, int > waferUV() const
Definition: HFNoseDetId.h:81
HFNoseDetId::type
int type() const
get the type
Definition: HFNoseDetId.h:50
HFNoseDetId::kHFNoseZsideOffset
static const int kHFNoseZsideOffset
Definition: HFNoseDetId.h:125
DetId::id_
uint32_t id_
Definition: DetId.h:69
HFNoseDetId::HFNoseCoarseThick
Definition: HFNoseDetId.h:24
HFNoseDetId::subdet
ForwardSubdetector subdet() const
get the subdetector
Definition: HFNoseDetId.h:43
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
HFNoseDetId::waferUAbs
int waferUAbs() const
get the wafer #'s in u,v or in x,y
Definition: HFNoseDetId.h:73
HFNoseDetId::isEE
bool isEE() const
consistency check : no bits left => no overhead
Definition: HFNoseDetId.h:104
HFNoseDetId::kHFNoseWaferUSignMask
static const int kHFNoseWaferUSignMask
Definition: HFNoseDetId.h:118
HFNoseDetId::cellX
int cellX() const
Definition: HFNoseDetId.h:62
HFNoseDetId::cellV
int cellV() const
Definition: HFNoseDetId.h:60
HFNoseDetId::kHFNoseWaferVSignOffset
static const int kHFNoseWaferVSignOffset
Definition: HFNoseDetId.h:121
HFNoseDetId::triggerCellUV
std::pair< int, int > triggerCellUV() const
Definition: HFNoseDetId.h:101
HFNoseDetId::HFNoseLayerEEmax
static const int HFNoseLayerEEmax
Definition: HFNoseDetId.h:29
HFNoseDetId::cellU
int cellU() const
get the cell #'s in u,v or in x,y
Definition: HFNoseDetId.h:59
HFNoseDetId::cellUV
std::pair< int, int > cellUV() const
Definition: HFNoseDetId.h:61
HFNoseDetId::kHFNoseLayerOffset
static const int kHFNoseLayerOffset
Definition: HFNoseDetId.h:123
HFNoseDetId::HFNoseCoarseThin
Definition: HFNoseDetId.h:24
DetId.h
HFNoseDetId::kHFNoseCellUOffset
static const int kHFNoseCellUOffset
Definition: HFNoseDetId.h:111
HFNoseDetId::kHFNoseCellVOffset
static const int kHFNoseCellVOffset
Definition: HFNoseDetId.h:113
HFNoseDetId::operator=
HFNoseDetId & operator=(const DetId &id)
Definition: HFNoseDetId.cc:38
HFNoseDetId::cellXY
std::pair< int, int > cellXY() const
Definition: HFNoseDetId.h:70
HFNoseDetId::HFNoseFine
Definition: HFNoseDetId.h:24
HFNoseDetId::triggerCellV
int triggerCellV() const
Definition: HFNoseDetId.h:94
HFNoseDetId::waferV
int waferV() const
Definition: HFNoseDetId.h:78
HFNoseDetId::isForward
bool isForward() const
Definition: HFNoseDetId.h:106
HFNoseDetId::waferVAbs
int waferVAbs() const
Definition: HFNoseDetId.h:74
HFNoseDetId::cellY
int cellY() const
Definition: HFNoseDetId.h:66
HFNoseDetId::kHFNoseWaferVSignMask
static const int kHFNoseWaferVSignMask
Definition: HFNoseDetId.h:122
HFNoseDetId::HFNoseCoarseN
static const int HFNoseCoarseN
Definition: HFNoseDetId.h:26
HFNoseDetId::kHFNoseWaferVMask
static const int kHFNoseWaferVMask
Definition: HFNoseDetId.h:120