CMS 3D CMS Logo

HcalDcsDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 
6 
7 HcalDcsDetId::HcalDcsDetId(uint32_t rawid) : HcalOtherDetId(rawid) {}
8 
10  if ((subdet() != HcalDcsBarrel) || (subdet() != HcalDcsEndcap) || (subdet() != HcalDcsOuter) ||
11  (subdet() != HcalDcsForward)) {
12  throw cms::Exception("Invalid DetId") << "Cannot intialize HcalDcsDetId from " << std::hex << id_ << std::dec;
13  }
14 }
15 
17  HcalOtherSubdetector subd, int side_or_ring, unsigned int slc, DcsType ty, unsigned int subchan)
18  : HcalOtherDetId(subd) {
19  id_ |= ((side_or_ring > 0) ? ((1 << kSideOffset) | (side_or_ring << kRingOffset)) : ((-side_or_ring) << kRingOffset));
20  id_ |= (slc & 0x1F) << kSliceOffset;
21  id_ |= (ty & 0xF) << kTypeOffset;
22  id_ |= (subchan & 0xF) << kSubChannelOffset;
23 }
24 
26  int ty(HV);
27  do {
29  return HcalDcsDetId::DcsType(ty);
30  } while (++ty != DCS_MAX);
31  return DCSUNKNOWN;
32 }
33 
35  switch (typ) {
36  case HV:
37  return "HV";
38  case BV:
39  return "BV";
40  case CATH:
41  return "CATH";
42  case DYN7:
43  return "DYN7";
44  case DYN8:
45  return "DYN8";
46  case RM_TEMP:
47  return "RM_TEMP";
48  case CCM_TEMP:
49  return "CCM_TEMP";
50  case CALIB_TEMP:
51  return "CALIB_TEMP";
52  case LVTTM_TEMP:
53  return "LVTTM_TEMP";
54  case TEMP:
55  return "TEMP";
56  case QPLL_LOCK:
57  return "QPLL_LOCK";
58  case STATUS:
59  return "STATUS";
60  default:
61  return "DCSUNKNOWN";
62  }
63  return "Invalid";
64 }
65 
66 std::ostream& operator<<(std::ostream& s, const HcalDcsDetId& id) {
67  switch (id.subdet()) {
68  case (HcalDcsBarrel):
69  return s << "(HB" << id.zside() << ' ' << id.slice() << ' ' << id.typeString(id.type()) << id.subchannel() << ')';
70  case (HcalDcsEndcap):
71  return s << "(HE" << id.zside() << ' ' << id.slice() << ' ' << id.typeString(id.type()) << id.subchannel() << ')';
72  case (HcalDcsOuter):
73  return s << "(HO" << id.ring() << " " << id.slice() << ' ' << id.typeString(id.type()) << id.subchannel() << ')';
74  case (HcalDcsForward):
75  return s << "(HF" << id.zside() << ' ' << ((id.type() <= HcalDcsDetId::DYN8) ? "Q" : "") << id.slice() << ' '
76  << id.typeString(id.type()) << id.subchannel() << ')';
77  default:
78  return s << id.rawId();
79  }
80 }
static unsigned int const kSideOffset
Definition: HcalDcsDetId.h:63
std::ostream & operator<<(std::ostream &s, const HcalDcsDetId &id)
Definition: HcalDcsDetId.cc:66
HcalOtherSubdetector
Definition: HcalAssistant.h:40
static unsigned int const kTypeOffset
Definition: HcalDcsDetId.h:66
static unsigned int const kSliceOffset
Definition: HcalDcsDetId.h:65
static unsigned int const kSubChannelOffset
Definition: HcalDcsDetId.h:67
static DcsType DcsTypeFromString(const std::string &str)
Definition: HcalDcsDetId.cc:25
Definition: DetId.h:17
static unsigned int const kRingOffset
Definition: HcalDcsDetId.h:64
uint32_t id_
Definition: DetId.h:69
static std::string typeString(DcsType typ)
Definition: HcalDcsDetId.cc:34
#define str(s)
HcalOtherSubdetector subdet() const
get the category