CMS 3D CMS Logo

HcalCondObjectContainerBase.cc
Go to the documentation of this file.
10 
12  : packedIndexVersion_(0), topo_(topo) {
13  if (topo)
15 }
16 
19  edm::LogError("HCAL") << std::string("Inconsistent dense packing between current topology (") << topo->topoVersion()
20  << ") and calibration object (" << packedIndexVersion_ << ")";
21  topo_ = topo;
22 }
23 
25  unsigned int retval = 0xFFFFFFFFu;
26  if (!topo()) {
27  edm::LogError("HCAL") << "Topology pointer not set, HCAL conditions non-functional";
28  throw cms::Exception("Topology pointer not set, HCAL conditions non-functional");
29  return retval;
30  }
31 
32  if (fId.det() == DetId::Hcal) {
33  switch (HcalSubdetector(fId.subdetId())) {
34  case (HcalBarrel):
35  retval = topo()->detId2denseIdHB(fId);
36  break;
37  case (HcalEndcap):
38  retval = topo()->detId2denseIdHE(fId);
39  break;
40  case (HcalOuter):
41  retval = topo()->detId2denseIdHO(fId);
42  break;
43  case (HcalForward):
44  retval = topo()->detId2denseIdHF(fId);
45  break;
46  case (HcalTriggerTower):
47  retval = topo()->detId2denseIdHT(fId);
48  break;
49  case (HcalOther):
50  if (extractOther(fId) == HcalCalibration)
51  retval = topo()->detId2denseIdCALIB(fId);
52  break;
53  default:
54  break;
55  }
56  } else if (fId.det() == DetId::Calo) {
58  // the historical packing from HcalGeneric is different from HcalCastorDetId, so we clone the old packing here.
59  HcalCastorDetId tid(fId);
60  int zside = tid.zside();
61  int sector = tid.sector();
62  int module = tid.module();
63  static const int CASTORhalf = 224;
64 
65  int index = 14 * (sector - 1) + (module - 1);
66  if (zside == -1)
67  index += CASTORhalf;
68 
69  retval = (unsigned int)(index);
70  } else if (fId.subdetId() == HcalZDCDetId::SubdetectorId) {
71  HcalZDCDetId direct(fId);
72  // THIS IS A HORRIBLE HACK because there were _two_ dense indices for ZDC differing in their handling of +/-z
73  HcalZDCDetId swapZ(direct.section(), direct.zside() < 0, direct.channel());
74  retval = swapZ.denseIndex();
75  }
76  }
77  return retval;
78 }
79 
81  unsigned int retval = 0;
82 
83  if (!topo()) {
84  edm::LogError("HCAL") << "Topology pointer not set, HCAL conditions non-functional";
85  throw cms::Exception("Topology pointer not set, HCAL conditions non-functional");
86  return retval;
87  }
88 
89  if (fId.det() == DetId::Hcal) {
90  switch (HcalSubdetector(fId.subdetId())) {
91  case (HcalBarrel):
92  retval = topo()->getHBSize();
93  break;
94  case (HcalEndcap):
95  retval = topo()->getHESize();
96  break;
97  case (HcalOuter):
98  retval = topo()->getHOSize();
99  break;
100  case (HcalForward):
101  retval = topo()->getHFSize();
102  break;
103  case (HcalTriggerTower):
104  retval = topo()->getHTSize();
105  break;
106  case (HcalOther):
107  if (extractOther(fId) == HcalCalibration)
108  retval = topo()->getCALIBSize();
109  break;
110  default:
111  break;
112  }
113  } else if (fId.det() == DetId::Calo) {
116  } else if (fId.subdetId() == HcalZDCDetId::SubdetectorId) {
118  }
119  }
120  return retval;
121 }
122 
124  std::ostringstream os;
125  os << std::hex << "(0x" << id.rawId() << ") " << std::dec;
126 
127  if (id.det() == DetId::Hcal) {
128  switch (HcalSubdetector(id.subdetId())) {
129  case (HcalBarrel):
130  case (HcalEndcap):
131  case (HcalOuter):
132  case (HcalForward):
133  os << HcalDetId(id);
134  break;
135  case (HcalTriggerTower):
136  os << HcalTrigTowerDetId(id);
137  break;
138  case (HcalOther):
139  if (extractOther(id) == HcalCalibration)
140  os << HcalCalibDetId(id);
141  break;
142  default:
143  break;
144  }
145  } else if (id.det() == DetId::Calo) {
146  if (id.subdetId() == HcalCastorDetId::SubdetectorId) {
147  os << HcalCastorDetId(id);
148  } else if (id.subdetId() == HcalZDCDetId::SubdetectorId) {
149  os << HcalZDCDetId(id);
150  }
151  }
152  return os.str();
153 }
HcalCondObjectContainerBase(HcalCondObjectContainerBase const &o)
int topoVersion() const override
return a version which identifies the given topology
Section section() const
get the section
Definition: HcalZDCDetId.cc:44
unsigned int getHESize() const
Definition: HcalTopology.h:133
unsigned int detId2denseIdHF(const DetId &id) const
return a linear packed id from HF
HcalOtherSubdetector extractOther(const DetId &id) const
unsigned int detId2denseIdHO(const DetId &id) const
return a linear packed id from HO
std::string textForId(const DetId &id) const
int zside(DetId const &)
unsigned int getHBSize() const
Definition: HcalTopology.h:132
Log< level::Error, false > LogError
unsigned int getHOSize() const
Definition: HcalTopology.h:134
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
unsigned int detId2denseIdHE(const DetId &id) const
return a linear packed id from HE
unsigned int detId2denseIdCALIB(const DetId &id) const
return a linear packed id from CALIB
const HcalTopology * topo() const
virtual bool denseIdConsistent(int topoVer) const
return whether this topology is consistent with the numbering in the given topology ...
unsigned int detId2denseIdHB(const DetId &id) const
return a linear packed id from HB
int module() const
get the module (1-2 for EM, 1-12 for HAD)
int zside() const
get the z-side of the cell (1/-1)
uint32_t denseIndex() const
Definition: HcalZDCDetId.cc:71
HcalSubdetector
Definition: HcalAssistant.h:31
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
unsigned int getHFSize() const
Definition: HcalTopology.h:135
unsigned int getHTSize() const
Definition: HcalTopology.h:136
int sector() const
get the sector (1-16)
static const int SubdetectorId
Definition: DetId.h:17
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
unsigned int getCALIBSize() const
Definition: HcalTopology.h:137
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalZDCDetId.h:39
unsigned int detId2denseIdHT(const DetId &id) const
return a linear packed id from HT
void setTopo(const HcalTopology *topo)
int channel() const
get the channel
Definition: HcalZDCDetId.cc:63