CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalCalibrationWidthsSet.cc
Go to the documentation of this file.
4 #include <algorithm>
5 #include <iostream>
6 
7 
9  : sorted_ (false) {}
10 
12  Item target(fId);
13  std::vector<Item>::const_iterator cell;
14  if (sorted_) {
15  cell = std::lower_bound (mItems.begin(), mItems.end(), target);
16  }
17  else {
18  cell = std::find(mItems.begin(),mItems.end(), target);
19  }
20  if (cell == mItems.end() || cell->id != fId)
21  throw cms::Exception ("Conditions not found") << "Unavailable HcalCalibrationWidths for cell " << HcalGenericDetId(fId);
22  return cell->calib;
23 }
24 
26  sorted_=false;
27  std::vector<Item>::iterator cell=std::find(mItems.begin(),mItems.end(),Item(fId)); //slow, but guaranteed
28  if (cell==mItems.end())
29  {
30  mItems.push_back(Item(fId));
31  mItems.at(mItems.size()-1).calib=ca;
32  return;
33  }
34  cell->calib=ca;
35 }
37  if (!sorted_) {
38  std::sort (mItems.begin(), mItems.end());
39  sorted_ = true;
40  }
41 }
43  mItems.clear();
44 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
void setCalibrationWidths(const DetId id, const HcalCalibrationWidths &ca)
std::vector< CalibWidthSetObject > mItems
const HcalCalibrationWidths & getCalibrationWidths(const DetId id) const
Definition: DetId.h:20