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 }
funct::false
false
Definition: Factorize.h:29
CastorCalibrationsSet::clear
void clear()
Definition: CastorCalibrationsSet.cc:38
HcalGenericDetId
Definition: HcalGenericDetId.h:15
CastorCalibrationsSet::setCalibrations
void setCalibrations(const DetId id, const CastorCalibrations &ca)
Definition: CastorCalibrationsSet.cc:21
CastorCalibrationsSet::CalibSetObject
Definition: CastorCalibrationsSet.h:17
HcalGenericDetId.h
CastorCalibrationsSet::sorted_
bool sorted_
Definition: CastorCalibrationsSet.h:27
CastorCalibrationsSet::sort
void sort()
Definition: CastorCalibrationsSet.cc:32
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
DetId
Definition: DetId.h:17
CastorCalibrations
Definition: CastorCalibrations.h:9
calib
Definition: CalibElectron.h:12
CastorCalibrationsSet.h
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
CastorCalibrationsSet::getCalibrations
const CastorCalibrations & getCalibrations(const DetId id) const
Definition: CastorCalibrationsSet.cc:8
CastorCalibrationsSet::CastorCalibrationsSet
CastorCalibrationsSet()
Definition: CastorCalibrationsSet.cc:6
CastorCalibrationsSet::mItems
std::vector< CalibSetObject > mItems
Definition: CastorCalibrationsSet.h:26
CastorCalibrationsSet::Item
CalibSetObject Item
Definition: CastorCalibrationsSet.h:24
Exception.h
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
cms::Exception
Definition: Exception.h:70