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 }
HGCSiliconDetId::kHGCalWaferUMask
static const int kHGCalWaferUMask
Definition: HGCSiliconDetId.h:113
ForwardEmpty
Definition: ForwardSubdetector.h:5
HGCSiliconDetId::kHGCalCellVMask
static const int kHGCalCellVMask
Definition: HGCSiliconDetId.h:111
HGCSiliconDetId::kHGCalLayerOffset
static const int kHGCalLayerOffset
Definition: HGCSiliconDetId.h:120
HGCSiliconDetId::kHGCalWaferUOffset
static const int kHGCalWaferUOffset
Definition: HGCSiliconDetId.h:112
HGCSiliconDetId.h
HGCSiliconDetId::kHGCalWaferUSignMask
static const int kHGCalWaferUSignMask
Definition: HGCSiliconDetId.h:115
HGCSiliconDetId::kHGCalCellUMask
static const int kHGCalCellUMask
Definition: HGCSiliconDetId.h:109
operator<<
std::ostream & operator<<(std::ostream &s, const HGCSiliconDetId &id)
Definition: HGCSiliconDetId.cc:49
HGCSiliconDetId::kHGCalTypeMask
static const int kHGCalTypeMask
Definition: HGCSiliconDetId.h:125
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
DetId
Definition: DetId.h:17
DetId::HGCalHSi
Definition: DetId.h:33
DetId::HGCalEE
Definition: DetId.h:32
HGCSiliconDetId::kHGCalWaferVMask
static const int kHGCalWaferVMask
Definition: HGCSiliconDetId.h:117
alignCSCRings.s
s
Definition: alignCSCRings.py:92
gen
Definition: PythiaDecays.h:13
HGCSiliconDetId::kHGCalWaferVSignOffset
static const int kHGCalWaferVSignOffset
Definition: HGCSiliconDetId.h:118
HGCSiliconDetId::kHGCalWaferVSignMask
static const int kHGCalWaferVSignMask
Definition: HGCSiliconDetId.h:119
DetId::id_
uint32_t id_
Definition: DetId.h:69
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
HGCSiliconDetId::kHGCalZsideOffset
static const int kHGCalZsideOffset
Definition: HGCSiliconDetId.h:122
HGCSiliconDetId::operator=
HGCSiliconDetId & operator=(const DetId &id)
Definition: HGCSiliconDetId.cc:38
DetId::Detector
Detector
Definition: DetId.h:24
HGCSiliconDetId::Undefined
static const HGCSiliconDetId Undefined
Definition: HGCSiliconDetId.h:105
HGCSiliconDetId::kHGCalWaferVOffset
static const int kHGCalWaferVOffset
Definition: HGCSiliconDetId.h:116
HGCSiliconDetId::kHGCalTypeOffset
static const int kHGCalTypeOffset
Definition: HGCSiliconDetId.h:124
HGCSiliconDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCSiliconDetId.h:54
HGCSiliconDetId::cellV
int cellV() const
Definition: HGCSiliconDetId.h:61
HGCSiliconDetId::cellU
int cellU() const
get the cell #'s in u,v or in x,y
Definition: HGCSiliconDetId.h:60
HGCSiliconDetId::kHGCalLayerMask
static const int kHGCalLayerMask
Definition: HGCSiliconDetId.h:121
Exception
Definition: hltDiff.cc:246
HGCSiliconDetId::waferU
int waferU() const
Definition: HGCSiliconDetId.h:76
Exception.h
HGCSiliconDetId::kHGCalWaferUSignOffset
static const int kHGCalWaferUSignOffset
Definition: HGCSiliconDetId.h:114
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGCSiliconDetId::kHGCalCellVOffset
static const int kHGCalCellVOffset
Definition: HGCSiliconDetId.h:110
HGCSiliconDetId::HGCSiliconDetId
HGCSiliconDetId()
Definition: HGCSiliconDetId.cc:8
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HGCSiliconDetId::kHGCalZsideMask
static const int kHGCalZsideMask
Definition: HGCSiliconDetId.h:123
HGCSiliconDetId::waferV
int waferV() const
Definition: HGCSiliconDetId.h:77
HGCSiliconDetId::kHGCalCellUOffset
static const int kHGCalCellUOffset
Definition: HGCSiliconDetId.h:108
HGCSiliconDetId::layer
int layer() const
get the layer #
Definition: HGCSiliconDetId.h:57