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 24 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 18 of file NanoAODRNTuples.cc.

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

Referenced by fill().

18  {
19  auto model = RNTupleModel::Create();
20  m_run = RNTupleFieldPtr<UInt_t>("run", "", *model);
21  m_luminosityBlock = RNTupleFieldPtr<UInt_t>("luminosityBlock", "", *model);
22  // TODO use Append when we bump our RNTuple version:
23  // m_ntuple = RNTupleWriter::Append(std::move(model), "LuminosityBlocks", file);
24  RNTupleWriteOptions options;
25  options.SetCompression(file.GetCompressionSettings());
26  m_ntuple = std::make_unique<RNTupleWriter>(std::move(model),
27  std::make_unique<RPageSinkFile>("LuminosityBlocks", file, options));
28 }
std::unique_ptr< RNTupleWriter > m_ntuple
RNTupleFieldPtr< UInt_t > m_run
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 30 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().

30  {
31  if (!m_ntuple) {
32  createFields(id, file);
33  }
34  m_run.fill(id.run());
36  m_ntuple->Fill();
37 }
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 39 of file NanoAODRNTuples.cc.

References m_ntuple.

Referenced by NanoAODRNTupleOutputModule::reallyCloseFile().

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

Member Data Documentation

◆ m_luminosityBlock

RNTupleFieldPtr<UInt_t> LumiNTuple::m_luminosityBlock
private

Definition at line 34 of file NanoAODRNTuples.h.

Referenced by createFields(), and fill().

◆ m_ntuple

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

Definition at line 32 of file NanoAODRNTuples.h.

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

◆ m_run

RNTupleFieldPtr<UInt_t> LumiNTuple::m_run
private

Definition at line 33 of file NanoAODRNTuples.h.

Referenced by createFields(), and fill().