#include <HcalDcsMap.h>
Classes | |
class | const_iterator |
class | Item |
Public Member Functions | |
const_iterator | beginByDcsId (void) const |
const_iterator | beginById (void) const |
const_iterator | endByDcsId (void) const |
const_iterator | endById (void) const |
HcalDcsMap () | |
const std::vector< HcalDcsDetId > | lookup (HcalDetId fId, HcalDcsDetId::DcsType type) const |
const std::vector< HcalDetId > | lookup (HcalDcsDetId fId) const |
bool | mapGeomId2DcsId (HcalDetId fId, HcalDcsDetId fDcsId) |
void | sort () |
void | sortByDcsId () const |
void | sortById () const |
~HcalDcsMap () | |
Protected Member Functions | |
std::vector< HcalDcsDetId > | allHcalDcsDetId () const |
std::vector< HcalGenericDetId > | allHcalDetId () const |
const std::vector< const Item * > | findByDcsId (unsigned long fDcsId) const |
const std::vector< const Item * > | findById (unsigned long fId) const |
const std::vector< const Item * > * | getItemsByDcsId (void) |
const std::vector< const Item * > * | getItemsById (void) |
Protected Attributes | |
std::vector< Item > | mItems |
std::vector< const Item * > | mItemsByDcsId |
std::vector< const Item * > | mItemsById |
bool | sortedByDcsId |
bool | sortedById |
Definition at line 23 of file HcalDcsMap.h.
HcalDcsMap::HcalDcsMap | ( | ) |
Definition at line 17 of file HcalDcsMap.cc.
: //FIXME mItems(HcalDcsDetId::maxLinearIndex+1), //mItems(0x7FFF), sortedById(false), sortedByDcsId(false){ }
HcalDcsMap::~HcalDcsMap | ( | ) |
Definition at line 24 of file HcalDcsMap.cc.
{ }
std::vector< HcalDcsDetId > HcalDcsMap::allHcalDcsDetId | ( | ) | const [protected] |
Definition at line 185 of file HcalDcsMap.cc.
References mItems, and query::result.
{ std::vector <HcalDcsDetId> result; for (std::vector<Item>::const_iterator item = mItems.begin (); item != mItems.end (); item++) if (item->mDcsId) result.push_back(HcalDcsDetId(item->mDcsId)); return result; }
std::vector< HcalGenericDetId > HcalDcsMap::allHcalDetId | ( | ) | const [protected] |
Definition at line 193 of file HcalDcsMap.cc.
References mItems, and query::result.
{ std::vector <HcalGenericDetId> result; std::set <unsigned long> allIds; for (std::vector<Item>::const_iterator item = mItems.begin (); item != mItems.end (); item++) if (item->mId) allIds.insert (item->mId); for (std::set <unsigned long>::const_iterator channel = allIds.begin (); channel != allIds.end (); channel++) { result.push_back (HcalGenericDetId (*channel)); } return result; }
HcalDcsMap::const_iterator HcalDcsMap::beginByDcsId | ( | void | ) | const |
Definition at line 52 of file HcalDcsMap.cc.
References HcalDcsMap::const_iterator::fIter, mItemsByDcsId, sortByDcsId(), and sortedByDcsId.
{ const_iterator _iter; if (!sortedByDcsId) sortByDcsId(); _iter.fIter = mItemsByDcsId.begin(); return _iter; }
HcalDcsMap::const_iterator HcalDcsMap::beginById | ( | void | ) | const |
Definition at line 45 of file HcalDcsMap.cc.
References HcalDcsMap::const_iterator::fIter, mItemsById, sortById(), and sortedById.
{ const_iterator _iter; if (!sortedById) sortById(); _iter.fIter = mItemsById.begin(); return _iter; }
HcalDcsMap::const_iterator HcalDcsMap::endByDcsId | ( | void | ) | const |
Definition at line 66 of file HcalDcsMap.cc.
References HcalDcsMap::const_iterator::fIter, mItemsByDcsId, sortByDcsId(), and sortedByDcsId.
{ const_iterator _iter; if (!sortedByDcsId) sortByDcsId(); _iter.fIter = mItemsByDcsId.end(); return _iter; }
HcalDcsMap::const_iterator HcalDcsMap::endById | ( | void | ) | const |
Definition at line 59 of file HcalDcsMap.cc.
References HcalDcsMap::const_iterator::fIter, mItemsById, sortById(), and sortedById.
{ const_iterator _iter; if (!sortedById) sortById(); _iter.fIter = mItemsById.end(); return _iter; }
const std::vector< const HcalDcsMap::Item * > HcalDcsMap::findByDcsId | ( | unsigned long | fDcsId | ) | const [protected] |
Definition at line 125 of file HcalDcsMap.cc.
References mItemsByDcsId, query::result, sortByDcsId(), sortedByDcsId, and filterCSVwithJSON::target.
Referenced by lookup(), and mapGeomId2DcsId().
{ Item target (0, fDcsId); std::vector<const HcalDcsMap::Item*>::const_iterator item; std::vector<const HcalDcsMap::Item *> result; if (!sortedByDcsId) sortByDcsId(); hcal_impl::LessByDcsId lessByDcsId; item = std::lower_bound (mItemsByDcsId.begin(), mItemsByDcsId.end(), &target, lessByDcsId); if (item == mItemsByDcsId.end() || (*item)->mDcsId != fDcsId) { // throw cms::Exception ("Conditions not found") << "Unavailable Dcs map for cell " << fDcsId; return result; } else{ if(item != mItemsByDcsId.end() && !lessByDcsId(&target, *item)){ result.push_back( *item ); ++item; } } return result; }
const std::vector< const HcalDcsMap::Item * > HcalDcsMap::findById | ( | unsigned long | fId | ) | const [protected] |
Definition at line 103 of file HcalDcsMap.cc.
References mItemsById, query::result, sortById(), sortedById, and filterCSVwithJSON::target.
Referenced by lookup().
{ Item target (fId, 0); std::vector<const HcalDcsMap::Item*>::const_iterator item; std::vector<const HcalDcsMap::Item *> result; if (!sortedById) sortById(); hcal_impl::LessById lessById; item = std::lower_bound (mItemsById.begin(), mItemsById.end(), &target, lessById); if (item == mItemsById.end() || (*item)->mId != fId){ // throw cms::Exception ("Conditions not found") << "Unavailable Dcs map for cell " << fId; return result; } else{ if(item != mItemsById.end() && !lessById(&target, *item)){ result.push_back( *item ); ++item; } } return result; }
const std::vector<const Item *>* HcalDcsMap::getItemsByDcsId | ( | void | ) | [inline, protected] |
const std::vector<const Item *>* HcalDcsMap::getItemsById | ( | void | ) | [inline, protected] |
const std::vector< HcalDcsDetId > HcalDcsMap::lookup | ( | HcalDetId | fId, |
HcalDcsDetId::DcsType | type | ||
) | const |
Definition at line 166 of file HcalDcsMap.cc.
References findById(), DetId::rawId(), HcalDcsDetId::ring(), HcalDcsDetId::slice(), HcalDcsDetId::subchannel(), HcalOtherDetId::subdet(), and HcalDcsDetId::zside().
{ const std::vector<const Item *> items = findById (fId.rawId ()); std::vector<HcalDcsDetId> _ids; for (std::vector<const Item *>::const_iterator item = items.begin(); item != items.end(); ++item){ HcalDcsDetId _id(*item ? (*item)->mId : 0); _ids.push_back( HcalDcsDetId(_id.subdet(), _id.zside()*_id.ring(), _id.slice(), type, _id.subchannel() ) ); } return _ids; }
const std::vector< HcalDetId > HcalDcsMap::lookup | ( | HcalDcsDetId | fId | ) | const |
Definition at line 147 of file HcalDcsMap.cc.
References HcalDcsDetId::DCSUNKNOWN, findByDcsId(), HcalDcsDetId::ring(), HcalDcsDetId::slice(), HcalDcsDetId::subchannel(), and HcalOtherDetId::subdet().
{ // DCS type is a part of DcsDetId but it does not make sense to keep // duplicate records in the map for DCS channels where only type is different. // Hence, the type in HcalDcsDetId is always forced to DCSUNKNOWN HcalDcsDetId fDcsId_notype(fId.subdet(), fId.ring(), // side is already included fId.slice(), HcalDcsDetId::DCSUNKNOWN, fId.subchannel()); const std::vector<const Item *> items = findByDcsId (fDcsId_notype.rawId ()); std::vector<HcalDetId> _ids; for (std::vector<const Item *>::const_iterator item = items.begin(); item != items.end(); ++item){ _ids.push_back( DetId(*item ? (*item)->mId : 0) ); } return _ids; }
bool HcalDcsMap::mapGeomId2DcsId | ( | HcalDetId | fId, |
HcalDcsDetId | fDcsId | ||
) |
Definition at line 205 of file HcalDcsMap.cc.
References HcalDcsDetId::DCSUNKNOWN, findByDcsId(), mItems, HcalDcsDetId::ring(), HcalDcsDetId::slice(), sortedByDcsId, sortedById, HcalDcsDetId::subchannel(), and HcalOtherDetId::subdet().
{ // DCS type is a part of DcsDetId but it does not make sense to keep // duplicate records in the map for DCS channels where only type is different. // Hence, the type in HcalDcsDetId is always forced to DCSUNKNOWN HcalDcsDetId fDcsId_notype(fDcsId.subdet(), fDcsId.ring(), // side is included fDcsId.slice(), HcalDcsDetId::DCSUNKNOWN, fDcsId.subchannel()); const std::vector<const Item *> items = findByDcsId(fDcsId_notype); for (std::vector<const Item *>::const_iterator item = items.begin(); item != items.end(); ++item){ if ((*item)->mId == fId){ edm::LogWarning("HCAL") << "HcalDcsMap::mapGeomId2DcsId-> Geom channel " << fId << " already mapped to DCS channel " << fDcsId_notype; return false; // element already exists } } Item _item(fId, fDcsId_notype); mItems.push_back(_item); sortedById=false; sortedByDcsId=false; return true; }
void HcalDcsMap::sort | ( | ) | [inline] |
void HcalDcsMap::sortByDcsId | ( | ) | const |
Definition at line 243 of file HcalDcsMap.cc.
References i, mItems, mItemsByDcsId, sort(), and sortedByDcsId.
Referenced by beginByDcsId(), endByDcsId(), and findByDcsId().
{ if (!sortedByDcsId) { mItemsByDcsId.clear(); for (std::vector<Item>::const_iterator i=mItems.begin(); i!=mItems.end(); ++i) { if (i->mDcsId) mItemsByDcsId.push_back(&(*i)); } std::sort (mItemsByDcsId.begin(), mItemsByDcsId.end(), hcal_impl::LessByDcsId ()); sortedByDcsId=true; } }
void HcalDcsMap::sortById | ( | ) | const |
Definition at line 232 of file HcalDcsMap.cc.
References i, mItems, mItemsById, sort(), and sortedById.
Referenced by beginById(), endById(), and findById().
{ if (!sortedById) { mItemsById.clear(); for (std::vector<Item>::const_iterator i=mItems.begin(); i!=mItems.end(); ++i) { if (i->mDcsId) mItemsById.push_back(&(*i)); } std::sort (mItemsById.begin(), mItemsById.end(), hcal_impl::LessById ()); sortedById=true; } }
std::vector<Item> HcalDcsMap::mItems [protected] |
Definition at line 103 of file HcalDcsMap.h.
Referenced by allHcalDcsDetId(), allHcalDetId(), mapGeomId2DcsId(), sortByDcsId(), and sortById().
std::vector<const Item*> HcalDcsMap::mItemsByDcsId [mutable, protected] |
Definition at line 107 of file HcalDcsMap.h.
Referenced by beginByDcsId(), endByDcsId(), findByDcsId(), getItemsByDcsId(), and sortByDcsId().
std::vector<const Item*> HcalDcsMap::mItemsById [mutable, protected] |
Definition at line 104 of file HcalDcsMap.h.
Referenced by beginById(), endById(), findById(), getItemsById(), and sortById().
bool HcalDcsMap::sortedByDcsId [mutable, protected] |
Definition at line 108 of file HcalDcsMap.h.
Referenced by beginByDcsId(), endByDcsId(), findByDcsId(), mapGeomId2DcsId(), and sortByDcsId().
bool HcalDcsMap::sortedById [mutable, protected] |
Definition at line 105 of file HcalDcsMap.h.
Referenced by beginById(), endById(), findById(), mapGeomId2DcsId(), and sortById().