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 
31  HFNoseDetId();
33  HFNoseDetId(uint32_t rawid);
35  HFNoseDetId(int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV);
37  HFNoseDetId(const DetId& id);
39  HFNoseDetId& operator=(const DetId& id);
40 
42  ForwardSubdetector subdet() const { return HFNose; }
43 
45  HFNoseDetId geometryCell() const { return HFNoseDetId(zside(), 0, layer(), waferU(), waferV(), 0, 0); }
46  HFNoseDetId moduleId() const { return HFNoseDetId(zside(), type(), layer(), waferU(), waferV(), 0, 0); }
47 
49  int type() const { return (id_ >> kHFNoseTypeOffset) & kHFNoseTypeMask; }
50 
52  int zside() const { return (((id_ >> kHFNoseZsideOffset) & kHFNoseZsideMask) ? -1 : 1); }
53 
55  int layer() const { return ((id_ >> kHFNoseLayerOffset) & kHFNoseLayerMask) + 1; }
56 
58  int cellU() const { return (id_ >> kHFNoseCellUOffset) & kHFNoseCellUMask; }
59  int cellV() const { return (id_ >> kHFNoseCellVOffset) & kHFNoseCellVMask; }
60  std::pair<int, int> cellUV() const { return std::pair<int, int>(cellU(), cellV()); }
61  int cellX() const {
62  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
63  return (3 * (cellV() - N) + 2);
64  }
65  int cellY() const {
66  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
67  return (2 * cellU() - (N + cellV()));
68  }
69  std::pair<int, int> cellXY() const { return std::pair<int, int>(cellX(), cellY()); }
70 
72  int waferUAbs() const { return (id_ >> kHFNoseWaferUOffset) & kHFNoseWaferUMask; }
73  int waferVAbs() const { return (id_ >> kHFNoseWaferVOffset) & kHFNoseWaferVMask; }
74  int waferU() const {
76  }
77  int waferV() const {
79  }
80  std::pair<int, int> waferUV() const { return std::pair<int, int>(waferU(), waferV()); }
81  int waferX() const { return (-2 * waferU() + waferV()); }
82  int waferY() const { return (2 * waferV()); }
83  std::pair<int, int> waferXY() const { return std::pair<int, int>(waferX(), waferY()); }
84 
85  // get trigger cell u,v
86  int triggerCellU() const {
87  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
88  int NT = (type() == HFNoseFine) ? HFNoseFineTrigger : HFNoseCoarseTrigger;
89  return (cellU() >= N && cellV() >= N)
90  ? cellU() / NT
91  : ((cellU() < N && cellU() <= cellV()) ? cellU() / NT : (1 + (cellU() - (cellV() % NT + 1)) / NT));
92  }
93  int triggerCellV() const {
94  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
95  int NT = (type() == HFNoseFine) ? HFNoseFineTrigger : HFNoseCoarseTrigger;
96  return (cellU() >= N && cellV() >= N)
97  ? cellV() / NT
98  : ((cellU() < N && cellU() <= cellV()) ? ((cellV() - cellU()) / NT + cellU() / NT) : cellV() / NT);
99  }
100  std::pair<int, int> triggerCellUV() const { return std::pair<int, int>(triggerCellU(), triggerCellV()); }
101 
103  bool isEE() const { return (layer() <= kHFNoseLayerEEmax); }
104  bool isHE() const { return (layer() > kHFNoseLayerEEmax); }
105  bool isForward() const { return true; }
106 
107  static const HFNoseDetId Undefined;
108 
109 private:
110  static const int kHFNoseLayerEEmax = 6;
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
std::ostream & operator<<(std::ostream &, const HFNoseDetId &id)
Definition: HFNoseDetId.cc:48
type
Definition: HCALResponse.h:21
static const int kHFNoseWaferUOffset
Definition: HFNoseDetId.h:115
static const int HFNoseCoarseN
Definition: HFNoseDetId.h:26
int triggerCellU() const
Definition: HFNoseDetId.h:86
int zside() const
get the z-side of the cell (1/-1)
Definition: HFNoseDetId.h:52
static const HFNoseDetId Undefined
Definition: HFNoseDetId.h:107
static const int HFNoseCoarseTrigger
Definition: HFNoseDetId.h:28
int type() const
get the type
Definition: HFNoseDetId.h:49
std::pair< int, int > waferXY() const
Definition: HFNoseDetId.h:83
static const int kHFNoseZsideMask
Definition: HFNoseDetId.h:126
static const int kHFNoseTypeOffset
Definition: HFNoseDetId.h:127
int cellU() const
get the cell #&#39;s in u,v or in x,y
Definition: HFNoseDetId.h:58
bool isEE() const
consistency check : no bits left => no overhead
Definition: HFNoseDetId.h:103
static const int kHFNoseTypeMask
Definition: HFNoseDetId.h:128
static const int kHFNoseWaferUSignOffset
Definition: HFNoseDetId.h:117
std::pair< int, int > cellXY() const
Definition: HFNoseDetId.h:69
HFNoseDetId geometryCell() const
Definition: HFNoseDetId.h:45
std::pair< int, int > triggerCellUV() const
Definition: HFNoseDetId.h:100
int waferX() const
Definition: HFNoseDetId.h:81
int waferVAbs() const
Definition: HFNoseDetId.h:73
ForwardSubdetector
static const int kHFNoseCellUMask
Definition: HFNoseDetId.h:112
static const int kHFNoseLayerEEmax
Definition: HFNoseDetId.h:110
static const int kHFNoseWaferVOffset
Definition: HFNoseDetId.h:119
static const int HFNoseFineN
Definition: HFNoseDetId.h:25
int waferY() const
Definition: HFNoseDetId.h:82
static const int HFNoseFineTrigger
Definition: HFNoseDetId.h:27
static const int kHFNoseWaferUMask
Definition: HFNoseDetId.h:116
int cellV() const
Definition: HFNoseDetId.h:59
int waferV() const
Definition: HFNoseDetId.h:77
int layer() const
get the layer #
Definition: HFNoseDetId.h:55
static const int kHFNoseCellVMask
Definition: HFNoseDetId.h:114
int waferU() const
Definition: HFNoseDetId.h:74
std::pair< int, int > cellUV() const
Definition: HFNoseDetId.h:60
static const int kHFNoseZsideOffset
Definition: HFNoseDetId.h:125
static const int kHFNoseLayerMask
Definition: HFNoseDetId.h:124
HFNoseDetId moduleId() const
Definition: HFNoseDetId.h:46
bool isForward() const
Definition: HFNoseDetId.h:105
int cellX() const
Definition: HFNoseDetId.h:61
static const int kHFNoseCellUOffset
Definition: HFNoseDetId.h:111
Definition: DetId.h:17
HFNoseDetId & operator=(const DetId &id)
Definition: HFNoseDetId.cc:38
#define N
Definition: blowfish.cc:9
static const int kHFNoseLayerOffset
Definition: HFNoseDetId.h:123
static const int kHFNoseWaferVSignOffset
Definition: HFNoseDetId.h:121
uint32_t id_
Definition: DetId.h:69
bool isHE() const
Definition: HFNoseDetId.h:104
std::pair< int, int > waferUV() const
Definition: HFNoseDetId.h:80
static const int kHFNoseWaferUSignMask
Definition: HFNoseDetId.h:118
ForwardSubdetector subdet() const
get the subdetector
Definition: HFNoseDetId.h:42
static const int kHFNoseWaferVSignMask
Definition: HFNoseDetId.h:122
static const int kHFNoseWaferVMask
Definition: HFNoseDetId.h:120
static const int kHFNoseCellVOffset
Definition: HFNoseDetId.h:113
int waferUAbs() const
get the wafer #&#39;s in u,v or in x,y
Definition: HFNoseDetId.h:72
int cellY() const
Definition: HFNoseDetId.h:65
int triggerCellV() const
Definition: HFNoseDetId.h:93