From ec6501d497a9eba69d2f348bc43933851be08341 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Thu, 9 Jan 2025 14:47:57 -0500 Subject: [PATCH] feat: add RNTuple with multiple cluster groups (#168) * Added RNTuple with multiple cluster groups * Small tweaks --- .../rntuple_multiple_cluster_groups.C | 34 ++++++++++++++++++ ...tiple_cluster_groups_rntuple_v1-0-0-0.root | Bin 0 -> 7162 bytes 2 files changed, 34 insertions(+) create mode 100644 dev/make-root/rntuple_multiple_cluster_groups.C create mode 100644 src/skhep_testdata/data/test_multiple_cluster_groups_rntuple_v1-0-0-0.root 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 0000000000000000000000000000000000000000..4e5b61b599d6f5a86508216c1b8970ec762eaaa3 GIT binary patch literal 7162 zcmdT}3s{WV8$a`Xb4g8CqoxZ6p;|O0$rzdvs-^9QB;8D{G)?U^T_u$yZEPx)gk)R_ zZBkULv`IH@EG-pU4{dCl$j-JT^*`TCD8^r6_p$Fh-<&h&Io~($`~KeZ-aekMFCT!X zvH$=!0P4N)+5_iq@WR0>0T0J#0I0zqxHPyhN~%XY;hlcLw#O=fljzCVgWx}kiD19P zi{qis_weVt_ylnHUVa=8mvx)~f4&FL(y`Ah9>)4;?g0dh z4-qc_BtZ@m;5EpLD)$w4gS@>p{Eo?jTO+z(=jCo3eQ+O}U~9_pbqB!F4tEBCH8`ME zsQbco4e%fUGZGG4Ai}L;VKBAZe)W|-Ezoe*>^ZaOddvY7F3knLTn{pw`19Eeh8LGV zTi=EMB~BWyz#lGw9_#qNJXNNip$mT@Fht<83ti8!h%y$?)By|N6oCRjgsR!Q1XHFH z?5VW!D5WX$<)aRVd9CBi#*EcXUVlWr7OwE>dy9Dzk$Q`EPh#=;Y+=?CR?7&Srahu3x`l1Bb)q`uXvAe12eHaByg7SXg*? zL_}0nbaYHiY;0UyeEiOx2?>db$;l}xX=&-{85#TcXJ%$)2?R%u96OeibK*p9ZeCt~ zenG*RGet!uCFjnSm6exQR8&@0RnN8QTy_frr zDsEdkawvZt%JfMh5Rhx?>gwwo8m?TqdbP3f`t_!!mX=$$T3hejxqG**t-bxhgN}~Q z&aSS+A0apPLB)90Fun+uN*YgjM!#4twO1^4|p~;pB+m{C{WZ zQ$Y=x7QspXzAc2vIk+H4TPxG*W8fU^N%-8%00&(WVcISy?F3}pT$2!$z#tfPa1D}9 zCn;=1aE{h(ehAbEDu%P<3pWO;&3uttZdu42Ih@eVyp9WpvD5i)JH&s=3=kBCU6ooz zg1|@qS_wXh-T~31V`!qZ;Q@1ur35sW0#E})fr?i17Y>-AA08i37}Qs{rW88n+n8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