CMS 3D CMS Logo

HGCScintillatorDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_ForwardDetId_HGCScintillatorDetId_H
2 #define DataFormats_ForwardDetId_HGCScintillatorDetId_H 1
3 
4 #include <iosfwd>
5 #include <vector>
8 
9 /* \brief description of the bit assigment
10  [0:8] iphi index wrt x-axis on +z side
11  [9:16] |radius| index (starting from a minimum radius depending on type)
12  [17:21] Layer #
13  [22] Trigger(1)/Detector(0) cell
14  [23:24] Reserved for future extension
15  [25:25] z-side (0 for +z; 1 for -z)
16  [26:27] Type (0 fine divisions of scintillators;
17  1 coarse divisions of scintillators)
18  [28:31] Detector type (HGCalHSc)
19 */
20 
21 class HGCScintillatorDetId : public DetId {
22 
23 public:
24 
28  HGCScintillatorDetId(uint32_t rawid);
30  HGCScintillatorDetId(int type, int layer, int iradius, int iphi,
31  bool trigger=false);
33  HGCScintillatorDetId(const DetId& id);
36 
39 
41  DetId::Detector subdet() const { return det(); }
42 
44  int type() const { return (id_>>kHGCalTypeOffset)&kHGCalTypeMask; }
45 
47  int zside() const { return (((id_>>kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
48 
50  int layer() const { return (id_>>kHGCalLayerOffset)&kHGCalLayerMask; }
51 
53  int iradiusAbs() const;
54  int iradius() const { return zside()*iradiusAbs(); }
55  int ietaAbs() const { return iradiusAbs(); }
56  int ieta() const { return zside()*ietaAbs(); }
57 
59  int iphi() const;
60  std::pair<int,int> ietaphi() const { return std::pair<int,int>(ieta(),iphi()); }
61  std::pair<int,int> iradiusphi() const { return std::pair<int,int>(iradius(),iphi()); }
62 
64  std::vector<HGCScintillatorDetId> detectorCells() const;
65  bool trigger() const {
66  return (((id_>>kHGCalTriggerOffset)&kHGCalTriggerMask) == 1);
67  }
69 
71  bool isEE() const { return false; }
72  bool isHE() const { return true; }
73  bool isForward() const { return true; }
74 
76 
77 public:
78 
79  static const int kHGCalPhiOffset = 0;
80  static const int kHGCalPhiMask = 0x1FF;
81  static const int kHGCalRadiusOffset = 9;
82  static const int kHGCalRadiusMask = 0xFF;
83  static const int kHGCalLayerOffset = 17;
84  static const int kHGCalLayerMask = 0x1F;
85  static const int kHGCalTriggerOffset = 22;
86  static const int kHGCalTriggerMask = 0x1;
87  static const int kHGCalZsideOffset = 25;
88  static const int kHGCalZsideMask = 0x1;
89  static const int kHGCalTypeOffset = 26;
90  static const int kHGCalTypeMask = 0x3;
91 
92  int iradiusTriggerAbs() const;
93  int iradiusTrigger() const { return zside()*iradiusTriggerAbs(); }
94  int iphiTrigger() const;
95 };
96 
97 std::ostream& operator<<(std::ostream&,const HGCScintillatorDetId& id);
98 
99 #endif
type
Definition: HCALResponse.h:21
static const int kHGCalTriggerOffset
int iradiusAbs() const
get the eta index
static const int kHGCalTypeOffset
int type() const
get the type
DetId::Detector subdet() const
get the subdetector
HGCScintillatorDetId & operator=(const DetId &id)
std::pair< int, int > ietaphi() const
static const int kHGCalLayerMask
static const int kHGCalRadiusOffset
int iphi() const
get the phi index
static const int kHGCalTriggerMask
HGCScintillatorDetId geometryCell() const
std::vector< HGCScintillatorDetId > detectorCells() const
trigger or detector cell
static const HGCScintillatorDetId Undefined
Definition: DetId.h:18
static const int kHGCalRadiusMask
std::ostream & operator<<(std::ostream &, const HGCScintillatorDetId &id)
Detector
Definition: DetId.h:26
uint32_t id_
Definition: DetId.h:62
bool isEE() const
consistency check : no bits left => no overhead
static const int kHGCalPhiMask
int layer() const
get the layer #
int zside() const
get the z-side of the cell (1/-1)
static const int kHGCalZsideMask
static const int kHGCalZsideOffset
static const int kHGCalLayerOffset
static const int kHGCalTypeMask
static const int kHGCalPhiOffset
std::pair< int, int > iradiusphi() const
HGCScintillatorDetId triggerCell() const
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39