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(DetId::Detector det, int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV);
37  HFNoseDetId(int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV);
39  HFNoseDetId(const DetId& id);
41  HFNoseDetId& operator=(const DetId& id);
42 
44  ForwardSubdetector subdet() const { return HFNose; }
45 
47  HFNoseDetId geometryCell() const { return HFNoseDetId(zside(), 0, layer(), waferU(), waferV(), 0, 0); }
48  HFNoseDetId moduleId() const { return HFNoseDetId(zside(), type(), layer(), waferU(), waferV(), 0, 0); }
49 
51  int type() const { return (id_ >> kHFNoseTypeOffset) & kHFNoseTypeMask; }
52 
54  int zside() const { return (((id_ >> kHFNoseZsideOffset) & kHFNoseZsideMask) ? -1 : 1); }
55 
57  int layer() const { return ((id_ >> kHFNoseLayerOffset) & kHFNoseLayerMask) + 1; }
58 
60  int cellU() const { return (id_ >> kHFNoseCellUOffset) & kHFNoseCellUMask; }
61  int cellV() const { return (id_ >> kHFNoseCellVOffset) & kHFNoseCellVMask; }
62  std::pair<int, int> cellUV() const { return std::pair<int, int>(cellU(), cellV()); }
63  int cellX() const {
64  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
65  return (3 * (cellV() - N) + 2);
66  }
67  int cellY() const {
68  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
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_ >> kHFNoseWaferUOffset) & kHFNoseWaferUMask; }
75  int waferVAbs() const { return (id_ >> kHFNoseWaferVOffset) & kHFNoseWaferVMask; }
76  int waferU() const {
78  }
79  int waferV() const {
81  }
82  std::pair<int, int> waferUV() const { return std::pair<int, int>(waferU(), waferV()); }
83  int waferX() const { return (-2 * waferU() + waferV()); }
84  int waferY() const { return (2 * waferV()); }
85  std::pair<int, int> waferXY() const { return std::pair<int, int>(waferX(), waferY()); }
86 
87  // get trigger cell u,v
88  int triggerCellU() const {
89  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
91  return (cellU() >= N && cellV() >= N)
92  ? cellU() / NT
93  : ((cellU() < N && cellU() <= cellV()) ? cellU() / NT : (1 + (cellU() - (cellV() % NT + 1)) / NT));
94  }
95  int triggerCellV() const {
96  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
98  return (cellU() >= N && cellV() >= N)
99  ? cellV() / NT
100  : ((cellU() < N && cellU() <= cellV()) ? ((cellV() - cellU()) / NT + cellU() / NT) : cellV() / NT);
101  }
102  std::pair<int, int> triggerCellUV() const { return std::pair<int, int>(triggerCellU(), triggerCellV()); }
103 
105  bool isEE() const { return (layer() <= HFNoseLayerEEmax); }
106  bool isHE() const { return (layer() > HFNoseLayerEEmax); }
107  bool isForward() const { return true; }
108 
109  static const HFNoseDetId Undefined;
110 
111 private:
112  static const int kHFNoseCellUOffset = 0;
113  static const int kHFNoseCellUMask = 0x1F;
114  static const int kHFNoseCellVOffset = 5;
115  static const int kHFNoseCellVMask = 0x1F;
116  static const int kHFNoseWaferUOffset = 10;
117  static const int kHFNoseWaferUMask = 0xF;
118  static const int kHFNoseWaferUSignOffset = 14;
119  static const int kHFNoseWaferUSignMask = 0x1;
120  static const int kHFNoseWaferVOffset = 15;
121  static const int kHFNoseWaferVMask = 0xF;
122  static const int kHFNoseWaferVSignOffset = 19;
123  static const int kHFNoseWaferVSignMask = 0x1;
124  static const int kHFNoseLayerOffset = 20;
125  static const int kHFNoseLayerMask = 0x7;
126  static const int kHFNoseZsideOffset = 23;
127  static const int kHFNoseZsideMask = 0x1;
128  static const int kHFNoseTypeOffset = 24;
129  static const int kHFNoseTypeMask = 0x1;
130 };
131 
132 std::ostream& operator<<(std::ostream&, const HFNoseDetId& id);
133 
134 #endif
std::ostream & operator<<(std::ostream &, const HFNoseDetId &id)
Definition: HFNoseDetId.cc:51
int cellY() const
Definition: HFNoseDetId.h:67
static const int kHFNoseWaferUOffset
Definition: HFNoseDetId.h:116
static const int HFNoseCoarseN
Definition: HFNoseDetId.h:26
static const HFNoseDetId Undefined
Definition: HFNoseDetId.h:109
static const int HFNoseCoarseTrigger
Definition: HFNoseDetId.h:28
int layer() const
get the layer #
Definition: HFNoseDetId.h:57
HFNoseDetId moduleId() const
Definition: HFNoseDetId.h:48
static const int kHFNoseZsideMask
Definition: HFNoseDetId.h:127
static const int kHFNoseTypeOffset
Definition: HFNoseDetId.h:128
int waferX() const
Definition: HFNoseDetId.h:83
int waferU() const
Definition: HFNoseDetId.h:76
static const int kHFNoseTypeMask
Definition: HFNoseDetId.h:129
static const int kHFNoseWaferUSignOffset
Definition: HFNoseDetId.h:118
ForwardSubdetector
static const int kHFNoseCellUMask
Definition: HFNoseDetId.h:113
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
static const int kHFNoseWaferVOffset
Definition: HFNoseDetId.h:120
std::pair< int, int > waferXY() const
Definition: HFNoseDetId.h:85
static const int HFNoseFineN
Definition: HFNoseDetId.h:25
static const int HFNoseFineTrigger
Definition: HFNoseDetId.h:27
static const int kHFNoseWaferUMask
Definition: HFNoseDetId.h:117
int waferUAbs() const
get the wafer #&#39;s in u,v or in x,y
Definition: HFNoseDetId.h:74
static const int kHFNoseCellVMask
Definition: HFNoseDetId.h:115
std::pair< int, int > waferUV() const
Definition: HFNoseDetId.h:82
int cellX() const
Definition: HFNoseDetId.h:63
static const int kHFNoseZsideOffset
Definition: HFNoseDetId.h:126
static const int kHFNoseLayerMask
Definition: HFNoseDetId.h:125
ForwardSubdetector subdet() const
get the subdetector
Definition: HFNoseDetId.h:44
int cellU() const
get the cell #&#39;s in u,v or in x,y
Definition: HFNoseDetId.h:60
bool isHE() const
Definition: HFNoseDetId.h:106
int type() const
get the type
Definition: HFNoseDetId.h:51
HFNoseDetId geometryCell() const
Definition: HFNoseDetId.h:47
int triggerCellU() const
Definition: HFNoseDetId.h:88
static const int kHFNoseCellUOffset
Definition: HFNoseDetId.h:112
Definition: DetId.h:17
HFNoseDetId & operator=(const DetId &id)
Definition: HFNoseDetId.cc:41
#define N
Definition: blowfish.cc:9
static const int kHFNoseLayerOffset
Definition: HFNoseDetId.h:124
int cellV() const
Definition: HFNoseDetId.h:61
static const int kHFNoseWaferVSignOffset
Definition: HFNoseDetId.h:122
Detector
Definition: DetId.h:24
uint32_t id_
Definition: DetId.h:69
std::pair< int, int > triggerCellUV() const
Definition: HFNoseDetId.h:102
int waferV() const
Definition: HFNoseDetId.h:79
static const int HFNoseLayerEEmax
Definition: HFNoseDetId.h:29
bool isEE() const
consistency check : no bits left => no overhead
Definition: HFNoseDetId.h:105
bool isForward() const
Definition: HFNoseDetId.h:107
static const int kHFNoseWaferUSignMask
Definition: HFNoseDetId.h:119
int waferVAbs() const
Definition: HFNoseDetId.h:75
std::pair< int, int > cellXY() const
Definition: HFNoseDetId.h:71
int triggerCellV() const
Definition: HFNoseDetId.h:95
static const int kHFNoseWaferVSignMask
Definition: HFNoseDetId.h:123
static const int kHFNoseWaferVMask
Definition: HFNoseDetId.h:121
std::pair< int, int > cellUV() const
Definition: HFNoseDetId.h:62
static const int kHFNoseCellVOffset
Definition: HFNoseDetId.h:114
int waferY() const
Definition: HFNoseDetId.h:84
int zside() const
get the z-side of the cell (1/-1)
Definition: HFNoseDetId.h:54