Transition PWG0 -> PWGUD
[u/mrichter/AliRoot.git] / PWGUD / selectors / trigger / show.C
CommitLineData
53e8ea6f 1void showAll(const char* fileName = "trigger.root")
039db886 2{
70fdd197 3 TH1* fStats[100];
4
039db886 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;
c01a136b 15 hist->Rebin(10);
039db886 16 hist->Draw();
17 c->SaveAs(Form("trigger_%d.png", count));
907972ff 18 Printf("%s: %d", hist->GetTitle(), (Int_t) hist->GetEntries());
039db886 19
70fdd197 20 fStats[count] = hist;
039db886 21 count++;
22 }
70fdd197 23
24 Int_t base = 1;
25 if (fStats[0])
c01a136b 26 base = (Int_t) fStats[0]->Integral(0, fStats[0]->GetNbinsX()+1);
70fdd197 27
28 for (Int_t i=0; i<count; i++)
29 if (fStats[i])
30 {
31 c->cd(i+1);
32 fStats[i]->Draw();
c01a136b 33 Printf("%s: %d triggers | %f %% of all triggered", fStats[i]->GetTitle(), (UInt_t) fStats[i]->Integral(0, fStats[i]->GetNbinsX()+1), 100.0 * fStats[i]->Integral(0, fStats[i]->GetNbinsX()+1) / base);
70fdd197 34 }
35
039db886 36}
53e8ea6f 37
38void show(const char* fileName = "trigger.root")
39{
40 TFile::Open(fileName);
41
42 c = new TCanvas("c", "c", 1500, 1000);
43 c->Divide(4, 3);
44
45 for (Int_t i=0; i<4; i++)
46 {
47 for (Int_t j=6; j<=8; j++)
48 {
49 hist = (TH1*) gFile->Get(Form("fStats_%d_%d", i, j));
50 c->cd((j-6)*4+i+1);
51 hist->Rebin(2);
52 hist->Rebin(2);
53 hist->Rebin(2);
54 hist->Draw();
55 }
56 }
57
58 c->SaveAs("trigger_rates.png");
59}
60