CalibFormats
HcalObjects
src
HcalCalibrationsSet.cc
Go to the documentation of this file.
1
#include "
CalibFormats/HcalObjects/interface/HcalCalibrationsSet.h
"
2
#include "
DataFormats/HcalDetId/interface/HcalGenericDetId.h
"
3
#include "
FWCore/Utilities/interface/Exception.h
"
4
#include <algorithm>
5
#include <iostream>
6
#include <utility>
7
8
HcalCalibrationsSet::HcalCalibrationsSet
() {}
9
10
const
HcalCalibrations
&
HcalCalibrationsSet::getCalibrations
(
const
DetId
fId)
const
{
11
DetId
fId2(
hcalTransformedId
(fId));
12
auto
cell =
mItems
.find(fId2);
13
if
((cell ==
mItems
.end()) || (!
hcalEqualDetId
(cell->first, fId2)))
14
throw
cms::Exception
(
"Conditions not found"
) <<
"Unavailable HcalCalibrations for cell "
<<
HcalGenericDetId
(fId);
15
return
cell->second.calib;
16
}
17
18
void
HcalCalibrationsSet::setCalibrations
(
DetId
fId,
const
HcalCalibrations
& ca) {
19
DetId
fId2(
hcalTransformedId
(fId));
20
auto
cell =
mItems
.find(fId2);
21
if
(cell ==
mItems
.end()) {
22
auto
result
=
mItems
.emplace(fId2, fId2);
23
result
.first->second.calib = ca;
24
return
;
25
}
26
cell->second.calib = ca;
27
}
28
29
void
HcalCalibrationsSet::clear
() {
mItems
.clear(); }
30
31
std::vector<DetId>
HcalCalibrationsSet::getAllChannels
()
const
{
32
std::vector<DetId>
channels
;
33
channels
.reserve(
mItems
.size());
34
for
(
const
auto
&
tmp
:
mItems
) {
35
channels
.push_back(
tmp
.second.id);
36
}
37
return
channels
;
38
}
HcalCalibrationsSet::clear
void clear()
Definition:
HcalCalibrationsSet.cc:29
HcalGenericDetId
Definition:
HcalGenericDetId.h:15
HcalCalibrationsSet::HcalCalibrationsSet
HcalCalibrationsSet()
Definition:
HcalCalibrationsSet.cc:8
HcalGenericDetId.h
createJobs.tmp
tmp
align.sh
Definition:
createJobs.py:716
HcalCalibrationsSet::getCalibrations
const HcalCalibrations & getCalibrations(const DetId id) const
Definition:
HcalCalibrationsSet.cc:10
DetId
Definition:
DetId.h:17
HcalCalibrationsSet::getAllChannels
std::vector< DetId > getAllChannels() const
Definition:
HcalCalibrationsSet.cc:31
hcalTransformedId
DetId hcalTransformedId(const DetId &aid)
Definition:
HcalDetIdRelationship.cc:11
HcalCalibrations
Definition:
HcalCalibrations.h:9
HcalCalibrationsSet.h
hcalEqualDetId
bool hcalEqualDetId(Item *cell, const DetId &fId)
Definition:
HcalDetIdRelationship.h:11
Exception
Definition:
hltDiff.cc:245
ewkTauDQM_cfi.channels
channels
Definition:
ewkTauDQM_cfi.py:14
Exception.h
mps_fire.result
result
Definition:
mps_fire.py:311
HcalCalibrationsSet::mItems
std::unordered_map< uint32_t, CalibSetObject > mItems
Definition:
HcalCalibrationsSet.h:34
HcalCalibrationsSet::setCalibrations
void setCalibrations(const DetId id, const HcalCalibrations &ca)
Definition:
HcalCalibrationsSet.cc:18
Generated for CMSSW Reference Manual by
1.8.16