I ran:
void buscaHIST (TDirectory *dir) {
TIter nextkey (dir->GetListOfKeys());
TKey *key;
while ((key = (TKey*)nextkey())) {
if (strstr(key->GetClassName(),"TH2F")) {
printf (" %s :: %s :: %s\n",key->GetName(),key->GetClassName(),dir->GetPath());
}
if (!strcmp(key->GetClassName(),"TDirectoryFile")) {
dir->cd(key->GetName());
TDirectory *subdir = gDirectory;
buscaHIST(subdir);
dir->cd();
}
}
}
This is the error:
root [0] TFile *f = TFile::Open("input.root")
(TFile *) 0x26e6960
root [1] .L buscaHIST.C
root [2] buscaHIST(&f)
ROOT_prompt_2:1:1: error: no matching function for call to 'buscaHIST'
buscaHIST(&f)
^~~~~~~~~
directoriemine/run/buscaHIST.C:1:6: note: candidate function not viable: no known conversion from 'TFile **' to 'TDirectory *' for 1st argument; remove &
void buscaHIST (TDirectory *dir) {
^
(there is not subdirectories on the root file)