CalibFormats
HcalObjects
src
HcalCalibrationWidthsSet.cc
Go to the documentation of this file.
1
#include "
CalibFormats/HcalObjects/interface/HcalCalibrationWidthsSet.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
HcalCalibrationWidthsSet::HcalCalibrationWidthsSet
() {}
9
10
const
HcalCalibrationWidths
&
HcalCalibrationWidthsSet::getCalibrationWidths
(
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"
)
15
<<
"Unavailable HcalCalibrationWidths for cell "
<<
HcalGenericDetId
(fId);
16
return
cell->second.calib;
17
}
18
19
void
HcalCalibrationWidthsSet::setCalibrationWidths
(
DetId
fId,
const
HcalCalibrationWidths
& ca) {
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
30
void
HcalCalibrationWidthsSet::clear
() {
mItems
.clear(); }
31
32
std::vector<DetId>
HcalCalibrationWidthsSet::getAllChannels
()
const
{
33
std::vector<DetId>
channels
;
34
channels
.reserve(
mItems
.size());
35
for
(
const
auto
&
tmp
:
mItems
) {
36
channels
.push_back(
tmp
.second.id);
37
}
38
return
channels
;
39
}
HcalGenericDetId
Definition:
HcalGenericDetId.h:15
HcalGenericDetId.h
HcalCalibrationWidthsSet::getCalibrationWidths
const HcalCalibrationWidths & getCalibrationWidths(const DetId id) const
Definition:
HcalCalibrationWidthsSet.cc:10
createJobs.tmp
tmp
align.sh
Definition:
createJobs.py:716
HcalCalibrationWidthsSet::getAllChannels
std::vector< DetId > getAllChannels() const
Definition:
HcalCalibrationWidthsSet.cc:32
DetId
Definition:
DetId.h:17
HcalCalibrationWidthsSet::HcalCalibrationWidthsSet
HcalCalibrationWidthsSet()
Definition:
HcalCalibrationWidthsSet.cc:8
hcalTransformedId
DetId hcalTransformedId(const DetId &aid)
Definition:
HcalDetIdRelationship.cc:11
HcalCalibrationWidthsSet::mItems
std::unordered_map< uint32_t, CalibWidthSetObject > mItems
Definition:
HcalCalibrationWidthsSet.h:34
HcalCalibrationWidthsSet.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
HcalCalibrationWidths
Definition:
HcalCalibrationWidths.h:9
HcalCalibrationWidthsSet::clear
void clear()
Definition:
HcalCalibrationWidthsSet.cc:30
HcalCalibrationWidthsSet::setCalibrationWidths
void setCalibrationWidths(const DetId id, const HcalCalibrationWidths &ca)
Definition:
HcalCalibrationWidthsSet.cc:19
Generated for CMSSW Reference Manual by
1.8.16