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:4] u-coordinate of the cell (measured from the lower left
12  [5:9] v-coordinate of the cell corner of the wafer)
13  [10:13] abs(u) of the wafer (u-axis points along -x axis)
14  [14:14] sign of u (0:+u; 1:-u) (u=0 is at the center of beam line)
15  [15:18] abs(v) of the wafer (v-axis points 60-degree wrt x-axis)
16  [19:19] sign of v (0:+v; 1:-v) (v=0 is at the center of beam line)
17  [20:24] layer number
18  [25:25] z-side (0 for +z; 1 for -z)
19  [26:27] Type (0 fine divisions of wafer with 120 mum thick silicon
20  1 coarse divisions of wafer with 200 mum thick silicon
21  2 coarse divisions of wafer with 300 mum thick silicon)
22  [28:31] Detector type (HGCalEE or HGCalHSi)
23 */
24 
25 class HGCalTriggerDetId : public DetId {
26 
27 public:
28 
29  static const int HGCalTriggerCell =4;
30 
34  HGCalTriggerDetId(uint32_t rawid);
36  HGCalTriggerDetId(int subdet, int zp, int type, int layer,
37  int waferU, int waferV, int cellU, int cellV);
39  HGCalTriggerDetId(const DetId& id);
41  HGCalTriggerDetId& operator=(const DetId& id);
42 
46 
48  int type() const { return (id_>>kHGCalTypeOffset)&kHGCalTypeMask; }
49 
51  int zside() const { return (((id_>>kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
52 
54  int layer() const { return (id_>>kHGCalLayerOffset)&kHGCalLayerMask; }
55 
59  std::pair<int,int> triggerCellUV() const {
60  return std::pair<int,int>(triggerCellU(),triggerCellV()); }
61  int triggerCellX() const;
62  int triggerCellY() const;
63  std::pair<int,int> triggerCellXY() const {
64  return std::pair<int,int>(triggerCellX(),triggerCellY()); }
65 
67  int waferUAbs() const { return (id_>>kHGCalWaferUOffset)&kHGCalWaferUMask; }
68  int waferVAbs() const { return (id_>>kHGCalWaferVOffset)&kHGCalWaferVMask; }
69  int waferU() const { return (((id_>>kHGCalWaferUSignOffset) & kHGCalWaferUSignMask) ? -waferUAbs() : waferUAbs()); }
70  int waferV() const { return (((id_>>kHGCalWaferVSignOffset) & kHGCalWaferVSignMask) ? -waferVAbs() : waferVAbs()); }
71  std::pair<int,int> waferUV() const { return std::pair<int,int>(waferU(),waferV()); }
72  int waferX() const { return (-2*waferU()+waferV()); }
73  int waferY() const { return (2*waferV()); }
74  std::pair<int,int> waferXY() const { return std::pair<int,int>(waferX(),waferY()); }
75 
76  // get trigger cell u,v
77  std::vector<int> cellU() const;
78  std::vector<int> cellV() const;
79  std::vector<std::pair<int,int> > cellUV() const;
80 
82  bool isEE() const { return (subdet() == HGCalEETrigger); }
83  bool isHSilicon() const { return (subdet() == HGCalHSiTrigger); }
84  bool isForward() const { return true; }
85 
87 
88  private:
89 
90  static const int kHGCalCellUOffset = 0;
91  static const int kHGCalCellUMask = 0xF;
92  static const int kHGCalCellVOffset = 4;
93  static const int kHGCalCellVMask = 0xF;
94  static const int kHGCalWaferUOffset = 8;
95  static const int kHGCalWaferUMask = 0xF;
96  static const int kHGCalWaferUSignOffset = 12;
97  static const int kHGCalWaferUSignMask = 0x1;
98  static const int kHGCalWaferVOffset = 13;
99  static const int kHGCalWaferVMask = 0xF;
100  static const int kHGCalWaferVSignOffset = 17;
101  static const int kHGCalWaferVSignMask = 0x1;
102  static const int kHGCalLayerOffset = 18;
103  static const int kHGCalLayerMask = 0x1F;
104  static const int kHGCalTypeOffset = 23;
105  static const int kHGCalTypeMask = 0x1;
106  static const int kHGCalZsideOffset = 27;
107  static const int kHGCalZsideMask = 0x1;
108  static const int kHGCalSubdetOffset = 25;
109  static const int kHGCalSubdetMask = 0x3;
110 };
111 
112 std::ostream& operator<<(std::ostream&,const HGCalTriggerDetId& id);
113 
114 #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:59
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