Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
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
7
8
HcalCalibrationsSet::HcalCalibrationsSet
()
9
: sorted_ (
false
) {}
10
11
const
HcalCalibrations
&
HcalCalibrationsSet::getCalibrations
(
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 HcalCalibrations for cell "
<<
HcalGenericDetId
(fId);
22
return
cell->calib;
23
}
24
25
void
HcalCalibrationsSet::setCalibrations
(
DetId
fId,
const
HcalCalibrations
& 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
HcalCalibrationsSet::sort
() {
37
if
(!
sorted_
) {
38
std::sort
(
mItems
.begin(),
mItems
.end());
39
sorted_
=
true
;
40
}
41
}
42
void
HcalCalibrationsSet::clear
() {
43
mItems
.clear();
44
}
HcalCalibrationsSet.h
HcalCalibrationsSet::Item
CalibSetObject Item
Definition:
HcalCalibrationsSet.h:29
HcalCalibrationsSet::mItems
std::vector< CalibSetObject > mItems
Definition:
HcalCalibrationsSet.h:31
funct::false
false
Definition:
Factorize.h:34
python.multivaluedict.sort
def sort
Definition:
multivaluedict.py:161
HcalCalibrations
Definition:
HcalCalibrations.h:11
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition:
FindCaloHit.cc:7
HcalCalibrationsSet::CalibSetObject
Definition:
HcalCalibrationsSet.h:22
HcalGenericDetId.h
calib
MVATrainerComputer * calib
Definition:
MVATrainer.cc:64
HcalCalibrationsSet::sorted_
bool sorted_
Definition:
HcalCalibrationsSet.h:32
HcalCalibrationsSet::HcalCalibrationsSet
HcalCalibrationsSet()
Definition:
HcalCalibrationsSet.cc:8
HcalGenericDetId
Definition:
HcalGenericDetId.h:16
DetId
Definition:
DetId.h:20
Exception.h
filterCSVwithJSON.target
tuple target
Definition:
filterCSVwithJSON.py:31
cms::Exception
Definition:
Exception.h:66
HcalCalibrationsSet::getCalibrations
const HcalCalibrations & getCalibrations(const DetId id) const
Definition:
HcalCalibrationsSet.cc:11
HcalCalibrationsSet::setCalibrations
void setCalibrations(const DetId id, const HcalCalibrations &ca)
Definition:
HcalCalibrationsSet.cc:25
HcalCalibrationsSet::sort
void sort()
Definition:
HcalCalibrationsSet.cc:36
HcalCalibrationsSet::clear
void clear()
Definition:
HcalCalibrationsSet.cc:42
Generated for CMSSW Reference Manual by
1.8.5