26constexpr char const* kNTupleFileName =
"ntpl005_introspection.root";
36 double x()
const {
return fX; }
37 double y()
const {
return fY; }
38 double z()
const {
return fZ; }
40 void SetXYZ(
double x,
double y,
double z) {
51 auto fldVector3 = model->MakeField<Vector3>(
"v3");
59 for (
unsigned int i = 0; i < 500000; ++i) {
60 fldVector3->SetXYZ(
r.Gaus(0,1),
r.Landau(0,1),
r.Gaus(100,10));
66void ntpl005_introspection() {
82 reader->EnableMetrics();
88 TH1F h1(
"x",
"x component of Vector3", 100, -3, 3);
92 auto viewX = reader->GetView<
double>(
"v3.fX");
93 for (
auto i : reader->GetEntryRange()) {
100 TH1F h2(
"y",
"y component of Vector3", 100, -5, 20);
101 auto viewY = reader->GetView<
double>(
"v3.fY");
102 for (
auto i : reader->GetEntryRange()) {
112 auto retval =
gSystem->GetPathInfo(kNTupleFileName, fileStat);
114 float fileSize =
static_cast<float>(fileStat.
fSize);
115 float nbytesRead = reader->GetMetrics().GetCounter(
"RNTupleReader.RPageSourceFile.szReadPayload")->GetValueAsInt() +
116 reader->GetMetrics().GetCounter(
"RNTupleReader.RPageSourceFile.szReadOverhead")->GetValueAsInt();
118 std::cout <<
"File size: " << fileSize / 1024. / 1024. <<
" MiB" << std::endl;
119 std::cout <<
"Read from file: " << nbytesRead / 1024. / 1024. <<
" MiB" << std::endl;
120 std::cout <<
"Ratio: " << nbytesRead / fileSize << std::endl;
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.
Common user-tunable settings for storing RNTuples.
void SetCompression(std::uint32_t val)
static std::unique_ptr< RNTupleWriter > Recreate(std::unique_ptr< ROOT::RNTupleModel > model, std::string_view ntupleName, std::string_view storage, const ROOT::RNTupleWriteOptions &options=ROOT::RNTupleWriteOptions())
Creates an RNTupleWriter backed by storage, overwriting it if one with the same URI exists.
1-D histogram with a float per channel (see TH1 documentation)
This is the base class for the ROOT Random number generators.
@ kUseGeneralPurpose
Use the new recommended general-purpose setting; it is a best trade-off between compression ratio/dec...