hooks for PMD flow analysis
[u/mrichter/AliRoot.git] / PWG2 / FLOW / macros / plotQAflow.C
1
2 void plotQAflow(const char* filename="")
3 {
4  TFile f(filename,"read");
5  TKey* key = f.GetListOfKeys()->At(0);
6  if (!key) return;
7  TObjArray* flowQA = dynamic_cast<TObjArray*>(f.Get(key->GetName()));
8  if (!flowQA) return;
9  TObjArray* before = dynamic_cast<TObjArray*>(flowQA->At(0));
10  TObjArray* after = dynamic_cast<TObjArray*>(flowQA->At(1));
11  for (Int_t i=0; i<before->GetEntries(); i++)
12  {
13    TH1* hbefore = dynamic_cast<TH1*>(before->At(i));
14    TH1* hafter = dynamic_cast<TH1*>(after->At(i));
15    TCanvas* canvas = new TCanvas(hbefore->GetName(), hbefore->GetTitle());
16    canvas->SetLogy();
17    TLegend* legend = new TLegend(0.8,0.8,1.0,1.0);
18    hbefore->SetAxisRange(0.1,hbefore->GetBinContent(hbefore->GetMaximumBin()),"Y");
19    hbefore->Draw();
20    legend->AddEntry(hbefore,"before cuts","l");
21    hafter->SetLineColor(2);
22    legend->AddEntry(hafter,"after cuts","l");
23    hafter->Draw("same");
24    legend->Draw();
25  }
26 }