CMS 3D CMS Logo

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

#include <NanoAODRNTuples.h>

Public Member Functions

void fill (const edm::ProcessHistoryRegistry &procHist, TFile &file)
 
void finalizeWrite ()
 
 MetadataNTuple ()=default
 

Private Member Functions

void createFields (TFile &file)
 

Private Attributes

std::unique_ptr< RNTupleWriter > m_ntuple
 
RNTupleFieldPtr< std::string > m_phId
 
std::shared_ptr< RNTupleCollectionWriter > m_procHist
 

Detailed Description

Definition at line 83 of file NanoAODRNTuples.h.

Constructor & Destructor Documentation

◆ MetadataNTuple()

MetadataNTuple::MetadataNTuple ( )
default

Member Function Documentation

◆ createFields()

void MetadataNTuple::createFields ( TFile &  file)
private

Definition at line 116 of file NanoAODRNTuples.cc.

References geometryDiff::file, m_ntuple, m_phId, m_procHist, MakeRNTupleWriter, edm::poolNames::metaDataTreeName(), isotrackApplyRegressor::model, eostools::move(), AlcaSiPixelAliHarvester0T_cff::options, and edm::poolNames::processHistoryBranchName().

Referenced by fill().

116  {
117  auto procHistModel = RNTupleModel::Create();
118  // ProcessHistory.transients_.phid_ replacement
119  m_phId = RNTupleFieldPtr<std::string>("transients_phid_", "", *procHistModel);
120  auto model = RNTupleModel::Create();
121  m_procHist = model->MakeCollection(edm::poolNames::processHistoryBranchName(), std::move(procHistModel));
122  RNTupleWriteOptions options;
123  options.SetCompression(file.GetCompressionSettings());
125  std::make_unique<RPageSinkFile>(edm::poolNames::metaDataTreeName(), file, options));
126 }
std::string const & metaDataTreeName()
Definition: BranchType.cc:159
std::unique_ptr< RNTupleWriter > m_ntuple
std::string const & processHistoryBranchName()
Definition: BranchType.cc:177
#define MakeRNTupleWriter
std::shared_ptr< RNTupleCollectionWriter > m_procHist
RNTupleFieldPtr< std::string > m_phId
def move(src, dest)
Definition: eostools.py:511

◆ fill()

void MetadataNTuple::fill ( const edm::ProcessHistoryRegistry procHist,
TFile &  file 
)

Definition at line 128 of file NanoAODRNTuples.cc.

References createFields(), geometryDiff::file, RNTupleFieldPtr< T >::fill(), m_ntuple, m_phId, m_procHist, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by NanoAODRNTupleOutputModule::writeProvenance().

128  {
129  if (!m_ntuple) {
131  }
132  for (const auto& ph : procHist) {
133  std::string phid;
134  ph.second.id().toString(phid);
135  m_phId.fill(phid);
136  m_procHist->Fill();
137  }
138  m_ntuple->Fill();
139 }
std::unique_ptr< RNTupleWriter > m_ntuple
void fill(const T &value)
std::shared_ptr< RNTupleCollectionWriter > m_procHist
void createFields(TFile &file)
RNTupleFieldPtr< std::string > m_phId

◆ finalizeWrite()

void MetadataNTuple::finalizeWrite ( )

Definition at line 141 of file NanoAODRNTuples.cc.

References m_ntuple.

Referenced by NanoAODRNTupleOutputModule::writeProvenance().

141 { m_ntuple.reset(); }
std::unique_ptr< RNTupleWriter > m_ntuple

Member Data Documentation

◆ m_ntuple

std::unique_ptr<RNTupleWriter> MetadataNTuple::m_ntuple
private

Definition at line 98 of file NanoAODRNTuples.h.

Referenced by createFields(), fill(), and finalizeWrite().

◆ m_phId

RNTupleFieldPtr<std::string> MetadataNTuple::m_phId
private

Definition at line 97 of file NanoAODRNTuples.h.

Referenced by createFields(), and fill().

◆ m_procHist

std::shared_ptr<RNTupleCollectionWriter> MetadataNTuple::m_procHist
private

Definition at line 94 of file NanoAODRNTuples.h.

Referenced by createFields(), and fill().