Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
CalibFormats
CastorObjects
src
CastorCalibrationWidthsSet.cc
Go to the documentation of this file.
1
#include "
CalibFormats/CastorObjects/interface/CastorCalibrationWidthsSet.h
"
2
#include "
DataFormats/HcalDetId/interface/HcalGenericDetId.h
"
3
#include "
FWCore/Utilities/interface/Exception.h
"
4
#include <algorithm>
5
#include <iostream>
6
7
8
CastorCalibrationWidthsSet::CastorCalibrationWidthsSet
()
9
: sorted_ (
false
) {}
10
11
const
CastorCalibrationWidths
&
CastorCalibrationWidthsSet::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 CastorCalibrationWidths for cell "
<<
HcalGenericDetId
(fId);
22
return
cell->calib;
23
}
24
25
void
CastorCalibrationWidthsSet::setCalibrationWidths
(
DetId
fId,
const
CastorCalibrationWidths
& 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
CastorCalibrationWidthsSet::sort
() {
37
if
(!
sorted_
) {
38
std::sort
(
mItems
.begin(),
mItems
.end());
39
sorted_
=
true
;
40
}
41
}
42
void
CastorCalibrationWidthsSet::clear
() {
43
mItems
.clear();
44
}
CastorCalibrationWidthsSet::setCalibrationWidths
void setCalibrationWidths(const DetId id, const CastorCalibrationWidths &ca)
Definition:
CastorCalibrationWidthsSet.cc:25
funct::false
false
Definition:
Factorize.h:34
CastorCalibrationWidths
Definition:
CastorCalibrationWidths.h:9
CastorCalibrationWidthsSet::getCalibrationWidths
const CastorCalibrationWidths & getCalibrationWidths(const DetId id) const
Definition:
CastorCalibrationWidthsSet.cc:11
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
CastorCalibrationWidthsSet::sorted_
bool sorted_
Definition:
CastorCalibrationWidthsSet.h:33
HcalGenericDetId.h
calib
MVATrainerComputer * calib
Definition:
MVATrainer.cc:64
CastorCalibrationWidthsSet::Item
CalibWidthSetObject Item
Definition:
CastorCalibrationWidthsSet.h:30
CastorCalibrationWidthsSet::sort
void sort()
Definition:
CastorCalibrationWidthsSet.cc:36
CastorCalibrationWidthsSet::clear
void clear()
Definition:
CastorCalibrationWidthsSet.cc:42
HcalGenericDetId
Definition:
HcalGenericDetId.h:16
CastorCalibrationWidthsSet::mItems
std::vector< CalibWidthSetObject > mItems
Definition:
CastorCalibrationWidthsSet.h:32
DetId
Definition:
DetId.h:20
Exception.h
filterCSVwithJSON.target
tuple target
Definition:
filterCSVwithJSON.py:31
CastorCalibrationWidthsSet.h
cms::Exception
Definition:
Exception.h:66
CastorCalibrationWidthsSet::CastorCalibrationWidthsSet
CastorCalibrationWidthsSet()
Definition:
CastorCalibrationWidthsSet.cc:8
CastorCalibrationWidthsSet::CalibWidthSetObject
Definition:
CastorCalibrationWidthsSet.h:23
Generated for CMSSW Reference Manual by
1.8.5