CMS 3D CMS Logo

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

#include <TableOutputFields.h>

Public Member Functions

void createFields (const edm::EventForOutput &event, RNTupleModel &model)
 
void fill (const edm::EventForOutput &event)
 
 TableOutputVectorFields ()=default
 
 TableOutputVectorFields (const edm::EDGetToken &token)
 

Private Attributes

edm::EDGetToken m_token
 
std::vector< FlatTableField< std::vector< bool > > > m_vboolFields
 
std::vector< FlatTableField< std::vector< float > > > m_vfloatFields
 
std::vector< FlatTableField< std::vector< int > > > m_vintFields
 
std::vector< FlatTableField< std::vector< std::uint8_t > > > m_vuint8Fields
 

Detailed Description

Definition at line 80 of file TableOutputFields.h.

Constructor & Destructor Documentation

◆ TableOutputVectorFields() [1/2]

TableOutputVectorFields::TableOutputVectorFields ( )
default

◆ TableOutputVectorFields() [2/2]

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

Member Function Documentation

◆ createFields()

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

Definition at line 93 of file TableOutputFields.cc.

References nanoaod::FlatTable::Bool, Exception, nanoaod::FlatTable::Float, patZpeak::handle, mps_fire::i, nanoaod::FlatTable::Int32, m_token, m_vboolFields, m_vfloatFields, m_vintFields, m_vuint8Fields, ReggeGribovPartonMC_EposLHC_2760GeV_PbPb_cfi::model, TableParser::table, and nanoaod::FlatTable::UInt8.

93  {
95  event.getByToken(m_token, handle);
97  for (std::size_t i = 0; i < table.nColumns(); i++) {
98  switch (table.columnType(i)) {
100  m_vfloatFields.emplace_back(FlatTableField<std::vector<float>>(table, i, model));
101  break;
103  m_vintFields.emplace_back(FlatTableField<std::vector<int>>(table, i, model));
104  break;
106  m_vuint8Fields.emplace_back(FlatTableField<std::vector<std::uint8_t>>(table, i, model));
107  break;
109  m_vboolFields.emplace_back(FlatTableField<std::vector<bool>>(table, i, model));
110  break;
111  default:
112  throw cms::Exception("LogicError", "Unsupported type");
113  }
114  }
115 }
std::vector< FlatTableField< std::vector< float > > > m_vfloatFields
std::vector< FlatTableField< std::vector< bool > > > m_vboolFields
std::vector< FlatTableField< std::vector< int > > > m_vintFields
std::vector< FlatTableField< std::vector< std::uint8_t > > > m_vuint8Fields

◆ fill()

void TableOutputVectorFields::fill ( const edm::EventForOutput event)

Definition at line 116 of file TableOutputFields.cc.

References patZpeak::handle, m_token, m_vboolFields, m_vfloatFields, m_vintFields, m_vuint8Fields, and TableParser::table.

116  {
118  event.getByToken(m_token, handle);
119  const auto& table = *handle;
120  for (auto& field : m_vfloatFields) {
121  field.fillVectored(table);
122  }
123  for (auto& field : m_vintFields) {
124  field.fillVectored(table);
125  }
126  for (auto& field : m_vuint8Fields) {
127  field.fillVectored(table);
128  }
129  for (auto& field : m_vboolFields) {
130  field.fillVectored(table);
131  }
132 }
std::vector< FlatTableField< std::vector< float > > > m_vfloatFields
std::vector< FlatTableField< std::vector< bool > > > m_vboolFields
std::vector< FlatTableField< std::vector< int > > > m_vintFields
std::vector< FlatTableField< std::vector< std::uint8_t > > > m_vuint8Fields

Member Data Documentation

◆ m_token

edm::EDGetToken TableOutputVectorFields::m_token
private

Definition at line 88 of file TableOutputFields.h.

Referenced by createFields(), and fill().

◆ m_vboolFields

std::vector<FlatTableField<std::vector<bool> > > TableOutputVectorFields::m_vboolFields
private

Definition at line 92 of file TableOutputFields.h.

Referenced by createFields(), and fill().

◆ m_vfloatFields

std::vector<FlatTableField<std::vector<float> > > TableOutputVectorFields::m_vfloatFields
private

Definition at line 89 of file TableOutputFields.h.

Referenced by createFields(), and fill().

◆ m_vintFields

std::vector<FlatTableField<std::vector<int> > > TableOutputVectorFields::m_vintFields
private

Definition at line 90 of file TableOutputFields.h.

Referenced by createFields(), and fill().

◆ m_vuint8Fields

std::vector<FlatTableField<std::vector<std::uint8_t> > > TableOutputVectorFields::m_vuint8Fields
private

Definition at line 91 of file TableOutputFields.h.

Referenced by createFields(), and fill().