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 }
std::ostream & operator<<(std::ostream &s, const HGCEEDetId &id)
Definition: HGCEEDetId.cc:46
static const int kHGCEELayerMask
Definition: HGCEEDetId.h:17
static const int kHGCEECellMask
Definition: HGCEEDetId.h:11
ForwardSubdetector subdet() const
get the subdetector
Definition: HGCEEDetId.h:36
int cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCEEDetId.h:39
static const int kHGCEELayerOffset
Definition: HGCEEDetId.h:16
static const int kHGCEEZsideMask
Definition: HGCEEDetId.h:19
ForwardSubdetector
static const int kHGCEESectorMask
Definition: HGCEEDetId.h:13
static const HGCEEDetId Undefined
Definition: HGCEEDetId.h:57
static const int kHGCEEZsideOffset
Definition: HGCEEDetId.h:18
Definition: DetId.h:17
uint32_t id_
Definition: DetId.h:69
static const int kHGCEESubSectorOffset
Definition: HGCEEDetId.h:14
static const int kHGCEESubSectorMask
Definition: HGCEEDetId.h:15
static const int kHGCEESectorOffset
Definition: HGCEEDetId.h:12
static const int kHGCEECellOffset
Definition: HGCEEDetId.h:10
HGCEEDetId & operator=(const DetId &id)
Definition: HGCEEDetId.cc:35