CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HGCSiliconDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 #include <iostream>
5 
6 const HGCSiliconDetId HGCSiliconDetId::Undefined(HGCalEE, 0, 0, 0, 0, 0, 0, 0);
7 
9 
10 HGCSiliconDetId::HGCSiliconDetId(uint32_t rawid) : DetId(rawid) {}
11 
13  DetId::Detector det, int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV)
14  : DetId(det, ForwardEmpty) {
15  int waferUabs(std::abs(waferU)), waferVabs(std::abs(waferV));
16  int waferUsign = (waferU >= 0) ? 0 : 1;
17  int waferVsign = (waferV >= 0) ? 0 : 1;
18  int zside = (zp < 0) ? 1 : 0;
19  id_ |= (((cellU & kHGCalCellUMask) << kHGCalCellUOffset) | ((cellV & kHGCalCellVMask) << kHGCalCellVOffset) |
20  ((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset) |
21  ((waferUsign & kHGCalWaferUSignMask) << kHGCalWaferUSignOffset) |
22  ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset) |
23  ((waferVsign & kHGCalWaferVSignMask) << kHGCalWaferVSignOffset) |
24  ((layer & kHGCalLayerMask) << kHGCalLayerOffset) | ((zside & kHGCalZsideMask) << kHGCalZsideOffset) |
25  ((type & kHGCalTypeMask) << kHGCalTypeOffset));
26 }
27 
29  if (!gen.null()) {
30  if ((gen.det() != HGCalEE) && (gen.det() != HGCalHSi)) {
31  throw cms::Exception("Invalid DetId")
32  << "Cannot initialize HGCSiliconDetId from " << std::hex << gen.rawId() << std::dec;
33  }
34  }
35  id_ = gen.rawId();
36 }
37 
39  if (!gen.null()) {
40  if ((gen.det() != HGCalEE) && (gen.det() != HGCalHSi)) {
41  throw cms::Exception("Invalid DetId")
42  << "Cannot assign HGCSiliconDetId from " << std::hex << gen.rawId() << std::dec;
43  }
44  }
45  id_ = gen.rawId();
46  return (*this);
47 }
48 
49 std::ostream& operator<<(std::ostream& s, const HGCSiliconDetId& id) {
50  return s << " HGCSiliconDetId::EE:HE= " << id.isEE() << ":" << id.isHE() << " type= " << id.type()
51  << " z= " << id.zside() << " layer= " << id.layer() << " wafer(u,v:x,y)= (" << id.waferU() << ","
52  << id.waferV() << ":" << id.waferX() << "," << id.waferY() << ")"
53  << " cell(u,v:x,y)= (" << id.cellU() << "," << id.cellV() << ":" << id.cellX() << "," << id.cellY() << ")";
54 }
static const int kHGCalWaferVOffset
static const int kHGCalTypeMask
int32_t waferU(const int32_t index)
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
static const int kHGCalWaferVSignOffset
static const int kHGCalCellUMask
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int zside() const
get the z-side of the cell (1/-1)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
static const int kHGCalCellVOffset
constexpr std::array< uint8_t, layerIndexSize > layer
static const int kHGCalTypeOffset
static const int kHGCalCellVMask
static const int kHGCalZsideOffset
static const HGCSiliconDetId Undefined
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int kHGCalLayerMask
Definition: DetId.h:17
static const int kHGCalWaferVMask
HGCSiliconDetId & operator=(const DetId &id)
static const int kHGCalWaferUSignMask
static const int kHGCalWaferUMask
static const int kHGCalZsideMask
static const int kHGCalWaferVSignMask
Detector
Definition: DetId.h:24
uint32_t id_
Definition: DetId.h:69
static const int kHGCalCellUOffset
static const int kHGCalLayerOffset
int32_t waferV(const int32_t index)
static const int kHGCalWaferUOffset
static const int kHGCalWaferUSignOffset
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46