Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
7
8
HcalCalibrationWidthsSet::HcalCalibrationWidthsSet
()
9
: sorted_ (
false
) {}
10
11
const
HcalCalibrationWidths
&
HcalCalibrationWidthsSet::getCalibrationWidths
(
const
DetId
fId)
const
{
12
Item
target
(fId);
13
std::vector<Item>::const_iterator cell;
14
if
(
sorted_
) {
15
cell = std::lower_bound (
mItems
.begin(),
mItems
.end(),
target
);
16
}
17
else
{
18
cell =
std::find
(
mItems
.begin(),
mItems
.end(),
target
);
19
}
20
if
(cell ==
mItems
.end() || cell->id != fId)
21
throw
cms::Exception
(
"Conditions not found"
) <<
"Unavailable HcalCalibrationWidths for cell "
<<
HcalGenericDetId
(fId);
22
return
cell->calib;
23
}
24
25
void
HcalCalibrationWidthsSet::setCalibrationWidths
(
DetId
fId,
const
HcalCalibrationWidths
& ca) {
26
sorted_
=
false
;
27
std::vector<Item>::iterator cell=
std::find
(
mItems
.begin(),
mItems
.end(),
Item
(fId));
//slow, but guaranteed
28
if
(cell==
mItems
.end())
29
{
30
mItems
.push_back(
Item
(fId));
31
mItems
.at(
mItems
.size()-1).
calib
=ca;
32
return
;
33
}
34
cell->calib=ca;
35
}
36
void
HcalCalibrationWidthsSet::sort
() {
37
if
(!
sorted_
) {
38
std::sort
(
mItems
.begin(),
mItems
.end());
39
sorted_
=
true
;
40
}
41
}
42
void
HcalCalibrationWidthsSet::clear
() {
43
mItems
.clear();
44
}
HcalCalibrationWidthsSet::CalibWidthSetObject
Definition:
HcalCalibrationWidthsSet.h:22
HcalCalibrationWidthsSet::sort
void sort()
Definition:
HcalCalibrationWidthsSet.cc:36
funct::false
false
Definition:
Factorize.h:34
python.multivaluedict.sort
def sort
Definition:
multivaluedict.py:161
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition:
FindCaloHit.cc:7
HcalGenericDetId.h
calib
MVATrainerComputer * calib
Definition:
MVATrainer.cc:64
HcalCalibrationWidthsSet::HcalCalibrationWidthsSet
HcalCalibrationWidthsSet()
Definition:
HcalCalibrationWidthsSet.cc:8
HcalCalibrationWidthsSet::clear
void clear()
Definition:
HcalCalibrationWidthsSet.cc:42
HcalCalibrationWidthsSet::sorted_
bool sorted_
Definition:
HcalCalibrationWidthsSet.h:32
HcalCalibrationWidthsSet::Item
CalibWidthSetObject Item
Definition:
HcalCalibrationWidthsSet.h:29
HcalCalibrationWidthsSet.h
HcalCalibrationWidthsSet::setCalibrationWidths
void setCalibrationWidths(const DetId id, const HcalCalibrationWidths &ca)
Definition:
HcalCalibrationWidthsSet.cc:25
HcalCalibrationWidthsSet::mItems
std::vector< CalibWidthSetObject > mItems
Definition:
HcalCalibrationWidthsSet.h:31
HcalGenericDetId
Definition:
HcalGenericDetId.h:16
HcalCalibrationWidthsSet::getCalibrationWidths
const HcalCalibrationWidths & getCalibrationWidths(const DetId id) const
Definition:
HcalCalibrationWidthsSet.cc:11
DetId
Definition:
DetId.h:20
Exception.h
filterCSVwithJSON.target
tuple target
Definition:
filterCSVwithJSON.py:31
cms::Exception
Definition:
Exception.h:66
HcalCalibrationWidths
Definition:
HcalCalibrationWidths.h:11
Generated for CMSSW Reference Manual by
1.8.5