test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalCalibrationsSet.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  } else {
17  cell = std::find(mItems.begin(),mItems.end(), target);
18  }
19  if ((cell == mItems.end()) || (!hcalEqualDetId(cell->id.rawId(),fId)))
20  throw cms::Exception ("Conditions not found") << "Unavailable HcalCalibrations 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  mItems.push_back(Item(fId));
29  mItems.at(mItems.size()-1).calib=ca;
30  return;
31  }
32  cell->calib=ca;
33 }
34 
36  if (!sorted_) {
37  std::sort (mItems.begin(), mItems.end());
38  sorted_ = true;
39  }
40 }
41 
43  mItems.clear();
44 }
bool hcalEqualDetId(Item *cell, const DetId &fId)
std::vector< CalibSetObject > mItems
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
Definition: DetId.h:18
const HcalCalibrations & getCalibrations(const DetId id) const
void setCalibrations(const DetId id, const HcalCalibrations &ca)
volatile std::atomic< bool > shutdown_flag false