HGCal Test Beam  03a93d6239a951948e06fb3ef8dae4cbdebfad30
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
HGCalTBDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_ForwardDetId_HGCalTBDetId_H
2 #define DataFormats_ForwardDetId_HGCalTBDetId_H 1
3 
4 #include <iosfwd>
5 #include "DataFormats/DetId/interface/DetId.h"
6 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
7 
8 /*
9  On a sensor, the indexes are X and V. X is horizontal (in most diagrams) and V increases along the hexagon faces towards the upper right.
10 
11  */
12 class HGCalTBDetId : public DetId
13 {
14 
15 public:
16  static const int kHGCalTBXOffset = 0;
17  static const int kHGCalTBXMask = 0x1F;
18  static const int kHGCalTBXSignMask = 0x20;
19  static const int kHGCalTBVOffset = 6;
20  static const int kHGCalTBVMask = 0x1F;
21  static const int kHGCalTBVSignMask = 0x20;
22  static const int kHGCalTBSensorXOffset = 12;
23  static const int kHGCalTBSensorXMask = 0x7;
24  static const int kHGCalTBSensorXSignMask = 0x8;
25  static const int kHGCalTBSensorVOffset = 16;
26  static const int kHGCalTBSensorVMask = 0x7;
27  static const int kHGCalTBSensorVSignMask = 0x8;
28  static const int kHGCalTBCellTypeOffset = 20;
29  static const int kHGCalTBCellTypeMask = 0xF;
30  static const int kHGCalLayerOffset = 24;
31  static const int kHGCalLayerMask = 0x7F;
32  static const int kHGCalZsideOffset = 31;
33  static const int kHGCalZsideMask = 0x1;
34 
35  static const int kCellTypeStandard = 0;
36  static const int kCellTypeCalibInner = 1;
37  static const int kCellTypeCalibOuter = 2;
38 
39  /** Create a null cellid*/
40  HGCalTBDetId();
41  /** Create cellid from raw id (0=invalid tower id) */
42  HGCalTBDetId(uint32_t rawid);
43  /** Constructor from layer, sensor_iu, sensor_iv, iu, iv, calibr cell numbers */
44  HGCalTBDetId(int lay, int sensor_iu, int sensor_iv, int iu, int iv, int cellType);
45  /** Constructor from a generic cell id */
46  HGCalTBDetId(const DetId& id);
47  /** Assignment from a generic cell id */
48  HGCalTBDetId& operator=(const DetId& id);
49 
50  /// get the absolute value of the cell #'s
51  int iu() const
52  {
53  uint32_t v = id_;
54  return (v & kHGCalTBXSignMask) ? ((v & kHGCalTBXMask) - kHGCalTBXSignMask) : (v & kHGCalTBXMask);
55  }
56  int iv() const
57  {
58  uint32_t v = id_ >> kHGCalTBVOffset;
59  return (v & kHGCalTBVSignMask) ? ((v & kHGCalTBVMask) - kHGCalTBVSignMask) : (v & kHGCalTBVMask);
60  }
61 
62  /// get the sensor #
63  int sensorIU() const
64  {
65  uint32_t v = id_ >> kHGCalTBSensorXOffset;
66  return (v & kHGCalTBSensorXSignMask) ? (-(v & kHGCalTBSensorXMask)) : (v & kHGCalTBSensorXMask);
67  }
68  int sensorIV() const
69  {
70  uint32_t v = id_ >> kHGCalTBSensorVOffset;
71  return (v & kHGCalTBSensorVSignMask) ? (-(v & kHGCalTBSensorVMask)) : (v & kHGCalTBSensorVMask);
72  }
73 
74  /// cell type
75  int cellType() const
76  {
78  }
79 
80  /// get the layer #
81  int layer() const
82  {
83  return (id_ >> kHGCalLayerOffset)&kHGCalLayerMask;
84  }
85 
86  /// get the z-side of the cell (1/-1)
87  int zside() const
88  {
89  return ((id_ >> kHGCalZsideOffset) & kHGCalZsideMask ? -1 : 1);
90  }
91 
92  /// consistency check : no bits left => no overhead
93  bool isHGCal() const
94  {
95  return true;
96  }
97  bool isForward() const
98  {
99  return true;
100  }
101 
102 };
103 
104 std::ostream& operator<<(std::ostream&, const HGCalTBDetId& id);
105 
106 #endif
int layer() const
get the layer #
Definition: HGCalTBDetId.h:81
static const int kHGCalZsideOffset
Definition: HGCalTBDetId.h:32
int sensorIV() const
Definition: HGCalTBDetId.h:68
bool isForward() const
Definition: HGCalTBDetId.h:97
static const int kHGCalTBSensorVSignMask
Definition: HGCalTBDetId.h:27
static const int kCellTypeCalibInner
Definition: HGCalTBDetId.h:36
static const int kHGCalLayerMask
Definition: HGCalTBDetId.h:31
static const int kHGCalTBSensorVMask
Definition: HGCalTBDetId.h:26
static const int kHGCalTBSensorVOffset
Definition: HGCalTBDetId.h:25
HGCalTBDetId & operator=(const DetId &id)
Definition: HGCalTBDetId.cc:31
static const int kHGCalTBCellTypeMask
Definition: HGCalTBDetId.h:29
static const int kCellTypeCalibOuter
Definition: HGCalTBDetId.h:37
int cellType() const
cell type
Definition: HGCalTBDetId.h:75
int iv() const
Definition: HGCalTBDetId.h:56
static const int kHGCalTBVSignMask
Definition: HGCalTBDetId.h:21
static const int kHGCalTBSensorXOffset
Definition: HGCalTBDetId.h:22
static const int kHGCalZsideMask
Definition: HGCalTBDetId.h:33
static const int kHGCalTBXMask
Definition: HGCalTBDetId.h:17
int iu() const
get the absolute value of the cell #&#39;s
Definition: HGCalTBDetId.h:51
static const int kHGCalTBSensorXMask
Definition: HGCalTBDetId.h:23
bool isHGCal() const
consistency check : no bits left =&gt; no overhead
Definition: HGCalTBDetId.h:93
std::ostream & operator<<(std::ostream &, const HGCalTBDetId &id)
Definition: HGCalTBDetId.cc:37
static const int kHGCalTBVMask
Definition: HGCalTBDetId.h:20
static const int kHGCalTBXOffset
Definition: HGCalTBDetId.h:16
static const int kCellTypeStandard
Definition: HGCalTBDetId.h:35
static const int kHGCalTBCellTypeOffset
Definition: HGCalTBDetId.h:28
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCalTBDetId.h:87
int sensorIU() const
get the sensor #
Definition: HGCalTBDetId.h:63
static const int kHGCalLayerOffset
Definition: HGCalTBDetId.h:30
static const int kHGCalTBSensorXSignMask
Definition: HGCalTBDetId.h:24
static const int kHGCalTBVOffset
Definition: HGCalTBDetId.h:19
static const int kHGCalTBXSignMask
Definition: HGCalTBDetId.h:18