CMS 3D CMS Logo

HGCEEDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 #include <iostream>
5 
6 const HGCEEDetId HGCEEDetId::Undefined(ForwardEmpty, 0, 0, 0, 0, 0);
7 
9 
10 HGCEEDetId::HGCEEDetId(uint32_t rawid) : DetId(rawid) {}
11 
12 HGCEEDetId::HGCEEDetId(ForwardSubdetector subdet, int zp, int lay, int sec, int subsec, int cell)
13  : DetId(Forward, subdet) {
16  if (subsec < 0)
17  subsec = 0;
19  id_ |= ((lay & kHGCEELayerMask) << kHGCEELayerOffset);
20  if (zp > 0)
21  id_ |= ((zp & kHGCEEZsideMask) << kHGCEEZsideOffset);
22 }
23 
25  if (!gen.null()) {
27  if (gen.det() != Forward || (subdet != HGCEE)) {
28  throw cms::Exception("Invalid DetId")
29  << "Cannot initialize HGCEEDetId from " << std::hex << gen.rawId() << std::dec;
30  }
31  }
32  id_ = gen.rawId();
33 }
34 
36  if (!gen.null()) {
38  if (gen.det() != Forward || (subdet != HGCEE)) {
39  throw cms::Exception("Invalid DetId") << "Cannot assign HGCEEDetId from " << std::hex << gen.rawId() << std::dec;
40  }
41  }
42  id_ = gen.rawId();
43  return (*this);
44 }
45 
46 std::ostream& operator<<(std::ostream& s, const HGCEEDetId& id) {
47  switch (id.subdet()) {
48  case (HGCEE):
49  return s << "isEE=" << id.isEE() << " zpos=" << id.zside() << " layer=" << id.layer()
50  << " phi subSector=" << id.subsector() << " sector=" << id.sector() << " cell=" << id.cell();
51  default:
52  return s << id.rawId();
53  }
54 }
HGCEEDetId.h
ForwardEmpty
Definition: ForwardSubdetector.h:5
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
HGCEEDetId::kHGCEESubSectorMask
static const int kHGCEESubSectorMask
Definition: HGCEEDetId.h:15
HGCEEDetId::kHGCEEZsideOffset
static const int kHGCEEZsideOffset
Definition: HGCEEDetId.h:18
HGCEEDetId::kHGCEESubSectorOffset
static const int kHGCEESubSectorOffset
Definition: HGCEEDetId.h:14
HGCEEDetId::kHGCEECellOffset
static const int kHGCEECellOffset
Definition: HGCEEDetId.h:10
HGCEEDetId::operator=
HGCEEDetId & operator=(const DetId &id)
Definition: HGCEEDetId.cc:35
DetId
Definition: DetId.h:17
alignCSCRings.s
s
Definition: alignCSCRings.py:92
operator<<
std::ostream & operator<<(std::ostream &s, const HGCEEDetId &id)
Definition: HGCEEDetId.cc:46
HGCEEDetId::kHGCEELayerMask
static const int kHGCEELayerMask
Definition: HGCEEDetId.h:17
gen
Definition: PythiaDecays.h:13
HGCEEDetId::kHGCEESectorOffset
static const int kHGCEESectorOffset
Definition: HGCEEDetId.h:12
HGCEE
Definition: ForwardSubdetector.h:8
HGCEEDetId::subdet
ForwardSubdetector subdet() const
get the subdetector
Definition: HGCEEDetId.h:36
DetId::id_
uint32_t id_
Definition: DetId.h:69
HGCEEDetId::cell
int cell() const
get the absolute value of the cell #'s in x and y
Definition: HGCEEDetId.h:39
HGCEEDetId::kHGCEELayerOffset
static const int kHGCEELayerOffset
Definition: HGCEEDetId.h:16
HGCEEDetId::kHGCEEZsideMask
static const int kHGCEEZsideMask
Definition: HGCEEDetId.h:19
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:87
HGCEEDetId::kHGCEECellMask
static const int kHGCEECellMask
Definition: HGCEEDetId.h:11
Exception
Definition: hltDiff.cc:245
Exception.h
HGCEEDetId
Definition: HGCEEDetId.h:8
HGCEEDetId::HGCEEDetId
HGCEEDetId()
Definition: HGCEEDetId.cc:8
DetId::Forward
Definition: DetId.h:30
HGCEEDetId::Undefined
static const HGCEEDetId Undefined
Definition: HGCEEDetId.h:57
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HGCEEDetId::kHGCEESectorMask
static const int kHGCEESectorMask
Definition: HGCEEDetId.h:13