From 1cbfc13d4e0af22b3cabe41c6fea06f1ff9db383 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Mon, 18 Nov 2024 15:13:23 -0500 Subject: [PATCH] Added new test files --- dev/make-root/rntuple_extension_columns.C | 56 ++++++++++++++++++ dev/make-root/rntuple_extension_columns.md | 14 ----- dev/make-root/rntuple_nested_structs.C | 46 ++++++++++++++ .../test_extension_columns_rntuple_v1.root | Bin 0 -> 3749 bytes .../data/test_nested_structs_rntuple_v1.root | Bin 0 -> 2082 bytes 5 files changed, 102 insertions(+), 14 deletions(-) create mode 100644 dev/make-root/rntuple_extension_columns.C delete mode 100644 dev/make-root/rntuple_extension_columns.md create mode 100644 dev/make-root/rntuple_nested_structs.C create mode 100644 src/skhep_testdata/data/test_extension_columns_rntuple_v1.root create mode 100644 src/skhep_testdata/data/test_nested_structs_rntuple_v1.root diff --git a/dev/make-root/rntuple_extension_columns.C b/dev/make-root/rntuple_extension_columns.C new file mode 100644 index 0000000..fdc9892 --- /dev/null +++ b/dev/make-root/rntuple_extension_columns.C @@ -0,0 +1,56 @@ +/* https://root.cern/doc/master/ntpl001__staff_8C.html */ +R__LOAD_LIBRARY(ROOTNTuple) +#include +#include +#include +#include +#include +#include + +#include +#include + +using RNTupleModel = ROOT::Experimental::RNTupleModel; +using RNTupleWriter = ROOT::Experimental::RNTupleWriter; +using RNTupleWriteOptions = ROOT::Experimental::RNTupleWriteOptions; + +void rntuple_extension_columns() { + auto options = RNTupleWriteOptions(); + options.SetMaxUnzippedPageSize(700); + options.SetApproxZippedClusterSize(2000); + options.SetMaxUnzippedClusterSize(2000); + + std::string rootFileName{"test_extension_columns_rntuple_v1.root"}; + auto model = RNTupleModel::Create(); + auto int_field = model->MakeField("int_field"); + + auto ntuple = RNTupleWriter::Recreate(std::move(model), "ntuple", rootFileName, options); + + for (int i = 0; i < 200; i++) { + *int_field = i; + ntuple->Fill(); + } + + auto modelUpdater = ntuple->CreateModelUpdater(); + modelUpdater->BeginUpdate(); + auto vec_fload = modelUpdater->MakeField("float_field"); + modelUpdater->CommitUpdate(); + + for (int i = 0; i < 200; i++) { + *int_field = i; + *vec_fload = i + 0.5; + ntuple->Fill(); + } + + auto modelUpdater2 = ntuple->CreateModelUpdater(); + modelUpdater2->BeginUpdate(); + auto intvec_field = modelUpdater2->MakeField>("intvec_field"); + modelUpdater2->CommitUpdate(); + + for (int i = 0; i < 200; i++) { + *int_field = i; + *vec_fload = i + 0.5; + *intvec_field = {i, i + 1}; + ntuple->Fill(); + } +} diff --git a/dev/make-root/rntuple_extension_columns.md b/dev/make-root/rntuple_extension_columns.md deleted file mode 100644 index f958f91..0000000 --- a/dev/make-root/rntuple_extension_columns.md +++ /dev/null @@ -1,14 +0,0 @@ -1. Checkout an Athena build with ROOT nightly (currently has RNTuple RC2) -2. Get an ATLAS RAW file -3. Run reco: -```bash -Reco_tf.py \ - --CA="True" \ - --maxEvents=40 \ - --multithreaded="True" \ - --sharedWriter="True" \ - --parallelCompression="False" \ - --inputBSFile="raw.root" \ - --outputDAOD_TLAFile="daod_tla.root" \ - --preExec="flags.Output.StorageTechnology.EventData=\"ROOTRNTUPLE\""; -``` diff --git a/dev/make-root/rntuple_nested_structs.C b/dev/make-root/rntuple_nested_structs.C new file mode 100644 index 0000000..a252776 --- /dev/null +++ b/dev/make-root/rntuple_nested_structs.C @@ -0,0 +1,46 @@ +/* https://root.cern/doc/master/ntpl001__staff_8C.html */ +R__LOAD_LIBRARY(ROOTNTuple) +#include +#include +#include +#include +#include + +#include +#include + +using RNTupleModel = ROOT::Experimental::RNTupleModel; +using RNTupleWriter = ROOT::Experimental::RNTupleWriter; + +struct SubSubSruct { + int i; + std::vector v; +}; + +struct SubStruct { + int i; + SubSubSruct sub_sub_struct; +}; + +struct TopStruct { + int i; + SubStruct sub_struct; +}; + +void rntuple_nested_structs() { + std::string rootFileName{"test_nested_structs_rntuple_v1.root"}; + auto model = RNTupleModel::Create(); + auto struct_field = model->MakeField("my_struct"); + auto ntuple = + RNTupleWriter::Recreate(std::move(model), "ntuple", rootFileName); + + + *struct_field = TopStruct(); + for (int i = 0; i < 10; i++) { + struct_field->i = i; + struct_field->sub_struct.i = i + 1; + struct_field->sub_struct.sub_sub_struct.i = i + 2; + struct_field->sub_struct.sub_sub_struct.v = {i, i + 1}; + ntuple->Fill(); + } +} diff --git a/src/skhep_testdata/data/test_extension_columns_rntuple_v1.root b/src/skhep_testdata/data/test_extension_columns_rntuple_v1.root new file mode 100644 index 0000000000000000000000000000000000000000..aef72f2314965424d85887884cd26578c9901262 GIT binary patch literal 3749 zcmcIn4LFq99{<1dZA{a!49RLpLYgLIEz&F!)>oQaa=S<~HX24_Vk%ihl2j^Lg_4gx ztPn~{Mah-5M6+#5Wu?z;TWM-(RrkEZz0=dveV(=V?)yCFJ?Fg7|D50d<9Gh&|4Jni z8Nkp401yH&OHd0$V;|Ho)M7}e9|mAtLH$nj;ZHtgfHneQT>mp~@KEiH&;ZB+_Xx4b zOeTtzg^1)bQFLsCBsye;M7$;{IyOWaEn5>K7KOyk=1Orj|EL_0aU2yEKsPtJP7sarz?H!_Ci6eKjN zFcXae{QLx*I6JP*94?PHyY?OK%(F-kG8TPESwH7Y{)TfUpqPkb3n!4Xe;z?`wDvpq`-8 zFti>!P6AUJ5J(gnoxx;j>#+3=42?J@re@}rR$QL7t)0DtlQZAN&E3Px+t)upusASi zS#W5WFnndCI66iui<7TQNKD$4lA4yDu_JSLR(8(*yaNS=#fOiUmX%jl)towgrv7}x z#ir(#*0%PmU5e{BZuZ>i?dyN==*iP(1B1#}L$62P0!9WppG-ApwB3`p0>dPkQd@iX zrGHu8XUL<)@9X;m32bTqRe^CD@@MtM0HeZcej{d)^sBwcBqrT3htN`$V$)t59B@se zb`U9zI1o7Iz z$16@$pRBDrd+tKxrOW@k^4<3xo!5T&vHRBTyFcB#|M2n8zx?|A#mnD@e}D51FanW8 zrch}bbWO$t=0uj3_9r^J^XBotaB-!u;NXC4uZX1FO4HSh>@eNFEU+pa5lUM{s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qf7{ixaHuhvYdxbGH5E$TsQ$Q zOC1~nd0-xpQg2>p*2@F;3%!MKb-OLpS0q*fIyUj>W)T2NUm@Q#R;F&4?BqUBK{ zsb_S!MB7cWCQQ7RBaVn(B@&`8Ru<$`AUZ2O8x3DJ8 zy}YSV=~wJIw@u5evcY05x!u`Vg3ae1H0nKlt1_xq5UIGmI>zs)liuCBy^WWP zYBt}VbRcqOU%!0vltSF|y^-5lV97ojH%ME*Z4)zl}|= zy!4$%aCU^m%JssmWAQr7tQ}SbHrSn^VaF1)RIlmVfBf?K{dxZ7Zdu(YUbW4prjiw1 zb%u%mpaHqV_{>>OXOW^}LwnTopwfiuQsKM)A-hQ}-wPcw%@}X1zBX8Y&TxTFIJqV~ z$(?@ma8mN{ySuMSO{?QVI`d;o3QwNdqg%P(ap~ELUSA(4fqC4>0>aM| a9PguI0bR`k)t}`!Sb#XdEQz0!1^)ug=Pu#^ literal 0 HcmV?d00001 diff --git a/src/skhep_testdata/data/test_nested_structs_rntuple_v1.root b/src/skhep_testdata/data/test_nested_structs_rntuple_v1.root new file mode 100644 index 0000000000000000000000000000000000000000..510fa82cf496ddd4f81fde2cd44a16bdd9023e54 GIT binary patch literal 2082 zcmbVNX;4#F6u$3eAtWIn28uOe3`JQa1OZVNV-Xw#2M_{N5dk5gB9K7xh#)g4Iu?zB zh%ibKwX#&Pl}*P5p+Po9#Hduz;sTALh)N5tRMYz&3id}G+dFe}PR{$@`OZDdeR7!$ z1K^bb06+`?jR$~U57d3(M&MpYhVnH46fXeKd}#Qes~kW_V2x5c{0evzo*^4_D_Rop<+sqXM!vmfUsbMgn%*>Se>+g8&!r})&pcZVW2|Tc)TpA z1qB3%xXSr_M`yl3;4uB2js}g301Cb9LoG4w{UJrNq~Nr(yliJ8us9}srohCmu5nV# zabBd5o)R6L6775}hl+ZmEC&2{#dWPM*%MJtQ%YhmncRI5m=CCtf?OR1zRI2oxBwwh zrh~4iqI8mpUd7>sIbksH^IcKiYVg zQ^8J4q`vlf%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