14void write_rntuple_to_rfile(
const char *fileName)
21 auto pInt = model->MakeField<
int>(
"intField");
27 for (
int i = 0; i < 10; ++i) {
35void read_rntuple_from_rfile(
const char *fileName)
46 auto pInt = reader->GetModel().GetDefaultEntry().GetPtr<
int>(
"intField");
48 for (
auto i : reader->GetEntryRange()) {
50 std::cout <<
"value[" << i <<
"] = " << *pInt <<
"\n";
54void rfile002_rntuple()
56 const char *
const fileName =
"rfile_rntuple.root";
58 write_rntuple_to_rfile(fileName);
59 read_rntuple_from_rfile(fileName);
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
R__EXTERN TSystem * gSystem
static std::unique_ptr< RFile > Open(std::string_view path, const ROpenOptions &opts=ROpenOptions())
Opens the file for reading.
static std::unique_ptr< RFile > Recreate(std::string_view path, const RRecreateOptions &opts=RRecreateOptions())
Opens the file for reading/writing, overwriting it if it already exists.
static std::unique_ptr< RNTupleModel > Create()
static std::unique_ptr< RNTupleReader > Open(std::string_view ntupleName, std::string_view storage, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Open an RNTuple for reading.
Representation of an RNTuple data set in a ROOT file.
virtual int Unlink(const char *name)
Unlink, i.e.
std::unique_ptr< RNTupleWriter > RNTupleWriter_Append(std::unique_ptr< ROOT::RNTupleModel > model, std::string_view ntuplePath, ROOT::Experimental::RFile &file, const ROOT::RNTupleWriteOptions &options=ROOT::RNTupleWriteOptions())
Creates an RNTupleWriter that writes into the given file, appending to it.