CMS 3D CMS Logo

HGCalTriggerDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_ForwardDetId_HGCalTriggerDetId_H
2 #define DataFormats_ForwardDetId_HGCalTriggerDetId_H 1
3 
4 #include <iosfwd>
5 #include <vector>
9 
10 /* \brief description of the bit assigment
11  [0:3] u-coordinate of the cell (measured from the lower left
12  [4:7] v-coordinate of the cell corner of the wafer)
13  [8:11] abs(u) of the wafer (u-axis points along -x axis)
14  [12:12] sign of u (0:+u; 1:-u) (u=0 is at the center of beam line)
15  [13:16] abs(v) of the wafer (v-axis points 60-degree wrt x-axis)
16  [17:17] sign of v (0:+v; 1:-v) (v=0 is at the center of beam line)
17  [18:22] layer number
18  [23:24] Type (0 fine divisions of wafer with 120 mum thick silicon
19  1 coarse divisions of wafer with 200 mum thick silicon
20  2 coarse divisions of wafer with 300 mum thick silicon)
21  [25:26] Subdetector Type (HGCalEETrigger/HGCalHSiTrigger)
22  [27:27] z-side (0 for +z; 1 for -z)
23  [28:31] Detector type (HGCalTrigger)
24 */
25 
26 class HGCalTriggerDetId : public DetId {
27 
28 public:
29 
30  static const int HGCalTriggerCell =4;
31 
35  HGCalTriggerDetId(uint32_t rawid);
37  HGCalTriggerDetId(int subdet, int zp, int type, int layer,
38  int waferU, int waferV, int cellU, int cellV);
40  HGCalTriggerDetId(const DetId& id);
42  HGCalTriggerDetId& operator=(const DetId& id);
43 
47 
49  int type() const { return (id_>>kHGCalTypeOffset)&kHGCalTypeMask; }
50 
52  int zside() const { return (((id_>>kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
53 
55  int layer() const { return (id_>>kHGCalLayerOffset)&kHGCalLayerMask; }
56 
60  std::pair<int,int> triggerCellUV() const {
61  return std::pair<int,int>(triggerCellU(),triggerCellV()); }
62  int triggerCellX() const;
63  int triggerCellY() const;
64  std::pair<int,int> triggerCellXY() const {
65  return std::pair<int,int>(triggerCellX(),triggerCellY()); }
66 
68  int waferUAbs() const { return (id_>>kHGCalWaferUOffset)&kHGCalWaferUMask; }
69  int waferVAbs() const { return (id_>>kHGCalWaferVOffset)&kHGCalWaferVMask; }
70  int waferU() const { return (((id_>>kHGCalWaferUSignOffset) & kHGCalWaferUSignMask) ? -waferUAbs() : waferUAbs()); }
71  int waferV() const { return (((id_>>kHGCalWaferVSignOffset) & kHGCalWaferVSignMask) ? -waferVAbs() : waferVAbs()); }
72  std::pair<int,int> waferUV() const { return std::pair<int,int>(waferU(),waferV()); }
73  int waferX() const { return (-2*waferU()+waferV()); }
74  int waferY() const { return (2*waferV()); }
75  std::pair<int,int> waferXY() const { return std::pair<int,int>(waferX(),waferY()); }
76 
77  // get trigger cell u,v
78  std::vector<int> cellU() const;
79  std::vector<int> cellV() const;
80  std::vector<std::pair<int,int> > cellUV() const;
81 
83  bool isEE() const { return (subdet() == HGCalEETrigger); }
84  bool isHSilicon() const { return (subdet() == HGCalHSiTrigger); }
85  bool isForward() const { return true; }
86 
88 
89  private:
90 
91  static const int kHGCalCellUOffset = 0;
92  static const int kHGCalCellUMask = 0xF;
93  static const int kHGCalCellVOffset = 4;
94  static const int kHGCalCellVMask = 0xF;
95  static const int kHGCalWaferUOffset = 8;
96  static const int kHGCalWaferUMask = 0xF;
97  static const int kHGCalWaferUSignOffset = 12;
98  static const int kHGCalWaferUSignMask = 0x1;
99  static const int kHGCalWaferVOffset = 13;
100  static const int kHGCalWaferVMask = 0xF;
101  static const int kHGCalWaferVSignOffset = 17;
102  static const int kHGCalWaferVSignMask = 0x1;
103  static const int kHGCalLayerOffset = 18;
104  static const int kHGCalLayerMask = 0x1F;
105  static const int kHGCalTypeOffset = 23;
106  static const int kHGCalTypeMask = 0x3;
107  static const int kHGCalZsideOffset = 27;
108  static const int kHGCalZsideMask = 0x1;
109  static const int kHGCalSubdetOffset = 25;
110  static const int kHGCalSubdetMask = 0x3;
111 };
112 
113 std::ostream& operator<<(std::ostream&,const HGCalTriggerDetId& id);
114 
115 #endif
HGCalTriggerSubdetector
type
Definition: HCALResponse.h:21
static const int kHGCalSubdetMask
HGCalTriggerSubdetector subdet() const
get the subdetector
static const int kHGCalWaferVSignMask
std::pair< int, int > triggerCellUV() const
int triggerCellU() const
get the cell #&#39;s in u,v or in x,y
std::vector< std::pair< int, int > > cellUV() const
int zside() const
get the z-side of the cell (1/-1)
int waferUAbs() const
get the wafer #&#39;s in u,v or in x,y
static const int kHGCalTypeOffset
int type() const
get the type
std::pair< int, int > triggerCellXY() const
static const int kHGCalLayerOffset
int triggerCellX() const
static const int kHGCalCellVOffset
int layer() const
get the layer #
static const int kHGCalZsideMask
static const int kHGCalWaferUSignMask
static const int HGCalTriggerCell
static const int kHGCalWaferUOffset
static const int kHGCalZsideOffset
int triggerCellY() const
static const int kHGCalWaferVMask
static const int kHGCalTypeMask
std::vector< int > cellV() const
int triggerCellV() const
bool isEE() const
consistency check : no bits left => no overhead
static const int kHGCalSubdetOffset
std::pair< int, int > waferXY() const
static const int kHGCalCellVMask
static const HGCalTriggerDetId Undefined
Definition: DetId.h:18
HGCalTriggerDetId & operator=(const DetId &id)
bool isHSilicon() const
int waferVAbs() const
static const int kHGCalWaferUMask
uint32_t id_
Definition: DetId.h:62
std::ostream & operator<<(std::ostream &, const HGCalTriggerDetId &id)
static const int kHGCalLayerMask
static const int kHGCalWaferVSignOffset
std::vector< int > cellU() const
static const int kHGCalCellUOffset
std::pair< int, int > waferUV() const
static const int kHGCalWaferVOffset
static const int kHGCalCellUMask
bool isForward() const
static const int kHGCalWaferUSignOffset