CMS 3D CMS Logo

CastorCalibrationsSet.cc
Go to the documentation of this file.
4 #include <algorithm>
5 
7 
9  Item target(fId);
10  std::vector<Item>::const_iterator cell;
11  if (sorted_) {
12  cell = std::lower_bound(mItems.begin(), mItems.end(), target);
13  } else {
14  cell = std::find(mItems.begin(), mItems.end(), target);
15  }
16  if (cell == mItems.end() || cell->id != fId)
17  throw cms::Exception("Conditions not found") << "Unavailable CastorCalibrations for cell " << HcalGenericDetId(fId);
18  return cell->calib;
19 }
20 
22  sorted_ = false;
23  std::vector<Item>::iterator cell = std::find(mItems.begin(), mItems.end(), Item(fId)); //slow, but guaranteed
24  if (cell == mItems.end()) {
25  mItems.push_back(Item(fId));
26  mItems.at(mItems.size() - 1).calib = ca;
27  return;
28  }
29 
30  cell->calib = ca;
31 }
33  if (!sorted_) {
34  std::sort(mItems.begin(), mItems.end());
35  sorted_ = true;
36  }
37 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void setCalibrations(const DetId id, const CastorCalibrations &ca)
std::vector< CalibSetObject > mItems
Definition: DetId.h:17
const CastorCalibrations & getCalibrations(const DetId id) const