Example script to loop over all the objects of a ROOT file directory and print in Postscript all the TH1 derived objects. This script uses the file generated by tutorial hsimple.C
Author: Rene Brun
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Friday, March 24, 2023 at 10:55 AM.
TFile *f1 = TFile::Open("hsimple.root");
TIter keyList(f1->GetListOfKeys());
TKey *key;
TCanvas c1;
c1.Print("hsimple.ps[");
while ((key = (TKey*)keyList())) {
TClass *cl = gROOT->GetClass(key->GetClassName());
if (!cl->InheritsFrom("TH1")) continue;
TH1 *h = (TH1*)key->ReadObj();
h->Draw();
c1.Print("hsimple.ps");
}
c1.Print("hsimple.ps]");
Info in <TCanvas::Print>: ps file hsimple.ps has been created Info in <TCanvas::Print>: Current canvas added to ps file hsimple.ps Info in <TCanvas::Print>: Current canvas added to ps file hsimple.ps Info in <TCanvas::Print>: Current canvas added to ps file hsimple.ps Info in <TCanvas::Print>: ps file hsimple.ps has been closed