CMS 3D CMS Logo

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;
20  ((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset) |
21  ((waferUsign & kHGCalWaferUSignMask) << kHGCalWaferUSignOffset) |
22  ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset) |
23  ((waferVsign & kHGCalWaferVSignMask) << kHGCalWaferVSignOffset) |
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)
static const int kHGCalWaferVSignOffset
int cellU() const
get the cell #&#39;s in u,v or in x,y
static const int kHGCalCellUMask
static const int kHGCalCellVOffset
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
static const int kHGCalTypeOffset
int layer() const
get the layer #
static const int kHGCalCellVMask
static const int kHGCalZsideOffset
static const HGCSiliconDetId Undefined
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int waferU() const
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
int waferV() const
static const int kHGCalZsideMask
static const int kHGCalWaferVSignMask
Detector
Definition: DetId.h:24
int zside() const
get the z-side of the cell (1/-1)
uint32_t id_
Definition: DetId.h:69
static const int kHGCalCellUOffset
int cellV() const
static const int kHGCalLayerOffset
std::ostream & operator<<(std::ostream &s, const HGCSiliconDetId &id)
int32_t waferV(const int32_t index)
static const int kHGCalWaferUOffset
static const int kHGCalWaferUSignOffset