I was wondering if there is a way, to check whether an object, inside a root file, exists.
The idea is that I have a root file with histograms saved in it. To use the histograms I call
The problem is that some of this histograms don’t exist. Therefore if such a histogram is not found the code crashes. I would like to be able to check if a histogram exists, so as to continue working with my program.
Something like this would be ideal (I am doing this while opening multiple files in a loop)
TFile *f = new TFile(TString::Format("Signals_%d_%d.root",run, seg));
if (f->IsOpen()==kFALSE) continue;
Any help or idea is more than welcome!