CMS 3D CMS Logo

FlatTable.cc
Go to the documentation of this file.
2 
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 
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  case ColumnType::UInt32:
29  addColumn<uint32_t>(other.columnName(i), other.columnData<uint32_t>(i), other.columnDoc(i));
30  break;
31  case ColumnType::Double:
32  addColumn<double>(other.columnName(i), other.columnData<double>(i), other.columnDoc(i));
33  break;
34  default:
35  throw cms::Exception("LogicError", "Unsupported type");
36  }
37  }
38 }
39 
40 double nanoaod::FlatTable::getAnyValue(unsigned int row, unsigned int column) const {
41  if (column >= nColumns())
42  throw cms::Exception("LogicError", "Invalid column");
43  switch (columnType(column)) {
44  case ColumnType::Float:
45  return *(beginData<float>(column) + row);
46  case ColumnType::Int:
47  return *(beginData<int>(column) + row);
48  case ColumnType::Bool:
49  return *(beginData<bool>(column) + row);
50  case ColumnType::UInt8:
51  return *(beginData<uint8_t>(column) + row);
52  case ColumnType::UInt32:
53  return *(beginData<uint32_t>(column) + row);
54  case ColumnType::Double:
55  return *(beginData<double>(column) + row);
56  }
57  throw cms::Exception("LogicError", "Unsupported type");
58 }
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
Bool
int Bool
Definition: Types.h:100
UInt32
unsigned int UInt32
Definition: Types.h:69
trackingPlots.other
other
Definition: trackingPlots.py:1464
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:207
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FlatTable.h
nanoaod::FlatTable::name
const std::string & name() const
Definition: FlatTable.h:59
nanoaod::FlatTable
Definition: FlatTable.h:38
nanoaod::FlatTable::getAnyValue
double getAnyValue(unsigned int row, unsigned int column) const
Definition: FlatTable.cc:40
Exception
Definition: hltDiff.cc:245
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