CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HFNoseDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 #include <iostream>
5 
6 const HFNoseDetId HFNoseDetId::Undefined(0, 0, 0, 0, 0, 0, 0);
7 
9 
10 HFNoseDetId::HFNoseDetId(uint32_t rawid) : DetId(rawid) {}
11 
12 HFNoseDetId::HFNoseDetId(int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV)
13  : DetId(Forward, HFNose) {
14  int waferUabs(std::abs(waferU)), waferVabs(std::abs(waferV));
15  int waferUsign = (waferU >= 0) ? 0 : 1;
16  int waferVsign = (waferV >= 0) ? 0 : 1;
17  int zside = (zp < 0) ? 1 : 0;
18  int lay = std::max(layer - 1, 0);
19  id_ |= (((cellU & kHFNoseCellUMask) << kHFNoseCellUOffset) | ((cellV & kHFNoseCellVMask) << kHFNoseCellVOffset) |
20  ((waferUabs & kHFNoseWaferUMask) << kHFNoseWaferUOffset) |
22  ((waferVabs & kHFNoseWaferVMask) << kHFNoseWaferVOffset) |
25  ((type & kHFNoseTypeMask) << kHFNoseTypeOffset));
26 }
27 
29  if (!gen.null()) {
30  if (!((gen.det() == Forward) && (gen.subdetId() == (int)(HFNose)))) {
31  throw cms::Exception("Invalid DetId")
32  << "Cannot initialize HFNoseDetId from " << std::hex << gen.rawId() << std::dec;
33  }
34  }
35  id_ = gen.rawId();
36 }
37 
39  if (!gen.null()) {
40  if (!((gen.det() == Forward) && (gen.subdetId() == (int)(HFNose)))) {
41  throw cms::Exception("Invalid DetId") << "Cannot assign HFNoseDetId from " << std::hex << gen.rawId() << std::dec;
42  }
43  }
44  id_ = gen.rawId();
45  return (*this);
46 }
47 
48 std::ostream& operator<<(std::ostream& s, const HFNoseDetId& id) {
49  return s << " HFNoseDetId::EE:HE= " << id.isEE() << ":" << id.isHE() << " type= " << id.type() << " z= " << id.zside()
50  << " layer= " << id.layer() << " wafer(u,v:x,y)= (" << id.waferU() << "," << id.waferV() << ":"
51  << id.waferX() << "," << id.waferY() << ")"
52  << " cell(u,v:x,y)= (" << id.cellU() << "," << id.cellV() << ":" << id.cellX() << "," << id.cellY() << ")";
53 }
static const int kHFNoseWaferUOffset
Definition: HFNoseDetId.h:115
int zside() const
get the z-side of the cell (1/-1)
Definition: HFNoseDetId.h:53
static const HFNoseDetId Undefined
Definition: HFNoseDetId.h:108
static const int kHFNoseZsideMask
Definition: HFNoseDetId.h:126
static const int kHFNoseTypeOffset
Definition: HFNoseDetId.h:127
int32_t waferU(const int32_t index)
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static const int kHFNoseTypeMask
Definition: HFNoseDetId.h:128
static const int kHFNoseWaferUSignOffset
Definition: HFNoseDetId.h:117
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
static const int kHFNoseCellUMask
Definition: HFNoseDetId.h:112
constexpr std::array< uint8_t, layerIndexSize > layer
static const int kHFNoseWaferVOffset
Definition: HFNoseDetId.h:119
static const int kHFNoseWaferUMask
Definition: HFNoseDetId.h:116
static const int kHFNoseCellVMask
Definition: HFNoseDetId.h:114
static const int kHFNoseZsideOffset
Definition: HFNoseDetId.h:125
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static const int kHFNoseLayerMask
Definition: HFNoseDetId.h:124
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int kHFNoseCellUOffset
Definition: HFNoseDetId.h:111
Definition: DetId.h:17
HFNoseDetId & operator=(const DetId &id)
Definition: HFNoseDetId.cc:38
static const int kHFNoseLayerOffset
Definition: HFNoseDetId.h:123
static const int kHFNoseWaferVSignOffset
Definition: HFNoseDetId.h:121
uint32_t id_
Definition: DetId.h:69
static const int kHFNoseWaferUSignMask
Definition: HFNoseDetId.h:118
int32_t waferV(const int32_t index)
static const int kHFNoseWaferVSignMask
Definition: HFNoseDetId.h:122
static const int kHFNoseWaferVMask
Definition: HFNoseDetId.h:120
static const int kHFNoseCellVOffset
Definition: HFNoseDetId.h:113
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46