1 #ifndef HcalCondObjectContainer_h 2 #define HcalCondObjectContainer_h 53 const Item* getValues(
DetId fId,
bool throwOnFail=
true)
const;
56 const bool exists(
DetId fId)
const;
59 bool addValues(
const Item& myItem);
62 std::vector<DetId> getAllChannels()
const;
67 typedef std::pair< std::string, std::vector<Item> >
tHcalCont;
71 tAllContWithNames allContainers;
72 allContainers.push_back(tHcalCont(
"HB",HBcontainer));
73 allContainers.push_back(tHcalCont(
"HE",HEcontainer));
74 allContainers.push_back(tHcalCont(
"HO",HOcontainer));
75 allContainers.push_back(tHcalCont(
"HF",HFcontainer));
76 allContainers.push_back(tHcalCont(
"HT",HTcontainer));
77 allContainers.push_back(tHcalCont(
"ZDC",ZDCcontainer));
78 allContainers.push_back(tHcalCont(
"CALIB",CALIBcontainer));
79 allContainers.push_back(tHcalCont(
"CASTOR",CASTORcontainer));
84 void initContainer(
DetId container);
105 template<
class Item>
void 112 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++) HBcontainer.push_back(emptyItem);
115 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++) HEcontainer.push_back(emptyItem);
118 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++) HOcontainer.push_back(emptyItem);
121 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++) HFcontainer.push_back(emptyItem);
124 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++) HTcontainer.push_back(emptyItem);
128 for (
unsigned int i = 0;
i <
sizeFor(fId);
i++) CALIBcontainer.push_back(emptyItem);
136 for (
unsigned int i=0;
i<
sizeFor(fId);
i++) CASTORcontainer.push_back(emptyItem);
138 for (
unsigned int i=0;
i<
sizeFor(fId);
i++) ZDCcontainer.push_back(emptyItem);
144 template<
class Item>
const Item*
148 const Item* cell =
nullptr;
150 if (index<0xFFFFFFFu) {
154 if (index < HBcontainer.size()) cell = &(HBcontainer.at(index));
157 if (index < HEcontainer.size()) cell = &(HEcontainer.at(index));
160 if (index < HFcontainer.size()) cell = &(HFcontainer.at(index));
163 if (index < HOcontainer.size()) cell = &(HOcontainer.at(index));
166 if (index < HTcontainer.size()) cell = &(HTcontainer.at(index));
176 if (index < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index) );
178 if (index < ZDCcontainer.size()) cell = &(ZDCcontainer.at(index) );
186 <<
"Unavailable Conditions of type " << myname() <<
" for cell " <<
textForId(fId);
191 <<
"Requested conditions of type " << myname() <<
" for cell " <<
textForId(fId) <<
" got conditions for cell " <<
textForId(
DetId(cell->rawId()));
199 template<
class Item>
const bool 201 const Item* cell = getValues(fId,
false);
210 template<
class Item>
bool 213 DetId fId(myItem.rawId());
216 Item* cell =
nullptr;
218 if (index<0xFFFFFFFu) {
222 if (HBcontainer.empty() ) initContainer(fId);
223 if (index < HBcontainer.size()) cell = &(HBcontainer.at(index) );
226 if (HEcontainer.empty() ) initContainer(fId);
227 if (index < HEcontainer.size()) cell = &(HEcontainer.at(index) );
230 if (HFcontainer.empty() ) initContainer(fId);
231 if (index < HFcontainer.size()) cell = &(HFcontainer.at(index) );
234 if (HOcontainer.empty() ) initContainer(fId);
235 if (index < HOcontainer.size()) cell = &(HOcontainer.at(index) );
238 if (HTcontainer.empty() ) initContainer(fId);
239 if (index < HTcontainer.size()) cell = &(HTcontainer.at(index) );
243 if (CALIBcontainer.empty() ) initContainer(fId);
244 if (index < CALIBcontainer.size()) cell = &(CALIBcontainer.at(index) );
252 if (CASTORcontainer.empty() ) initContainer(fId);
253 if (index < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index) );
255 if (ZDCcontainer.empty() ) initContainer(fId);
256 if (index < ZDCcontainer.size()) cell = &(ZDCcontainer.at(index) );
268 <<
" no valid filling possible for Conditions of type " << myname() <<
" for DetId " <<
textForId(fId);
272 template<
class Item> std::vector<DetId>
274 std::vector<DetId> channels;
276 for (
unsigned int i=0;
i<HBcontainer.size();
i++) {
277 if (emptyItem.rawId() != HBcontainer.at(
i).rawId() )
278 channels.push_back(
DetId(HBcontainer.at(
i).rawId()) );
280 for (
unsigned int i=0;
i<HEcontainer.size();
i++) {
281 if (emptyItem.rawId() != HEcontainer.at(
i).rawId() )
282 channels.push_back(
DetId(HEcontainer.at(
i).rawId()) );
284 for (
unsigned int i=0;
i<HOcontainer.size();
i++) {
285 if (emptyItem.rawId() != HOcontainer.at(
i).rawId() )
286 channels.push_back(
DetId(HOcontainer.at(
i).rawId()) );
288 for (
unsigned int i=0;
i<HFcontainer.size();
i++) {
289 if (emptyItem.rawId() != HFcontainer.at(
i).rawId() )
290 channels.push_back(
DetId(HFcontainer.at(
i).rawId()) );
292 for (
unsigned int i=0;
i<HTcontainer.size();
i++) {
293 if (emptyItem.rawId() != HTcontainer.at(
i).rawId() )
294 channels.push_back(
DetId(HTcontainer.at(
i).rawId()) );
296 for (
unsigned int i=0;
i<ZDCcontainer.size();
i++) {
297 if (emptyItem.rawId() != ZDCcontainer.at(
i).rawId() )
298 channels.push_back(
DetId(ZDCcontainer.at(
i).rawId()) );
300 for (
unsigned int i=0;
i<CALIBcontainer.size();
i++) {
301 if (emptyItem.rawId() != CALIBcontainer.at(
i).rawId() )
302 channels.push_back(
DetId(CALIBcontainer.at(
i).rawId()) );
304 for (
unsigned int i=0;
i<CASTORcontainer.size();
i++) {
305 if (emptyItem.rawId() != CASTORcontainer.at(
i).rawId() )
306 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
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::vector< Item > HFcontainer
std::pair< std::string, std::vector< Item > > tHcalCont
void setTopo(const HcalTopology *topo)
std::vector< tHcalCont > tAllContWithNames
const HcalTopology * topo() const
constexpr Detector det() const
get the detector field from this detid