1 #ifndef HcalCondObjectContainer_h
2 #define HcalCondObjectContainer_h
66 typedef std::pair< std::string, std::vector<Item> >
tHcalCont;
104 template<
class Item>
void
111 case(
HcalBarrel) :
for (
unsigned int i=0;
i<sizeFor(fId);
i++) HBcontainer.push_back(emptyItem);
break;
112 case(
HcalEndcap) :
for (
unsigned int i=0;
i<sizeFor(fId);
i++) HEcontainer.push_back(emptyItem);
break;
113 case(
HcalOuter) :
for (
unsigned int i=0;
i<sizeFor(fId);
i++) HOcontainer.push_back(emptyItem);
break;
114 case(
HcalForward) :
for (
unsigned int i=0;
i<sizeFor(fId);
i++) HFcontainer.push_back(emptyItem);
break;
115 case(
HcalTriggerTower) :
for (
unsigned int i=0;
i<sizeFor(fId);
i++) HTcontainer.push_back(emptyItem);
break;
117 for (
unsigned int i=0;
i<sizeFor(fId);
i++) CALIBcontainer.push_back(emptyItem);
break;
123 for (
unsigned int i=0;
i<sizeFor(fId);
i++) CASTORcontainer.push_back(emptyItem);
125 for (
unsigned int i=0;
i<sizeFor(fId);
i++) ZDCcontainer.push_back(emptyItem);
131 template<
class Item>
const Item*
134 unsigned int index=indexFor(fId);
138 if (index<0xFFFFFFFu) {
141 case(
HcalBarrel) :
if (index < HBcontainer.size()) cell = &(HBcontainer.at(index) );
break;
142 case(
HcalEndcap) :
if (index < HEcontainer.size()) cell = &(HEcontainer.at(index) );
break;
143 case(
HcalForward) :
if (index < HFcontainer.size()) cell = &(HFcontainer.at(index) );
break;
144 case(
HcalOuter) :
if (index < HOcontainer.size()) cell = &(HOcontainer.at(index) );
break;
145 case(
HcalTriggerTower) :
if (index < HTcontainer.size()) cell = &(HTcontainer.at(index) );
break;
147 if (index < CALIBcontainer.size()) cell = &(CALIBcontainer.at(index) );
153 if (index < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index) );
155 if (index < ZDCcontainer.size()) cell = &(ZDCcontainer.at(index) );
165 <<
"Unavailable Conditions of type " << myname() <<
" for cell " << textForId(fId);
167 }
else if (cell->rawId() != fId) {
170 <<
"Requested conditions of type " << myname() <<
" for cell " << textForId(fId) <<
" got conditions for cell " << textForId(
DetId(cell->rawId()));
178 template<
class Item>
const bool
181 const Item* cell = getValues(fId,
false);
184 if (cell->rawId() == fId )
190 template<
class Item>
bool
194 DetId fId(myItem.rawId());
195 unsigned int index=indexFor(fId);
199 if (index<0xFFFFFFFu) {
202 case(
HcalBarrel) :
if (!HBcontainer.size() ) initContainer(fId);
203 if (index < HBcontainer.size()) cell = &(HBcontainer.at(index) );
break;
204 case(
HcalEndcap) :
if (!HEcontainer.size() ) initContainer(fId);
205 if (index < HEcontainer.size()) cell = &(HEcontainer.at(index) );
break;
206 case(
HcalForward) :
if (!HFcontainer.size() ) initContainer(fId);
207 if (index < HFcontainer.size()) cell = &(HFcontainer.at(index) );
break;
208 case(
HcalOuter) :
if (!HOcontainer.size() ) initContainer(fId);
209 if (index < HOcontainer.size()) cell = &(HOcontainer.at(index) );
break;
211 if (index < HTcontainer.size()) cell = &(HTcontainer.at(index) );
break;
213 if (!CALIBcontainer.size() ) initContainer(fId);
214 if (index < CALIBcontainer.size()) cell = &(CALIBcontainer.at(index) );
221 if (!CASTORcontainer.size() ) initContainer(fId);
222 if (index < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index) );
224 if (!ZDCcontainer.size() ) initContainer(fId);
225 if (index < ZDCcontainer.size()) cell = &(ZDCcontainer.at(index) );
237 <<
" no valid filling possible for Conditions of type " << myname() <<
" for DetId " << textForId(fId);
241 template<
class Item> std::vector<DetId>
244 std::vector<DetId> channels;
246 for (
unsigned int i=0;
i<HBcontainer.size();
i++)
248 if (emptyItem.rawId() != HBcontainer.at(
i).rawId() )
249 channels.push_back(
DetId(HBcontainer.at(
i).rawId()) );
251 for (
unsigned int i=0;
i<HEcontainer.size();
i++)
253 if (emptyItem.rawId() != HEcontainer.at(
i).rawId() )
254 channels.push_back(
DetId(HEcontainer.at(
i).rawId()) );
256 for (
unsigned int i=0;
i<HOcontainer.size();
i++)
258 if (emptyItem.rawId() != HOcontainer.at(
i).rawId() )
259 channels.push_back(
DetId(HOcontainer.at(
i).rawId()) );
261 for (
unsigned int i=0;
i<HFcontainer.size();
i++)
263 if (emptyItem.rawId() != HFcontainer.at(
i).rawId() )
264 channels.push_back(
DetId(HFcontainer.at(
i).rawId()) );
266 for (
unsigned int i=0;
i<HTcontainer.size();
i++)
268 if (emptyItem.rawId() != HTcontainer.at(
i).rawId() )
269 channels.push_back(
DetId(HTcontainer.at(
i).rawId()) );
271 for (
unsigned int i=0;
i<ZDCcontainer.size();
i++)
273 if (emptyItem.rawId() != ZDCcontainer.at(
i).rawId() )
274 channels.push_back(
DetId(ZDCcontainer.at(
i).rawId()) );
276 for (
unsigned int i=0;
i<CALIBcontainer.size();
i++)
278 if (emptyItem.rawId() != CALIBcontainer.at(
i).rawId() )
279 channels.push_back(
DetId(CALIBcontainer.at(
i).rawId()) );
281 for (
unsigned int i=0;
i<CASTORcontainer.size();
i++)
283 if (emptyItem.rawId() != CASTORcontainer.at(
i).rawId() )
284 channels.push_back(
DetId(CASTORcontainer.at(
i).rawId()) );
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
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
#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)
Detector det() const
get the detector field from this detid
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