CMS 3D CMS Logo

HGCScintillatorDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 #include <iostream>
5 
7 
9 
11 
12 HGCScintillatorDetId::HGCScintillatorDetId(int type, int layer, int radius, int phi, bool trigger, int sipm)
13  : DetId(HGCalHSc, ForwardEmpty) {
14  int zside = (radius < 0) ? 1 : 0;
15  int itrig = trigger ? 1 : 0;
16  int radiusAbs = std::abs(radius);
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 ((iradiusAbs() + 1) / 2);
54  else
55  return iradiusAbs();
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 = iradiusAbs();
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()
116  << " radius= " << id.iradius() << ":" << id.iradiusTrigger() << " phi= " << id.iphi() << ":"
117  << id.iphiTrigger();
118 }
HGCScintillatorDetId::setType
void setType(int type)
Definition: HGCScintillatorDetId.cc:72
HGCScintillatorDetId::iradiusAbs
int iradiusAbs() const
get the eta index
Definition: HGCScintillatorDetId.cc:44
HGCScintillatorDetId::iphi
int iphi() const
get the phi index
Definition: HGCScintillatorDetId.cc:58
HGCScintillatorDetId.h
ForwardEmpty
Definition: ForwardSubdetector.h:5
HGCScintillatorDetId::kHGCalTypeOffset
static const int kHGCalTypeOffset
Definition: HGCScintillatorDetId.h:93
HGCScintillatorDetId::kHGCalTriggerOffset
static const int kHGCalTriggerOffset
Definition: HGCScintillatorDetId.h:86
operator<<
std::ostream & operator<<(std::ostream &s, const HGCScintillatorDetId &id)
Definition: HGCScintillatorDetId.cc:113
HGCScintillatorDetId::kHGCalTriggerMask
static const int kHGCalTriggerMask
Definition: HGCScintillatorDetId.h:87
HGCScintillatorDetId::iphiTrigger
int iphiTrigger() const
Definition: HGCScintillatorDetId.cc:65
HGCScintillatorDetId::kHGCalTypeMask
static const int kHGCalTypeMask
Definition: HGCScintillatorDetId.h:94
HGCScintillatorDetId::iradiusTrigger
int iradiusTrigger() const
Definition: HGCScintillatorDetId.h:98
HGCScintillatorDetId::geometryCell
HGCScintillatorDetId geometryCell() const
Definition: HGCScintillatorDetId.cc:98
HGCScintillatorDetId::detectorCells
std::vector< HGCScintillatorDetId > detectorCells() const
trigger or detector cell
Definition: HGCScintillatorDetId.cc:82
HGCScintillatorDetId::layer
int layer() const
get the layer #
Definition: HGCScintillatorDetId.h:50
HGCScintillatorDetId::iradiusTriggerAbs
int iradiusTriggerAbs() const
Definition: HGCScintillatorDetId.cc:51
DetId
Definition: DetId.h:17
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HGCScintillatorDetId::trigger
bool trigger() const
Definition: HGCScintillatorDetId.h:69
HGCScintillatorDetId::kHGCalSiPMMask0
static const int kHGCalSiPMMask0
Definition: HGCScintillatorDetId.h:90
HGCScintillatorDetId::kHGCalLayerMask
static const int kHGCalLayerMask
Definition: HGCScintillatorDetId.h:85
gen
Definition: PythiaDecays.h:13
HGCScintillatorDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCScintillatorDetId.h:47
HGCScintillatorDetId::triggerCell
HGCScintillatorDetId triggerCell() const
Definition: HGCScintillatorDetId.cc:106
DetId::id_
uint32_t id_
Definition: DetId.h:69
PVValHelper::phi
Definition: PVValidationHelpers.h:68
HGCScintillatorDetId::Undefined
static const HGCScintillatorDetId Undefined
Definition: HGCScintillatorDetId.h:77
HGCScintillatorDetId::kHGCalRadiusOffset
static const int kHGCalRadiusOffset
Definition: HGCScintillatorDetId.h:82
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
HGCScintillatorDetId::iradius
int iradius() const
Definition: HGCScintillatorDetId.h:54
HGCScintillatorDetId::kHGCalPhiOffset
static const int kHGCalPhiOffset
Definition: HGCScintillatorDetId.h:80
HGCScintillatorDetId::operator=
HGCScintillatorDetId & operator=(const DetId &id)
Definition: HGCScintillatorDetId.cc:33
HGCScintillatorDetId::kHGCalRadiusMask
static const int kHGCalRadiusMask
Definition: HGCScintillatorDetId.h:83
HGCScintillatorDetId::type
int type() const
get/set the type
Definition: HGCScintillatorDetId.h:43
HGCScintillatorDetId::kHGCalPhiMask
static const int kHGCalPhiMask
Definition: HGCScintillatorDetId.h:81
HGCScintillatorDetId::kHGCalSiPMOffset
static const int kHGCalSiPMOffset
Definition: HGCScintillatorDetId.h:88
HGCScintillatorDetId::HGCScintillatorDetId
HGCScintillatorDetId()
Definition: HGCScintillatorDetId.cc:8
DDAxes::phi
HGCScintillatorDetId::kHGCalZsideMask
static const int kHGCalZsideMask
Definition: HGCScintillatorDetId.h:92
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:23
DetId::HGCalHSc
Definition: DetId.h:34
HGCScintillatorDetId::kHGCalZsideOffset
static const int kHGCalZsideOffset
Definition: HGCScintillatorDetId.h:91
Exception
Definition: hltDiff.cc:246
postprocess-scan-build.cells
cells
Definition: postprocess-scan-build.py:13
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
HGCScintillatorDetId::setSiPM
void setSiPM(int sipm)
Definition: HGCScintillatorDetId.cc:77
Exception.h
trigger
Definition: HLTPrescaleTableCond.h:8
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGCScintillatorDetId::kHGCalLayerOffset
static const int kHGCalLayerOffset
Definition: HGCScintillatorDetId.h:84
HGCScintillatorDetId::kHGCalTypeMask0
static const int kHGCalTypeMask0
Definition: HGCScintillatorDetId.h:95
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HGCScintillatorDetId::sipm
int sipm() const
get/set the sipm size
Definition: HGCScintillatorDetId.h:64
HGCScintillatorDetId::kHGCalSiPMMask
static const int kHGCalSiPMMask
Definition: HGCScintillatorDetId.h:89