Main Page
Namespaces
Classes
Package Documentation
CalibFormats
CastorObjects
src
CastorCalibrationsSet.cc
Go to the documentation of this file.
1
#include "
CalibFormats/CastorObjects/interface/CastorCalibrationsSet.h
"
2
#include "
DataFormats/HcalDetId/interface/HcalGenericDetId.h
"
3
#include "
FWCore/Utilities/interface/Exception.h
"
4
#include <algorithm>
5
6
CastorCalibrationsSet::CastorCalibrationsSet
() : sorted_(
false
) {}
7
8
const
CastorCalibrations
&
CastorCalibrationsSet::getCalibrations
(
const
DetId
fId)
const
{
9
Item
target
(fId);
10
std::vector<Item>::const_iterator cell;
11
if
(
sorted_
) {
12
cell =
std::lower_bound
(
mItems
.begin(),
mItems
.end(),
target
);
13
}
else
{
14
cell =
std::find
(
mItems
.begin(),
mItems
.end(),
target
);
15
}
16
if
(cell ==
mItems
.end() || cell->id != fId)
17
throw
cms::Exception
(
"Conditions not found"
) <<
"Unavailable CastorCalibrations for cell "
<<
HcalGenericDetId
(fId);
18
return
cell->calib;
19
}
20
21
void
CastorCalibrationsSet::setCalibrations
(
DetId
fId,
const
CastorCalibrations
& ca) {
22
sorted_
=
false
;
23
std::vector<Item>::iterator cell =
std::find
(
mItems
.begin(),
mItems
.end(),
Item
(fId));
//slow, but guaranteed
24
if
(cell ==
mItems
.end()) {
25
mItems
.push_back(
Item
(fId));
26
mItems
.at(
mItems
.size() - 1).
calib
= ca;
27
return
;
28
}
29
30
cell->calib = ca;
31
}
32
void
CastorCalibrationsSet::sort
() {
33
if
(!
sorted_
) {
34
std::sort
(
mItems
.begin(),
mItems
.end());
35
sorted_
=
true
;
36
}
37
}
38
void
CastorCalibrationsSet::clear
() {
mItems
.clear(); }
jetUpdater_cfi.sort
sort
Definition:
jetUpdater_cfi.py:29
funct::false
false
Definition:
Factorize.h:36
CastorCalibrationsSet::Item
CalibSetObject Item
Definition:
CastorCalibrationsSet.h:24
CastorCalibrations
Definition:
CastorCalibrations.h:9
edmPickEvents.target
target
Definition:
edmPickEvents.py:310
CastorCalibrationsSet::CastorCalibrationsSet
CastorCalibrationsSet()
Definition:
CastorCalibrationsSet.cc:6
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition:
FindCaloHit.cc:20
CastorCalibrationsSet::getCalibrations
const CastorCalibrations & getCalibrations(const DetId id) const
Definition:
CastorCalibrationsSet.cc:8
CastorCalibrationsSet::sorted_
bool sorted_
Definition:
CastorCalibrationsSet.h:27
HcalGenericDetId.h
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition:
pfDeepBoostedJetPreprocessParams_cfi.py:15
CastorCalibrationsSet::clear
void clear()
Definition:
CastorCalibrationsSet.cc:38
CastorCalibrationsSet.h
calib
Definition:
CalibElectron.h:14
CastorCalibrationsSet::setCalibrations
void setCalibrations(const DetId id, const CastorCalibrations &ca)
Definition:
CastorCalibrationsSet.cc:21
CastorCalibrationsSet::sort
void sort()
Definition:
CastorCalibrationsSet.cc:32
CastorCalibrationsSet::mItems
std::vector< CalibSetObject > mItems
Definition:
CastorCalibrationsSet.h:26
CastorCalibrationsSet::CalibSetObject
Definition:
CastorCalibrationsSet.h:17
HcalGenericDetId
Definition:
HcalGenericDetId.h:15
DetId
Definition:
DetId.h:18
Exception.h
cms::Exception
Definition:
Exception.h:68
Generated for CMSSW Reference Manual by
1.8.11