Loading [MathJax]/extensions/tex2jax.js
Logo ROOT   6.08/07
Reference Guide
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
loopdir.C File Reference

Detailed Description

View in nbviewer Open in SWAN Example of script to loop on all the objects of a ROOT file directory and print on Postscript all TH1 derived objects.

This script uses the file generated by tutorial hsimple.C



void loopdir() {
TFile *f1 = TFile::Open("hsimple.root");
TIter keyList(f1->GetListOfKeys());
TKey *key;
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]");
}
Author
Rene Brun

Definition in file loopdir.C.