Revision 1ff8cfc023263a593b0e186877352756557e2553 authored by Rene Brun on 19 November 2004, 06:46:19 UTC, committed by Rene Brun on 19 November 2004, 06:46:19 UTC
# Default 3d Viewer # by default 3-D views are shown in the pad. # if the next line is activated, the default viewer will be OpenGL #Viewer3D.DefaultDrawOption: ogl git-svn-id: http://root.cern.ch/svn/root/trunk@10564 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 8524938
work.C
void work(int x, int y, int page){
//example of script to plot all histograms in a Root file
//on a Postcript file (x times y per page)
//The following logic can be used to loop on all the keys of a file:
// TFile f("myfile.root");
// TIter next(f1->GetListOfKeys());
// TKey *key;
// while ((key = (TKey*)next())) {
// //key->GetClassName() returns the name of the object class
// TObject *obj = key->ReadObj(); //read object from file
// //obj->ClassName() should be equal to key->GetClassName()
// //obj->InheritsFrom("someclass") test if obj inherits from someclass
// }
int page_cnt, hist_per_page, i;
TFile *f1 = new TFile("hsimple.root");
TCanvas *c1 = new TCanvas("c1");
TPostScript *ps = new TPostScript("file.ps",112);
c1->Divide(x,y);
hist_per_page = x*y;
TIter next(f1->GetListOfKeys()); //make an iterator on list of keys
TKey *key;
while (page_cnt < page) {
ps->NewPage();
i=1;
while (hist_per_page >= i) {
c1->cd(i);
key = (TKey*)next(); //get next key on the file
if (!key) break; //if no more keys, key=0
TObject *obj = key->ReadObj(); //read object associated to key
if (obj->InheritsFrom("TH1")) { //interested by histograms only
obj->Draw(); //draw histogram with default option
i++;
}
}
c1->Update();
if (!key) break;
page_cnt++;
}
ps->Close();
//gSystem->Exec("lpr -Psmith2079 file.ps");
//gSystem->Exec("gv file.ps");
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...