1 #ifndef HcalCondObjectContainer_h
2 #define HcalCondObjectContainer_h
67 typedef std::pair< std::string, std::vector<Item> >
tHcalCont;
105 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*
133 unsigned int index=indexFor(fId);
135 const Item* cell =
NULL;
137 if (index<0xFFFFFFFu) {
140 case(
HcalBarrel) :
if (index < HBcontainer.size()) cell = &(HBcontainer.at(index) );
break;
141 case(
HcalEndcap) :
if (index < HEcontainer.size()) cell = &(HEcontainer.at(index) );
break;
142 case(
HcalForward) :
if (index < HFcontainer.size()) cell = &(HFcontainer.at(index) );
break;
143 case(
HcalOuter) :
if (index < HOcontainer.size()) cell = &(HOcontainer.at(index) );
break;
144 case(
HcalTriggerTower) :
if (index < HTcontainer.size()) cell = &(HTcontainer.at(index) );
break;
146 if (index < CALIBcontainer.size()) cell = &(CALIBcontainer.at(index) );
152 if (index < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index) );
154 if (index < ZDCcontainer.size()) cell = &(ZDCcontainer.at(index) );
162 <<
"Unavailable Conditions of type " << myname() <<
" for cell " << textForId(fId);
167 <<
"Requested conditions of type " << myname() <<
" for cell " << textForId(fId) <<
" got conditions for cell " << textForId(
DetId(cell->rawId()));
175 template<
class Item>
const bool
177 const Item* cell = getValues(fId,
false);
186 template<
class Item>
bool
189 DetId fId(myItem.rawId());
190 unsigned int index=indexFor(fId);
194 if (index<0xFFFFFFFu) {
197 case(
HcalBarrel) :
if (!HBcontainer.size() ) initContainer(fId);
198 if (index < HBcontainer.size()) cell = &(HBcontainer.at(index) );
break;
199 case(
HcalEndcap) :
if (!HEcontainer.size() ) initContainer(fId);
200 if (index < HEcontainer.size()) cell = &(HEcontainer.at(index) );
break;
201 case(
HcalForward) :
if (!HFcontainer.size() ) initContainer(fId);
202 if (index < HFcontainer.size()) cell = &(HFcontainer.at(index) );
break;
203 case(
HcalOuter) :
if (!HOcontainer.size() ) initContainer(fId);
204 if (index < HOcontainer.size()) cell = &(HOcontainer.at(index) );
break;
206 if (index < HTcontainer.size()) cell = &(HTcontainer.at(index) );
break;
208 if (!CALIBcontainer.size() ) initContainer(fId);
209 if (index < CALIBcontainer.size()) cell = &(CALIBcontainer.at(index) );
216 if (!CASTORcontainer.size() ) initContainer(fId);
217 if (index < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index) );
219 if (!ZDCcontainer.size() ) initContainer(fId);
220 if (index < ZDCcontainer.size()) cell = &(ZDCcontainer.at(index) );
232 <<
" no valid filling possible for Conditions of type " << myname() <<
" for DetId " << textForId(fId);
236 template<
class Item> std::vector<DetId>
238 std::vector<DetId> channels;
240 for (
unsigned int i=0;
i<HBcontainer.size();
i++) {
241 if (emptyItem.rawId() != HBcontainer.at(
i).rawId() )
242 channels.push_back(
DetId(HBcontainer.at(
i).rawId()) );
244 for (
unsigned int i=0;
i<HEcontainer.size();
i++) {
245 if (emptyItem.rawId() != HEcontainer.at(
i).rawId() )
246 channels.push_back(
DetId(HEcontainer.at(
i).rawId()) );
248 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++) {
253 if (emptyItem.rawId() != HFcontainer.at(
i).rawId() )
254 channels.push_back(
DetId(HFcontainer.at(
i).rawId()) );
256 for (
unsigned int i=0;
i<HTcontainer.size();
i++) {
257 if (emptyItem.rawId() != HTcontainer.at(
i).rawId() )
258 channels.push_back(
DetId(HTcontainer.at(
i).rawId()) );
260 for (
unsigned int i=0;
i<ZDCcontainer.size();
i++) {
261 if (emptyItem.rawId() != ZDCcontainer.at(
i).rawId() )
262 channels.push_back(
DetId(ZDCcontainer.at(
i).rawId()) );
264 for (
unsigned int i=0;
i<CALIBcontainer.size();
i++) {
265 if (emptyItem.rawId() != CALIBcontainer.at(
i).rawId() )
266 channels.push_back(
DetId(CALIBcontainer.at(
i).rawId()) );
268 for (
unsigned int i=0;
i<CASTORcontainer.size();
i++) {
269 if (emptyItem.rawId() != CASTORcontainer.at(
i).rawId() )
270 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
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