CMS 3D CMS Logo

HGCScintillatorDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 #include <iostream>
5 
7 
9 
11 
13  : DetId(HGCalHSc, ForwardEmpty) {
14  int zside = (ring < 0) ? 1 : 0;
15  int itrig = trigger ? 1 : 0;
16  int ringAbs = std::abs(ring);
21 }
22 
24  if (!gen.null()) {
25  if (gen.det() != HGCalHSc) {
26  throw cms::Exception("Invalid DetId")
27  << "Cannot initialize HGCScintillatorDetId from " << std::hex << gen.rawId() << std::dec;
28  }
29  }
30  id_ = gen.rawId();
31 }
32 
34  if (!gen.null()) {
35  if (gen.det() != HGCalHSc) {
36  throw cms::Exception("Invalid DetId")
37  << "Cannot assign HGCScintillatorDetId from " << std::hex << gen.rawId() << std::dec;
38  }
39  }
40  id_ = gen.rawId();
41  return (*this);
42 }
43 
45  if (trigger())
46  return (2 * ((id_ >> kHGCalRadiusOffset) & kHGCalRadiusMask));
47  else
48  return ((id_ >> kHGCalRadiusOffset) & kHGCalRadiusMask);
49 }
50 
52  if (trigger())
53  return ((ring() + 1) / 2);
54  else
55  return ring();
56 }
57 
59  if (trigger())
60  return (2 * ((id_ >> kHGCalPhiOffset) & kHGCalPhiMask));
61  else
62  return ((id_ >> kHGCalPhiOffset) & kHGCalPhiMask);
63 }
64 
66  if (trigger())
67  return ((iphi() + 1) / 2);
68  else
69  return iphi();
70 }
71 
75 }
76 
80 }
81 
82 std::vector<HGCScintillatorDetId> HGCScintillatorDetId::detectorCells() const {
83  std::vector<HGCScintillatorDetId> cells;
84  int irad = ring();
85  int ifi = iphi();
86  int iz = zside();
87  if (trigger()) {
88  cells.emplace_back(HGCScintillatorDetId(type(), layer(), (2 * irad - 1) * iz, 2 * ifi - 1, false));
89  cells.emplace_back(HGCScintillatorDetId(type(), layer(), 2 * irad * iz, 2 * ifi - 1, false));
90  cells.emplace_back(HGCScintillatorDetId(type(), layer(), (2 * irad - 1) * iz, 2 * ifi, false));
91  cells.emplace_back(HGCScintillatorDetId(type(), layer(), 2 * irad * iz, 2 * ifi, false));
92  } else {
93  cells.emplace_back(HGCScintillatorDetId(type(), layer(), irad * iz, ifi, false));
94  }
95  return cells;
96 }
97 
99  if (trigger()) {
100  return HGCScintillatorDetId(type(), layer(), iradiusTrigger(), iphiTrigger(), false);
101  } else {
102  return HGCScintillatorDetId(type(), layer(), iradius(), iphi(), false);
103  }
104 }
105 
107  if (trigger())
108  return HGCScintillatorDetId(type(), layer(), iradius(), iphi(), true);
109  else
110  return HGCScintillatorDetId(type(), layer(), iradiusTrigger(), iphiTrigger(), true);
111 }
112 
113 std::ostream& operator<<(std::ostream& s, const HGCScintillatorDetId& id) {
114  return s << " HGCScintillatorDetId::EE:HE= " << id.isEE() << ":" << id.isHE() << " trigger= " << id.trigger()
115  << " type= " << id.type() << " SiPM= " << id.sipm() << " layer= " << id.layer() << " ring= " << id.iradius()
116  << ":" << id.iradiusTrigger() << " phi= " << id.iphi() << ":" << id.iphiTrigger();
117 }
static const int kHGCalTriggerOffset
HGCScintillatorDetId triggerCell() const
static const int kHGCalTypeOffset
int type() const
get/set the type
static const int kHGCalSiPMOffset
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
HGCScintillatorDetId & operator=(const DetId &id)
int iphi() const
get the phi index
static const int kHGCalSiPMMask0
int layer() const
get the layer #
std::ostream & operator<<(std::ostream &s, const HGCScintillatorDetId &id)
static const int kHGCalLayerMask
static const int kHGCalRadiusOffset
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int kHGCalTriggerMask
int zside() const
get the z-side of the cell (1/-1)
static const HGCScintillatorDetId Undefined
int ring() const
get the eta index
Definition: DetId.h:17
static const int kHGCalRadiusMask
std::vector< HGCScintillatorDetId > detectorCells() const
trigger or detector cell
uint32_t id_
Definition: DetId.h:69
static const int kHGCalTypeMask0
HGCScintillatorDetId geometryCell() const
static const int kHGCalPhiMask
static const int kHGCalSiPMMask
static const int kHGCalZsideMask
static const int kHGCalZsideOffset
static const int kHGCalLayerOffset
static const int kHGCalTypeMask
int sipm() const
get/set the sipm size
static const int kHGCalPhiOffset