From c4338598fbf92e696dab81977a83fc8fb299ab6e Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Thu, 14 Nov 2024 10:20:54 -0500 Subject: [PATCH] Updated scripts for RNTuple v1 --- .../Run2012BC_DoubleMuParked_Muons_rntuple_1000evts.md | 2 +- dev/make-root/rntuple_1jag_int_float.C | 3 ++- dev/make-root/rntuple_atomic_bitset.C | 2 +- dev/make-root/rntuple_bit.C | 3 ++- dev/make-root/rntuple_emptystruct_invalidvar.C | 5 +++-- ...ple_extension_columns.md => rntuple_extension_columns.md} | 0 dev/make-root/rntuple_index_multicluster.C | 4 ++-- dev/make-root/rntuple_int_5e4.C | 3 ++- dev/make-root/rntuple_int_float.C | 3 ++- dev/make-root/rntuple_int_multicluster.C | 3 ++- dev/make-root/rntuple_int_vfloat_tlv_vtlv.C | 3 ++- dev/make-root/rntuple_split_3e4.C | 3 ++- dev/make-root/rntuple_stl_containers.C | 3 ++- 13 files changed, 23 insertions(+), 14 deletions(-) rename dev/make-root/{test_ntuple_extension_columns.md => rntuple_extension_columns.md} (100%) diff --git a/dev/make-root/Run2012BC_DoubleMuParked_Muons_rntuple_1000evts.md b/dev/make-root/Run2012BC_DoubleMuParked_Muons_rntuple_1000evts.md index 4e7d9ec..9ba6e9c 100644 --- a/dev/make-root/Run2012BC_DoubleMuParked_Muons_rntuple_1000evts.md +++ b/dev/make-root/Run2012BC_DoubleMuParked_Muons_rntuple_1000evts.md @@ -1,7 +1,7 @@ First, download `Run2012BC_DoubleMuParked_Muons.root` from [here](https://opendata.cern.ch/record/12341). Then, run the following commands in ROOT. ```cpp -auto importer = ROOT::Experimental::RNTupleImporter::Create("./Run2012BC_DoubleMuParked_Muons.root", "Events", "./Run2012BC_DoubleMuParked_Muons_rntuple_1000evts.root"); +auto importer = ROOT::Experimental::RNTupleImporter::Create("./Run2012BC_DoubleMuParked_Muons.root", "Events", "./Run2012BC_DoubleMuParked_Muons_1000evts_rntuple_v1.root"); auto c = importer.get(); c->SetMaxEntries(1000); c->Import() diff --git a/dev/make-root/rntuple_1jag_int_float.C b/dev/make-root/rntuple_1jag_int_float.C index b4fac3d..348bf3a 100644 --- a/dev/make-root/rntuple_1jag_int_float.C +++ b/dev/make-root/rntuple_1jag_int_float.C @@ -3,13 +3,14 @@ R__LOAD_LIBRARY(ROOTNTuple); #include #include #include +#include #include using RNTupleModel = ROOT::Experimental::RNTupleModel; using RNTupleWriter = ROOT::Experimental::RNTupleWriter; void rntuple_1jag_int_float() { - std::string rootFileName{"test_ntuple_1jag_int_float.root"}; + std::string rootFileName{"test_1jag_int_float_rntuple_v1.root"}; auto model = RNTupleModel::Create(); auto v_int = model->MakeField>("one_v_integers"); auto v_float = model->MakeField>("two_v_floats"); diff --git a/dev/make-root/rntuple_atomic_bitset.C b/dev/make-root/rntuple_atomic_bitset.C index 45b8f37..f29cdd4 100644 --- a/dev/make-root/rntuple_atomic_bitset.C +++ b/dev/make-root/rntuple_atomic_bitset.C @@ -13,7 +13,7 @@ using RNTupleModel = ROOT::Experimental::RNTupleModel; using RNTupleWriter = ROOT::Experimental::RNTupleWriter; void rntuple_atomic_bitset() { - std::string rootFileName{"test_ntuple_atomic_bitset.root"}; + std::string rootFileName{"test_atomic_bitset_rntuple_v1.root"}; auto model = RNTupleModel::Create(); auto atomic_int_field = model->MakeField>("atomic_int"); auto bitset_field = model->MakeField>("bitset"); diff --git a/dev/make-root/rntuple_bit.C b/dev/make-root/rntuple_bit.C index 2a1968d..885c021 100644 --- a/dev/make-root/rntuple_bit.C +++ b/dev/make-root/rntuple_bit.C @@ -2,13 +2,14 @@ R__LOAD_LIBRARY(ROOTNTuple) #include #include #include +#include #include using RNTupleModel = ROOT::Experimental::RNTupleModel; using RNTupleWriter = ROOT::Experimental::RNTupleWriter; void rntuple_bit() { - std::string rootFileName{"test_ntuple_bit.root"}; + std::string rootFileName{"test_bit_rntuple_v1.root"}; auto model = RNTupleModel::Create(); auto bit_field = model->MakeField("one_bit"); auto ntuple = diff --git a/dev/make-root/rntuple_emptystruct_invalidvar.C b/dev/make-root/rntuple_emptystruct_invalidvar.C index 79d1b6b..d0873e1 100644 --- a/dev/make-root/rntuple_emptystruct_invalidvar.C +++ b/dev/make-root/rntuple_emptystruct_invalidvar.C @@ -17,12 +17,13 @@ struct EmptyStruct {}; struct StructForVariant { int i; StructForVariant() = default; + StructForVariant(int ii) : i(ii) {}; StructForVariant(const StructForVariant &) { throw std::runtime_error("copy ctor"); } StructForVariant &operator=(const StructForVariant &) = default; }; void rntuple_emptystruct_invalidvar() { - std::string rootFileName{"test_ntuple_emptystruct_invalidvar.root"}; + std::string rootFileName{"test_emptystruct_invalidvar_rntuple_v1.root"}; auto model = RNTupleModel::Create(); auto empty_struct_field = model->MakeField("empty_struct"); auto variant_field = model->MakeField>("variant"); @@ -33,7 +34,7 @@ void rntuple_emptystruct_invalidvar() { *variant_field = 1; // valid state ntuple->Fill(); - *variant_field = { 1 }; // valid state + variant_field->emplace(2); // valid state ntuple->Fill(); try { diff --git a/dev/make-root/test_ntuple_extension_columns.md b/dev/make-root/rntuple_extension_columns.md similarity index 100% rename from dev/make-root/test_ntuple_extension_columns.md rename to dev/make-root/rntuple_extension_columns.md diff --git a/dev/make-root/rntuple_index_multicluster.C b/dev/make-root/rntuple_index_multicluster.C index 5f317c3..fb77984 100644 --- a/dev/make-root/rntuple_index_multicluster.C +++ b/dev/make-root/rntuple_index_multicluster.C @@ -16,11 +16,11 @@ using RNTupleWriteOptions = ROOT::Experimental::RNTupleWriteOptions; void rntuple_index_multicluster() { auto options = RNTupleWriteOptions(); - options.SetApproxUnzippedPageSize(512); + options.SetMaxUnzippedPageSize(512); options.SetApproxZippedClusterSize(1000); options.SetMaxUnzippedClusterSize(1024); - std::string rootFileName{"test_ntuple_index_multicluster.root"}; + std::string rootFileName{"test_index_multicluster_rntuple_v1.root"}; auto model = RNTupleModel::Create(); auto int_vector = model->MakeField>("int_vector"); auto ntuple = diff --git a/dev/make-root/rntuple_int_5e4.C b/dev/make-root/rntuple_int_5e4.C index be0cfd4..70516df 100644 --- a/dev/make-root/rntuple_int_5e4.C +++ b/dev/make-root/rntuple_int_5e4.C @@ -7,13 +7,14 @@ R__LOAD_LIBRARY(ROOTNTuple) #include #include #include +#include #include using RNTupleModel = ROOT::Experimental::RNTupleModel; using RNTupleWriter = ROOT::Experimental::RNTupleWriter; void rntuple_int_5e4() { - std::string rootFileName{"test_ntuple_int_5e4.root"}; + std::string rootFileName{"test_int_5e4_rntuple_v1.root"}; auto model = RNTupleModel::Create(); auto int_field = model->MakeField("one_integers"); auto ntuple = diff --git a/dev/make-root/rntuple_int_float.C b/dev/make-root/rntuple_int_float.C index 943a2d5..aa5aa63 100644 --- a/dev/make-root/rntuple_int_float.C +++ b/dev/make-root/rntuple_int_float.C @@ -3,13 +3,14 @@ R__LOAD_LIBRARY(ROOTNTuple) #include #include #include +#include #include using RNTupleModel = ROOT::Experimental::RNTupleModel; using RNTupleWriter = ROOT::Experimental::RNTupleWriter; void rntuple_int_float() { - std::string rootFileName{"test_ntuple_int_float.root"}; + std::string rootFileName{"test_int_float_rntuple_v1.root"}; auto model = RNTupleModel::Create(); auto int_field = model->MakeField("one_integers"); auto float_field = model->MakeField("two_floats"); diff --git a/dev/make-root/rntuple_int_multicluster.C b/dev/make-root/rntuple_int_multicluster.C index 7adf906..a71856e 100644 --- a/dev/make-root/rntuple_int_multicluster.C +++ b/dev/make-root/rntuple_int_multicluster.C @@ -4,13 +4,14 @@ R__LOAD_LIBRARY(ROOTNTuple) #include #include #include +#include #include using RNTupleModel = ROOT::Experimental::RNTupleModel; using RNTupleWriter = ROOT::Experimental::RNTupleWriter; void rntuple_int_multicluster() { - std::string rootFileName{"test_ntuple_int_multicluster.root"}; + std::string rootFileName{"test_int_multicluster_rntuple_v1.root"}; auto model = RNTupleModel::Create(); auto int_field = model->MakeField("one_integers"); auto ntuple = diff --git a/dev/make-root/rntuple_int_vfloat_tlv_vtlv.C b/dev/make-root/rntuple_int_vfloat_tlv_vtlv.C index 4466ab2..aa97685 100644 --- a/dev/make-root/rntuple_int_vfloat_tlv_vtlv.C +++ b/dev/make-root/rntuple_int_vfloat_tlv_vtlv.C @@ -4,6 +4,7 @@ R__LOAD_LIBRARY(ROOTNTuple) #include #include #include +#include #include using RNTupleModel = ROOT::Experimental::RNTupleModel; @@ -17,7 +18,7 @@ struct LV{ }; void rntuple_int_vfloat_tlv_vtlv() { - std::string rootFileName{"test_ntuple_int_vfloat_tlv_vtlv.root"}; + std::string rootFileName{"test_int_vfloat_tlv_vtlv_rntuple_v1.root"}; auto model = RNTupleModel::Create(); auto int_field = model->MakeField("one_integers"); auto v_float_field = model->MakeField>("two_v_floats"); diff --git a/dev/make-root/rntuple_split_3e4.C b/dev/make-root/rntuple_split_3e4.C index ae8771a..acbf860 100644 --- a/dev/make-root/rntuple_split_3e4.C +++ b/dev/make-root/rntuple_split_3e4.C @@ -5,13 +5,14 @@ R__LOAD_LIBRARY(ROOTNTuple) #include #include #include +#include #include using RNTupleModel = ROOT::Experimental::RNTupleModel; using RNTupleWriter = ROOT::Experimental::RNTupleWriter; void rntuple_split_3e4() { - std::string rootFileName{"test_ntuple_split_3e4.root"}; + std::string rootFileName{"test_split_3e4_rntuple_v1.root"}; auto model = RNTupleModel::Create(); auto splitint_field = model->MakeField("one_int32"); auto splitint_field2 = model->MakeField("two_uint32"); diff --git a/dev/make-root/rntuple_stl_containers.C b/dev/make-root/rntuple_stl_containers.C index ca8e027..9eea78b 100644 --- a/dev/make-root/rntuple_stl_containers.C +++ b/dev/make-root/rntuple_stl_containers.C @@ -6,6 +6,7 @@ R__LOAD_LIBRARY(ROOTNTuple) #include #include #include +#include #include using RNTupleModel = ROOT::Experimental::RNTupleModel; @@ -25,7 +26,7 @@ struct LV{ }; void rntuple_stl_containers() { - std::string rootFileName{"test_ntuple_stl_containers.root"}; + std::string rootFileName{"test_stl_containers_rntuple_v1.root"}; auto model = RNTupleModel::Create(); auto string = model->MakeField("string"); auto vector_int32 = model->MakeField>("vector_int32");