Skip to content

Commit

Permalink
Added new RNTuple test file (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas authored Sep 12, 2024
1 parent bc0a974 commit b8f4523
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions dev/make-root/rntuple_index_multicluster.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* https://root.cern/doc/master/ntpl001__staff_8C.html */

#include <vector>

R__LOAD_LIBRARY(ROOTNTuple)
#include <ROOT/RField.hxx>
#include <ROOT/RNTuple.hxx>
#include <ROOT/RNTupleModel.hxx>
#include <ROOT/RNTupleWriter.hxx>
#include <ROOT/RNTupleWriteOptions.hxx>
#include <ROOT/RRawFile.hxx>

using RNTupleModel = ROOT::Experimental::RNTupleModel;
using RNTupleWriter = ROOT::Experimental::RNTupleWriter;
using RNTupleWriteOptions = ROOT::Experimental::RNTupleWriteOptions;

void rntuple_index_multicluster() {
auto options = RNTupleWriteOptions();
options.SetApproxUnzippedPageSize(512);
options.SetApproxZippedClusterSize(1000);
options.SetMaxUnzippedClusterSize(1024);

std::string rootFileName{"test_ntuple_index_multicluster.root"};
auto model = RNTupleModel::Create();
auto int_vector = model->MakeField<std::vector<int16_t>>("int_vector");
auto ntuple =
RNTupleWriter::Recreate(std::move(model), "ntuple", rootFileName, options);
for(int16_t j=0; j<2; j++){
for(int16_t i=0; i<100; i++){
*int_vector = {i, static_cast<int16_t>(i+j)};
ntuple->Fill();
}
}
}
Binary file not shown.

0 comments on commit b8f4523

Please sign in to comment.