]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG0/trigger/show.C
adding plot to histogram spd online trigger bits
[u/mrichter/AliRoot.git] / PWG0 / trigger / show.C
1 void show(const char* fileName = "trigger.root")
2 {
3   TH1* fStats[100];
4
5   TFile::Open(fileName);
6   
7   Int_t count = 0;
8   while (1)
9   {
10     hist = (TH1*) gFile->Get(Form("fStats_%d", count));
11     if (!hist)
12       break;
13     
14     c = new TCanvas;
15     hist->Draw();
16     c->SaveAs(Form("trigger_%d.png", count));
17     Printf("%s: %d", hist->GetTitle(), (Int_t) hist->GetEntries());
18     
19     fStats[count] = hist;
20     count++;
21   }
22
23   Int_t base = 1;
24   if (fStats[0])
25     base = (Int_t) fStats[0]->Integral();
26
27   for (Int_t i=0; i<count; i++)
28     if (fStats[i])
29     {
30       c->cd(i+1);
31       fStats[i]->Draw();
32       Printf("%s: %d triggers | %f %% of all triggered", fStats[i]->GetTitle(), (UInt_t) fStats[i]->Integral(), 100.0 * fStats[i]->Integral() / base);
33     }
34
35 }