1 Double_t EvaluatePIDqaTOF(const char* gridDir, Int_t irun, Int_t color, TLegend* leg, TCanvas* cmatchAll, Option_t* opt="same err"){
4 // macro to evaluate PID QA for TOF
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");
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");
23 efficiencyT0Maker->DrawCopy(opt);
25 leg->AddEntry(efficiencyT0Maker,Form("run %d",irun),"l");
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));
35 void MakeTrendT0Tof(Int_t nruns, Int_t* runs, const char* gridDirBase, const char* pass){
38 // macro to make the trending of the T0tof efficiency for the given run list
40 // .L EvaluatePIDqaTOF.C
41 // Int_t runs[2] = {123456,234567}
42 // MakeTrendT0Tof(2,runs,"alien:///alice/data/2011/LHC11h","ESDs/pass1_HLT")
45 gStyle->SetOptStat(0);
46 gStyle->SetOptTitle(0);
48 Printf("More colors needed! change the macro...");
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);
55 //leg->SetBorderSize(0);
56 for (Int_t irun = 0; irun<nruns; irun++){
57 TString path(gridDirBase);
59 path+=Form("%d",runs[irun]);
62 Printf("path for run %d = %s",runs[irun],path.Data());
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);
70 cmatchAll->Print("T0tof_efficiency.png");
71 cmatchAll->Print("T0tof_efficiency.root");