DataFormats
NanoAOD
src
FlatTable.cc
Go to the documentation of this file.
1
#include "
DataFormats/NanoAOD/interface/FlatTable.h
"
2
3
int
nanoaod::FlatTable::columnIndex
(
const
std::string
&
name
)
const
{
4
for
(
unsigned
int
i
= 0,
n
=
columns_
.size();
i
<
n
; ++
i
) {
5
if
(
columns_
[
i
].
name
==
name
)
6
return
i
;
7
}
8
return
-1;
9
}
10
11
void
nanoaod::FlatTable::addExtension
(
const
nanoaod::FlatTable
&
other
) {
12
if
(
extension
() || !
other
.extension() ||
name
() !=
other
.name() ||
size
() !=
other
.size())
13
throw
cms::Exception
(
"LogicError"
,
"Mismatch in adding extension"
);
14
for
(
unsigned
int
i
= 0,
n
=
other
.nColumns();
i
<
n
; ++
i
) {
15
switch
(
other
.columnType(
i
)) {
16
case
ColumnType::Float:
17
addColumn<float>(
other
.columnName(
i
),
other
.columnData<
float
>(
i
),
other
.columnDoc(
i
));
18
break
;
19
case
ColumnType::Int
:
20
addColumn<int>(
other
.columnName(
i
),
other
.columnData<
int
>(
i
),
other
.columnDoc(
i
));
21
break
;
22
case
ColumnType::Bool
:
23
addColumn<bool>(
other
.columnName(
i
),
other
.columnData<
bool
>(
i
),
other
.columnDoc(
i
));
24
break
;
25
case
ColumnType::UInt8:
26
addColumn<uint8_t>(
other
.columnName(
i
),
other
.columnData<uint8_t>(
i
),
other
.columnDoc(
i
));
27
break
;
28
default
:
29
throw
cms::Exception
(
"LogicError"
,
"Unsupported type"
);
30
}
31
}
32
}
33
34
double
nanoaod::FlatTable::getAnyValue
(
unsigned
int
row,
unsigned
int
column)
const
{
35
if
(column >= nColumns())
36
throw
cms::Exception
(
"LogicError"
,
"Invalid column"
);
37
switch
(columnType(column)) {
38
case
ColumnType::Float:
39
return
*(beginData<float>(column) + row);
40
case
ColumnType::Int
:
41
return
*(beginData<int>(column) + row);
42
case
ColumnType::Bool
:
43
return
*(beginData<bool>(column) + row);
44
case
ColumnType::UInt8:
45
return
*(beginData<uint8_t>(column) + row);
46
}
47
throw
cms::Exception
(
"LogicError"
,
"Unsupported type"
);
48
}
mps_fire.i
i
Definition:
mps_fire.py:428
dqmiodumpmetadata.n
n
Definition:
dqmiodumpmetadata.py:28
Bool
int Bool
Definition:
Types.h:100
trackingPlots.other
other
Definition:
trackingPlots.py:1467
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
nanoaod::FlatTable::addExtension
void addExtension(const FlatTable &extension)
Definition:
FlatTable.cc:11
nanoaod::FlatTable::columnIndex
int columnIndex(const std::string &name) const
Definition:
FlatTable.cc:3
Json::Int
int Int
Definition:
forwards.h:16
runGCPTkAlMap.extension
extension
Definition:
runGCPTkAlMap.py:188
nanoaod::FlatTable::columns_
std::vector< Column > columns_
Definition:
FlatTable.h:197
FlatTable.h
nanoaod::FlatTable::name
const std::string & name() const
Definition:
FlatTable.h:57
nanoaod::FlatTable
Definition:
FlatTable.h:38
nanoaod::FlatTable::getAnyValue
double getAnyValue(unsigned int row, unsigned int column) const
Definition:
FlatTable.cc:34
Exception
Definition:
hltDiff.cc:246
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
cms::Exception
Definition:
Exception.h:70
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
Generated for CMSSW Reference Manual by
1.8.16