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 }
funct::false
false
Definition: Factorize.h:29
HcalGenericDetId
Definition: HcalGenericDetId.h:15
CastorCalibrationWidthsSet::setCalibrationWidths
void setCalibrationWidths(const DetId id, const CastorCalibrationWidths &ca)
Definition: CastorCalibrationWidthsSet.cc:23
HcalGenericDetId.h
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
CastorCalibrationWidthsSet::CalibWidthSetObject
Definition: CastorCalibrationWidthsSet.h:22
DetId
Definition: DetId.h:17
CastorCalibrationWidthsSet::sorted_
bool sorted_
Definition: CastorCalibrationWidthsSet.h:32
CastorCalibrationWidthsSet::Item
CalibWidthSetObject Item
Definition: CastorCalibrationWidthsSet.h:29
CastorCalibrationWidthsSet::clear
void clear()
Definition: CastorCalibrationWidthsSet.cc:39
CastorCalibrationWidthsSet::sort
void sort()
Definition: CastorCalibrationWidthsSet.cc:33
CastorCalibrationWidthsSet::mItems
std::vector< CalibWidthSetObject > mItems
Definition: CastorCalibrationWidthsSet.h:31
calib
Definition: CalibElectron.h:12
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
CastorCalibrationWidthsSet::CastorCalibrationWidthsSet
CastorCalibrationWidthsSet()
Definition: CastorCalibrationWidthsSet.cc:7
CastorCalibrationWidthsSet::getCalibrationWidths
const CastorCalibrationWidths & getCalibrationWidths(const DetId id) const
Definition: CastorCalibrationWidthsSet.cc:9
CastorCalibrationWidthsSet.h
Exception.h
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
CastorCalibrationWidths
Definition: CastorCalibrationWidths.h:9
cms::Exception
Definition: Exception.h:70