Geometry
MTDCommonData
src
MTDBaseNumber.cc
Go to the documentation of this file.
1
#include "
Geometry/MTDCommonData/interface/MTDBaseNumber.h
"
2
3
MTDBaseNumber::MTDBaseNumber
() : _theLevels(0) {}
4
5
MTDBaseNumber::MTDBaseNumber
(
const
MTDBaseNumber
& aBaseNumber)
6
: _sortedName(aBaseNumber._sortedName),
7
_sortedCopyNumber(aBaseNumber._sortedCopyNumber),
8
_theLevels(aBaseNumber._theLevels) {}
9
10
void
MTDBaseNumber::setSize
(
const
int
&
size
) {
11
if
(
size
<
MAXLEVEL
) {
12
_sortedName
.resize(
size
);
13
_sortedCopyNumber
.resize(
size
);
14
}
else
{
15
_sortedName
.resize(
MAXLEVEL
);
16
_sortedCopyNumber
.resize(
MAXLEVEL
);
17
edm::LogWarning
(
"MTDGeom"
) <<
"Required base number size exceeding maximum"
;
18
}
19
}
20
21
void
MTDBaseNumber::addLevel
(
const
std::string
&
name
,
const
int
& copyNumber) {
22
if
(
_theLevels
==
MAXLEVEL
- 1) {
23
throw
cms::Exception
(
"WrongMTDGeom"
) <<
"MTDBaseNumber required to add more levels than maximum allowed"
;
24
}
25
_sortedName
[
_theLevels
] =
name
;
26
_sortedCopyNumber
[
_theLevels
] = copyNumber;
27
_theLevels
++;
28
}
29
30
int
MTDBaseNumber::getLevels
()
const
{
return
_theLevels
; }
31
32
int
MTDBaseNumber::getCopyNumber
(
int
level
)
const
{
return
_sortedCopyNumber
[
level
]; }
33
34
int
MTDBaseNumber::getCopyNumber
(
const
std::string
&
levelName
)
const
{
35
for
(
int
iLevel = 0; iLevel <
_theLevels
; iLevel++) {
36
if
(
_sortedName
[iLevel] ==
levelName
) {
37
return
_sortedCopyNumber
[iLevel];
38
}
39
}
40
return
0;
41
}
42
43
std::string
const
&
MTDBaseNumber::getLevelName
(
int
level
)
const
{
return
_sortedName
[
level
]; }
44
45
int
MTDBaseNumber::getCapacity
() {
return
_sortedName
.capacity(); }
46
47
void
MTDBaseNumber::reset
() {
_theLevels
= 0; }
personalPlayback.level
level
Definition:
personalPlayback.py:22
MTDBaseNumber::getCapacity
int getCapacity()
Definition:
MTDBaseNumber.cc:45
MTDBaseNumber
Definition:
MTDBaseNumber.h:15
MTDBaseNumber::_sortedName
std::vector< std::string > _sortedName
Definition:
MTDBaseNumber.h:35
MTDBaseNumber::getCopyNumber
int getCopyNumber(int level) const
Definition:
MTDBaseNumber.cc:32
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:122
MTDBaseNumber::getLevels
int getLevels() const
Definition:
MTDBaseNumber.cc:30
MTDBaseNumber::getLevelName
std::string const & getLevelName(int level) const
Definition:
MTDBaseNumber.cc:43
MTDBaseNumber::_sortedCopyNumber
std::vector< int > _sortedCopyNumber
Definition:
MTDBaseNumber.h:36
MTDBaseNumber::addLevel
void addLevel(const std::string &name, const int ©Number)
Definition:
MTDBaseNumber.cc:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
MTDBaseNumber::_theLevels
int _theLevels
Definition:
MTDBaseNumber.h:37
MTDBaseNumber::setSize
void setSize(const int &size)
Definition:
MTDBaseNumber.cc:10
fwlog::levelName
const char * levelName(LogLevel)
Definition:
fwLog.cc:32
MTDBaseNumber.h
Exception
Definition:
hltDiff.cc:245
MTDBaseNumber::reset
void reset()
Definition:
MTDBaseNumber.cc:47
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
MTDBaseNumber::MAXLEVEL
static constexpr int MAXLEVEL
Definition:
MTDBaseNumber.h:33
MTDBaseNumber::MTDBaseNumber
MTDBaseNumber()
Definition:
MTDBaseNumber.cc:3
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
Generated for CMSSW Reference Manual by
1.8.16