diff --git a/dev/make-root/rntuple_multiple_cluster_groups.C b/dev/make-root/rntuple_multiple_cluster_groups.C new file mode 100644 index 0000000..b4f6975 --- /dev/null +++ b/dev/make-root/rntuple_multiple_cluster_groups.C @@ -0,0 +1,34 @@ +/* https://root.cern/doc/master/ntpl001__staff_8C.html */ +/* this file tests when we have multiple pages, each page stores 65536 bytes, + * thus we need to make it longer */ +/* https://github.com/scikit-hep/uproot5/pull/630 */ + +R__LOAD_LIBRARY(ROOTNTuple) +#include +#include +#include +#include +#include + +using RNTupleModel = ROOT::Experimental::RNTupleModel; +using RNTupleWriter = ROOT::Experimental::RNTupleWriter; + +void rntuple_multiple_cluster_groups() { + std::string rootFileName{"test_multiple_cluster_groups_rntuple_v1-0-0-0.root"}; + auto model = RNTupleModel::Create(); + auto int_field = model->MakeField("one"); + auto int_vector = model->MakeField>("int_vector"); + auto ntuple = + RNTupleWriter::Recreate(std::move(model), "ntuple", rootFileName); + for(auto i=0; i<1000; i++){ + if (i && i%100==0) { + ntuple->CommitCluster(); + } + if (i == 450 || i == 750) { // to add a bit of unevenness + ntuple->CommitCluster(/*commitClusterGroup*/ true); + } + *int_field = i; + *int_vector = {static_cast(i), static_cast(i+1)}; + ntuple->Fill(); + } +} diff --git a/src/skhep_testdata/data/test_multiple_cluster_groups_rntuple_v1-0-0-0.root b/src/skhep_testdata/data/test_multiple_cluster_groups_rntuple_v1-0-0-0.root new file mode 100644 index 0000000..4e5b61b Binary files /dev/null and b/src/skhep_testdata/data/test_multiple_cluster_groups_rntuple_v1-0-0-0.root differ