Skip to content

Commit b8f4523

Browse files
authored
Added new RNTuple test file (#159)
1 parent bc0a974 commit b8f4523

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* https://root.cern/doc/master/ntpl001__staff_8C.html */
2+
3+
#include <vector>
4+
5+
R__LOAD_LIBRARY(ROOTNTuple)
6+
#include <ROOT/RField.hxx>
7+
#include <ROOT/RNTuple.hxx>
8+
#include <ROOT/RNTupleModel.hxx>
9+
#include <ROOT/RNTupleWriter.hxx>
10+
#include <ROOT/RNTupleWriteOptions.hxx>
11+
#include <ROOT/RRawFile.hxx>
12+
13+
using RNTupleModel = ROOT::Experimental::RNTupleModel;
14+
using RNTupleWriter = ROOT::Experimental::RNTupleWriter;
15+
using RNTupleWriteOptions = ROOT::Experimental::RNTupleWriteOptions;
16+
17+
void rntuple_index_multicluster() {
18+
auto options = RNTupleWriteOptions();
19+
options.SetApproxUnzippedPageSize(512);
20+
options.SetApproxZippedClusterSize(1000);
21+
options.SetMaxUnzippedClusterSize(1024);
22+
23+
std::string rootFileName{"test_ntuple_index_multicluster.root"};
24+
auto model = RNTupleModel::Create();
25+
auto int_vector = model->MakeField<std::vector<int16_t>>("int_vector");
26+
auto ntuple =
27+
RNTupleWriter::Recreate(std::move(model), "ntuple", rootFileName, options);
28+
for(int16_t j=0; j<2; j++){
29+
for(int16_t i=0; i<100; i++){
30+
*int_vector = {i, static_cast<int16_t>(i+j)};
31+
ntuple->Fill();
32+
}
33+
}
34+
}
2.21 KB
Binary file not shown.

0 commit comments

Comments
 (0)