]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/macrosQA/EvaluatePIDqaTOF.C
Adding extra check for GPU_FORCE_64BIT_PTR env var
[u/mrichter/AliRoot.git] / TOF / macrosQA / EvaluatePIDqaTOF.C
1 Double_t EvaluatePIDqaTOF(const char* gridDir, Int_t irun, Int_t color, TLegend* leg, TCanvas* cmatchAll, Option_t* opt="hist same err"){
2
3         //
4         // macro to evaluate PID QA for TOF
5         //
6
7         TGrid::Connect("alien://");
8         TFile* f = TFile::Open(Form("%s/QAresults.root",gridDir));
9         TDirectoryFile* d = (TDirectoryFile*)f->Get("PIDqa");
10         TList* list = (TList*)d->Get("PIDqa");
11         TList* listTOF = (TList*)list->FindObject("TOF");
12         TH1F* hT0MakerEff = (TH1F*)listTOF->FindObject("hT0MakerEff");
13         hT0MakerEff->Sumw2();
14         TH1F* hnTracksAt_TOF = (TH1F*)listTOF->FindObject("hnTracksAt_TOF");
15         hnTracksAt_TOF->Sumw2();
16         TH1F* efficiencyT0Maker = (TH1F*)hT0MakerEff->Clone("efficiencyT0Maker");
17         efficiencyT0Maker->Divide(hT0MakerEff, hnTracksAt_TOF, 1, 1, "b");
18         efficiencyT0Maker->SetLineColor(color);
19         efficiencyT0Maker->SetMarkerColor(color);
20         efficiencyT0Maker->GetXaxis()->SetTitle("nTracks at TOF");
21         efficiencyT0Maker->GetYaxis()->SetTitle("T0TOF efficiency");
22         cmatchAll->cd();
23         efficiencyT0Maker->DrawCopy(opt);
24
25         leg->AddEntry(efficiencyT0Maker,Form("run %d",irun),"l");
26
27         TCanvas* cmatch = new TCanvas(Form("cmatch_%d",irun),Form("cmatch_%d",irun),50,50,750,550);
28         efficiencyT0Maker->DrawCopy();
29         cmatch->Print(Form("T0tofEfficiency_run_%d.png",irun));
30         cmatch->Print(Form("T0tofEfficiency_run_%d.root",irun));
31         efficiencyT0Maker->Fit("pol0");
32         return (Double_t)(efficiencyT0Maker->GetFunction("pol0")->GetParameter(1));
33 }
34
35 void MakeTrendT0Tof(Int_t nruns, Int_t* runs, const char* gridDirBase, const char* pass){
36
37         //
38         // macro to make the trending of the T0tof efficiency for the given run list
39         // e.g.:
40         // .L EvaluatePIDqaTOF.C
41         // Int_t runs[2] = {123456,234567}
42         // MakeTrendT0Tof(2,runs,"alien:///alice/data/2011/LHC11h","ESDs/pass1_HLT")
43         //
44
45         gStyle->SetOptStat(0);
46         gStyle->SetOptTitle(0);
47         if (nruns > 12) {
48                 Printf("More colors needed! change the macro...");
49                 return;
50         }
51         Int_t colors[12] = {kOrange, kRed, kMagenta, kBlue, kAzure+10, kGreen, kYellow+2, kOrange+2, kPink-9, kViolet+2, kBlue-2, kAzure+1};
52         TCanvas* cmatchAll = new TCanvas(Form("cmatchAll"),Form("cmatchAll"),50,50,750,550);
53         TLegend * leg = new TLegend(0.6,0.2,0.8,0.2+0.05*nruns);
54         leg->SetFillColor(0);
55         //leg->SetBorderSize(0);
56         for (Int_t irun = 0; irun<nruns; irun++){
57                 TString path(gridDirBase);
58                 path+="/000";
59                 path+=Form("%d",runs[irun]);
60                 path+="/";
61                 path+=pass;
62                 Printf("path for run %d = %s",runs[irun],path.Data());          
63                 Double_t eff = 0;
64                 if (irun == 0) eff = EvaluatePIDqaTOF(path.Data(), runs[irun], colors[irun], leg, cmatchAll, "hist err");
65                 else eff = EvaluatePIDqaTOF(path.Data(), runs[irun], colors[irun], leg, cmatchAll);
66                 Printf("the average efficiency for run %d is %f", runs[irun], eff);
67         }
68         cmatchAll->cd();
69         leg->Draw();
70         cmatchAll->Print("T0tof_efficiency.png");
71         cmatchAll->Print("T0tof_efficiency.root");
72         return;
73 }
74