CMS 3D CMS Logo

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