Demonstrate the basic usage of RFile.
{
TH1D hist(
"hist",
"hist", 10, 0, 100);
hist.FillRandom("gaus", 1000);
file->Put(hist.GetName(), hist);
file->Put(std::string("a/") + hist.GetName(), hist);
file->Put(std::string("a/b/") + hist.GetName(), hist);
}
{
for (auto key : file->ListKeys()) {
auto hist = file->Get<
TH1D>(key.GetPath());
if (!hist)
continue;
std::cout << key.GetClassName() << " at " << key.GetPath() << ';' << key.GetCycle() << ":\n";
std::cout <<
" entries: " << hist->
GetEntries() <<
"\n";
}
}
void rfile001_basics()
{
const char *const fileName = "rfile_basics.root";
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TSystem * gSystem
static std::unique_ptr< RFile > Open(std::string_view path)
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.
1-D histogram with a double per channel (see TH1 documentation)
virtual Double_t GetEntries() const
Return the current number of entries.
virtual int Unlink(const char *name)
Unlink, i.e.
TH1D at hist;1:
entries: 1000
TH1D at a/hist;1:
entries: 1000
TH1D at a/b/hist;1:
entries: 1000
- Warning
- This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
- Date
- 2025-11-06
- Author
- Giacomo Parolini giaco.nosp@m.mo.p.nosp@m.aroli.nosp@m.ni@c.nosp@m.ern.c.nosp@m.h
Definition in file rfile001_basics.C.