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:12] abs(u) of the wafer (u-axis points along -x axis)
12  [13:13] sign of u (0:+u; 1:-u) (u=0 is at the center of beam line)
13  [14:16] abs(v) of the wafer (v-axis points 60-degree wrt x-axis)
14  [17:17] sign of v (0:+v; 1:-v) (v=0 is at the center of beam line)
15  [18:21] layer number
16  [22:22] z-side (0 for +z; 1 for -z)
17  [23:24] 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  [25:27] Subdetector type (HFNose)
21  [28:31] Detector type (Forward)
22 */
23 class HFNoseDetId : public DetId {
24 
25 public:
26 
28  static const int HFNoseFineN =12;
29  static const int HFNoseCoarseN=8;
30  static const int HFNoseFineTrigger =3;
31  static const int HFNoseCoarseTrigger=2;
32 
34  HFNoseDetId();
36  HFNoseDetId(uint32_t rawid);
38  HFNoseDetId(int zp, int type, int layer, int waferU, int waferV, int cellU,
39  int cellV);
41  HFNoseDetId(const DetId& id);
43  HFNoseDetId& operator=(const DetId& id);
44 
46  ForwardSubdetector subdet() const { return HFNose; }
47 
49  HFNoseDetId geometryCell () const {return HFNoseDetId (zside(), 0, layer(), waferU(), waferV(), 0, 0);}
50 
52  int type() const { return (id_>>kHFNoseTypeOffset)&kHFNoseTypeMask; }
53 
55  int zside() const { return (((id_>>kHFNoseZsideOffset) & kHFNoseZsideMask) ? -1 : 1); }
56 
58  int layer() const { return (id_>>kHFNoseLayerOffset)&kHFNoseLayerMask; }
59 
61  int cellU() const { return (id_>>kHFNoseCellUOffset)&kHFNoseCellUMask; }
62  int cellV() const { return (id_>>kHFNoseCellVOffset)&kHFNoseCellVMask; }
63  std::pair<int,int> cellUV() const { return std::pair<int,int>(cellU(),cellV()); }
64  int cellX() const {
65  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
66  return (3*(cellV()-N)+2);
67  }
68  int cellY() const {
69  int N = (type() == HFNoseFine) ? HFNoseFineN : HFNoseCoarseN;
70  return (2*cellU()-(N+cellV()));
71  }
72  std::pair<int,int> cellXY() const { return std::pair<int,int>(cellX(),cellY()); }
73 
77  int waferU() const { return (((id_>>kHFNoseWaferUSignOffset) & kHFNoseWaferUSignMask) ? -waferUAbs() : waferUAbs()); }
78  int waferV() const { return (((id_>>kHFNoseWaferVSignOffset) & kHFNoseWaferVSignMask) ? -waferVAbs() : waferVAbs()); }
79  std::pair<int,int> waferUV() const { return std::pair<int,int>(waferU(),waferV()); }
80  int waferX() const { return (-2*waferU()+waferV()); }
81  int waferY() const { return (2*waferV()); }
82  std::pair<int,int> waferXY() const { return std::pair<int,int>(waferX(),waferY()); }
83 
85  bool isEE() const { return (layer() <= kHFNoseLayerEEmax); }
86  bool isHE() const { return (layer() > kHFNoseLayerEEmax); }
87  bool isForward() const { return true; }
88 
89  static const HFNoseDetId Undefined;
90 
91 private:
92 
93  static const int kHFNoseLayerEEmax = 6;
94  static const int kHFNoseCellUOffset = 0;
95  static const int kHFNoseCellUMask = 0x1F;
96  static const int kHFNoseCellVOffset = 5;
97  static const int kHFNoseCellVMask = 0x1F;
98  static const int kHFNoseWaferUOffset = 10;
99  static const int kHFNoseWaferUMask = 0x7;
100  static const int kHFNoseWaferUSignOffset = 13;
101  static const int kHFNoseWaferUSignMask = 0x1;
102  static const int kHFNoseWaferVOffset = 14;
103  static const int kHFNoseWaferVMask = 0x7;
104  static const int kHFNoseWaferVSignOffset = 17;
105  static const int kHFNoseWaferVSignMask = 0x1;
106  static const int kHFNoseLayerOffset = 18;
107  static const int kHFNoseLayerMask = 0xF;
108  static const int kHFNoseZsideOffset = 22;
109  static const int kHFNoseZsideMask = 0x1;
110  static const int kHFNoseTypeOffset = 23;
111  static const int kHFNoseTypeMask = 0x3;
112 };
113 
114 std::ostream& operator<<(std::ostream&,const HFNoseDetId& id);
115 
116 #endif
std::ostream & operator<<(std::ostream &, const HFNoseDetId &id)
Definition: HFNoseDetId.cc:51
type
Definition: HCALResponse.h:21
std::pair< int, int > waferXY() const
Definition: HFNoseDetId.h:82
static const int kHFNoseWaferUOffset
Definition: HFNoseDetId.h:98
static const int HFNoseCoarseN
Definition: HFNoseDetId.h:29
int zside() const
get the z-side of the cell (1/-1)
Definition: HFNoseDetId.h:55
static const HFNoseDetId Undefined
Definition: HFNoseDetId.h:89
static const int HFNoseCoarseTrigger
Definition: HFNoseDetId.h:31
int type() const
get the type
Definition: HFNoseDetId.h:52
static const int kHFNoseZsideMask
Definition: HFNoseDetId.h:109
static const int kHFNoseTypeOffset
Definition: HFNoseDetId.h:110
int cellU() const
get the cell #&#39;s in u,v or in x,y
Definition: HFNoseDetId.h:61
bool isEE() const
consistency check : no bits left => no overhead
Definition: HFNoseDetId.h:85
static const int kHFNoseTypeMask
Definition: HFNoseDetId.h:111
static const int kHFNoseWaferUSignOffset
Definition: HFNoseDetId.h:100
std::pair< int, int > waferUV() const
Definition: HFNoseDetId.h:79
HFNoseDetId geometryCell() const
Definition: HFNoseDetId.h:49
int waferX() const
Definition: HFNoseDetId.h:80
int waferVAbs() const
Definition: HFNoseDetId.h:76
ForwardSubdetector
std::pair< int, int > cellXY() const
Definition: HFNoseDetId.h:72
static const int kHFNoseCellUMask
Definition: HFNoseDetId.h:95
static const int kHFNoseLayerEEmax
Definition: HFNoseDetId.h:93
std::pair< int, int > cellUV() const
Definition: HFNoseDetId.h:63
static const int kHFNoseWaferVOffset
Definition: HFNoseDetId.h:102
static const int HFNoseFineN
Definition: HFNoseDetId.h:28
int waferY() const
Definition: HFNoseDetId.h:81
static const int HFNoseFineTrigger
Definition: HFNoseDetId.h:30
static const int kHFNoseWaferUMask
Definition: HFNoseDetId.h:99
int cellV() const
Definition: HFNoseDetId.h:62
int waferV() const
Definition: HFNoseDetId.h:78
int layer() const
get the layer #
Definition: HFNoseDetId.h:58
static const int kHFNoseCellVMask
Definition: HFNoseDetId.h:97
int waferU() const
Definition: HFNoseDetId.h:77
static const int kHFNoseZsideOffset
Definition: HFNoseDetId.h:108
static const int kHFNoseLayerMask
Definition: HFNoseDetId.h:107
bool isForward() const
Definition: HFNoseDetId.h:87
int cellX() const
Definition: HFNoseDetId.h:64
static const int kHFNoseCellUOffset
Definition: HFNoseDetId.h:94
Definition: DetId.h:18
HFNoseDetId & operator=(const DetId &id)
Definition: HFNoseDetId.cc:41
#define N
Definition: blowfish.cc:9
static const int kHFNoseLayerOffset
Definition: HFNoseDetId.h:106
static const int kHFNoseWaferVSignOffset
Definition: HFNoseDetId.h:104
uint32_t id_
Definition: DetId.h:59
bool isHE() const
Definition: HFNoseDetId.h:86
static const int kHFNoseWaferUSignMask
Definition: HFNoseDetId.h:101
ForwardSubdetector subdet() const
get the subdetector
Definition: HFNoseDetId.h:46
static const int kHFNoseWaferVSignMask
Definition: HFNoseDetId.h:105
static const int kHFNoseWaferVMask
Definition: HFNoseDetId.h:103
static const int kHFNoseCellVOffset
Definition: HFNoseDetId.h:96
int waferUAbs() const
get the wafer #&#39;s in u,v or in x,y
Definition: HFNoseDetId.h:75
int cellY() const
Definition: HFNoseDetId.h:68