32constexpr char const* kNTupleFileName =
"ntpl001_staff.root";
36 ifstream fin(
gROOT->GetTutorialDir() +
"/io/tree/cernstaff.dat");
37 assert(fin.is_open());
44 auto fldCategory = model->MakeField<
int>(
"Category");
45 auto fldFlag = model->MakeField<
unsigned int>(
"Flag");
46 auto fldAge = model->MakeField<
int>(
"Age");
47 auto fldService = model->MakeField<
int>(
"Service");
48 auto fldChildren = model->MakeField<
int>(
"Children");
49 auto fldGrade = model->MakeField<
int>(
"Grade");
50 auto fldStep = model->MakeField<
int>(
"Step");
51 auto fldHrweek = model->MakeField<
int>(
"Hrweek");
52 auto fldCost = model->MakeField<
int>(
"Cost");
53 auto fldDivision = model->MakeField<std::string>(
"Division");
54 auto fldNation = model->MakeField<std::string>(
"Nation");
61 while (std::getline(fin, record)) {
62 std::istringstream iss(record);
63 iss >> *fldCategory >> *fldFlag >> *fldAge >> *fldService >> *fldChildren >> *fldGrade >> *fldStep >> *fldHrweek
64 >> *fldCost >> *fldDivision >> *fldNation;
77 std::shared_ptr<int> fldAge = model->MakeField<
int>(
"Age");
85 std::cout <<
"The first entry in JSON format:" << std::endl;
88 auto c =
new TCanvas(
"c",
"", 200, 10, 700, 500);
89 TH1I h(
"h",
"Age Distribution CERN, 1988", 100, 0, 100);
92 for (
auto entryId : *reader) {
94 reader->LoadEntry(entryId);
101void ntpl001_staff() {
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.
static std::unique_ptr< RNTupleWriter > Recreate(std::unique_ptr< ROOT::RNTupleModel > model, std::string_view ntupleName, std::string_view storage, const ROOT::RNTupleWriteOptions &options=ROOT::RNTupleWriteOptions())
Creates an RNTupleWriter backed by storage, overwriting it if one with the same URI exists.
1-D histogram with an int per channel (see TH1 documentation)