24 std::unique_ptr<TFile> ifile{
TFile::Open(
"testFile.root",
"read")};
25 if (!ifile || ifile->IsZombie()) {
26 std::cerr <<
"Problem opening the file testFile.root" << std::endl;
38 while (aReader.
Next()) {
39 if (branch1->time != 0)
40 std::cout <<
" -Branch1 : time: " << branch1->time <<
"\t energy: " << branch1->energy << std::endl;
41 else if (branch2->time != 0)
42 std::cout <<
" +Branch2 : time: " << branch2->time <<
"\t energy: " << branch2->energy << std::endl;
44 std::cerr <<
"WARNING: entry " << aReader.
GetCurrentEntry() <<
" is empty! " << std::endl;
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
An interface for reading values stored in ROOT columnar datasets.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
bool Next()
Move to the next entry (or index of the TEntryList if that is set).
Long64_t GetCurrentEntry() const
Returns the index of the current entry being read.