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 
11 HGCSiliconDetId::HGCSiliconDetId(uint32_t rawid) : DetId(rawid) {
12 }
13 
15  int layer, int waferU, int waferV, int cellU,
16  int cellV) : DetId(det,ForwardEmpty) {
17 
18  int waferUabs(std::abs(waferU)), waferVabs(std::abs(waferV));
19  int waferUsign = (waferU >= 0) ? 0 : 1;
20  int waferVsign = (waferV >= 0) ? 0 : 1;
21  int zside = (zp < 0) ? 1 : 0;
22  id_ |= (((cellU & kHGCalCellUMask) << kHGCalCellUOffset) |
23  ((cellV & kHGCalCellVMask) << kHGCalCellVOffset) |
24  ((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset) |
25  ((waferUsign& kHGCalWaferUSignMask) << kHGCalWaferUSignOffset) |
26  ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset) |
27  ((waferVsign& kHGCalWaferVSignMask) << kHGCalWaferVSignOffset) |
28  ((layer & kHGCalLayerMask) << kHGCalLayerOffset) |
29  ((zside & kHGCalZsideMask) << kHGCalZsideOffset) |
30  ((type & kHGCalTypeMask) << kHGCalTypeOffset));
31 }
32 
34  if (!gen.null()) {
35  if ((gen.det()!=HGCalEE) && (gen.det()!=HGCalHSi)) {
36  throw cms::Exception("Invalid DetId") << "Cannot initialize HGCSiliconDetId from " << std::hex << gen.rawId() << std::dec;
37  }
38  }
39  id_ = gen.rawId();
40 }
41 
43  if (!gen.null()) {
44  if ((gen.det()!=HGCalEE) && (gen.det()!=HGCalHSi)) {
45  throw cms::Exception("Invalid DetId") << "Cannot assign HGCSiliconDetId from " << std::hex << gen.rawId() << std::dec;
46  }
47  }
48  id_ = gen.rawId();
49  return (*this);
50 }
51 
52 std::ostream& operator<<(std::ostream& s,const HGCSiliconDetId& id) {
53  return s << " EE:HE= " << id.isEE() << ":" << id.isHE()
54  << " type= " << id.type() << " z= " << id.zside()
55  << " layer= " << id.layer()
56  << " wafer(u,v:x,y)= (" << id.waferU() << "," << id.waferV() << ":"
57  << id.waferX() << "," << id.waferY() << ")"
58  << " cell(u,v:x,y)= (" << id.cellU() << "," << id.cellV() << ":"
59  << id.cellX() << "," << id.cellY() << ")";
60 }
61 
62 
type
Definition: HCALResponse.h:21
static const int kHGCalWaferVOffset
static const int kHGCalTypeMask
constexpr bool null() const
is this a null id ?
Definition: DetId.h:49
int waferU() const
int cellV() const
static const int kHGCalWaferVSignOffset
static const int kHGCalCellUMask
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
int zside() const
get the z-side of the cell (1/-1)
static const int kHGCalCellVOffset
int cellU() const
get the cell #&#39;s in u,v or in x,y
static const int kHGCalTypeOffset
static const int kHGCalCellVMask
static const int kHGCalZsideOffset
int layer() const
get the layer #
static const HGCSiliconDetId Undefined
int waferV() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int kHGCalLayerMask
Definition: DetId.h:18
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:26
uint32_t id_
Definition: DetId.h:59
static const int kHGCalCellUOffset
static const int kHGCalLayerOffset
std::ostream & operator<<(std::ostream &s, const HGCSiliconDetId &id)
static const int kHGCalWaferUOffset
static const int kHGCalWaferUSignOffset
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39