CMS 3D CMS Logo

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

#include <NanoAODRNTuples.h>

Public Member Functions

void fill (const edm::LuminosityBlockID &id, TFile &file)
 
void finalizeWrite ()
 
 LumiNTuple ()=default
 

Private Member Functions

void createFields (const edm::LuminosityBlockID &id, TFile &file)
 

Private Attributes

RNTupleFieldPtr< UInt_t > m_luminosityBlock
 
std::unique_ptr< RNTupleWriter > m_ntuple
 
RNTupleFieldPtr< UInt_t > m_run
 

Detailed Description

Definition at line 30 of file NanoAODRNTuples.h.

Constructor & Destructor Documentation

◆ LumiNTuple()

LumiNTuple::LumiNTuple ( )
default

Member Function Documentation

◆ createFields()

void LumiNTuple::createFields ( const edm::LuminosityBlockID id,
TFile &  file 
)
private

Definition at line 25 of file NanoAODRNTuples.cc.

References geometryDiff::file, m_luminosityBlock, m_ntuple, m_run, MakeRNTupleWriter, ReggeGribovPartonMC_EposLHC_2760GeV_PbPb_cfi::model, eostools::move(), and AlcaSiPixelAliHarvester0T_cff::options.

Referenced by fill().

25  {
26  auto model = RNTupleModel::Create();
27  m_run = RNTupleFieldPtr<UInt_t>("run", "", *model);
28  m_luminosityBlock = RNTupleFieldPtr<UInt_t>("luminosityBlock", "", *model);
29  // TODO use Append when we bump our RNTuple version:
30  // m_ntuple = RNTupleWriter::Append(std::move(model), "LuminosityBlocks", file);
31  RNTupleWriteOptions options;
32  options.SetCompression(file.GetCompressionSettings());
33  m_ntuple = MakeRNTupleWriter(std::move(model), std::make_unique<RPageSinkFile>("LuminosityBlocks", file, options));
34 }
std::unique_ptr< RNTupleWriter > m_ntuple
RNTupleFieldPtr< UInt_t > m_run
#define MakeRNTupleWriter
RNTupleFieldPtr< UInt_t > m_luminosityBlock
def move(src, dest)
Definition: eostools.py:511

◆ fill()

void LumiNTuple::fill ( const edm::LuminosityBlockID id,
TFile &  file 
)

Definition at line 36 of file NanoAODRNTuples.cc.

References createFields(), geometryDiff::file, RNTupleFieldPtr< T >::fill(), m_luminosityBlock, m_ntuple, m_run, writedatasetfile::run, and relativeConstraints::value.

Referenced by NanoAODRNTupleOutputModule::writeLuminosityBlock().

36  {
37  if (!m_ntuple) {
38  createFields(id, file);
39  }
40  m_run.fill(id.run());
42  m_ntuple->Fill();
43 }
std::unique_ptr< RNTupleWriter > m_ntuple
RNTupleFieldPtr< UInt_t > m_run
void fill(const T &value)
void createFields(const edm::LuminosityBlockID &id, TFile &file)
RNTupleFieldPtr< UInt_t > m_luminosityBlock

◆ finalizeWrite()

void LumiNTuple::finalizeWrite ( )

Definition at line 45 of file NanoAODRNTuples.cc.

References m_ntuple.

Referenced by NanoAODRNTupleOutputModule::reallyCloseFile().

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

Member Data Documentation

◆ m_luminosityBlock

RNTupleFieldPtr<UInt_t> LumiNTuple::m_luminosityBlock
private

Definition at line 40 of file NanoAODRNTuples.h.

Referenced by createFields(), and fill().

◆ m_ntuple

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

Definition at line 38 of file NanoAODRNTuples.h.

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

◆ m_run

RNTupleFieldPtr<UInt_t> LumiNTuple::m_run
private

Definition at line 39 of file NanoAODRNTuples.h.

Referenced by createFields(), and fill().