CMS 3D CMS Logo

HGCEEDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 #include <iostream>
5 
7 
9 }
10 
11 HGCEEDetId::HGCEEDetId(uint32_t rawid) : DetId(rawid) {
12 }
13 
14 HGCEEDetId::HGCEEDetId(ForwardSubdetector subdet, int zp, int lay, int sec, int subsec, int cell) : DetId(Forward,subdet) {
15 
16  id_ |= ((cell & kHGCEECellMask) << kHGCEECellOffset);
17  id_ |= ((sec & kHGCEESectorMask) << kHGCEESectorOffset);
18  if (subsec<0) subsec=0;
20  id_ |= ((lay & kHGCEELayerMask) << kHGCEELayerOffset);
21  if (zp>0) id_ |= ((zp & kHGCEEZsideMask) << kHGCEEZsideOffset);
22 }
23 
25  if (!gen.null()) {
27  if (gen.det()!=Forward || (subdet!=HGCEE)) {
28  throw cms::Exception("Invalid DetId") << "Cannot initialize HGCEEDetId from " << std::hex << gen.rawId() << std::dec;
29  }
30  }
31  id_ = gen.rawId();
32 }
33 
35  if (!gen.null()) {
37  if (gen.det()!=Forward || (subdet!=HGCEE)) {
38  throw cms::Exception("Invalid DetId") << "Cannot assign HGCEEDetId from " << std::hex << gen.rawId() << std::dec;
39  }
40  }
41  id_ = gen.rawId();
42  return (*this);
43 }
44 
45 std::ostream& operator<<(std::ostream& s,const HGCEEDetId& id) {
46  switch (id.subdet()) {
47  case(HGCEE) : return s << "isEE=" << id.isEE()
48  << " zpos=" << id.zside()
49  << " layer=" << id.layer()
50  << " phi subSector=" << id.subsector()
51  << " sector=" << id.sector()
52  << " cell=" << id.cell();
53  default : return s << id.rawId();
54  }
55 }
56 
57 
std::ostream & operator<<(std::ostream &s, const HGCEEDetId &id)
Definition: HGCEEDetId.cc:45
static const int kHGCEELayerMask
Definition: HGCEEDetId.h:18
static const int kHGCEECellMask
Definition: HGCEEDetId.h:12
ForwardSubdetector subdet() const
get the subdetector
Definition: HGCEEDetId.h:37
constexpr bool null() const
is this a null id ?
Definition: DetId.h:52
int cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCEEDetId.h:40
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
static const int kHGCEELayerOffset
Definition: HGCEEDetId.h:17
static const int kHGCEEZsideMask
Definition: HGCEEDetId.h:20
ForwardSubdetector
static const int kHGCEESectorMask
Definition: HGCEEDetId.h:14
static const HGCEEDetId Undefined
Definition: HGCEEDetId.h:58
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
static const int kHGCEEZsideOffset
Definition: HGCEEDetId.h:19
Definition: DetId.h:18
uint32_t id_
Definition: DetId.h:62
static const int kHGCEESubSectorOffset
Definition: HGCEEDetId.h:15
static const int kHGCEESubSectorMask
Definition: HGCEEDetId.h:16
static const int kHGCEESectorOffset
Definition: HGCEEDetId.h:13
static const int kHGCEECellOffset
Definition: HGCEEDetId.h:11
HGCEEDetId & operator=(const DetId &id)
Definition: HGCEEDetId.cc:34
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39