7 #include <TDirectoryFile.h>
11 #include <TPaveText.h>
14 #include <AliCounterCollection.h>
16 //read the file and take list and stat
18 Bool_t ReadFile(TList* &list,TH1F* &hstat,TString listname,TString partname,TString path="./",TString filename="AnalysisResults.root");
20 Bool_t ReadFile(TList* &list,TH1F* &hstat,TString listname,TString partname,TString path,TString filename){
22 TString hstatname="nEntriesQA",dirname="PWG3_D2H_QA";
23 filename.Prepend(path);
27 TFile* f=new TFile(filename.Data());
29 cout<<filename.Data()<<" not found"<<endl;
32 TDirectoryFile* dir=(TDirectoryFile*)f->Get(dirname);
34 cout<<dirname.Data()<<" not found in "<<filename.Data()<<endl;
38 list=(TList*)dir->Get(listname);
40 cout<<"List "<<listname.Data()<<" not found"<<endl;
45 hstat=(TH1F*)dir->Get(hstatname);
47 cout<<hstatname.Data()<<" not found"<<endl;
53 //draw "track related" histograms (list "outputTrack")
54 void DrawOutputTrack(TString partname="D0",TString textleg="",TString path="./"){
55 gStyle->SetCanvasColor(0);
56 gStyle->SetTitleFillColor(0);
57 gStyle->SetStatColor(0);
58 gStyle->SetPalette(1);
60 TString listname="outputTrack";
65 Bool_t isRead=ReadFile(list,hstat,listname,partname,path);
68 cout<<":-( null pointers..."<<endl;
72 for(Int_t i=0;i<list->GetEntries();i++){
73 TH1F* h=(TH1F*)list->At(i);
75 cout<<"Histogram "<<i<<" not found"<<endl;
78 TCanvas* c=new TCanvas(Form("c%s",h->GetName()),h->GetName());
81 TString hname=h->GetName();
82 if(!hname.Contains("nCls")){
85 } else h->Draw("htext0");
86 c->SaveAs(Form("%s%s.png",c->GetName(),textleg.Data()));
89 TCanvas* cst=new TCanvas("cst","Stat");
92 hstat->Draw("htext0");
93 cst->SaveAs(Form("%s%s.png",hstat->GetName(),textleg.Data()));
98 //draw "pid related" histograms (list "outputPID")
99 void DrawOutputPID(TString partname="D0",TString textleg="",TString path="./"){
100 gStyle->SetCanvasColor(0);
101 gStyle->SetTitleFillColor(0);
102 gStyle->SetStatColor(0);
103 gStyle->SetPalette(1);
105 TString listname="outputPid";
110 Bool_t isRead=ReadFile(list,hstat,listname,partname,path);
113 cout<<":-( null pointers..."<<endl;
117 for(Int_t i=0;i<list->GetEntries();i++){
118 TClass* objtype=list->At(i)->IsA();
119 TString tpname=objtype->GetName();
122 TH1F* h=(TH1F*)list->At(i);
125 cout<<"Histogram "<<i<<" not found"<<endl;
128 //h->Scale(1./h->Integral("width"));
129 TCanvas* c=new TCanvas(Form("c%s",h->GetName()),h->GetName());
135 c->SaveAs(Form("%s.png",h->GetName()));
136 TFile* fout=new TFile(Form("%s.root",h->GetName()),"recreate");
142 TH2F* h=(TH2F*)list->At(i);
145 cout<<"Histogram "<<i<<" not found"<<endl;
148 h->Scale(1./h->Integral("width"));
149 TCanvas* c=new TCanvas(Form("c%s",h->GetName()),h->GetName());
155 c->SaveAs(Form("%s.png",h->GetName()));
156 TFile* fout=new TFile(Form("%s.root",h->GetName()),"recreate");
163 void DrawOutputCentrality(TString partname="D0",TString textleg="",TString path="./"){
164 gStyle->SetCanvasColor(0);
165 gStyle->SetTitleFillColor(0);
166 gStyle->SetStatColor(0);
167 gStyle->SetPalette(1);
169 TString listname="outputCentrCheck";
174 Bool_t isRead=ReadFile(list,hstat,listname,partname,path);
177 cout<<":-( null pointers..."<<endl;
181 for(Int_t i=0;i<list->GetEntries();i++){
182 TH1F* h=(TH1F*)list->At(i);
184 cout<<"Histogram "<<i<<" not found"<<endl;
187 TCanvas* c=new TCanvas(Form("c%s",h->GetName()),h->GetName());
191 c->SaveAs(Form("%s%s.png",c->GetName(),textleg.Data()));
194 TCanvas* cst=new TCanvas("cst","Stat");
197 hstat->Draw("htext0");
198 cst->SaveAs(Form("%s%s.png",hstat->GetName(),textleg.Data()));
200 listname="countersCentrality";
202 isRead=ReadFile(list,hstat,listname,partname,path);
205 cout<<":-( null pointers..."<<endl;
208 for(Int_t i=0;i<list->GetEntries();i++){
209 AliCounterCollection* coll=(AliCounterCollection*)list->At(i);
211 coll->SortRubric("run");//sort by run number
212 //coll->PrintKeyWords();
213 Int_t ncentr=10;//check this
216 TCanvas *ccent=new TCanvas(Form("ccent%s",coll->GetName()),Form("Centrality vs Run (%s)",coll->GetName()),1400,800);
219 for(Int_t ic=0;ic<ncentr;ic++){
221 TH1F* h=(TH1F*)coll->Get("run",Form("centralityclass:%d_%d",ic*10,ic*10+10));
222 h->SetName(Form("h%d%d",i,ic));
223 if(ic>=0 && ic<=1){ //0-20
225 h020=(TH1F*)h->Clone(Form("h020%s",coll->GetName()));
226 h020->SetTitle(Form("Centrality 0-20 %s",coll->GetName()));
230 if(ic>=2 && ic<=7){ //20-80
232 h2080=(TH1F*)h->Clone(Form("h2080%s",coll->GetName()));
233 h2080->SetTitle(Form("Centrality 20-80 %s",coll->GetName()));
241 // h->SetLineColor(ic+1);
242 // if(ic==0)h->DrawClone();
243 // else h->DrawClone("sames");
252 ccent->SaveAs(Form("%s%s.png",ccent->GetName(),textleg.Data()));