CMS 3D CMS Logo

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);
20  ((waferUabs & kHFNoseWaferUMask) << kHFNoseWaferUOffset) |
22  ((waferVabs & kHFNoseWaferVMask) << kHFNoseWaferVOffset) |
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
static const HFNoseDetId Undefined
Definition: HFNoseDetId.h:108
int layer() const
get the layer #
Definition: HFNoseDetId.h:56
static const int kHFNoseZsideMask
Definition: HFNoseDetId.h:126
static const int kHFNoseTypeOffset
Definition: HFNoseDetId.h:127
int32_t waferU(const int32_t index)
int waferU() const
Definition: HFNoseDetId.h:75
static const int kHFNoseTypeMask
Definition: HFNoseDetId.h:128
static const int kHFNoseWaferUSignOffset
Definition: HFNoseDetId.h:117
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
std::ostream & operator<<(std::ostream &s, const HFNoseDetId &id)
Definition: HFNoseDetId.cc:48
static const int kHFNoseCellVMask
Definition: HFNoseDetId.h:114
static const int kHFNoseZsideOffset
Definition: HFNoseDetId.h:125
static const int kHFNoseLayerMask
Definition: HFNoseDetId.h:124
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int cellU() const
get the cell #&#39;s in u,v or in x,y
Definition: HFNoseDetId.h:59
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
int cellV() const
Definition: HFNoseDetId.h:60
static const int kHFNoseWaferVSignOffset
Definition: HFNoseDetId.h:121
uint32_t id_
Definition: DetId.h:69
int waferV() const
Definition: HFNoseDetId.h:78
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
int zside() const
get the z-side of the cell (1/-1)
Definition: HFNoseDetId.h:53