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 
24 public:
25 
27  static const int HGCalFineN =12;
28  static const int HGCalCoarseN=8;
29  static const int HGCalFineTrigger =3;
30  static const int HGCalCoarseTrigger=2;
31 
35  HGCSiliconDetId(uint32_t rawid);
37  HGCSiliconDetId(DetId::Detector det, int zp, int type, int layer, int waferU,
38  int waferV, int cellU, int cellV);
40  HGCSiliconDetId(const DetId& id);
42  HGCSiliconDetId& operator=(const DetId& id);
43 
45  HGCSiliconDetId geometryCell () const {return HGCSiliconDetId (det(), zside(), 0, layer(), waferU(), waferV(), 0, 0);}
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;
86  int NT = (type() == HGCalFine) ? HGCalFineTrigger : HGCalCoarseTrigger;
87  return (cellU() >= N && cellV() >= N) ? cellU()/NT :
88  ((cellU() < N && cellU() <= cellV()) ? cellU()/NT :
89  (1+(cellU()-(cellV()%NT+1))/NT));
90  }
91  int triggerCellV() const {
92  int N = (type() == HGCalFine) ? HGCalFineN : HGCalCoarseN;
93  int NT = (type() == HGCalFine) ? HGCalFineTrigger : HGCalCoarseTrigger;
94  return (cellU() >= N && cellV() >= N) ? cellV()/NT :
95  ((cellU() < N && cellU() <= cellV()) ? ((cellV()-cellU())/NT+cellU()/NT) :
96  cellV()/NT);
97  }
98  std::pair<int,int> triggerCellUV() const {
99  return std::pair<int,int>(triggerCellU(),triggerCellV());
100  }
101 
103  bool isEE() const { return (det() == HGCalEE); }
104  bool isHE() const { return (det() == HGCalHSi); }
105  bool isForward() const { return true; }
106 
108 
109 private:
110 
111  static const int kHGCalCellUOffset = 0;
112  static const int kHGCalCellUMask = 0x1F;
113  static const int kHGCalCellVOffset = 5;
114  static const int kHGCalCellVMask = 0x1F;
115  static const int kHGCalWaferUOffset = 10;
116  static const int kHGCalWaferUMask = 0xF;
117  static const int kHGCalWaferUSignOffset = 14;
118  static const int kHGCalWaferUSignMask = 0x1;
119  static const int kHGCalWaferVOffset = 15;
120  static const int kHGCalWaferVMask = 0xF;
121  static const int kHGCalWaferVSignOffset = 19;
122  static const int kHGCalWaferVSignMask = 0x1;
123  static const int kHGCalLayerOffset = 20;
124  static const int kHGCalLayerMask = 0x1F;
125  static const int kHGCalZsideOffset = 25;
126  static const int kHGCalZsideMask = 0x1;
127  static const int kHGCalTypeOffset = 26;
128  static const int kHGCalTypeMask = 0x3;
129 };
130 
131 std::ostream& operator<<(std::ostream&,const HGCSiliconDetId& id);
132 
133 #endif
type
Definition: HCALResponse.h:21
static const int kHGCalWaferVOffset
bool isForward() const
static const int kHGCalTypeMask
int waferX() const
int cellX() const
int waferU() const
int cellV() const
static const int kHGCalWaferVSignOffset
static const int kHGCalCellUMask
int zside() const
get the z-side of the cell (1/-1)
static const int HGCalFineN
static const int kHGCalCellVOffset
int cellU() const
get the cell #&#39;s in u,v or in x,y
static const int kHGCalTypeOffset
DetId::Detector subdet() const
get the subdetector
HGCSiliconDetId geometryCell() const
static const int kHGCalCellVMask
static const int kHGCalZsideOffset
int type() const
get the type
int layer() const
get the layer #
static const int HGCalCoarseTrigger
static const HGCSiliconDetId Undefined
int waferV() const
bool isHE() const
std::ostream & operator<<(std::ostream &, const HGCSiliconDetId &id)
int waferVAbs() const
std::pair< int, int > waferUV() const
static const int HGCalCoarseN
static const int kHGCalLayerMask
bool isEE() const
consistency check : no bits left => no overhead
Definition: DetId.h:18
static const int kHGCalWaferVMask
HGCSiliconDetId & operator=(const DetId &id)
static const int kHGCalWaferUSignMask
static const int kHGCalWaferUMask
#define N
Definition: blowfish.cc:9
static const int kHGCalZsideMask
static const int kHGCalWaferVSignMask
Detector
Definition: DetId.h:26
uint32_t id_
Definition: DetId.h:59
static const int kHGCalCellUOffset
int waferUAbs() const
get the wafer #&#39;s in u,v or in x,y
int waferY() const
static const int kHGCalLayerOffset
int triggerCellU() const
std::pair< int, int > cellXY() const
int triggerCellV() const
std::pair< int, int > triggerCellUV() const
static const int kHGCalWaferUOffset
std::pair< int, int > waferXY() const
static const int HGCalFineTrigger
static const int kHGCalWaferUSignOffset
int cellY() const
std::pair< int, int > cellUV() const
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39