Try (note: you will need to “loop” over all found keys, check the “class” for each of them, if it’s a directory you would again need to get the list of its keys, and so on …):
inputFile1->GetListOfKeys()->Print();
If you decide to proceed this way, see also [url=https://root-forum.cern.ch/t/aux-1-aux-2-aux3/13345/2 old thread about “AUX;1 AUX;2 AUX3;”[/url].
Note: if you know (in advance) all names of all trees that you are interested in, then it’s easy:
TTree *t1;
inputFile1->GetObject(“FirstTree”, t1); // try to read the "FirstTree"
if (t1) { … first tree found … }
TTree *t2;
inputFile1->GetObject(“SecondTree”, t2); // try to read the "SecondTree"
if (t2) { … second tree found … }