CMS 3D CMS Logo

HGCHEDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 
5 const HGCHEDetId HGCHEDetId::Undefined(ForwardEmpty, 0, 0, 0, 0, 0);
6 
8 
9 HGCHEDetId::HGCHEDetId(uint32_t rawid) : DetId(rawid) {}
10 
11 HGCHEDetId::HGCHEDetId(ForwardSubdetector subdet, int zp, int lay, int sec, int subsec, int cell)
12  : DetId(Forward, subdet) {
15  if (subsec < 0)
16  subsec = 0;
18  id_ |= ((lay & kHGCHELayerMask) << kHGCHELayerOffset);
19  if (zp > 0)
20  id_ |= ((zp & kHGCHEZsideMask) << kHGCHEZsideOffset);
21 }
22 
24  if (!gen.null()) {
26  if ((gen.det() != Forward) || (subdet != HGCHEF && subdet != HGCHEB)) {
27  throw cms::Exception("Invalid DetId") << "Cannot initialize HGCHEDetId from " << std::hex << gen.rawId()
28  << std::dec << " Det|SubDet " << gen.det() << "|" << subdet;
29  }
30  }
31  id_ = gen.rawId();
32 }
33 
35  if (!gen.null()) {
37  if ((gen.det() != Forward) || (subdet != HGCHEF && subdet != HGCHEB)) {
38  throw cms::Exception("Invalid DetId") << "Cannot assign HGCHEDetId from " << std::hex << gen.rawId() << std::dec
39  << " Det|SubDet " << gen.det() << "|" << subdet;
40  }
41  }
42  id_ = gen.rawId();
43  return (*this);
44 }
45 
47  int sub = ((subdet() == HGCHEF) ? 0 : ((id_ >> kHGCHESubSectorOffset) & kHGCHESubSectorMask));
48  return HGCHEDetId(subdet(), zside(), layer(), sector(), sub, 0);
49 }
50 
51 std::ostream& operator<<(std::ostream& s, const HGCHEDetId& id) {
52  if (id.subdet() == HGCHEF || id.subdet() == HGCHEB) {
53  return s << "isHE=" << id.isHE() << " zpos=" << id.zside() << " layer=" << id.layer()
54  << " phi subSector=" << id.subsector() << " sector=" << id.sector() << " cell=" << id.cell();
55  } else {
56  return s << std::hex << id.rawId() << std::dec;
57  }
58 }
HGCHEDetId::cell
int cell() const
get the absolute value of the cell #'s in x and y
Definition: HGCHEDetId.h:40
HGCHEDetId.h
ForwardEmpty
Definition: ForwardSubdetector.h:5
HGCHEDetId::layer
int layer() const
get the layer #
Definition: HGCHEDetId.h:49
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
HGCHEDetId::kHGCHESectorMask
static const int kHGCHESectorMask
Definition: HGCHEDetId.h:13
HGCHEDetId::kHGCHEZsideOffset
static const int kHGCHEZsideOffset
Definition: HGCHEDetId.h:18
HGCHEDetId::HGCHEDetId
HGCHEDetId()
Definition: HGCHEDetId.cc:7
HGCHEDetId::kHGCHEZsideMask
static const int kHGCHEZsideMask
Definition: HGCHEDetId.h:19
DetId
Definition: DetId.h:17
HGCHEDetId::sector
int sector() const
get the sector #
Definition: HGCHEDetId.h:43
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HGCHEDetId::geometryCell
HGCHEDetId geometryCell() const
Definition: HGCHEDetId.cc:46
HGCHEDetId::kHGCHECellMask
static const int kHGCHECellMask
Definition: HGCHEDetId.h:11
HGCHEDetId::kHGCHESubSectorOffset
static const int kHGCHESubSectorOffset
Definition: HGCHEDetId.h:14
HGCHEDetId::operator=
HGCHEDetId & operator=(const DetId &id)
Definition: HGCHEDetId.cc:34
operator<<
std::ostream & operator<<(std::ostream &s, const HGCHEDetId &id)
Definition: HGCHEDetId.cc:51
HGCHEDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCHEDetId.h:52
gen
Definition: PythiaDecays.h:13
HGCHEDetId::subdet
ForwardSubdetector subdet() const
get the subdetector
Definition: HGCHEDetId.h:37
HGCHEDetId::Undefined
static const HGCHEDetId Undefined
Definition: HGCHEDetId.h:58
DetId::id_
uint32_t id_
Definition: DetId.h:69
HGCHEDetId::kHGCHELayerOffset
static const int kHGCHELayerOffset
Definition: HGCHEDetId.h:16
HGCHEDetId::kHGCHECellOffset
static const int kHGCHECellOffset
Definition: HGCHEDetId.h:10
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:94
HGCHEDetId
Definition: HGCHEDetId.h:8
HGCHEDetId::kHGCHESubSectorMask
static const int kHGCHESubSectorMask
Definition: HGCHEDetId.h:15
Exception
Definition: hltDiff.cc:245
Exception.h
HGCHEF
Definition: ForwardSubdetector.h:9
HGCHEDetId::kHGCHESectorOffset
static const int kHGCHESectorOffset
Definition: HGCHEDetId.h:12
DetId::Forward
Definition: DetId.h:30
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HGCHEB
Definition: ForwardSubdetector.h:10
HGCHEDetId::kHGCHELayerMask
static const int kHGCHELayerMask
Definition: HGCHEDetId.h:17