diff --git a/.github/workflows/root.yml b/.github/workflows/root.yml index 91360c1..89c8d69 100644 --- a/.github/workflows/root.yml +++ b/.github/workflows/root.yml @@ -5,10 +5,10 @@ on: pull_request: jobs: - root-v634: - name: ROOT 6.34 + root-v636: + name: ROOT 6.36 runs-on: ubuntu-latest - container: rootproject/root:6.34.00-ubuntu24.04 + container: rootproject/root:6.36.00-ubuntu25.04 steps: - name: Check out repository uses: actions/checkout@v5 diff --git a/README.md b/README.md index dbd36f3..b13bff5 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,9 @@ More tests are planned in the future, please [consult the list of issues](https: ## Reference Implementation This repository also contains a reference implementation with ROOT macros. -They currently target ROOT v6.34 with the first official version of the RNTuple on-disk binary format. -In this release, the API is not yet finalized and all classes are in the `ROOT::Experimental` namespace. -We rely on this version to produce a first set of reference files that can be used to test backwards compatibility. -Afterwards, the implementation will be updated for the stable API (available since ROOT v6.36). +They target the stable API released with ROOT v6.36 and should work on newer versions. +Compatibility with ROOT v6.34 can be tested with version v1.0 of the RNTuple Validation Suite. +It was the first official version of the RNTuple on-disk binary format, but the API was not yet finalized and all classes were in the `ROOT::Experimental` namespace. ### How to Run diff --git a/compression/algorithms/write_algorithm.hxx b/compression/algorithms/write_algorithm.hxx index 177f64b..dea1b32 100644 --- a/compression/algorithms/write_algorithm.hxx +++ b/compression/algorithms/write_algorithm.hxx @@ -1,28 +1,27 @@ #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include void write_algorithm(std::string_view filename, std::uint32_t compression) { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Int64 = model->MakeField("Int64"); model->GetMutableField("Int64").SetColumnRepresentatives( - {{EColumnType::kSplitInt64}}); + {{ROOT::ENTupleColumnType::kSplitInt64}}); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(compression); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // Write 32 entries to make sure the compression block is not too small. for (int i = 0; i < 32; i++) { diff --git a/compression/block/big/write.C b/compression/block/big/write.C index 79152da..799650a 100644 --- a/compression/block/big/write.C +++ b/compression/block/big/write.C @@ -1,33 +1,32 @@ #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include void write(std::string_view filename = "compression.block.big.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Int64 = model->MakeField("Int64"); model->GetMutableField("Int64").SetColumnRepresentatives( - {{EColumnType::kSplitInt64}}); + {{ROOT::ENTupleColumnType::kSplitInt64}}); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; // Crank up the zstd compression level to reduce the output file size by // approximately a factor 6 (from 76K with 505 to 12K). options.SetCompression(509); // Increase the maximum unzipped page size to make it bigger than the maximum // size of a compression block, which is 16 MiB. options.SetMaxUnzippedPageSize(128 * 1024 * 1024); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // Write 40 MiB of entries that will be split into three compression blocks. static constexpr int Entries = 40 * 1024 * 1024 / sizeof(std::int64_t); diff --git a/compression/block/short/write.C b/compression/block/short/write.C index e262002..cc959ee 100644 --- a/compression/block/short/write.C +++ b/compression/block/short/write.C @@ -1,28 +1,27 @@ #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include void write(std::string_view filename = "compression.block.short.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Int64 = model->MakeField("Int64"); model->GetMutableField("Int64").SetColumnRepresentatives( - {{EColumnType::kSplitInt64}}); + {{ROOT::ENTupleColumnType::kSplitInt64}}); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(505); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // Write only 2 entries to make sure the compression block is small and // actually stored uncompressed. diff --git a/compression/read_compression.hxx b/compression/read_compression.hxx index 141d031..d2d7a94 100644 --- a/compression/read_compression.hxx +++ b/compression/read_compression.hxx @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -11,7 +8,7 @@ using ROOT::Experimental::RNTupleReader; #include void read_compression(std::string_view input, std::string_view output) { - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto Int64 = reader->GetModel().GetDefaultEntry().GetPtr("Int64"); std::int64_t sum = 0; diff --git a/projections/cardinality/read.C b/projections/cardinality/read.C index 573e611..b42fd2f 100644 --- a/projections/cardinality/read.C +++ b/projections/cardinality/read.C @@ -1,9 +1,10 @@ #include #include +#if __has_include() +#include +#else #include - -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; +#endif #include #include @@ -14,7 +15,7 @@ using ROOT::Experimental::RNTupleReader; using Vector = std::vector; -static void PrintVectorValue(const REntry &entry, std::string_view name, +static void PrintVectorValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { Vector &value = *entry.GetPtr(name); os << " \"" << name << "\": ["; @@ -38,7 +39,7 @@ static void PrintVectorValue(const REntry &entry, std::string_view name, } template -static void PrintCardinality(const REntry &entry, std::string_view name, +static void PrintCardinality(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { T value = *entry.GetPtr>(name); os << " \"" << name << "\": " << value; @@ -53,7 +54,7 @@ void read(std::string_view input = "projections.cardinality.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/projections/cardinality/write.C b/projections/cardinality/write.C index 146878d..0240fbd 100644 --- a/projections/cardinality/write.C +++ b/projections/cardinality/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -18,37 +16,40 @@ using ROOT::Experimental::RNTupleWriter; using Vector = std::vector; -static std::shared_ptr MakeVectorField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeVectorField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } template -static void AddProjectedCardinalityField(RNTupleModel &model, +static void AddProjectedCardinalityField(ROOT::RNTupleModel &model, std::string_view name, std::string_view source) { - auto field = std::make_unique>>(name); + auto field = + std::make_unique>>(name); model.AddProjectedField(std::move(field), [&source](const std::string &) { return std::string{source}; }); } void write(std::string_view filename = "projections.cardinality.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeVectorField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeVectorField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeVectorField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeVectorField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeVectorField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeVectorField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeVectorField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeVectorField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); // Create RNTupleCardinality projections AddProjectedCardinalityField(*model, "Index32Cardinality", @@ -60,10 +61,10 @@ void write(std::string_view filename = "projections.cardinality.root") { AddProjectedCardinalityField(*model, "SplitIndex64Cardinality", "SplitIndex64"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element vectors, with ascending values *Index32 = {1}; diff --git a/projections/collection/read.C b/projections/collection/read.C index 25ebea5..895aa8c 100644 --- a/projections/collection/read.C +++ b/projections/collection/read.C @@ -2,9 +2,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,8 +10,9 @@ using ROOT::Experimental::RNTupleReader; #include template -static void PrintCollectionValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintCollectionValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { C &value = *entry.GetPtr(name); os << " \"" << name << "\": ["; bool first = true; @@ -41,7 +39,7 @@ void read(std::string_view input = "projections.collection.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/projections/collection/write.C b/projections/collection/write.C index e7a96b8..e5e6cb4 100644 --- a/projections/collection/write.C +++ b/projections/collection/write.C @@ -4,11 +4,6 @@ #include #include -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -16,11 +11,11 @@ using ROOT::Experimental::RNTupleWriter; #include void write(std::string_view filename = "projections.collection.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Vector = model->MakeField>("Vector"); auto Projected = - std::make_unique>>("Projected"); + std::make_unique>>("Projected"); model->AddProjectedField(std::move(Projected), [](const std::string &fieldName) { if (fieldName == "Projected") { @@ -30,10 +25,10 @@ void write(std::string_view filename = "projections.collection.root") { } }); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: ascending values *Vector = {1, 2}; diff --git a/projections/leaf/read.C b/projections/leaf/read.C index 6abb391..928e3dc 100644 --- a/projections/leaf/read.C +++ b/projections/leaf/read.C @@ -1,9 +1,5 @@ #include #include -#include - -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; #include #include @@ -23,7 +19,7 @@ template <> void PrintValue(const float &value, std::ostream &os) { } template -static void PrintPairValue(const REntry &entry, std::string_view name, +static void PrintPairValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { auto &value = *entry.GetPtr>(name); os << " \"" << name << "\": [\n"; @@ -41,7 +37,7 @@ static void PrintPairValue(const REntry &entry, std::string_view name, } template -static void PrintValue(const REntry &entry, std::string_view name, +static void PrintValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { T value = *entry.GetPtr(name); os << " \"" << name << "\": "; @@ -59,7 +55,7 @@ void read(std::string_view input = "projections.leaf.root", os << std::hexfloat; os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/projections/leaf/write.C b/projections/leaf/write.C index 905e4f2..a1be2bb 100644 --- a/projections/leaf/write.C +++ b/projections/leaf/write.C @@ -3,11 +3,6 @@ #include #include -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -15,25 +10,25 @@ using ROOT::Experimental::RNTupleWriter; #include template -static void AddProjectedField(RNTupleModel &model, std::string_view name, +static void AddProjectedField(ROOT::RNTupleModel &model, std::string_view name, std::string_view source) { - auto field = std::make_unique>(name); + auto field = std::make_unique>(name); model.AddProjectedField(std::move(field), [&source](const std::string &) { return std::string{source}; }); } void write(std::string_view filename = "projections.leaf.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Pair = model->MakeField>("Pair"); AddProjectedField(*model, "Int32", "Pair._0"); AddProjectedField(*model, "Float", "Pair._1"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: ascending values *Pair = {1, 2.0}; diff --git a/projections/nested/read.C b/projections/nested/read.C index 2395788..43a87c0 100644 --- a/projections/nested/read.C +++ b/projections/nested/read.C @@ -2,9 +2,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -36,7 +33,7 @@ void PrintValue(const std::pair &value, std::ostream &os) { } template -static void PrintVectorValue(const REntry &entry, std::string_view name, +static void PrintVectorValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { auto &value = *entry.GetPtr>(name); os << " \"" << name << "\": ["; @@ -67,7 +64,7 @@ void read(std::string_view input = "projections.nested.root", os << std::hexfloat; os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/projections/nested/write.C b/projections/nested/write.C index 39ae6e5..383ef95 100644 --- a/projections/nested/write.C +++ b/projections/nested/write.C @@ -4,11 +4,6 @@ #include #include -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -17,9 +12,9 @@ using ROOT::Experimental::RNTupleWriter; #include template -static void AddProjectedField(RNTupleModel &model, std::string_view name, +static void AddProjectedField(ROOT::RNTupleModel &model, std::string_view name, std::string_view source) { - auto field = std::make_unique>>(name); + auto field = std::make_unique>>(name); model.AddProjectedField(std::move(field), [&name, &source](const std::string &fieldName) { if (fieldName == name) { @@ -31,7 +26,7 @@ static void AddProjectedField(RNTupleModel &model, std::string_view name, } void write(std::string_view filename = "projections.nested.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto VectorPair = model->MakeField>>( @@ -39,10 +34,10 @@ void write(std::string_view filename = "projections.nested.root") { AddProjectedField(*model, "VectorInt", "_0"); AddProjectedField(*model, "VectorFloat", "_1"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: ascending values VectorPair->emplace_back(1, 2.0); diff --git a/structure/cluster_groups/write.C b/structure/cluster_groups/write.C index a066b5d..bde75b4 100644 --- a/structure/cluster_groups/write.C +++ b/structure/cluster_groups/write.C @@ -2,22 +2,18 @@ #include #include -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include void write(std::string_view filename = "structure.cluster_groups.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Int32 = model->MakeField("Int32"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); *Int32 = 1; writer->Fill(); diff --git a/structure/clusters/write.C b/structure/clusters/write.C index ddaa34c..3f86810 100644 --- a/structure/clusters/write.C +++ b/structure/clusters/write.C @@ -2,22 +2,18 @@ #include #include -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include void write(std::string_view filename = "structure.clusters.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Int32 = model->MakeField("Int32"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); *Int32 = 1; writer->Fill(); diff --git a/structure/empty/write.C b/structure/empty/write.C index 055d33c..e19a0cf 100644 --- a/structure/empty/write.C +++ b/structure/empty/write.C @@ -2,22 +2,18 @@ #include #include -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include void write(std::string_view filename = "structure.empty.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Int32 = model->MakeField("Int32"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // Destruct the writer / commit the dataset without filling an entry. writer.reset(); diff --git a/structure/feature_flag/write.C b/structure/feature_flag/write.C index efcdf1e..0c348b9 100644 --- a/structure/feature_flag/write.C +++ b/structure/feature_flag/write.C @@ -3,18 +3,16 @@ #include #include #include +#include #include #include #include -using ROOT::Experimental::RFieldZero; -using ROOT::Experimental::RNTupleDescriptor; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::Internal::RFieldDescriptorBuilder; -using ROOT::Experimental::Internal::RNTupleDescriptorBuilder; -using ROOT::Experimental::Internal::RNTupleFileWriter; -using ROOT::Experimental::Internal::RNTupleSerializer; +using ROOT::Internal::RFieldDescriptorBuilder; +using ROOT::Internal::RNTupleDescriptorBuilder; +using ROOT::Internal::RNTupleFileWriter; +using ROOT::Internal::RNTupleSerializer; void write(std::string_view filename = "structure.feature_flag.root") { // Note that we are writing a file with a so-far unused feature flag. This @@ -22,17 +20,18 @@ void write(std::string_view filename = "structure.feature_flag.root") { // low-level classes to create the file. RNTupleDescriptorBuilder descBuilder; - // The following line will be required as of ROOT v6.36 - // descBuilder.SetVersionForWriting(); +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 36, 4) + descBuilder.SetVersionForWriting(); +#endif descBuilder.SetNTuple("ntpl", ""); - descBuilder.SetFeature(RNTupleDescriptor::kFeatureFlagTest); - descBuilder.AddField(RFieldDescriptorBuilder::FromField(RFieldZero()) + descBuilder.SetFeature(ROOT::RNTupleDescriptor::kFeatureFlagTest); + descBuilder.AddField(RFieldDescriptorBuilder::FromField(ROOT::RFieldZero()) .FieldId(0) .MakeDescriptor() .Unwrap()); auto descriptor = descBuilder.MoveDescriptor(); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); auto writer = RNTupleFileWriter::Recreate( "ntpl", filename, RNTupleFileWriter::EContainerFormat::kTFile, @@ -40,18 +39,18 @@ void write(std::string_view filename = "structure.feature_flag.root") { RNTupleSerializer serializer; - auto ctx = serializer.SerializeHeader(nullptr, descriptor); + auto ctx = serializer.SerializeHeader(nullptr, descriptor).Unwrap(); auto buffer = std::make_unique(ctx.GetHeaderSize()); - ctx = serializer.SerializeHeader(buffer.get(), descriptor); + ctx = serializer.SerializeHeader(buffer.get(), descriptor).Unwrap(); writer->WriteNTupleHeader(buffer.get(), ctx.GetHeaderSize(), ctx.GetHeaderSize()); - auto szFooter = serializer.SerializeFooter(nullptr, descriptor, ctx); + auto szFooter = serializer.SerializeFooter(nullptr, descriptor, ctx).Unwrap(); buffer = std::make_unique(szFooter); serializer.SerializeFooter(buffer.get(), descriptor, ctx); writer->WriteNTupleFooter(buffer.get(), szFooter, szFooter); - writer->Commit(); + writer->Commit(options.GetCompression()); // Call destructor to flush data to disk writer.reset(); } diff --git a/structure/read_structure.hxx b/structure/read_structure.hxx index dff1d2c..ef04b6d 100644 --- a/structure/read_structure.hxx +++ b/structure/read_structure.hxx @@ -2,9 +2,6 @@ #include #include -using ROOT::Experimental::RException; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -14,10 +11,10 @@ using ROOT::Experimental::RNTupleReader; void read_structure(std::string_view input, std::string_view output) { std::ofstream os(std::string{output}); - std::unique_ptr reader; + std::unique_ptr reader; try { - reader = RNTupleReader::Open("ntpl", input); - } catch (const RException &e) { + reader = ROOT::RNTupleReader::Open("ntpl", input); + } catch (const ROOT::RException &e) { std::string msgWithoutStacktrace; std::getline(std::istringstream(e.what()), msgWithoutStacktrace); os << "{\n"; diff --git a/types/RVec/fundamental/read.C b/types/RVec/fundamental/read.C index f1d4400..cda1944 100644 --- a/types/RVec/fundamental/read.C +++ b/types/RVec/fundamental/read.C @@ -2,9 +2,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,7 +10,7 @@ using ROOT::Experimental::RNTupleReader; using Vector = ROOT::RVec; -static void PrintVectorValue(const REntry &entry, std::string_view name, +static void PrintVectorValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { Vector &value = *entry.GetPtr(name); os << " \"" << name << "\": ["; @@ -41,7 +38,7 @@ void read(std::string_view input = "types.RVec.fundamental.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/RVec/fundamental/write.C b/types/RVec/fundamental/write.C index a7ae7bd..b123d01 100644 --- a/types/RVec/fundamental/write.C +++ b/types/RVec/fundamental/write.C @@ -1,48 +1,48 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include using Vector = ROOT::RVec; -static std::shared_ptr MakeVectorField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeVectorField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.RVec.fundamental.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeVectorField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeVectorField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeVectorField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeVectorField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeVectorField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeVectorField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeVectorField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeVectorField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element vectors, with ascending values *Index32 = {1}; diff --git a/types/RVec/nested/read.C b/types/RVec/nested/read.C index 7a0977a..abb016f 100644 --- a/types/RVec/nested/read.C +++ b/types/RVec/nested/read.C @@ -2,9 +2,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,8 +10,9 @@ using ROOT::Experimental::RNTupleReader; using Vector = ROOT::RVec>; -static void PrintNestedVectorValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintNestedVectorValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { Vector &value = *entry.GetPtr(name); os << " \"" << name << "\": ["; bool outerFirst = true; @@ -54,7 +52,7 @@ void read(std::string_view input = "types.RVec.nested.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/RVec/nested/write.C b/types/RVec/nested/write.C index 6cbbc9e..8f672c2 100644 --- a/types/RVec/nested/write.C +++ b/types/RVec/nested/write.C @@ -1,16 +1,14 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -18,33 +16,35 @@ using ROOT::Experimental::RNTupleWriter; using Inner = ROOT::RVec; using Vector = ROOT::RVec; -static std::shared_ptr MakeVectorField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeVectorField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); - field->GetSubFields()[0]->SetColumnRepresentatives({{indexType}}); + field->GetMutableSubfields()[0]->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.RVec.nested.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeVectorField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeVectorField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeVectorField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeVectorField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeVectorField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeVectorField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeVectorField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeVectorField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element vectors, with ascending values *Index32 = {{1}}; @@ -66,11 +66,4 @@ void write(std::string_view filename = "types.RVec.nested.root") { *SplitIndex32 = {{4}, {}, {5, 6}}; *SplitIndex64 = {{}, {7, 8, 9}, {}, {10}}; writer->Fill(); - - // Work around bug in 6.34 for destroying RVec's, later fixed by commit - // https://github.com/root-project/root/commit/996cac359d for 6.36. - Index32->clear(); - Index64->clear(); - SplitIndex32->clear(); - SplitIndex64->clear(); } diff --git a/types/array/read.C b/types/array/read.C index 6c0a72a..905112d 100644 --- a/types/array/read.C +++ b/types/array/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -54,7 +51,7 @@ template <> void PrintValue(const VectorInt32 &value, std::ostream &os) { } template -static void PrintArrayValue(const REntry &entry, std::string_view name, +static void PrintArrayValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { auto &value = *entry.GetPtr>(name); os << " \"" << name << "\": ["; @@ -76,8 +73,9 @@ static void PrintArrayValue(const REntry &entry, std::string_view name, os << "\n"; } -static void PrintArrayArrayValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintArrayArrayValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { auto &value = *entry.GetPtr, 3>>(name); os << " \"" << name << "\": ["; bool first = true; @@ -112,7 +110,7 @@ void read(std::string_view input = "types.array.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/array/write.C b/types/array/write.C index 68be78d..4d1d70f 100644 --- a/types/array/write.C +++ b/types/array/write.C @@ -2,10 +2,6 @@ #include #include -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -20,7 +16,7 @@ using Variant = std::variant; using VectorInt32 = std::vector; void write(std::string_view filename = "types.array.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Array_Int32 = model->MakeField("Array_Int32"); auto Array_Array = model->MakeField>("Array_Array"); @@ -31,10 +27,10 @@ void write(std::string_view filename = "types.array.root") { auto Array_Vector = model->MakeField>("Array_Vector"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: simple values *Array_Int32 = {1, 2}; diff --git a/types/atomic/read.C b/types/atomic/read.C index 4cafc1c..2fada49 100644 --- a/types/atomic/read.C +++ b/types/atomic/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include // for std::byte #include @@ -13,7 +10,7 @@ using ROOT::Experimental::RNTupleReader; #include template -static void PrintIntegerValue(const REntry &entry, std::string_view name, +static void PrintIntegerValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { T value = *entry.GetPtr>(name); os << " \"" << name << "\": "; @@ -27,7 +24,7 @@ static void PrintIntegerValue(const REntry &entry, std::string_view name, } template -static void PrintRealValue(const REntry &entry, std::string_view name, +static void PrintRealValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { T value = *entry.GetPtr>(name); os << " \"" << name << "\": \"" << value << "\""; @@ -44,7 +41,7 @@ void read(std::string_view input = "types.atomic.root", os << std::hexfloat; os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/atomic/write.C b/types/atomic/write.C index aaaab14..6dc2137 100644 --- a/types/atomic/write.C +++ b/types/atomic/write.C @@ -2,10 +2,6 @@ #include #include -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include // for std::byte #include @@ -13,13 +9,13 @@ using ROOT::Experimental::RNTupleWriter; #include template -static std::shared_ptr> MakeAtomicField(RNTupleModel &model, - std::string_view name) { +static std::shared_ptr> +MakeAtomicField(ROOT::RNTupleModel &model, std::string_view name) { return model.MakeField>(name); } void write(std::string_view filename = "types.atomic.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Bit = MakeAtomicField(*model, "Bit"); auto Byte = MakeAtomicField(*model, "Byte"); @@ -37,10 +33,10 @@ void write(std::string_view filename = "types.atomic.root") { auto Real32 = MakeAtomicField(*model, "Real32"); auto Real64 = MakeAtomicField(*model, "Real64"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: ascending values *Bit = 1; diff --git a/types/bitset/read.C b/types/bitset/read.C index 2000714..7affa5c 100644 --- a/types/bitset/read.C +++ b/types/bitset/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -12,7 +9,7 @@ using ROOT::Experimental::RNTupleReader; #include template -static void PrintBitsetValue(const REntry &entry, std::string_view name, +static void PrintBitsetValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { auto &value = *entry.GetPtr>(name); os << " \"" << name << "\": \"" << value.to_string() << "\""; @@ -27,7 +24,7 @@ void read(std::string_view input = "types.bitset.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/bitset/write.C b/types/bitset/write.C index 3e81e23..d82b034 100644 --- a/types/bitset/write.C +++ b/types/bitset/write.C @@ -2,25 +2,21 @@ #include #include -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include void write(std::string_view filename = "types.bitset.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Bitset1 = model->MakeField>("Bitset1"); auto Bitset64 = model->MakeField>("Bitset64"); auto Bitset65 = model->MakeField>("Bitset65"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: ascending bits set Bitset1->set(0); diff --git a/types/fundamental/integer/read.C b/types/fundamental/integer/read.C index 39c96a7..e586371 100644 --- a/types/fundamental/integer/read.C +++ b/types/fundamental/integer/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -11,7 +8,7 @@ using ROOT::Experimental::RNTupleReader; #include template -static void PrintIntegerValue(const REntry &entry, std::string_view name, +static void PrintIntegerValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { T value = *entry.GetPtr(name); os << " \"" << name << "\": "; @@ -29,7 +26,7 @@ void read(std::string_view input = "types.fundamental.integer.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/fundamental/integer/write.C b/types/fundamental/integer/write.C index ebd3100..44fe9c4 100644 --- a/types/fundamental/integer/write.C +++ b/types/fundamental/integer/write.C @@ -1,70 +1,68 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include #include template -static std::shared_ptr MakeFundamentalField(RNTupleModel &model, +static std::shared_ptr MakeFundamentalField(ROOT::RNTupleModel &model, std::string_view name, - EColumnType type) { - auto field = std::make_unique>(name); + ROOT::ENTupleColumnType type) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{type}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.fundamental.integer.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); - auto Int8 = - MakeFundamentalField(*model, "Int8", EColumnType::kInt8); - auto UInt8 = - MakeFundamentalField(*model, "UInt8", EColumnType::kUInt8); + auto Int8 = MakeFundamentalField(*model, "Int8", + ROOT::ENTupleColumnType::kInt8); + auto UInt8 = MakeFundamentalField( + *model, "UInt8", ROOT::ENTupleColumnType::kUInt8); // Non-split integer encoding - auto Int16 = - MakeFundamentalField(*model, "Int16", EColumnType::kInt16); - auto UInt16 = MakeFundamentalField(*model, "UInt16", - EColumnType::kUInt16); - auto Int32 = - MakeFundamentalField(*model, "Int32", EColumnType::kInt32); - auto UInt32 = MakeFundamentalField(*model, "UInt32", - EColumnType::kUInt32); - auto Int64 = - MakeFundamentalField(*model, "Int64", EColumnType::kInt64); - auto UInt64 = MakeFundamentalField(*model, "UInt64", - EColumnType::kUInt64); + auto Int16 = MakeFundamentalField( + *model, "Int16", ROOT::ENTupleColumnType::kInt16); + auto UInt16 = MakeFundamentalField( + *model, "UInt16", ROOT::ENTupleColumnType::kUInt16); + auto Int32 = MakeFundamentalField( + *model, "Int32", ROOT::ENTupleColumnType::kInt32); + auto UInt32 = MakeFundamentalField( + *model, "UInt32", ROOT::ENTupleColumnType::kUInt32); + auto Int64 = MakeFundamentalField( + *model, "Int64", ROOT::ENTupleColumnType::kInt64); + auto UInt64 = MakeFundamentalField( + *model, "UInt64", ROOT::ENTupleColumnType::kUInt64); // Split integer encoding auto SplitInt16 = MakeFundamentalField( - *model, "SplitInt16", EColumnType::kSplitInt16); + *model, "SplitInt16", ROOT::ENTupleColumnType::kSplitInt16); auto SplitUInt16 = MakeFundamentalField( - *model, "SplitUInt16", EColumnType::kSplitUInt16); + *model, "SplitUInt16", ROOT::ENTupleColumnType::kSplitUInt16); auto SplitInt32 = MakeFundamentalField( - *model, "SplitInt32", EColumnType::kSplitInt32); + *model, "SplitInt32", ROOT::ENTupleColumnType::kSplitInt32); auto SplitUInt32 = MakeFundamentalField( - *model, "SplitUInt32", EColumnType::kSplitUInt32); + *model, "SplitUInt32", ROOT::ENTupleColumnType::kSplitUInt32); auto SplitInt64 = MakeFundamentalField( - *model, "SplitInt64", EColumnType::kSplitInt64); + *model, "SplitInt64", ROOT::ENTupleColumnType::kSplitInt64); auto SplitUInt64 = MakeFundamentalField( - *model, "SplitUInt64", EColumnType::kSplitUInt64); + *model, "SplitUInt64", ROOT::ENTupleColumnType::kSplitUInt64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: ascending values *Int8 = 1; diff --git a/types/fundamental/misc/read.C b/types/fundamental/misc/read.C index d86bbcd..e68563e 100644 --- a/types/fundamental/misc/read.C +++ b/types/fundamental/misc/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include // for std::byte #include #include @@ -11,7 +8,7 @@ using ROOT::Experimental::RNTupleReader; #include template -static void PrintIntegerValue(const REntry &entry, std::string_view name, +static void PrintIntegerValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { T value = *entry.GetPtr(name); os << " \"" << name << "\": "; @@ -29,7 +26,7 @@ void read(std::string_view input = "types.fundamental.misc.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/fundamental/misc/write.C b/types/fundamental/misc/write.C index 45450c5..21256bf 100644 --- a/types/fundamental/misc/write.C +++ b/types/fundamental/misc/write.C @@ -1,42 +1,42 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include // for std::byte #include #include #include template -static std::shared_ptr MakeFundamentalField(RNTupleModel &model, +static std::shared_ptr MakeFundamentalField(ROOT::RNTupleModel &model, std::string_view name, - EColumnType type) { - auto field = std::make_unique>(name); + ROOT::ENTupleColumnType type) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{type}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.fundamental.misc.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); - auto Bit = MakeFundamentalField(*model, "Bit", EColumnType::kBit); - auto Byte = - MakeFundamentalField(*model, "Byte", EColumnType::kByte); - auto Char = MakeFundamentalField(*model, "Char", EColumnType::kChar); + auto Bit = + MakeFundamentalField(*model, "Bit", ROOT::ENTupleColumnType::kBit); + auto Byte = MakeFundamentalField(*model, "Byte", + ROOT::ENTupleColumnType::kByte); + auto Char = MakeFundamentalField(*model, "Char", + ROOT::ENTupleColumnType::kChar); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: ascending values *Bit = 1; diff --git a/types/fundamental/real/read.C b/types/fundamental/real/read.C index a9c4793..c941dc4 100644 --- a/types/fundamental/real/read.C +++ b/types/fundamental/real/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -11,7 +8,7 @@ using ROOT::Experimental::RNTupleReader; #include template -static void PrintRealValue(const REntry &entry, std::string_view name, +static void PrintRealValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { T value = *entry.GetPtr(name); os << " \"" << name << "\": \"" << value << "\""; @@ -28,7 +25,7 @@ void read(std::string_view input = "types.fundamental.real.root", os << std::hexfloat; os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/fundamental/real/write.C b/types/fundamental/real/write.C index 33e0728..9f4b53d 100644 --- a/types/fundamental/real/write.C +++ b/types/fundamental/real/write.C @@ -1,57 +1,55 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include template -static std::shared_ptr MakeFundamentalField(RNTupleModel &model, +static std::shared_ptr MakeFundamentalField(ROOT::RNTupleModel &model, std::string_view name, - EColumnType type) { - auto field = std::make_unique>(name); + ROOT::ENTupleColumnType type) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{type}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.fundamental.real.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split float encoding - auto FloatReal16 = - MakeFundamentalField(*model, "FloatReal16", EColumnType::kReal16); - auto FloatReal32 = - MakeFundamentalField(*model, "FloatReal32", EColumnType::kReal32); - auto DoubleReal16 = MakeFundamentalField(*model, "DoubleReal16", - EColumnType::kReal16); - auto DoubleReal32 = MakeFundamentalField(*model, "DoubleReal32", - EColumnType::kReal32); - auto DoubleReal64 = MakeFundamentalField(*model, "DoubleReal64", - EColumnType::kReal64); + auto FloatReal16 = MakeFundamentalField( + *model, "FloatReal16", ROOT::ENTupleColumnType::kReal16); + auto FloatReal32 = MakeFundamentalField( + *model, "FloatReal32", ROOT::ENTupleColumnType::kReal32); + auto DoubleReal16 = MakeFundamentalField( + *model, "DoubleReal16", ROOT::ENTupleColumnType::kReal16); + auto DoubleReal32 = MakeFundamentalField( + *model, "DoubleReal32", ROOT::ENTupleColumnType::kReal32); + auto DoubleReal64 = MakeFundamentalField( + *model, "DoubleReal64", ROOT::ENTupleColumnType::kReal64); // Split float encoding // NB there is no kSplitReal16 auto FloatSplitReal32 = MakeFundamentalField( - *model, "FloatSplitReal32", EColumnType::kSplitReal32); + *model, "FloatSplitReal32", ROOT::ENTupleColumnType::kSplitReal32); auto DoubleSplitReal32 = MakeFundamentalField( - *model, "DoubleSplitReal32", EColumnType::kSplitReal32); + *model, "DoubleSplitReal32", ROOT::ENTupleColumnType::kSplitReal32); auto DoubleSplitReal64 = MakeFundamentalField( - *model, "DoubleSplitReal64", EColumnType::kSplitReal64); + *model, "DoubleSplitReal64", ROOT::ENTupleColumnType::kSplitReal64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: ascending values *FloatReal16 = 1.0f; diff --git a/types/fundamental/real32quant/read.C b/types/fundamental/real32quant/read.C index 1180ddf..2c0c892 100644 --- a/types/fundamental/real32quant/read.C +++ b/types/fundamental/real32quant/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -11,7 +8,7 @@ using ROOT::Experimental::RNTupleReader; #include template -static void PrintRealValue(const REntry &entry, std::string_view name, +static void PrintRealValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { T value = *entry.GetPtr(name); os << " \"" << name << "\": \"" << value << "\""; @@ -28,7 +25,7 @@ void read(std::string_view input = "types.fundamental.real32quant.root", os << std::hexfloat; os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/fundamental/real32quant/write.C b/types/fundamental/real32quant/write.C index 395b734..516883a 100644 --- a/types/fundamental/real32quant/write.C +++ b/types/fundamental/real32quant/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -17,19 +15,19 @@ using ROOT::Experimental::RNTupleWriter; static constexpr double pi = 3.14159265358979323846; template -static std::shared_ptr MakeFieldReal32Quant(RNTupleModel &model, - std::string_view name, - int nBits, double min, double max) { +static std::shared_ptr MakeFieldReal32Quant(ROOT::RNTupleModel &model, + std::string_view name, int nBits, + double min, double max) { assert(nBits >= 1 && nBits <= 32); assert(max > min); - auto field = std::make_unique>(name); + auto field = std::make_unique>(name); field->SetQuantized(min, max, nBits); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.fundamental.real32quant.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto FloatReal32Quant1 = MakeFieldReal32Quant(*model, "FloatReal32Quant1", 1, -1, 1); @@ -44,9 +42,10 @@ void write(std::string_view filename = "types.fundamental.real32quant.root") { auto DoubleReal32Quant32 = MakeFieldReal32Quant(*model, "DoubleReal32Quant32", 32, -100, 25); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: ascending values *FloatReal32Quant1 = -1.0f; diff --git a/types/fundamental/real32trunc/read.C b/types/fundamental/real32trunc/read.C index 16a7d94..6400879 100644 --- a/types/fundamental/real32trunc/read.C +++ b/types/fundamental/real32trunc/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -11,7 +8,7 @@ using ROOT::Experimental::RNTupleReader; #include template -static void PrintRealValue(const REntry &entry, std::string_view name, +static void PrintRealValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { T value = *entry.GetPtr(name); os << " \"" << name << "\": \"" << value << "\""; @@ -28,7 +25,7 @@ void read(std::string_view input = "types.fundamental.real32trunc.root", os << std::hexfloat; os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/fundamental/real32trunc/write.C b/types/fundamental/real32trunc/write.C index de03250..247cbd3 100644 --- a/types/fundamental/real32trunc/write.C +++ b/types/fundamental/real32trunc/write.C @@ -1,32 +1,30 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include template -static std::shared_ptr MakeFieldReal32Trunc(RNTupleModel &model, +static std::shared_ptr MakeFieldReal32Trunc(ROOT::RNTupleModel &model, std::string_view name, int nBits) { assert(nBits >= 10 && nBits < 32); - auto field = std::make_unique>(name); + auto field = std::make_unique>(name); field->SetTruncated(nBits); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.fundamental.real32trunc.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto FloatReal32Trunc10 = MakeFieldReal32Trunc(*model, "FloatReal32Trunc10", 10); @@ -41,10 +39,10 @@ void write(std::string_view filename = "types.fundamental.real32trunc.root") { auto DoubleReal32Trunc31 = MakeFieldReal32Trunc(*model, "DoubleReal32Trunc31", 31); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: ascending values *FloatReal32Trunc10 = 1.0f; diff --git a/types/map/fundamental/read.C b/types/map/fundamental/read.C index 6197876..3dd7231 100644 --- a/types/map/fundamental/read.C +++ b/types/map/fundamental/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,7 +10,7 @@ using ROOT::Experimental::RNTupleReader; using Map = std::map; -static void PrintMapValue(const REntry &entry, std::string_view name, +static void PrintMapValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { Map &item = *entry.GetPtr(name); os << " \"" << name << "\": {"; @@ -41,7 +38,7 @@ void read(std::string_view input = "types.map.fundamental.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/map/fundamental/write.C b/types/map/fundamental/write.C index 5447f7b..b528ea3 100644 --- a/types/map/fundamental/write.C +++ b/types/map/fundamental/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -17,32 +15,34 @@ using ROOT::Experimental::RNTupleWriter; using Map = std::map; -static std::shared_ptr MakeMapField(RNTupleModel &model, +static std::shared_ptr MakeMapField(ROOT::RNTupleModel &model, std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.map.fundamental.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeMapField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeMapField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeMapField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeMapField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeMapField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeMapField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeMapField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeMapField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element maps, with ascending values *Index32 = {{"a", 1}}; diff --git a/types/map/nested/read.C b/types/map/nested/read.C index bd72266..ad9435e 100644 --- a/types/map/nested/read.C +++ b/types/map/nested/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include @@ -16,8 +13,9 @@ using ROOT::Experimental::RNTupleReader; using Map = std::map>; -static void PrintNestedMapValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintNestedMapValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { Map &item = *entry.GetPtr(name); os << " \"" << name << "\": {"; bool outerFirst = true; @@ -61,7 +59,7 @@ void read(std::string_view input = "types.map.nested.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/map/nested/write.C b/types/map/nested/write.C index b63a83f..be1bb08 100644 --- a/types/map/nested/write.C +++ b/types/map/nested/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include @@ -20,13 +18,14 @@ using ROOT::Experimental::RNTupleWriter; using Map = std::map>; -static std::shared_ptr MakeMapField(RNTupleModel &model, +static std::shared_ptr MakeMapField(ROOT::RNTupleModel &model, std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); - field->GetSubFields()[0]->GetSubFields()[1]->SetColumnRepresentatives( - {{indexType}}); + field->GetMutableSubfields()[0] + ->GetMutableSubfields()[1] + ->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } @@ -36,22 +35,24 @@ void write(std::string_view filename = "types.map.nested.root") { throw std::runtime_error("could not find the required ROOT dictionaries, " "please make sure to run `make` first"); - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeMapField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeMapField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeMapField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeMapField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeMapField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeMapField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeMapField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeMapField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element maps, with ascending values *Index32 = {{"a", {{"aa", 1}}}}; diff --git a/types/multimap/fundamental/read.C b/types/multimap/fundamental/read.C index 441940c..6fb2683 100644 --- a/types/multimap/fundamental/read.C +++ b/types/multimap/fundamental/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,8 +10,8 @@ using ROOT::Experimental::RNTupleReader; using Multimap = std::multimap; -static void PrintMultimapValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintMultimapValue(const ROOT::REntry &entry, std::string_view name, + std::ostream &os, bool last = false) { Multimap &item = *entry.GetPtr(name); os << " \"" << name << "\": {"; bool first = true; @@ -41,7 +38,7 @@ void read(std::string_view input = "types.multimap.fundamental.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/multimap/fundamental/write.C b/types/multimap/fundamental/write.C index 3ace02e..288baaf 100644 --- a/types/multimap/fundamental/write.C +++ b/types/multimap/fundamental/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -17,32 +15,34 @@ using ROOT::Experimental::RNTupleWriter; using Multimap = std::multimap; -static std::shared_ptr MakeMultimapField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeMultimapField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.multimap.fundamental.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeMultimapField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeMultimapField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeMultimapField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeMultimapField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeMultimapField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeMultimapField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeMultimapField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeMultimapField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element maps, with ascending values *Index32 = {{"a", 1}}; diff --git a/types/multimap/nested/read.C b/types/multimap/nested/read.C index 74c4580..0a6cca5 100644 --- a/types/multimap/nested/read.C +++ b/types/multimap/nested/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include @@ -17,8 +14,9 @@ using ROOT::Experimental::RNTupleReader; using Multimap = std::multimap>; -static void PrintNestedMultimapValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintNestedMultimapValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { Multimap &item = *entry.GetPtr(name); os << " \"" << name << "\": {"; bool outerFirst = true; @@ -62,7 +60,7 @@ void read(std::string_view input = "types.multimap.nested.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/multimap/nested/write.C b/types/multimap/nested/write.C index 144dabb..85aa2c4 100644 --- a/types/multimap/nested/write.C +++ b/types/multimap/nested/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include @@ -21,13 +19,14 @@ using ROOT::Experimental::RNTupleWriter; using Multimap = std::multimap>; -static std::shared_ptr MakeMultimapField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeMultimapField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); - field->GetSubFields()[0]->GetSubFields()[1]->SetColumnRepresentatives( - {{indexType}}); + field->GetMutableSubfields()[0] + ->GetMutableSubfields()[1] + ->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } @@ -37,22 +36,24 @@ void write(std::string_view filename = "types.multimap.nested.root") { throw std::runtime_error("could not find the required ROOT dictionaries, " "please make sure to run `make` first"); - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeMultimapField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeMultimapField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeMultimapField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeMultimapField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeMultimapField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeMultimapField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeMultimapField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeMultimapField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element maps, with ascending values *Index32 = {{"a", {{"aa", 1}}}}; diff --git a/types/multiset/fundamental/read.C b/types/multiset/fundamental/read.C index 9e24295..65cfec9 100644 --- a/types/multiset/fundamental/read.C +++ b/types/multiset/fundamental/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,7 +10,7 @@ using ROOT::Experimental::RNTupleReader; using Multiset = std::multiset; -static void PrintMultisetValue(const REntry &entry, std::string_view name, +static void PrintMultisetValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { Multiset &value = *entry.GetPtr(name); os << " \"" << name << "\": ["; @@ -41,7 +38,7 @@ void read(std::string_view input = "types.multiset.fundamental.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/multiset/fundamental/write.C b/types/multiset/fundamental/write.C index 0654e7f..87a1aaa 100644 --- a/types/multiset/fundamental/write.C +++ b/types/multiset/fundamental/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -17,32 +15,34 @@ using ROOT::Experimental::RNTupleWriter; using Multiset = std::multiset; -static std::shared_ptr MakeMultisetField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeMultisetField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.multiset.fundamental.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeMultisetField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeMultisetField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeMultisetField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeMultisetField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeMultisetField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeMultisetField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeMultisetField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeMultisetField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element sets, with ascending values *Index32 = {1}; diff --git a/types/multiset/nested/read.C b/types/multiset/nested/read.C index b19ffb7..bf1967f 100644 --- a/types/multiset/nested/read.C +++ b/types/multiset/nested/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include @@ -16,8 +13,9 @@ using ROOT::Experimental::RNTupleReader; using Multiset = std::multiset>; -static void PrintNestedMultisetValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintNestedMultisetValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { Multiset &value = *entry.GetPtr(name); os << " \"" << name << "\": ["; bool outerFirst = true; @@ -61,7 +59,7 @@ void read(std::string_view input = "types.multiset.nested.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/multiset/nested/write.C b/types/multiset/nested/write.C index 710787b..b439f4c 100644 --- a/types/multiset/nested/write.C +++ b/types/multiset/nested/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include @@ -20,12 +18,12 @@ using ROOT::Experimental::RNTupleWriter; using Multiset = std::multiset>; -static std::shared_ptr MakeMultisetField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeMultisetField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); - field->GetSubFields()[0]->SetColumnRepresentatives({{indexType}}); + field->GetMutableSubfields()[0]->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } @@ -35,22 +33,24 @@ void write(std::string_view filename = "types.multiset.nested.root") { throw std::runtime_error("could not find the required ROOT dictionaries, " "please make sure to run `make` first"); - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeMultisetField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeMultisetField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeMultisetField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeMultisetField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeMultisetField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeMultisetField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeMultisetField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeMultisetField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element sets, with ascending values *Index32 = {{1}}; diff --git a/types/optional/read.C b/types/optional/read.C index fdf939d..4ab3c1d 100644 --- a/types/optional/read.C +++ b/types/optional/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -52,7 +49,7 @@ template <> void PrintValue(const VectorInt32Ty &value, std::ostream &os) { } template -static void PrintOptionalValue(const REntry &entry, std::string_view name, +static void PrintOptionalValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { auto &value = *entry.GetPtr>(name); os << " \"" << name << "\": "; @@ -67,8 +64,9 @@ static void PrintOptionalValue(const REntry &entry, std::string_view name, os << "\n"; } -static void PrintVectorOptValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintVectorOptValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { auto &value = *entry.GetPtr>>(name); os << " \"" << name << "\": ["; bool first = true; @@ -100,7 +98,7 @@ void read(std::string_view input = "types.optional.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/optional/write.C b/types/optional/write.C index 36e037e..84c05f2 100644 --- a/types/optional/write.C +++ b/types/optional/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -22,27 +20,29 @@ using OptInt32Ty = std::optional; using VariantTy = std::variant; using VectorInt32Ty = std::vector; -static std::shared_ptr MakeIntField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeIntField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.optional.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeIntField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeIntField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeIntField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeIntField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeIntField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeIntField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeIntField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeIntField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); auto String = model->MakeField>("String"); auto Variant = model->MakeField>("Variant"); @@ -51,10 +51,10 @@ void write(std::string_view filename = "types.optional.root") { auto VectorOpt = model->MakeField>>("VectorOpt"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: simple values *Index32 = 1; diff --git a/types/pair/read.C b/types/pair/read.C index ab5e2b4..a832cf4 100644 --- a/types/pair/read.C +++ b/types/pair/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -60,7 +57,7 @@ template <> void PrintValue(const Pair_Int32_String &value, std::ostream &os) { } template -static void PrintPairValue(const REntry &entry, std::string_view name, +static void PrintPairValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { auto &value = *entry.GetPtr>(name); os << " \"" << name << "\": [\n"; @@ -77,8 +74,9 @@ static void PrintPairValue(const REntry &entry, std::string_view name, os << "\n"; } -static void PrintVectorPairValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintVectorPairValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { auto &value = *entry.GetPtr>(name); os << " \"" << name << "\": ["; bool first = true; @@ -106,7 +104,7 @@ void read(std::string_view input = "types.pair.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/pair/write.C b/types/pair/write.C index 8c25f11..1afba25 100644 --- a/types/pair/write.C +++ b/types/pair/write.C @@ -2,10 +2,6 @@ #include #include -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -19,7 +15,7 @@ using Variant = std::variant; using VectorInt32 = std::vector; void write(std::string_view filename = "types.pair.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Int32_String = model->MakeField("Int32_String"); auto Variant_Vector = @@ -29,10 +25,10 @@ void write(std::string_view filename = "types.pair.root") { auto VectorPair = model->MakeField>("VectorPair"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: simple values *Int32_String = {1, "abc"}; diff --git a/types/set/fundamental/read.C b/types/set/fundamental/read.C index e9da3a7..170c8a3 100644 --- a/types/set/fundamental/read.C +++ b/types/set/fundamental/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,7 +10,7 @@ using ROOT::Experimental::RNTupleReader; using Set = std::set; -static void PrintSetValue(const REntry &entry, std::string_view name, +static void PrintSetValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { Set &value = *entry.GetPtr(name); os << " \"" << name << "\": ["; @@ -41,7 +38,7 @@ void read(std::string_view input = "types.set.fundamental.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/set/fundamental/write.C b/types/set/fundamental/write.C index 662d354..1db80b9 100644 --- a/types/set/fundamental/write.C +++ b/types/set/fundamental/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -17,32 +15,34 @@ using ROOT::Experimental::RNTupleWriter; using Set = std::set; -static std::shared_ptr MakeSetField(RNTupleModel &model, +static std::shared_ptr MakeSetField(ROOT::RNTupleModel &model, std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.set.fundamental.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeSetField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeSetField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeSetField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeSetField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeSetField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeSetField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeSetField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeSetField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element sets, with ascending values *Index32 = {1}; diff --git a/types/set/nested/read.C b/types/set/nested/read.C index 30ba4d2..e05ac9b 100644 --- a/types/set/nested/read.C +++ b/types/set/nested/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include @@ -16,8 +13,9 @@ using ROOT::Experimental::RNTupleReader; using Set = std::set>; -static void PrintNestedSetValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintNestedSetValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { Set &value = *entry.GetPtr(name); os << " \"" << name << "\": ["; bool outerFirst = true; @@ -61,7 +59,7 @@ void read(std::string_view input = "types.set.nested.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/set/nested/write.C b/types/set/nested/write.C index f93b38b..08b1b3f 100644 --- a/types/set/nested/write.C +++ b/types/set/nested/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include @@ -20,12 +18,12 @@ using ROOT::Experimental::RNTupleWriter; using Set = std::set>; -static std::shared_ptr MakeSetField(RNTupleModel &model, +static std::shared_ptr MakeSetField(ROOT::RNTupleModel &model, std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); - field->GetSubFields()[0]->SetColumnRepresentatives({{indexType}}); + field->GetMutableSubfields()[0]->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } @@ -35,22 +33,24 @@ void write(std::string_view filename = "types.set.nested.root") { throw std::runtime_error("could not find the required ROOT dictionaries, " "please make sure to run `make` first"); - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeSetField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeSetField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeSetField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeSetField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeSetField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeSetField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeSetField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeSetField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element sets, with ascending values *Index32 = {{1}}; diff --git a/types/string/read.C b/types/string/read.C index e18ac27..9e9a53c 100644 --- a/types/string/read.C +++ b/types/string/read.C @@ -1,15 +1,12 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include #include -static void PrintStringValue(const REntry &entry, std::string_view name, +static void PrintStringValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { std::string &value = *entry.GetPtr(name); os << " \"" << name << "\": \"" << value << "\""; @@ -24,7 +21,7 @@ void read(std::string_view input = "types.string.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/string/write.C b/types/string/write.C index bbdd3ea..04268d8 100644 --- a/types/string/write.C +++ b/types/string/write.C @@ -1,45 +1,46 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include -static std::shared_ptr MakeStringField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); - field->SetColumnRepresentatives({{indexType, EColumnType::kChar}}); +static std::shared_ptr +MakeStringField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); + field->SetColumnRepresentatives( + {{indexType, ROOT::ENTupleColumnType::kChar}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.string.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeStringField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeStringField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeStringField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeStringField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeStringField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeStringField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeStringField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeStringField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: one character strings, with ascending values *Index32 = "a"; diff --git a/types/tuple/read.C b/types/tuple/read.C index 854753a..6901aa3 100644 --- a/types/tuple/read.C +++ b/types/tuple/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -50,7 +47,7 @@ template <> void PrintValue(const Tuple_Int32_String &value, std::ostream &os) { os << " ]"; } -static void PrintTupleValue(const REntry &entry, std::string_view name, +static void PrintTupleValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { auto &value = *entry.GetPtr>(name); @@ -71,7 +68,7 @@ static void PrintTupleValue(const REntry &entry, std::string_view name, os << "\n"; } -static void PrintVariantValue(const REntry &entry, std::string_view name, +static void PrintVariantValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { auto &value = *entry.GetPtr>>(name); @@ -91,7 +88,7 @@ static void PrintVariantValue(const REntry &entry, std::string_view name, os << "\n"; } -static void PrintNestedValue(const REntry &entry, std::string_view name, +static void PrintNestedValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { auto &value = *entry.GetPtr>(name); os << " \"" << name << "\": [\n"; @@ -105,8 +102,9 @@ static void PrintNestedValue(const REntry &entry, std::string_view name, os << "\n"; } -static void PrintVectorTupleValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintVectorTupleValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { auto &value = *entry.GetPtr>(name); os << " \"" << name << "\": ["; bool first = true; @@ -134,7 +132,7 @@ void read(std::string_view input = "types.tuple.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/tuple/write.C b/types/tuple/write.C index 9005211..7a2c073 100644 --- a/types/tuple/write.C +++ b/types/tuple/write.C @@ -2,10 +2,6 @@ #include #include -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -18,7 +14,7 @@ using Tuple_Int32_String = std::tuple; using VectorInt32 = std::vector; void write(std::string_view filename = "types.tuple.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto Int32_String_Vector = model->MakeField>( @@ -30,10 +26,10 @@ void write(std::string_view filename = "types.tuple.root") { auto VectorTuple = model->MakeField>("VectorTuple"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: simple values *Int32_String_Vector = {1, "abc", {2, 3, 4}}; diff --git a/types/unique_ptr/read.C b/types/unique_ptr/read.C index 2cc9468..1391681 100644 --- a/types/unique_ptr/read.C +++ b/types/unique_ptr/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -51,8 +48,9 @@ template <> void PrintValue(const VectorInt32Ty &value, std::ostream &os) { } template -static void PrintUniquePtrValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintUniquePtrValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { auto &value = *entry.GetPtr>(name); os << " \"" << name << "\": "; if (!value) { @@ -66,8 +64,9 @@ static void PrintUniquePtrValue(const REntry &entry, std::string_view name, os << "\n"; } -static void PrintVectorPtrValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintVectorPtrValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { auto &value = *entry.GetPtr>>(name); os << " \"" << name << "\": ["; bool first = true; @@ -99,7 +98,7 @@ void read(std::string_view input = "types.unique_ptr.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/unique_ptr/write.C b/types/unique_ptr/write.C index cca10a9..0485387 100644 --- a/types/unique_ptr/write.C +++ b/types/unique_ptr/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -21,27 +19,29 @@ using PtrInt32Ty = std::unique_ptr; using VariantTy = std::variant; using VectorInt32Ty = std::vector; -static std::shared_ptr MakeIntField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeIntField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.unique_ptr.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeIntField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeIntField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeIntField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeIntField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeIntField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeIntField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeIntField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeIntField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); auto String = model->MakeField>("String"); auto Variant = model->MakeField>("Variant"); @@ -50,10 +50,10 @@ void write(std::string_view filename = "types.unique_ptr.root") { auto VectorPtr = model->MakeField>>("VectorPtr"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: simple values *Index32 = std::make_unique(1); diff --git a/types/unordered_map/fundamental/read.C b/types/unordered_map/fundamental/read.C index 9df571f..60d2f30 100644 --- a/types/unordered_map/fundamental/read.C +++ b/types/unordered_map/fundamental/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,7 +10,7 @@ using ROOT::Experimental::RNTupleReader; using UnorderedMap = std::unordered_map; -static void PrintMapValue(const REntry &entry, std::string_view name, +static void PrintMapValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { UnorderedMap &item = *entry.GetPtr(name); @@ -45,7 +42,7 @@ void read(std::string_view input = "types.unordered_map.fundamental.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/unordered_map/fundamental/write.C b/types/unordered_map/fundamental/write.C index 58f102a..669713c 100644 --- a/types/unordered_map/fundamental/write.C +++ b/types/unordered_map/fundamental/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -17,32 +15,34 @@ using ROOT::Experimental::RNTupleWriter; using UnorderedMap = std::unordered_map; -static std::shared_ptr MakeMapField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeMapField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.unordered_map.fundamental.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeMapField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeMapField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeMapField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeMapField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeMapField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeMapField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeMapField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeMapField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element maps, with ascending values *Index32 = {{"a", 1}}; diff --git a/types/unordered_map/nested/read.C b/types/unordered_map/nested/read.C index 585dfc8..d858997 100644 --- a/types/unordered_map/nested/read.C +++ b/types/unordered_map/nested/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include @@ -18,7 +15,7 @@ using UnorderedMap = std::unordered_map>; -static void PrintNestedUnorderedMapValue(const REntry &entry, +static void PrintNestedUnorderedMapValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { UnorderedMap &item = *entry.GetPtr(name); @@ -79,7 +76,7 @@ void read(std::string_view input = "types.unordered_map.nested.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/unordered_map/nested/write.C b/types/unordered_map/nested/write.C index 2e53014..58f4dbb 100644 --- a/types/unordered_map/nested/write.C +++ b/types/unordered_map/nested/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include @@ -21,13 +19,14 @@ using ROOT::Experimental::RNTupleWriter; using UnorderedMap = std::unordered_map>; -static std::shared_ptr MakeUnorderedMapField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeUnorderedMapField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); - field->GetSubFields()[0]->GetSubFields()[1]->SetColumnRepresentatives( - {{indexType}}); + field->GetMutableSubfields()[0] + ->GetMutableSubfields()[1] + ->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } @@ -37,22 +36,24 @@ void write(std::string_view filename = "types.unordered_map.nested.root") { throw std::runtime_error("could not find the required ROOT dictionaries, " "please make sure to run `make` first"); - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeUnorderedMapField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeUnorderedMapField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = MakeUnorderedMapField(*model, "Index32", + ROOT::ENTupleColumnType::kIndex32); + auto Index64 = MakeUnorderedMapField(*model, "Index64", + ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeUnorderedMapField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeUnorderedMapField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeUnorderedMapField( + *model, "SplitIndex32", ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeUnorderedMapField( + *model, "SplitIndex64", ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element maps, with ascending values *Index32 = {{"a", {{"aa", 1}}}}; diff --git a/types/unordered_multimap/fundamental/read.C b/types/unordered_multimap/fundamental/read.C index 0f3feaa..8e451ad 100644 --- a/types/unordered_multimap/fundamental/read.C +++ b/types/unordered_multimap/fundamental/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,7 +10,7 @@ using ROOT::Experimental::RNTupleReader; using UnorderedMultimap = std::unordered_multimap; -static void PrintMultimapValue(const REntry &entry, std::string_view name, +static void PrintMultimapValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { UnorderedMultimap &item = *entry.GetPtr(name); @@ -48,7 +45,7 @@ void read( std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/unordered_multimap/fundamental/write.C b/types/unordered_multimap/fundamental/write.C index bdebb90..a3227dd 100644 --- a/types/unordered_multimap/fundamental/write.C +++ b/types/unordered_multimap/fundamental/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -17,32 +15,34 @@ using ROOT::Experimental::RNTupleWriter; using UnorderedMultimap = std::unordered_multimap; -static std::shared_ptr MakeMultimapField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeMultimapField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.unordered_multimap.fundamental.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeMultimapField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeMultimapField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeMultimapField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeMultimapField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeMultimapField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeMultimapField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeMultimapField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeMultimapField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element maps, with ascending values *Index32 = {{"a", 1}}; diff --git a/types/unordered_multimap/nested/read.C b/types/unordered_multimap/nested/read.C index e5c085f..e4b74e3 100644 --- a/types/unordered_multimap/nested/read.C +++ b/types/unordered_multimap/nested/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include @@ -18,7 +15,7 @@ using UnorderedMultimap = std::unordered_multimap>; -static void PrintNestedUnorderedMultimapValue(const REntry &entry, +static void PrintNestedUnorderedMultimapValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { @@ -80,7 +77,7 @@ void read(std::string_view input = "types.unordered_multimap.nested.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/unordered_multimap/nested/write.C b/types/unordered_multimap/nested/write.C index 74c54b5..9063d4d 100644 --- a/types/unordered_multimap/nested/write.C +++ b/types/unordered_multimap/nested/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include @@ -21,13 +19,14 @@ using ROOT::Experimental::RNTupleWriter; using UnorderedMultimap = std::unordered_multimap>; -static std::shared_ptr MakeUnorderedMultimapField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeUnorderedMultimapField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); - field->GetSubFields()[0]->GetSubFields()[1]->SetColumnRepresentatives( - {{indexType}}); + field->GetMutableSubfields()[0] + ->GetMutableSubfields()[1] + ->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } @@ -37,22 +36,24 @@ void write(std::string_view filename = "types.unordered_multimap.nested.root") { throw std::runtime_error("could not find the required ROOT dictionaries, " "please make sure to run `make` first"); - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeUnorderedMultimapField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeUnorderedMultimapField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = MakeUnorderedMultimapField(*model, "Index32", + ROOT::ENTupleColumnType::kIndex32); + auto Index64 = MakeUnorderedMultimapField(*model, "Index64", + ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeUnorderedMultimapField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeUnorderedMultimapField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeUnorderedMultimapField( + *model, "SplitIndex32", ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeUnorderedMultimapField( + *model, "SplitIndex64", ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element maps, with ascending values *Index32 = {{"a", {{"aa", 1}}}}; diff --git a/types/unordered_multiset/fundamental/read.C b/types/unordered_multiset/fundamental/read.C index 8b4b422..144e53c 100644 --- a/types/unordered_multiset/fundamental/read.C +++ b/types/unordered_multiset/fundamental/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,7 +10,7 @@ using ROOT::Experimental::RNTupleReader; using UnorderedMultiSet = std::unordered_multiset; -static void PrintUnorderedMultiSetValue(const REntry &entry, +static void PrintUnorderedMultiSetValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { UnorderedMultiSet &value = *entry.GetPtr(name); @@ -47,7 +44,7 @@ void read( std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/unordered_multiset/fundamental/write.C b/types/unordered_multiset/fundamental/write.C index 2363242..f696bb8 100644 --- a/types/unordered_multiset/fundamental/write.C +++ b/types/unordered_multiset/fundamental/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -18,9 +16,9 @@ using ROOT::Experimental::RNTupleWriter; using UnorderedMultiSet = std::unordered_multiset; static std::shared_ptr -MakeUnorderedMultiSetField(RNTupleModel &model, std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +MakeUnorderedMultiSetField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); @@ -28,24 +26,24 @@ MakeUnorderedMultiSetField(RNTupleModel &model, std::string_view name, void write( std::string_view filename = "types.unordered_multiset.fundamental.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = - MakeUnorderedMultiSetField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = - MakeUnorderedMultiSetField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = MakeUnorderedMultiSetField(*model, "Index32", + ROOT::ENTupleColumnType::kIndex32); + auto Index64 = MakeUnorderedMultiSetField(*model, "Index64", + ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = MakeUnorderedMultiSetField(*model, "SplitIndex32", - EColumnType::kSplitIndex32); - auto SplitIndex64 = MakeUnorderedMultiSetField(*model, "SplitIndex64", - EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeUnorderedMultiSetField( + *model, "SplitIndex32", ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeUnorderedMultiSetField( + *model, "SplitIndex64", ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element sets, with ascending values *Index32 = {1}; diff --git a/types/unordered_multiset/nested/read.C b/types/unordered_multiset/nested/read.C index 36de48b..76fc4fe 100644 --- a/types/unordered_multiset/nested/read.C +++ b/types/unordered_multiset/nested/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include @@ -17,7 +14,7 @@ using ROOT::Experimental::RNTupleReader; using UnorderedMultiset = std::unordered_multiset>; -static void PrintNestedUnorderedMultisetValue(const REntry &entry, +static void PrintNestedUnorderedMultisetValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { @@ -76,7 +73,7 @@ void read(std::string_view input = "types.unordered_multiset.nested.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/unordered_multiset/nested/write.C b/types/unordered_multiset/nested/write.C index 62e5866..96d7b3f 100644 --- a/types/unordered_multiset/nested/write.C +++ b/types/unordered_multiset/nested/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include @@ -24,11 +22,11 @@ using UnorderedMultiset = std::unordered_multiset>; static std::shared_ptr -MakeUnorderedMultisetField(RNTupleModel &model, std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +MakeUnorderedMultisetField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); - field->GetSubFields()[0]->SetColumnRepresentatives({{indexType}}); + field->GetMutableSubfields()[0]->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } @@ -38,24 +36,24 @@ void write(std::string_view filename = "types.unordered_multiset.nested.root") { throw std::runtime_error("could not find the required ROOT dictionaries, " "please make sure to run `make` first"); - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = - MakeUnorderedMultisetField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = - MakeUnorderedMultisetField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = MakeUnorderedMultisetField(*model, "Index32", + ROOT::ENTupleColumnType::kIndex32); + auto Index64 = MakeUnorderedMultisetField(*model, "Index64", + ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = MakeUnorderedMultisetField(*model, "SplitIndex32", - EColumnType::kSplitIndex32); - auto SplitIndex64 = MakeUnorderedMultisetField(*model, "SplitIndex64", - EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeUnorderedMultisetField( + *model, "SplitIndex32", ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeUnorderedMultisetField( + *model, "SplitIndex64", ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element sets, with ascending values *Index32 = {{1}}; diff --git a/types/unordered_set/fundamental/read.C b/types/unordered_set/fundamental/read.C index daf2502..7b70148 100644 --- a/types/unordered_set/fundamental/read.C +++ b/types/unordered_set/fundamental/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,8 +10,9 @@ using ROOT::Experimental::RNTupleReader; using UnorderedSet = std::unordered_set; -static void PrintUnorderedSetValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintUnorderedSetValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { UnorderedSet &value = *entry.GetPtr(name); std::vector valueSorted(value.begin(), value.end()); @@ -45,7 +43,7 @@ void read(std::string_view input = "types.unordered_set.fundamental.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/unordered_set/fundamental/write.C b/types/unordered_set/fundamental/write.C index 1233983..e68fd83 100644 --- a/types/unordered_set/fundamental/write.C +++ b/types/unordered_set/fundamental/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -18,33 +16,33 @@ using ROOT::Experimental::RNTupleWriter; using UnorderedSet = std::unordered_set; static std::shared_ptr -MakeUnorderedSetField(RNTupleModel &model, std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +MakeUnorderedSetField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.unordered_set.fundamental.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = - MakeUnorderedSetField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = - MakeUnorderedSetField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = MakeUnorderedSetField(*model, "Index32", + ROOT::ENTupleColumnType::kIndex32); + auto Index64 = MakeUnorderedSetField(*model, "Index64", + ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeUnorderedSetField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeUnorderedSetField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeUnorderedSetField( + *model, "SplitIndex32", ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeUnorderedSetField( + *model, "SplitIndex64", ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element sets, with ascending values *Index32 = {1}; diff --git a/types/unordered_set/nested/read.C b/types/unordered_set/nested/read.C index 65f0361..43584d9 100644 --- a/types/unordered_set/nested/read.C +++ b/types/unordered_set/nested/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include @@ -16,7 +13,7 @@ using ROOT::Experimental::RNTupleReader; using UnorderedSet = std::unordered_set>; -static void PrintNestedUnorderedSetValue(const REntry &entry, +static void PrintNestedUnorderedSetValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { UnorderedSet &value = *entry.GetPtr(name); @@ -73,7 +70,7 @@ void read(std::string_view input = "types.unordered_set.nested.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/unordered_set/nested/write.C b/types/unordered_set/nested/write.C index e0afbcb..f1fa22c 100644 --- a/types/unordered_set/nested/write.C +++ b/types/unordered_set/nested/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include @@ -23,11 +21,11 @@ using ROOT::Experimental::RNTupleWriter; using UnorderedSet = std::unordered_set>; static std::shared_ptr -MakeUnorderedSetField(RNTupleModel &model, std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +MakeUnorderedSetField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); - field->GetSubFields()[0]->SetColumnRepresentatives({{indexType}}); + field->GetMutableSubfields()[0]->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } @@ -37,24 +35,24 @@ void write(std::string_view filename = "types.unordered_set.nested.root") { throw std::runtime_error("could not find the required ROOT dictionaries, " "please make sure to run `make` first"); - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = - MakeUnorderedSetField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = - MakeUnorderedSetField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = MakeUnorderedSetField(*model, "Index32", + ROOT::ENTupleColumnType::kIndex32); + auto Index64 = MakeUnorderedSetField(*model, "Index64", + ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeUnorderedSetField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeUnorderedSetField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeUnorderedSetField( + *model, "SplitIndex32", ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeUnorderedSetField( + *model, "SplitIndex64", ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element sets, with ascending values *Index32 = {{1}}; diff --git a/types/user/class/read.C b/types/user/class/read.C index 94e793e..5e0772c 100644 --- a/types/user/class/read.C +++ b/types/user/class/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include @@ -51,7 +48,7 @@ static void PrintUserMembers(const User &value, std::ostream &os, os << indent << "}\n"; } -static void PrintUserValue(const REntry &entry, std::string_view name, +static void PrintUserValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { auto &value = *entry.GetPtr(name); os << " \"" << name << "\": {\n"; @@ -63,7 +60,7 @@ static void PrintUserValue(const REntry &entry, std::string_view name, os << "\n"; } -static void PrintUserVector(const REntry &entry, std::string_view name, +static void PrintUserVector(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { auto &vector = *entry.GetPtr>(name); os << " \"" << name << "\": ["; @@ -97,7 +94,7 @@ void read(std::string_view input = "types.user.class.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/user/class/write.C b/types/user/class/write.C index 5ead06c..ebd9bb7 100644 --- a/types/user/class/write.C +++ b/types/user/class/write.C @@ -2,10 +2,6 @@ #include #include -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include @@ -17,15 +13,15 @@ void write(std::string_view filename = "types.user.class.root") { throw std::runtime_error("could not find the required ROOT dictionaries, " "please make sure to run `make` first"); - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto value = model->MakeField("f"); auto vector = model->MakeField>("Vector"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: simple values value->fInt = 1; diff --git a/types/user/enum/read.C b/types/user/enum/read.C index 541c321..08e7907 100644 --- a/types/user/enum/read.C +++ b/types/user/enum/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include @@ -16,7 +13,7 @@ using ROOT::Experimental::RNTupleReader; #include "UserEnum.hxx" template -static void PrintEnumValue(const REntry &entry, std::string_view name, +static void PrintEnumValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { T value = *entry.GetPtr(name); os << " \"" << name << "\": "; @@ -38,7 +35,7 @@ void read(std::string_view input = "types.user.enum.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/user/enum/write.C b/types/user/enum/write.C index 57240e6..76aa144 100644 --- a/types/user/enum/write.C +++ b/types/user/enum/write.C @@ -2,10 +2,6 @@ #include #include -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include @@ -17,7 +13,7 @@ void write(std::string_view filename = "types.user.enum.root") { throw std::runtime_error("could not find the required ROOT dictionaries, " "please make sure to run `make` first"); - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // TODO: enums with bool underlying type are possible since ROOT 6.38 auto EInt8 = model->MakeField("EnumInt8"); @@ -29,10 +25,10 @@ void write(std::string_view filename = "types.user.enum.root") { auto EInt64 = model->MakeField("EnumInt64"); auto EUInt64 = model->MakeField("EnumUInt64"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: simple values *EInt8 = EnumInt8::Simple; // = 1; diff --git a/types/variant/read.C b/types/variant/read.C index e98b093..24fb3c7 100644 --- a/types/variant/read.C +++ b/types/variant/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -16,7 +13,7 @@ using VectorInt32 = std::vector; using Variant = std::variant; using Vector = std::vector>; -static void PrintVariantValue(const REntry &entry, std::string_view name, +static void PrintVariantValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { Variant &value = *entry.GetPtr(name); os << " \"" << name << "\": "; @@ -48,7 +45,7 @@ static void PrintVariantValue(const REntry &entry, std::string_view name, os << "\n"; } -static void PrintVectorValue(const REntry &entry, std::string_view name, +static void PrintVectorValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { Vector &value = *entry.GetPtr(name); os << " \"" << name << "\": ["; @@ -82,7 +79,7 @@ void read(std::string_view input = "types.variant.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/variant/write.C b/types/variant/write.C index eed506a..ff7949c 100644 --- a/types/variant/write.C +++ b/types/variant/write.C @@ -2,10 +2,6 @@ #include #include -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -17,15 +13,15 @@ using Variant = std::variant; using Vector = std::vector>; void write(std::string_view filename = "types.variant.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); auto value = model->MakeField("f"); auto vector = model->MakeField("Vector"); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: std::int32_t *value = 1; diff --git a/types/vector/fundamental/read.C b/types/vector/fundamental/read.C index ff2eeb3..fe3f3c4 100644 --- a/types/vector/fundamental/read.C +++ b/types/vector/fundamental/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,7 +10,7 @@ using ROOT::Experimental::RNTupleReader; using Vector = std::vector; -static void PrintVectorValue(const REntry &entry, std::string_view name, +static void PrintVectorValue(const ROOT::REntry &entry, std::string_view name, std::ostream &os, bool last = false) { Vector &value = *entry.GetPtr(name); os << " \"" << name << "\": ["; @@ -41,7 +38,7 @@ void read(std::string_view input = "types.vector.fundamental.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/vector/fundamental/write.C b/types/vector/fundamental/write.C index f8a2c2a..2c69676 100644 --- a/types/vector/fundamental/write.C +++ b/types/vector/fundamental/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -17,32 +15,34 @@ using ROOT::Experimental::RNTupleWriter; using Vector = std::vector; -static std::shared_ptr MakeVectorField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeVectorField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.vector.fundamental.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeVectorField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeVectorField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeVectorField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeVectorField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeVectorField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeVectorField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeVectorField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeVectorField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element vectors, with ascending values *Index32 = {1}; diff --git a/types/vector/nested/read.C b/types/vector/nested/read.C index dea0cc8..b01ca92 100644 --- a/types/vector/nested/read.C +++ b/types/vector/nested/read.C @@ -1,9 +1,6 @@ #include #include -using ROOT::Experimental::REntry; -using ROOT::Experimental::RNTupleReader; - #include #include #include @@ -13,8 +10,9 @@ using ROOT::Experimental::RNTupleReader; using Vector = std::vector>; -static void PrintNestedVectorValue(const REntry &entry, std::string_view name, - std::ostream &os, bool last = false) { +static void PrintNestedVectorValue(const ROOT::REntry &entry, + std::string_view name, std::ostream &os, + bool last = false) { Vector &value = *entry.GetPtr(name); os << " \"" << name << "\": ["; bool outerFirst = true; @@ -54,7 +52,7 @@ void read(std::string_view input = "types.vector.nested.root", std::ofstream os(std::string{output}); os << "[\n"; - auto reader = RNTupleReader::Open("ntpl", input); + auto reader = ROOT::RNTupleReader::Open("ntpl", input); auto &entry = reader->GetModel().GetDefaultEntry(); bool first = true; for (auto index : *reader) { diff --git a/types/vector/nested/write.C b/types/vector/nested/write.C index a83d2ea..8dbf28a 100644 --- a/types/vector/nested/write.C +++ b/types/vector/nested/write.C @@ -1,15 +1,13 @@ #include #include +#if __has_include() +#include +#else #include +#endif #include #include -using ROOT::Experimental::EColumnType; -using ROOT::Experimental::RField; -using ROOT::Experimental::RNTupleModel; -using ROOT::Experimental::RNTupleWriteOptions; -using ROOT::Experimental::RNTupleWriter; - #include #include #include @@ -17,33 +15,35 @@ using ROOT::Experimental::RNTupleWriter; using Vector = std::vector>; -static std::shared_ptr MakeVectorField(RNTupleModel &model, - std::string_view name, - EColumnType indexType) { - auto field = std::make_unique>(name); +static std::shared_ptr +MakeVectorField(ROOT::RNTupleModel &model, std::string_view name, + ROOT::ENTupleColumnType indexType) { + auto field = std::make_unique>(name); field->SetColumnRepresentatives({{indexType}}); - field->GetSubFields()[0]->SetColumnRepresentatives({{indexType}}); + field->GetMutableSubfields()[0]->SetColumnRepresentatives({{indexType}}); model.AddField(std::move(field)); return model.GetDefaultEntry().GetPtr(name); } void write(std::string_view filename = "types.vector.nested.root") { - auto model = RNTupleModel::Create(); + auto model = ROOT::RNTupleModel::Create(); // Non-split index encoding - auto Index32 = MakeVectorField(*model, "Index32", EColumnType::kIndex32); - auto Index64 = MakeVectorField(*model, "Index64", EColumnType::kIndex64); + auto Index32 = + MakeVectorField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32); + auto Index64 = + MakeVectorField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64); // Split index encoding - auto SplitIndex32 = - MakeVectorField(*model, "SplitIndex32", EColumnType::kSplitIndex32); - auto SplitIndex64 = - MakeVectorField(*model, "SplitIndex64", EColumnType::kSplitIndex64); + auto SplitIndex32 = MakeVectorField(*model, "SplitIndex32", + ROOT::ENTupleColumnType::kSplitIndex32); + auto SplitIndex64 = MakeVectorField(*model, "SplitIndex64", + ROOT::ENTupleColumnType::kSplitIndex64); - RNTupleWriteOptions options; + ROOT::RNTupleWriteOptions options; options.SetCompression(0); - auto writer = - RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options); + auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl", + filename, options); // First entry: single-element vectors, with ascending values *Index32 = {{1}};