CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TableOutputFields Class Reference

#include <TableOutputFields.h>

Public Member Functions

void createFields (const edm::EventForOutput &event, RNTupleModel &model)
 
void fillEntry (const nanoaod::FlatTable &table, std::size_t i)
 
const edm::EDGetTokengetToken () const
 
void print () const
 
 TableOutputFields ()=default
 
 TableOutputFields (const edm::EDGetToken &token)
 

Private Attributes

std::vector< FlatTableField< bool > > m_boolFields
 
std::vector< FlatTableField< float > > m_floatFields
 
std::vector< FlatTableField< int > > m_intFields
 
edm::EDGetToken m_token
 
std::vector< FlatTableField< std::uint8_t > > m_uint8Fields
 

Detailed Description

Definition at line 68 of file TableOutputFields.h.

Constructor & Destructor Documentation

◆ TableOutputFields() [1/2]

TableOutputFields::TableOutputFields ( )
default

◆ TableOutputFields() [2/2]

TableOutputFields::TableOutputFields ( const edm::EDGetToken token)
inlineexplicit

Definition at line 71 of file TableOutputFields.h.

Member Function Documentation

◆ createFields()

void TableOutputFields::createFields ( const edm::EventForOutput event,
RNTupleModel &  model 
)

Definition at line 50 of file TableOutputFields.cc.

References nanoaod::FlatTable::Bool, Exception, nanoaod::FlatTable::Float, patZpeak::handle, mps_fire::i, nanoaod::FlatTable::Int32, m_boolFields, m_floatFields, m_intFields, m_token, m_uint8Fields, isotrackApplyRegressor::model, TableParser::table, and nanoaod::FlatTable::UInt8.

Referenced by TableCollection::createFields().

50  {
52  event.getByToken(m_token, handle);
54  for (std::size_t i = 0; i < table.nColumns(); i++) {
55  switch (table.columnType(i)) {
58  break;
60  m_intFields.emplace_back(FlatTableField<int>(table, i, model));
61  break;
64  break;
67  break;
68  default:
69  throw cms::Exception("LogicError", "Unsupported type");
70  }
71  }
72 }
edm::EDGetToken m_token
std::vector< FlatTableField< bool > > m_boolFields
std::vector< FlatTableField< std::uint8_t > > m_uint8Fields
std::vector< FlatTableField< int > > m_intFields
std::vector< FlatTableField< float > > m_floatFields

◆ fillEntry()

void TableOutputFields::fillEntry ( const nanoaod::FlatTable table,
std::size_t  i 
)

Definition at line 74 of file TableOutputFields.cc.

References mps_fire::i, m_boolFields, m_floatFields, m_intFields, m_uint8Fields, and TableParser::table.

Referenced by TableCollection::fill().

74  {
75  for (auto& field : m_floatFields) {
76  field.fill(table, i);
77  }
78  for (auto& field : m_intFields) {
79  field.fill(table, i);
80  }
81  for (auto& field : m_uint8Fields) {
82  field.fill(table, i);
83  }
84  for (auto& field : m_boolFields) {
85  field.fill(table, i);
86  }
87 }
std::vector< FlatTableField< bool > > m_boolFields
std::vector< FlatTableField< std::uint8_t > > m_uint8Fields
std::vector< FlatTableField< int > > m_intFields
std::vector< FlatTableField< float > > m_floatFields

◆ getToken()

const edm::EDGetToken & TableOutputFields::getToken ( ) const

Definition at line 89 of file TableOutputFields.cc.

References m_token.

Referenced by TableCollection::createFields(), TableCollection::fill(), and TableCollection::hasMainTable().

89 { return m_token; }
edm::EDGetToken m_token

◆ print()

void TableOutputFields::print ( void  ) const

Definition at line 35 of file TableOutputFields.cc.

References gather_cfg::cout, m_boolFields, m_floatFields, m_intFields, and m_uint8Fields.

Referenced by TableCollection::print().

35  {
36  for (const auto& field : m_floatFields) {
37  std::cout << " " << field.getFlatTableName() << ": f32,\n";
38  }
39  for (const auto& field : m_intFields) {
40  std::cout << " " << field.getFlatTableName() << ": i32,\n";
41  }
42  for (const auto& field : m_uint8Fields) {
43  std::cout << " " << field.getFlatTableName() << ": u8,\n";
44  }
45  for (const auto& field : m_boolFields) {
46  std::cout << " " << field.getFlatTableName() << ": bool,\n";
47  }
48 }
std::vector< FlatTableField< bool > > m_boolFields
std::vector< FlatTableField< std::uint8_t > > m_uint8Fields
std::vector< FlatTableField< int > > m_intFields
std::vector< FlatTableField< float > > m_floatFields

Member Data Documentation

◆ m_boolFields

std::vector<FlatTableField<bool> > TableOutputFields::m_boolFields
private

Definition at line 82 of file TableOutputFields.h.

Referenced by createFields(), fillEntry(), and print().

◆ m_floatFields

std::vector<FlatTableField<float> > TableOutputFields::m_floatFields
private

Definition at line 79 of file TableOutputFields.h.

Referenced by createFields(), fillEntry(), and print().

◆ m_intFields

std::vector<FlatTableField<int> > TableOutputFields::m_intFields
private

Definition at line 80 of file TableOutputFields.h.

Referenced by createFields(), fillEntry(), and print().

◆ m_token

edm::EDGetToken TableOutputFields::m_token
private

Definition at line 78 of file TableOutputFields.h.

Referenced by createFields(), and getToken().

◆ m_uint8Fields

std::vector<FlatTableField<std::uint8_t> > TableOutputFields::m_uint8Fields
private

Definition at line 81 of file TableOutputFields.h.

Referenced by createFields(), fillEntry(), and print().