FairRoot/PandaRoot
plot_all.C
Go to the documentation of this file.
1 #include "TString.h"
2 #include "TFile.h"
3 #include "TCanvas.h"
4 #include "TKey.h"
5 #include <iostream>
6 #include "TH1F.h"
7 #include "TRandom.h"
8 
9 using std::cout;
10 using std::endl;
11 
12 bool plot_all(TString fn="QA_histograms.root")
13 {
14  TCanvas *c1 = new TCanvas();
15  c1->Divide(6,6);
16 
17  TFile *f=new TFile(fn,"READ");
18  if (!f->IsZombie())
19  {
20  TKey *key;
21  TIter next(f->GetListOfKeys());
22 
23  Int_t yy = 0;
24  while ( (key = (TKey*)next()) )
25  {
26  c1->cd(yy+1);
27  TObject *obj = key->ReadObj();
28 
29  // only check TH1Fs
30  if (!obj->InheritsFrom("TH1F")) continue;
31 
32  TString name = obj->GetName();
33  cout << name << endl;
34  TH1F* h = (TH1F*) obj;
35  h->SetLineColor(2);
36  h->SetLineWidth(2);
37  h->Draw();
38  yy++;
39  }
40 
41  }
42 }
43 
TFile * f
Definition: bump_analys.C:12
c1
Definition: plot_dirc.C:35
TString name
bool plot_all(TString fn="QA_histograms.root")
Definition: plot_all.C:12
static int next[96]
Definition: ranlxd.cxx:374