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
7
CastorCalibrationsSet::CastorCalibrationsSet
()
8
: sorted_ (
false
) {}
9
10
const
CastorCalibrations
&
CastorCalibrationsSet::getCalibrations
(
const
DetId
fId)
const
{
11
Item
target
(fId);
12
std::vector<Item>::const_iterator cell;
13
if
(
sorted_
) {
14
cell = std::lower_bound (
mItems
.begin(),
mItems
.end(),
target
);
15
}
16
else
{
17
cell =
std::find
(
mItems
.begin(),
mItems
.end(),
target
);
18
}
19
if
(cell ==
mItems
.end() || cell->id != fId)
20
throw
cms::Exception
(
"Conditions not found"
) <<
"Unavailable CastorCalibrations for cell "
<<
HcalGenericDetId
(fId);
21
return
cell->calib;
22
}
23
24
void
CastorCalibrationsSet::setCalibrations
(
DetId
fId,
const
CastorCalibrations
& ca) {
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
{
29
mItems
.push_back(
Item
(fId));
30
mItems
.at(
mItems
.size()-1).
calib
=ca;
31
return
;
32
}
33
34
cell->calib=ca;
35
}
36
void
CastorCalibrationsSet::sort
() {
37
if
(!
sorted_
) {
38
std::sort (
mItems
.begin(),
mItems
.end());
39
sorted_
=
true
;
40
}
41
}
42
void
CastorCalibrationsSet::clear
() {
43
mItems
.clear();
44
}
funct::false
false
Definition:
Factorize.h:35
CastorCalibrationsSet::Item
CalibSetObject Item
Definition:
CastorCalibrationsSet.h:23
CastorCalibrations
Definition:
CastorCalibrations.h:9
edmPickEvents.target
target
Definition:
edmPickEvents.py:310
CastorCalibrationsSet::CastorCalibrationsSet
CastorCalibrationsSet()
Definition:
CastorCalibrationsSet.cc:7
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:10
CastorCalibrationsSet::sorted_
bool sorted_
Definition:
CastorCalibrationsSet.h:26
HcalGenericDetId.h
CastorCalibrationsSet::clear
void clear()
Definition:
CastorCalibrationsSet.cc:42
CastorCalibrationsSet.h
calib
Definition:
CalibElectron.h:14
CastorCalibrationsSet::setCalibrations
void setCalibrations(const DetId id, const CastorCalibrations &ca)
Definition:
CastorCalibrationsSet.cc:24
CastorCalibrationsSet::sort
void sort()
Definition:
CastorCalibrationsSet.cc:36
CastorCalibrationsSet::mItems
std::vector< CalibSetObject > mItems
Definition:
CastorCalibrationsSet.h:25
CastorCalibrationsSet::CalibSetObject
Definition:
CastorCalibrationsSet.h:16
HcalGenericDetId
Definition:
HcalGenericDetId.h:15
DetId
Definition:
DetId.h:18
Exception.h
cms::Exception
Definition:
Exception.h:67
Generated for CMSSW Reference Manual by
1.8.11