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 = (radius < 0) ? 1 : 0;
15  int itrig = trigger ? 1 : 0;
16  int radiusAbs = std::abs(radius);
20 }
21 
23  if (!gen.null()) {
24  if (gen.det() != HGCalHSc) {
25  throw cms::Exception("Invalid DetId")
26  << "Cannot initialize HGCScintillatorDetId from " << std::hex << gen.rawId() << std::dec;
27  }
28  }
29  id_ = gen.rawId();
30 }
31 
33  if (!gen.null()) {
34  if (gen.det() != HGCalHSc) {
35  throw cms::Exception("Invalid DetId")
36  << "Cannot assign HGCScintillatorDetId from " << std::hex << gen.rawId() << std::dec;
37  }
38  }
39  id_ = gen.rawId();
40  return (*this);
41 }
42 
44  if (trigger())
45  return (2 * ((id_ >> kHGCalRadiusOffset) & kHGCalRadiusMask));
46  else
47  return ((id_ >> kHGCalRadiusOffset) & kHGCalRadiusMask);
48 }
49 
51  if (trigger())
52  return ((iradiusAbs() + 1) / 2);
53  else
54  return iradiusAbs();
55 }
56 
58  if (trigger())
59  return (2 * ((id_ >> kHGCalPhiOffset) & kHGCalPhiMask));
60  else
61  return ((id_ >> kHGCalPhiOffset) & kHGCalPhiMask);
62 }
63 
65  if (trigger())
66  return ((iphi() + 1) / 2);
67  else
68  return iphi();
69 }
70 
71 std::vector<HGCScintillatorDetId> HGCScintillatorDetId::detectorCells() const {
72  std::vector<HGCScintillatorDetId> cells;
73  int irad = iradiusAbs();
74  int ifi = iphi();
75  int iz = zside();
76  if (trigger()) {
77  cells.emplace_back(HGCScintillatorDetId(type(), layer(), (2 * irad - 1) * iz, 2 * ifi - 1, false));
78  cells.emplace_back(HGCScintillatorDetId(type(), layer(), 2 * irad * iz, 2 * ifi - 1, false));
79  cells.emplace_back(HGCScintillatorDetId(type(), layer(), (2 * irad - 1) * iz, 2 * ifi, false));
80  cells.emplace_back(HGCScintillatorDetId(type(), layer(), 2 * irad * iz, 2 * ifi, false));
81  } else {
82  cells.emplace_back(HGCScintillatorDetId(type(), layer(), irad * iz, ifi, false));
83  }
84  return cells;
85 }
86 
88  if (trigger()) {
89  return HGCScintillatorDetId(type(), layer(), iradiusTrigger(), iphiTrigger(), false);
90  } else {
91  return HGCScintillatorDetId(type(), layer(), iradius(), iphi(), false);
92  }
93 }
94 
96  if (trigger())
97  return HGCScintillatorDetId(type(), layer(), iradius(), iphi(), true);
98  else
99  return HGCScintillatorDetId(type(), layer(), iradiusTrigger(), iphiTrigger(), true);
100 }
101 
102 std::ostream& operator<<(std::ostream& s, const HGCScintillatorDetId& id) {
103  return s << " HGCScintillatorDetId::EE:HE= " << id.isEE() << ":" << id.isHE() << " trigger= " << id.trigger()
104  << " type= " << id.type() << " layer= " << id.layer() << " radius= " << id.iradius() << ":"
105  << id.iradiusTrigger() << " phi= " << id.iphi() << ":" << id.iphiTrigger();
106 }
HGCScintillatorDetId::iradiusAbs
int iradiusAbs() const
get the eta index
Definition: HGCScintillatorDetId.cc:43
HGCScintillatorDetId::iphi
int iphi() const
get the phi index
Definition: HGCScintillatorDetId.cc:57
HGCScintillatorDetId.h
ForwardEmpty
Definition: ForwardSubdetector.h:5
HGCScintillatorDetId::kHGCalTypeOffset
static const int kHGCalTypeOffset
Definition: HGCScintillatorDetId.h:83
HGCScintillatorDetId::kHGCalTriggerOffset
static const int kHGCalTriggerOffset
Definition: HGCScintillatorDetId.h:79
operator<<
std::ostream & operator<<(std::ostream &s, const HGCScintillatorDetId &id)
Definition: HGCScintillatorDetId.cc:102
HGCScintillatorDetId::kHGCalTriggerMask
static const int kHGCalTriggerMask
Definition: HGCScintillatorDetId.h:80
HGCScintillatorDetId::iphiTrigger
int iphiTrigger() const
Definition: HGCScintillatorDetId.cc:64
HGCScintillatorDetId::kHGCalTypeMask
static const int kHGCalTypeMask
Definition: HGCScintillatorDetId.h:84
HGCScintillatorDetId::iradiusTrigger
int iradiusTrigger() const
Definition: HGCScintillatorDetId.h:87
HGCScintillatorDetId::geometryCell
HGCScintillatorDetId geometryCell() const
Definition: HGCScintillatorDetId.cc:87
HGCScintillatorDetId::detectorCells
std::vector< HGCScintillatorDetId > detectorCells() const
trigger or detector cell
Definition: HGCScintillatorDetId.cc:71
HGCScintillatorDetId::layer
int layer() const
get the layer #
Definition: HGCScintillatorDetId.h:47
HGCScintillatorDetId::iradiusTriggerAbs
int iradiusTriggerAbs() const
Definition: HGCScintillatorDetId.cc:50
DetId
Definition: DetId.h:17
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HGCScintillatorDetId::trigger
bool trigger() const
Definition: HGCScintillatorDetId.h:62
HGCScintillatorDetId::kHGCalLayerMask
static const int kHGCalLayerMask
Definition: HGCScintillatorDetId.h:78
gen
Definition: PythiaDecays.h:13
HGCScintillatorDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCScintillatorDetId.h:44
HGCScintillatorDetId::triggerCell
HGCScintillatorDetId triggerCell() const
Definition: HGCScintillatorDetId.cc:95
DetId::id_
uint32_t id_
Definition: DetId.h:69
PVValHelper::phi
Definition: PVValidationHelpers.h:68
HGCScintillatorDetId::Undefined
static const HGCScintillatorDetId Undefined
Definition: HGCScintillatorDetId.h:70
HGCScintillatorDetId::kHGCalRadiusOffset
static const int kHGCalRadiusOffset
Definition: HGCScintillatorDetId.h:75
HGCScintillatorDetId::iradius
int iradius() const
Definition: HGCScintillatorDetId.h:51
HGCScintillatorDetId::kHGCalPhiOffset
static const int kHGCalPhiOffset
Definition: HGCScintillatorDetId.h:73
HGCScintillatorDetId::operator=
HGCScintillatorDetId & operator=(const DetId &id)
Definition: HGCScintillatorDetId.cc:32
HGCScintillatorDetId::kHGCalRadiusMask
static const int kHGCalRadiusMask
Definition: HGCScintillatorDetId.h:76
HGCScintillatorDetId::type
int type() const
get the type
Definition: HGCScintillatorDetId.h:41
HGCScintillatorDetId::kHGCalPhiMask
static const int kHGCalPhiMask
Definition: HGCScintillatorDetId.h:74
HGCScintillatorDetId::HGCScintillatorDetId
HGCScintillatorDetId()
Definition: HGCScintillatorDetId.cc:8
DDAxes::phi
type
type
Definition: HCALResponse.h:21
HGCScintillatorDetId::kHGCalZsideMask
static const int kHGCalZsideMask
Definition: HGCScintillatorDetId.h:82
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:21
DetId::HGCalHSc
Definition: DetId.h:34
HGCScintillatorDetId::kHGCalZsideOffset
static const int kHGCalZsideOffset
Definition: HGCScintillatorDetId.h:81
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
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:77
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143