1 #ifndef HcalCondObjectContainer_h
2 #define HcalCondObjectContainer_h
56 typedef std::pair< std::string, std::vector<Item> >
tHcalCont;
95 template<
class Item>
void
102 case(
HcalBarrel) :
for (
unsigned int i=0;
i<sizeFor(fId);
i++) HBcontainer.push_back(emptyItem);
break;
103 case(
HcalEndcap) :
for (
unsigned int i=0;
i<sizeFor(fId);
i++) HEcontainer.push_back(emptyItem);
break;
104 case(
HcalOuter) :
for (
unsigned int i=0;
i<sizeFor(fId);
i++) HOcontainer.push_back(emptyItem);
break;
105 case(
HcalForward) :
for (
unsigned int i=0;
i<sizeFor(fId);
i++) HFcontainer.push_back(emptyItem);
break;
106 case(
HcalTriggerTower) :
for (
unsigned int i=0;
i<sizeFor(fId);
i++) HTcontainer.push_back(emptyItem);
break;
108 for (
unsigned int i=0;
i<sizeFor(fId);
i++) CALIBcontainer.push_back(emptyItem);
break;
114 for (
unsigned int i=0;
i<sizeFor(fId);
i++) CASTORcontainer.push_back(emptyItem);
116 for (
unsigned int i=0;
i<sizeFor(fId);
i++) ZDCcontainer.push_back(emptyItem);
122 template<
class Item>
const Item*
125 unsigned int index=indexFor(fId);
127 const Item* cell =
NULL;
129 if (index<0xFFFFFFFu) {
132 case(
HcalBarrel) :
if (index < HBcontainer.size()) cell = &(HBcontainer.at(index) );
break;
133 case(
HcalEndcap) :
if (index < HEcontainer.size()) cell = &(HEcontainer.at(index) );
break;
134 case(
HcalForward) :
if (index < HFcontainer.size()) cell = &(HFcontainer.at(index) );
break;
135 case(
HcalOuter) :
if (index < HOcontainer.size()) cell = &(HOcontainer.at(index) );
break;
136 case(
HcalTriggerTower) :
if (index < HTcontainer.size()) cell = &(HTcontainer.at(index) );
break;
138 if (index < CALIBcontainer.size()) cell = &(CALIBcontainer.at(index) );
144 if (index < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index) );
146 if (index < ZDCcontainer.size()) cell = &(ZDCcontainer.at(index) );
156 <<
"Unavailable Conditions of type " << myname() <<
" for cell " << textForId(fId);
158 }
else if (cell->rawId() != fId) {
161 <<
"Requested conditions of type " << myname() <<
" for cell " << textForId(fId) <<
" got conditions for cell " << textForId(
DetId(cell->rawId()));
169 template<
class Item>
const bool
172 const Item* cell = getValues(fId,
false);
175 if (cell->rawId() == fId )
181 template<
class Item>
bool
185 DetId fId(myItem.rawId());
186 unsigned int index=indexFor(fId);
190 if (index<0xFFFFFFFu) {
193 case(
HcalBarrel) :
if (!HBcontainer.size() ) initContainer(fId);
194 if (index < HBcontainer.size()) cell = &(HBcontainer.at(index) );
break;
195 case(
HcalEndcap) :
if (!HEcontainer.size() ) initContainer(fId);
196 if (index < HEcontainer.size()) cell = &(HEcontainer.at(index) );
break;
197 case(
HcalForward) :
if (!HFcontainer.size() ) initContainer(fId);
198 if (index < HFcontainer.size()) cell = &(HFcontainer.at(index) );
break;
199 case(
HcalOuter) :
if (!HOcontainer.size() ) initContainer(fId);
200 if (index < HOcontainer.size()) cell = &(HOcontainer.at(index) );
break;
202 if (index < HTcontainer.size()) cell = &(HTcontainer.at(index) );
break;
204 if (!CALIBcontainer.size() ) initContainer(fId);
205 if (index < CALIBcontainer.size()) cell = &(CALIBcontainer.at(index) );
212 if (!CASTORcontainer.size() ) initContainer(fId);
213 if (index < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index) );
215 if (!ZDCcontainer.size() ) initContainer(fId);
216 if (index < ZDCcontainer.size()) cell = &(ZDCcontainer.at(index) );
228 <<
" no valid filling possible for Conditions of type " << myname() <<
" for DetId " << textForId(fId);
232 template<
class Item> std::vector<DetId>
235 std::vector<DetId> channels;
237 for (
unsigned int i=0;
i<HBcontainer.size();
i++)
239 if (emptyItem.rawId() != HBcontainer.at(
i).rawId() )
240 channels.push_back(
DetId(HBcontainer.at(
i).rawId()) );
242 for (
unsigned int i=0;
i<HEcontainer.size();
i++)
244 if (emptyItem.rawId() != HEcontainer.at(
i).rawId() )
245 channels.push_back(
DetId(HEcontainer.at(
i).rawId()) );
247 for (
unsigned int i=0;
i<HOcontainer.size();
i++)
249 if (emptyItem.rawId() != HOcontainer.at(
i).rawId() )
250 channels.push_back(
DetId(HOcontainer.at(
i).rawId()) );
252 for (
unsigned int i=0;
i<HFcontainer.size();
i++)
254 if (emptyItem.rawId() != HFcontainer.at(
i).rawId() )
255 channels.push_back(
DetId(HFcontainer.at(
i).rawId()) );
257 for (
unsigned int i=0;
i<HTcontainer.size();
i++)
259 if (emptyItem.rawId() != HTcontainer.at(
i).rawId() )
260 channels.push_back(
DetId(HTcontainer.at(
i).rawId()) );
262 for (
unsigned int i=0;
i<ZDCcontainer.size();
i++)
264 if (emptyItem.rawId() != ZDCcontainer.at(
i).rawId() )
265 channels.push_back(
DetId(ZDCcontainer.at(
i).rawId()) );
267 for (
unsigned int i=0;
i<CALIBcontainer.size();
i++)
269 if (emptyItem.rawId() != CALIBcontainer.at(
i).rawId() )
270 channels.push_back(
DetId(CALIBcontainer.at(
i).rawId()) );
272 for (
unsigned int i=0;
i<CASTORcontainer.size();
i++)
274 if (emptyItem.rawId() != CASTORcontainer.at(
i).rawId() )
275 channels.push_back(
DetId(CASTORcontainer.at(
i).rawId()) );
const HcalTopology * topo_
unsigned int indexFor(DetId) const
std::vector< Item > HEcontainer
std::vector< Item > HBcontainer
HcalCondObjectContainerBase(const HcalTopology *)
void setTopo(const HcalTopology *topo) const
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
const bool exists(DetId fId) const
std::vector< DetId > getAllChannels() const
std::vector< Item > ZDCcontainer
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
static const int SubdetectorId
HcalCondObjectContainer(const HcalTopology *topo)
static const int SubdetectorId
virtual std::string myname() const
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)
Detector det() const
get the detector field from this detid
std::vector< Item > HFcontainer
std::pair< std::string, std::vector< Item > > tHcalCont
std::vector< tHcalCont > tAllContWithNames
const HcalTopology * topo() const