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(DetId::Detector det, int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV)
13  : DetId(det, 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 
28 HFNoseDetId::HFNoseDetId(int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV)
29  : HFNoseDetId(Forward, zp, type, layer, waferU, waferV, cellU, cellV) {}
30 
32  if (!gen.null()) {
33  if (!((gen.det() == Forward) && (gen.subdetId() == (int)(HFNose)))) {
34  throw cms::Exception("Invalid DetId")
35  << "Cannot initialize HFNoseDetId from " << std::hex << gen.rawId() << std::dec;
36  }
37  }
38  id_ = gen.rawId();
39 }
40 
42  if (!gen.null()) {
43  if (!((gen.det() == Forward) && (gen.subdetId() == (int)(HFNose)))) {
44  throw cms::Exception("Invalid DetId") << "Cannot assign HFNoseDetId from " << std::hex << gen.rawId() << std::dec;
45  }
46  }
47  id_ = gen.rawId();
48  return (*this);
49 }
50 
51 std::ostream& operator<<(std::ostream& s, const HFNoseDetId& id) {
52  return s << " HFNoseDetId::EE:HE= " << id.isEE() << ":" << id.isHE() << " type= " << id.type() << " z= " << id.zside()
53  << " layer= " << id.layer() << " wafer(u,v:x,y)= (" << id.waferU() << "," << id.waferV() << ":"
54  << id.waferX() << "," << id.waferY() << ")"
55  << " cell(u,v:x,y)= (" << id.cellU() << "," << id.cellV() << ":" << id.cellX() << "," << id.cellY() << ")";
56 }
static const int kHFNoseWaferUOffset
Definition: HFNoseDetId.h:116
static const HFNoseDetId Undefined
Definition: HFNoseDetId.h:109
int layer() const
get the layer #
Definition: HFNoseDetId.h:57
static const int kHFNoseZsideMask
Definition: HFNoseDetId.h:127
static const int kHFNoseTypeOffset
Definition: HFNoseDetId.h:128
int32_t waferU(const int32_t index)
int waferU() const
Definition: HFNoseDetId.h:76
static const int kHFNoseTypeMask
Definition: HFNoseDetId.h:129
static const int kHFNoseWaferUSignOffset
Definition: HFNoseDetId.h:118
static const int kHFNoseCellUMask
Definition: HFNoseDetId.h:113
static const int kHFNoseWaferVOffset
Definition: HFNoseDetId.h:120
static const int kHFNoseWaferUMask
Definition: HFNoseDetId.h:117
std::ostream & operator<<(std::ostream &s, const HFNoseDetId &id)
Definition: HFNoseDetId.cc:51
static const int kHFNoseCellVMask
Definition: HFNoseDetId.h:115
static const int kHFNoseZsideOffset
Definition: HFNoseDetId.h:126
static const int kHFNoseLayerMask
Definition: HFNoseDetId.h:125
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:60
static const int kHFNoseCellUOffset
Definition: HFNoseDetId.h:112
Definition: DetId.h:17
HFNoseDetId & operator=(const DetId &id)
Definition: HFNoseDetId.cc:41
static const int kHFNoseLayerOffset
Definition: HFNoseDetId.h:124
int cellV() const
Definition: HFNoseDetId.h:61
static const int kHFNoseWaferVSignOffset
Definition: HFNoseDetId.h:122
Detector
Definition: DetId.h:24
uint32_t id_
Definition: DetId.h:69
int waferV() const
Definition: HFNoseDetId.h:79
static const int kHFNoseWaferUSignMask
Definition: HFNoseDetId.h:119
int32_t waferV(const int32_t index)
static const int kHFNoseWaferVSignMask
Definition: HFNoseDetId.h:123
static const int kHFNoseWaferVMask
Definition: HFNoseDetId.h:121
static const int kHFNoseCellVOffset
Definition: HFNoseDetId.h:114
int zside() const
get the z-side of the cell (1/-1)
Definition: HFNoseDetId.h:54