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 
11 HFNoseDetId::HFNoseDetId(uint32_t rawid) : DetId(rawid) {
12 }
13 
14 HFNoseDetId::HFNoseDetId(int zp, int type, int layer, int waferU, int waferV,
15  int cellU, int cellV) : DetId(Forward,HFNose) {
16 
17  int waferUabs(std::abs(waferU)), waferVabs(std::abs(waferV));
18  int waferUsign = (waferU >= 0) ? 0 : 1;
19  int waferVsign = (waferV >= 0) ? 0 : 1;
20  int zside = (zp < 0) ? 1 : 0;
21  id_ |= (((cellU & kHFNoseCellUMask) << kHFNoseCellUOffset) |
22  ((cellV & kHFNoseCellVMask) << kHFNoseCellVOffset) |
23  ((waferUabs & kHFNoseWaferUMask) << kHFNoseWaferUOffset) |
25  ((waferVabs & kHFNoseWaferVMask) << kHFNoseWaferVOffset) |
27  ((layer & kHFNoseLayerMask) << kHFNoseLayerOffset) |
28  ((zside & kHFNoseZsideMask) << kHFNoseZsideOffset) |
29  ((type & kHFNoseTypeMask) << kHFNoseTypeOffset));
30 }
31 
33  if (!gen.null()) {
34  if (!((gen.det()==Forward) && (gen.subdetId()==(int)(HFNose)))) {
35  throw cms::Exception("Invalid DetId") << "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()
53  << " type= " << id.type() << " z= " << id.zside()
54  << " layer= " << id.layer()
55  << " wafer(u,v:x,y)= (" << id.waferU() << "," << id.waferV() << ":"
56  << id.waferX() << "," << id.waferY() << ")"
57  << " cell(u,v:x,y)= (" << id.cellU() << "," << id.cellV() << ":"
58  << id.cellX() << "," << id.cellY() << ")";
59 }
60 
61 
type
Definition: HCALResponse.h:21
static const int kHFNoseWaferUOffset
Definition: HFNoseDetId.h:98
int zside() const
get the z-side of the cell (1/-1)
Definition: HFNoseDetId.h:55
static const HFNoseDetId Undefined
Definition: HFNoseDetId.h:89
static const int kHFNoseZsideMask
Definition: HFNoseDetId.h:109
static const int kHFNoseTypeOffset
Definition: HFNoseDetId.h:110
int cellU() const
get the cell #&#39;s in u,v or in x,y
Definition: HFNoseDetId.h:61
constexpr bool null() const
is this a null id ?
Definition: DetId.h:52
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
static const int kHFNoseTypeMask
Definition: HFNoseDetId.h:111
static const int kHFNoseWaferUSignOffset
Definition: HFNoseDetId.h:100
static const int kHFNoseCellUMask
Definition: HFNoseDetId.h:95
static const int kHFNoseWaferVOffset
Definition: HFNoseDetId.h:102
static const int kHFNoseWaferUMask
Definition: HFNoseDetId.h:99
int cellV() const
Definition: HFNoseDetId.h:62
int waferV() const
Definition: HFNoseDetId.h:78
int layer() const
get the layer #
Definition: HFNoseDetId.h:58
std::ostream & operator<<(std::ostream &s, const HFNoseDetId &id)
Definition: HFNoseDetId.cc:51
static const int kHFNoseCellVMask
Definition: HFNoseDetId.h:97
int waferU() const
Definition: HFNoseDetId.h:77
static const int kHFNoseZsideOffset
Definition: HFNoseDetId.h:108
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 kHFNoseLayerMask
Definition: HFNoseDetId.h:107
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int kHFNoseCellUOffset
Definition: HFNoseDetId.h:94
Definition: DetId.h:18
HFNoseDetId & operator=(const DetId &id)
Definition: HFNoseDetId.cc:41
static const int kHFNoseLayerOffset
Definition: HFNoseDetId.h:106
static const int kHFNoseWaferVSignOffset
Definition: HFNoseDetId.h:104
uint32_t id_
Definition: DetId.h:62
static const int kHFNoseWaferUSignMask
Definition: HFNoseDetId.h:101
static const int kHFNoseWaferVSignMask
Definition: HFNoseDetId.h:105
static const int kHFNoseWaferVMask
Definition: HFNoseDetId.h:103
static const int kHFNoseCellVOffset
Definition: HFNoseDetId.h:96
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39