CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HGCHEDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 
6 
8 }
9 
10 HGCHEDetId::HGCHEDetId(uint32_t rawid) : DetId(rawid) {
11 }
12 
13 HGCHEDetId::HGCHEDetId(ForwardSubdetector subdet, int zp, int lay, int sec, int subsec, int cell) : DetId(Forward,subdet) {
14 
15  id_ |= ((cell & kHGCHECellMask) << kHGCHECellOffset);
16  id_ |= ((sec & kHGCHESectorMask) << kHGCHESectorOffset);
17  if (subsec<0) subsec=0;
19  id_ |= ((lay & kHGCHELayerMask) << kHGCHELayerOffset);
20  if(zp>0) id_ |= ((zp & kHGCHEZsideMask) << kHGCHEZsideOffset);
21 }
22 
24  if (!gen.null()) {
26  if ((gen.det()!=Forward) ||
27  (subdet!=HGCHEF && subdet!=HGCHEB && subdet!=HGCHET)) {
28  throw cms::Exception("Invalid DetId") << "Cannot initialize HGCHEDetId from " << std::hex << gen.rawId() << std::dec << " Det|SubDet " << gen.det() << "|" << subdet;
29  }
30  }
31  id_ = gen.rawId();
32 }
33 
35  if (!gen.null()) {
37  if ((gen.det()!=Forward) ||
38  (subdet!=HGCHEF && subdet!=HGCHEB && subdet!=HGCHET)) {
39  throw cms::Exception("Invalid DetId") << "Cannot assign HGCHEDetId from " << std::hex << gen.rawId() << std::dec << " 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  id.subdet() == HGCHET) {
54  return s << "isHE=" << id.isHE() << " zpos=" << id.zside()
55  << " layer=" << id.layer() << " phi subSector=" << id.subsector()
56  << " sector=" << id.sector() << " cell=" << id.cell();
57  } else {
58  return s << std::hex << id.rawId() << std::dec;
59  }
60 }
61 
62 
static const int kHGCHESubSectorOffset
Definition: HGCHEDetId.h:15
static const int kHGCHELayerOffset
Definition: HGCHEDetId.h:17
static const int kHGCHESubSectorMask
Definition: HGCHEDetId.h:16
static const int kHGCHESectorOffset
Definition: HGCHEDetId.h:13
int layer() const
get the layer #
Definition: HGCHEDetId.h:50
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
static const int kHGCHECellOffset
Definition: HGCHEDetId.h:11
ForwardSubdetector
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
HGCHEDetId geometryCell() const
Definition: HGCHEDetId.cc:46
static const int kHGCHELayerMask
Definition: HGCHEDetId.h:18
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
static const int kHGCHEZsideOffset
Definition: HGCHEDetId.h:19
static const int kHGCHEZsideMask
Definition: HGCHEDetId.h:20
Definition: DetId.h:18
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCHEDetId.h:53
uint32_t id_
Definition: DetId.h:55
bool null() const
is this a null id ?
Definition: DetId.h:45
static const int kHGCHECellMask
Definition: HGCHEDetId.h:12
static const int kHGCHESectorMask
Definition: HGCHEDetId.h:14
int sector() const
get the sector #
Definition: HGCHEDetId.h:44
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
ForwardSubdetector subdet() const
get the subdetector
Definition: HGCHEDetId.h:38
static const HGCHEDetId Undefined
Definition: HGCHEDetId.h:59
HGCHEDetId & operator=(const DetId &id)
Definition: HGCHEDetId.cc:34