40constexpr const char *kFileName =
"ntpl019_attributes.root";
57 auto file = std::unique_ptr<TFile>(
TFile::Open(kFileName,
"RECREATE"));
62 attrModel->SetDescription(
"Metadata containing the events' provenance");
88 for (
int i = 0; i < 100; ++i) {
93 if (i % 10 == 0 && i > 0) {
125 std::cout <<
"Here are the attribute sets linked to the RNTuple '" <<
kNTupleName <<
"':\n";
133 auto pRunNumber =
attrSet->GetModel().GetDefaultEntry().GetPtr<std::int32_t>(
"runNumber");
135 std::cout <<
"\nOpened attribute set '" <<
attrSet->GetDescriptor().GetName() <<
"' with description: \""
136 <<
attrSet->GetDescriptor().GetDescription() <<
"\"\n";
141 std::cout <<
"Entry " <<
mainIdx <<
" has the following attributes associated to it:\n";
144 std::cout <<
" runNumber = " << *
pRunNumber <<
" (valid for range [" << *
range.GetFirst() <<
", "
145 << *
range.GetLast() <<
"])\n";
155 std::cout <<
"\nRun " << *
pRunNumber <<
" is good. Events:\n";
158 std::cout <<
" Event " <<
mainIdx <<
" with pt = " <<
pEvent->pt <<
"\n";
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
static std::unique_ptr< RNTupleModel > Create()
static std::unique_ptr< RNTupleReader > Open(std::string_view ntupleName, std::string_view storage, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Open an RNTuple for reading.
static std::unique_ptr< RNTupleWriter > Append(std::unique_ptr< ROOT::RNTupleModel > model, std::string_view ntupleName, TDirectory &fileOrDirectory, const ROOT::RNTupleWriteOptions &options=ROOT::RNTupleWriteOptions())
Creates an RNTupleWriter that writes into an existing TFile or TDirectory, without overwriting its co...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Random number generator class based on M.