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< RCollectionNTupleWriter > m_procHist
 

Detailed Description

Definition at line 73 of file NanoAODRNTuples.h.

Constructor & Destructor Documentation

◆ MetadataNTuple()

MetadataNTuple::MetadataNTuple ( )
default

Member Function Documentation

◆ createFields()

void MetadataNTuple::createFields ( TFile &  file)
private

Definition at line 110 of file NanoAODRNTuples.cc.

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

Referenced by fill().

110  {
111  auto procHistModel = RNTupleModel::Create();
112  // ProcessHistory.transients_.phid_ replacement
113  m_phId = RNTupleFieldPtr<std::string>("transients_phid_", "", *procHistModel);
114  auto model = RNTupleModel::Create();
115  m_procHist = model->MakeCollection(edm::poolNames::processHistoryBranchName(), std::move(procHistModel));
116  RNTupleWriteOptions options;
117  options.SetCompression(file.GetCompressionSettings());
118  m_ntuple = std::make_unique<RNTupleWriter>(
119  std::move(model), std::make_unique<RPageSinkFile>(edm::poolNames::metaDataTreeName(), file, options));
120 }
std::string const & metaDataTreeName()
Definition: BranchType.cc:159
std::unique_ptr< RNTupleWriter > m_ntuple
std::string const & processHistoryBranchName()
Definition: BranchType.cc:177
std::shared_ptr< RCollectionNTupleWriter > 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 122 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().

122  {
123  if (!m_ntuple) {
125  }
126  for (const auto& ph : procHist) {
127  std::string phid;
128  ph.second.id().toString(phid);
129  m_phId.fill(phid);
130  m_procHist->Fill();
131  }
132  m_ntuple->Fill();
133 }
std::unique_ptr< RNTupleWriter > m_ntuple
void fill(const T &value)
std::shared_ptr< RCollectionNTupleWriter > m_procHist
void createFields(TFile &file)
RNTupleFieldPtr< std::string > m_phId

◆ finalizeWrite()

void MetadataNTuple::finalizeWrite ( )

Definition at line 135 of file NanoAODRNTuples.cc.

References m_ntuple.

Referenced by NanoAODRNTupleOutputModule::writeProvenance().

135 { 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 84 of file NanoAODRNTuples.h.

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

◆ m_phId

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

Definition at line 83 of file NanoAODRNTuples.h.

Referenced by createFields(), and fill().

◆ m_procHist

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

Definition at line 81 of file NanoAODRNTuples.h.

Referenced by createFields(), and fill().