1 #ifndef HcalCondObjectContainer_h 2 #define HcalCondObjectContainer_h 62 const Item* getValues(
DetId fId,
bool throwOnFail =
true)
const;
65 const bool exists(
DetId fId)
const;
68 bool addValues(
const Item& myItem);
71 std::vector<DetId> getAllChannels()
const;
76 typedef std::pair<std::string, std::vector<Item> >
tHcalCont;
80 tAllContWithNames allContainers;
81 allContainers.push_back(tHcalCont(
"HB", HBcontainer));
82 allContainers.push_back(tHcalCont(
"HE", HEcontainer));
83 allContainers.push_back(tHcalCont(
"HO", HOcontainer));
84 allContainers.push_back(tHcalCont(
"HF", HFcontainer));
85 allContainers.push_back(tHcalCont(
"HT", HTcontainer));
86 allContainers.push_back(tHcalCont(
"ZDC", ZDCcontainer));
87 allContainers.push_back(tHcalCont(
"CALIB", CALIBcontainer));
88 allContainers.push_back(tHcalCont(
"CASTOR", CASTORcontainer));
93 void initContainer(
DetId container);
107 template <
class Item>
110 template <
class Item>
117 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++)
118 HBcontainer.push_back(emptyItem);
121 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++)
122 HEcontainer.push_back(emptyItem);
125 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++)
126 HOcontainer.push_back(emptyItem);
129 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++)
130 HFcontainer.push_back(emptyItem);
133 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++)
134 HTcontainer.push_back(emptyItem);
138 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++)
139 CALIBcontainer.push_back(emptyItem);
147 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++)
148 CASTORcontainer.push_back(emptyItem);
150 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++)
151 ZDCcontainer.push_back(emptyItem);
156 template <
class Item>
160 const Item* cell =
nullptr;
162 if (index < 0xFFFFFFFu) {
166 if (index < HBcontainer.size())
167 cell = &(HBcontainer.at(index));
170 if (index < HEcontainer.size())
171 cell = &(HEcontainer.at(index));
174 if (index < HFcontainer.size())
175 cell = &(HFcontainer.at(index));
178 if (index < HOcontainer.size())
179 cell = &(HOcontainer.at(index));
182 if (index < HTcontainer.size())
183 cell = &(HTcontainer.at(index));
187 cell = &(CALIBcontainer.at(index));
194 if (index < CASTORcontainer.size())
195 cell = &(CASTORcontainer.at(index));
197 if (index < ZDCcontainer.size())
198 cell = &(ZDCcontainer.at(index));
206 <<
"Unavailable Conditions of type " << myname() <<
" for cell " <<
textForId(fId);
211 <<
"Requested conditions of type " << myname() <<
" for cell " <<
textForId(fId)
212 <<
" got conditions for cell " <<
textForId(
DetId(cell->rawId()));
220 template <
class Item>
222 const Item* cell = getValues(fId,
false);
231 template <
class Item>
234 DetId fId(myItem.rawId());
237 Item* cell =
nullptr;
239 if (index < 0xFFFFFFFu) {
243 if (HBcontainer.empty())
245 if (index < HBcontainer.size())
246 cell = &(HBcontainer.at(index));
249 if (HEcontainer.empty())
251 if (index < HEcontainer.size())
252 cell = &(HEcontainer.at(index));
255 if (HFcontainer.empty())
257 if (index < HFcontainer.size())
258 cell = &(HFcontainer.at(index));
261 if (HOcontainer.empty())
263 if (index < HOcontainer.size())
264 cell = &(HOcontainer.at(index));
267 if (HTcontainer.empty())
269 if (index < HTcontainer.size())
270 cell = &(HTcontainer.at(index));
274 if (CALIBcontainer.empty())
276 if (index < CALIBcontainer.size())
277 cell = &(CALIBcontainer.at(index));
285 if (CASTORcontainer.empty())
287 if (index < CASTORcontainer.size())
288 cell = &(CASTORcontainer.at(index));
290 if (ZDCcontainer.empty())
292 if (index < ZDCcontainer.size())
293 cell = &(ZDCcontainer.at(index));
298 if (cell !=
nullptr) {
305 <<
" no valid filling possible for Conditions of type " << myname() <<
" for DetId " <<
textForId(fId);
309 template <
class Item>
313 for (
unsigned int i = 0;
i < HBcontainer.size();
i++) {
314 if (emptyItem.rawId() != HBcontainer.at(
i).rawId())
315 channels.push_back(
DetId(HBcontainer.at(
i).rawId()));
317 for (
unsigned int i = 0;
i < HEcontainer.size();
i++) {
318 if (emptyItem.rawId() != HEcontainer.at(
i).rawId())
319 channels.push_back(
DetId(HEcontainer.at(
i).rawId()));
321 for (
unsigned int i = 0;
i < HOcontainer.size();
i++) {
322 if (emptyItem.rawId() != HOcontainer.at(
i).rawId())
323 channels.push_back(
DetId(HOcontainer.at(
i).rawId()));
325 for (
unsigned int i = 0;
i < HFcontainer.size();
i++) {
326 if (emptyItem.rawId() != HFcontainer.at(
i).rawId())
327 channels.push_back(
DetId(HFcontainer.at(
i).rawId()));
329 for (
unsigned int i = 0;
i < HTcontainer.size();
i++) {
330 if (emptyItem.rawId() != HTcontainer.at(
i).rawId())
331 channels.push_back(
DetId(HTcontainer.at(
i).rawId()));
333 for (
unsigned int i = 0;
i < ZDCcontainer.size();
i++) {
334 if (emptyItem.rawId() != ZDCcontainer.at(
i).rawId())
335 channels.push_back(
DetId(ZDCcontainer.at(
i).rawId()));
337 for (
unsigned int i = 0;
i < CALIBcontainer.size();
i++) {
338 if (emptyItem.rawId() != CALIBcontainer.at(
i).rawId())
339 channels.push_back(
DetId(CALIBcontainer.at(
i).rawId()));
341 for (
unsigned int i = 0;
i < CASTORcontainer.size();
i++) {
342 if (emptyItem.rawId() != CASTORcontainer.at(
i).rawId())
343 channels.push_back(
DetId(CASTORcontainer.at(
i).rawId()));
bool hcalEqualDetId(Item *cell, const DetId &fId)
HcalCondObjectContainerBase(HcalCondObjectContainerBase const &o)
const HcalTopology * topo_
unsigned int indexFor(DetId) const
std::vector< Item > HEcontainer
std::vector< Item > HBcontainer
virtual ~HcalCondObjectContainer()
std::vector< Item > CASTORcontainer
const Item * getValues(DetId fId, bool throwOnFail=true) const
HcalOtherSubdetector extractOther(const DetId &id) const
int getCreatorPackedIndexVersion() const
std::vector< tHcalCont > tAllContWithNames
unsigned int sizeFor(DetId) const
const tAllContWithNames getAllContainers() const
HcalCondObjectContainerBase & operator=(HcalCondObjectContainerBase const &o)
const bool exists(DetId fId) const
std::vector< DetId > getAllChannels() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< Item > ZDCcontainer
static const int SubdetectorId
HcalCondObjectContainer(const HcalTopology *topo)
static const int SubdetectorId
virtual std::string myname() const
#define COND_SERIALIZABLE
std::string textForId(const DetId &id) const
std::vector< Item > HTcontainer
std::vector< Item > HOcontainer
std::vector< Item > CALIBcontainer
void initContainer(DetId container)
bool addValues(const Item &myItem)
std::pair< std::string, std::vector< Item > > tHcalCont
std::vector< Item > HFcontainer
void setTopo(const HcalTopology *topo)
const HcalTopology * topo() const
constexpr Detector det() const
get the detector field from this detid