CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorCalibrationsSet.cc
Go to the documentation of this file.
4 #include <algorithm>
5 
6 
8  : sorted_ (false) {}
9 
11  Item target(fId);
12  std::vector<Item>::const_iterator cell;
13  if (sorted_) {
14  cell = std::lower_bound (mItems.begin(), mItems.end(), target);
15  }
16  else {
17  cell = std::find(mItems.begin(),mItems.end(), target);
18  }
19  if (cell == mItems.end() || cell->id != fId)
20  throw cms::Exception ("Conditions not found") << "Unavailable CastorCalibrations for cell " << HcalGenericDetId(fId);
21  return cell->calib;
22 }
23 
25  sorted_=false;
26  std::vector<Item>::iterator cell=std::find(mItems.begin(),mItems.end(),Item(fId)); //slow, but guaranteed
27  if (cell==mItems.end())
28  {
29  mItems.push_back(Item(fId));
30  mItems.at(mItems.size()-1).calib=ca;
31  return;
32  }
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
const CastorCalibrations & getCalibrations(const DetId id) const
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
void setCalibrations(const DetId id, const CastorCalibrations &ca)
std::vector< CalibSetObject > mItems
Definition: DetId.h:20