#include <CalibFormats/CastorObjects/interface/CastorCalibrationsSet.h>
Public Member Functions | |
CastorCalibrationsSet () | |
void | clear () |
const CastorCalibrations & | getCalibrations (const DetId id) const |
void | setCalibrations (const DetId id, const CastorCalibrations &ca) |
void | sort () |
Private Types | |
typedef CalibSetObject | Item |
Private Attributes | |
CastorCalibrations | dummy |
std::vector< CalibSetObject > | mItems |
bool | sorted_ |
Classes | |
struct | CalibSetObject |
Definition at line 8 of file CastorCalibrationsSet.h.
typedef CalibSetObject CastorCalibrationsSet::Item [private] |
Definition at line 23 of file CastorCalibrationsSet.h.
CastorCalibrationsSet::CastorCalibrationsSet | ( | ) |
Definition at line 36 of file CastorCalibrationsSet.cc.
References mItems.
00036 { 00037 mItems.clear(); 00038 }
const CastorCalibrations & CastorCalibrationsSet::getCalibrations | ( | const DetId | id | ) | const |
Definition at line 10 of file CastorCalibrationsSet.cc.
References find(), mItems, sorted_, and target.
00010 { 00011 Item target(fId); 00012 std::vector<Item>::const_iterator cell; 00013 if (sorted_) { 00014 cell = std::lower_bound (mItems.begin(), mItems.end(), target); 00015 } 00016 else { 00017 cell = std::find(mItems.begin(),mItems.end(), target); 00018 } 00019 if (cell == mItems.end() || cell->id != fId) 00020 throw cms::Exception ("Conditions not found") << "Unavailable CastorCalibrations for cell " << HcalGenericDetId(fId); 00021 return cell->calib; 00022 }
void CastorCalibrationsSet::setCalibrations | ( | const DetId | id, | |
const CastorCalibrations & | ca | |||
) |
Definition at line 24 of file CastorCalibrationsSet.cc.
References find(), mItems, and sorted_.
00024 { 00025 sorted_=false; 00026 std::vector<Item>::iterator cell=std::find(mItems.begin(),mItems.end(),Item(fId)); //slow, but guaranteed 00027 if (cell==mItems.end()) mItems.push_back(Item(fId)); 00028 cell->calib=ca; 00029 }
void CastorCalibrationsSet::sort | ( | ) |
Definition at line 30 of file CastorCalibrationsSet.cc.
References mItems, python::multivaluedict::sort(), and sorted_.
00030 { 00031 if (!sorted_) { 00032 std::sort (mItems.begin(), mItems.end()); 00033 sorted_ = true; 00034 } 00035 }
Definition at line 24 of file CastorCalibrationsSet.h.
std::vector<CalibSetObject> CastorCalibrationsSet::mItems [private] |
Definition at line 25 of file CastorCalibrationsSet.h.
Referenced by clear(), getCalibrations(), setCalibrations(), and sort().
bool CastorCalibrationsSet::sorted_ [private] |
Definition at line 26 of file CastorCalibrationsSet.h.
Referenced by getCalibrations(), setCalibrations(), and sort().