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  id_ |= ((cellV & kHGCalCellVMask) << kHGCalCellVOffset);
24  id_ |= ((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset);
25  id_ |= ((waferUsign& kHGCalWaferUSignMask) << kHGCalWaferUSignOffset);
26  id_ |= ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset);
27  id_ |= ((waferVsign& kHGCalWaferVSignMask) << kHGCalWaferVSignOffset);
28  id_ |= ((layer & kHGCalLayerMask) << kHGCalLayerOffset);
29  id_ |= ((zside & kHGCalZsideMask) << kHGCalZsideOffset);
30  id_ |= ((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
int waferU() const
int cellV() const
static const int kHGCalWaferVSignOffset
static const int kHGCalCellUMask
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
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
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:24
uint32_t id_
Definition: DetId.h:56
bool null() const
is this a null id ?
Definition: DetId.h:46
static const int kHGCalCellUOffset
static const int kHGCalLayerOffset
std::ostream & operator<<(std::ostream &s, const HGCSiliconDetId &id)
static const int kHGCalWaferUOffset
Detector det() const
get the detector field from this detid
Definition: DetId.h:36
static const int kHGCalWaferUSignOffset