test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
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
static const int kHGCEELayerOffset
Definition: HGCEEDetId.h:17
static const int kHGCEEZsideMask
Definition: HGCEEDetId.h:20
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
ForwardSubdetector
static const int kHGCEESectorMask
Definition: HGCEEDetId.h:14
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
static const HGCEEDetId Undefined
Definition: HGCEEDetId.h:58
static const int kHGCEEZsideOffset
Definition: HGCEEDetId.h:19
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
uint32_t id_
Definition: DetId.h:55
static const int kHGCEESubSectorOffset
Definition: HGCEEDetId.h:15
bool null() const
is this a null id ?
Definition: DetId.h:45
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
Detector det() const
get the detector field from this detid
Definition: DetId.h:35