CMS 3D CMS Logo

HcalCalibrationWidthsSet.cc
Go to the documentation of this file.
4 #include <algorithm>
5 #include <iostream>
6 #include <utility>
7 
9 {}
10 
12  DetId fId2(hcalTransformedId(fId));
13  auto cell = mItems.find(fId2);
14  if ((cell == mItems.end()) || (!hcalEqualDetId(cell->first,fId2)))
15  throw cms::Exception ("Conditions not found") << "Unavailable HcalCalibrationWidths for cell " << HcalGenericDetId(fId);
16  return cell->second.calib;
17 }
18 
20  DetId fId2(hcalTransformedId(fId));
21  auto cell = mItems.find(fId2);
22  if (cell==mItems.end()) {
23  auto result = mItems.emplace(fId2,fId2);
24  result.first->second.calib=ca;
25  return;
26  }
27  cell->second.calib=ca;
28 }
29 
31  mItems.clear();
32 }
33 
34 std::vector<DetId> HcalCalibrationWidthsSet::getAllChannels() const {
35  std::vector<DetId> channels;
36  channels.reserve(mItems.size());
37  for(const auto& tmp : mItems){
38  channels.push_back(tmp.second.id);
39  }
40  return channels;
41 }
bool hcalEqualDetId(Item *cell, const DetId &fId)
DetId hcalTransformedId(const DetId &aid)
std::vector< DetId > getAllChannels() const
std::unordered_map< uint32_t, CalibWidthSetObject > mItems
void setCalibrationWidths(const DetId id, const HcalCalibrationWidths &ca)
const HcalCalibrationWidths & getCalibrationWidths(const DetId id) const
Definition: DetId.h:18
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100