07fab1eb |
1 | // Usage: |
2 | // makeResults.C("tasks", "file_list", kGRID) |
3 | // tasks : "ALL" or one/more of the following separated by space: |
4 | // "EFF" : TRD Tracking Efficiency |
5 | // "EFFC" : TRD Tracking Efficiency Combined (barrel + stand alone) - only in case of simulations |
6 | // "RES" : TRD tracking Resolution |
07fab1eb |
7 | // "PID" : TRD PID - pion efficiency |
07fab1eb |
8 | // "DET" : Basic TRD Detector checks |
9 | // "NOFR" : Data set does not have AliESDfriends.root |
10 | // "NOMC" : Data set does not have Monte Carlo Informations (real data), so all tasks which rely |
11 | // on MC information are switched off |
12 | // file_list : is the list of the files to be processed. |
13 | // They should contain the full path. Here is an example: |
14 | // /lustre/alice/local/TRDdata/SIM/P-Flat/TRUNK/RUN0/TRD.Performance.root |
15 | // or for GRID alien:///alice/cern.ch/user/m/mfasel/MinBiasProd/results/ppMinBias80000/1/TRD.Performance.root |
16 | // kGRID : specify if files are comming from a GRID collection [default kFALSE] |
17 | // |
18 | // HOW TO BUILD THE FILE LIST |
19 | // 1. locally |
20 | // ls -1 BaseDir/RUN*/TRD.Performance.root > files.lst |
21 | // |
22 | // 2. on Grid |
23 | // char *BaseDir="/alice/cern.ch/user/m/mfasel/MinBiasProd/results/ppMinBias80000/"; |
24 | // TGrid::Connect("alien://"); |
0fe3fa87 |
25 | // TGridResult *res = gGrid->Query(BaseDir, "%/TRD.Performance.root"); |
07fab1eb |
26 | // TGridCollection *col = gGrid->OpenCollectionQuery(res); |
27 | // col->Reset(); |
28 | // TMap *map = 0x0; |
29 | // while(map = (TMap*)col->Next()){ |
30 | // TIter it((TCollection*)map); |
31 | // TObjString *info = 0x0; |
32 | // while(info=(TObjString*)it()){ |
33 | // printf("alien://%s\n", col->GetLFN(info->GetString().Data())); |
34 | // } |
35 | // } |
36 | // |
37 | // The files which will be processed are the intersection between the |
38 | // condition on the tasks and the files in the file list. |
39 | // |
40 | // Authors: |
41 | // Alex Bercuci (A.Bercuci@gsi.de) |
42 | // Markus Fasel (m.Fasel@gsi.de) |
43 | // |
44 | |
45 | #if ! defined (__CINT__) || defined (__MAKECINT__) |
46 | #include <fstream> |
47 | #include "TError.h" |
48 | #include <TClass.h> |
07fab1eb |
49 | #include <TCanvas.h> |
50 | #include <TH1.h> |
51 | #include <TGraph.h> |
52 | #include <TObjArray.h> |
53 | #include <TObjString.h> |
54 | #include <TString.h> |
55 | #include <TROOT.h> |
07fab1eb |
56 | #include <TStyle.h> |
0fe3fa87 |
57 | #include <TGrid.h> |
58 | #include <TGridResult.h> |
59 | #include <TGridCollection.h> |
07fab1eb |
60 | |
61 | #include "qaRec/AliTRDrecoTask.h" |
62 | |
63 | #endif |
64 | |
bd92849c |
65 | #include "AliTRDperformanceTrain.h" |
199fb43b |
66 | #include "helper.C" |
ef307cfe |
67 | //#include "../../PWG1/macros/AddPerformanceTask.h" |
07fab1eb |
68 | |
69 | Char_t *libs[] = {"libProofPlayer.so", "libANALYSIS.so", "libTRDqaRec.so"}; |
ef307cfe |
70 | // define setup |
ef307cfe |
71 | TCanvas *c = 0x0; |
c40fb08e |
72 | Bool_t mc(kFALSE), friends(kFALSE); |
73 | |
ef307cfe |
74 | void processTRD(TNamed* task); |
199fb43b |
75 | void processESD(TNamed* task); |
07fab1eb |
76 | void makeResults(Char_t *opt = "ALL", const Char_t *files=0x0, Bool_t kGRID=kFALSE) |
77 | { |
78 | if(kGRID){ |
79 | if(!gSystem->Getenv("GSHELL_ROOT")){ |
80 | Error("makeResults.C", "AliEn not initialized."); |
81 | return; |
82 | } |
83 | TGrid::Connect("alien://"); |
84 | } |
85 | |
86 | // Load Libraries in interactive mode |
87 | Int_t nlibs = static_cast<Int_t>(sizeof(libs)/sizeof(Char_t *)); |
88 | for(Int_t ilib=0; ilib<nlibs; ilib++){ |
89 | if(gSystem->Load(libs[ilib]) >= 0) continue; |
90 | Error("makeResults.C", Form("Failed to load %s.", libs[ilib])); |
91 | return; |
92 | } |
93 | |
c40fb08e |
94 | mc = HasReadMCData(opt); |
95 | friends = HasReadFriendData(opt); |
d797b5bb |
96 | |
1fd9389f |
97 | gStyle->SetOptStat(0); |
98 | gStyle->SetOptFit(0); |
07fab1eb |
99 | if(files) mergeProd("TRD.Performance.root", files); |
100 | Int_t fSteerTask = ParseOptions(opt); |
ef307cfe |
101 | |
102 | if(!c) c=new TCanvas("c", "Performance", 10, 10, 800, 500); |
07fab1eb |
103 | |
104 | TClass *ctask = new TClass; |
ef307cfe |
105 | AliAnalysisTask *task = 0x0; |
07fab1eb |
106 | for(Int_t itask = NTRDQATASKS; itask--;){ |
107 | if(!TSTBIT(fSteerTask, itask)) continue; |
07fab1eb |
108 | new(ctask) TClass(fgkTRDtaskClassName[itask]); |
ef307cfe |
109 | task = (AliAnalysisTask*)ctask->New(); |
07fab1eb |
110 | |
ef307cfe |
111 | if(task->IsA()->InheritsFrom("AliTRDrecoTask")) processTRD(task); |
199fb43b |
112 | else processESD(task); |
07fab1eb |
113 | } |
114 | delete ctask; |
115 | delete c; |
116 | } |
117 | |
07fab1eb |
118 | |
ef307cfe |
119 | //______________________________________________________ |
120 | void processTRD(TNamed *otask) |
121 | { |
122 | AliTRDrecoTask *task = dynamic_cast<AliTRDrecoTask*>(otask); |
123 | task->SetDebugLevel(0); |
124 | task->SetMCdata(mc); |
125 | task->SetFriends(friends); |
126 | |
127 | if(!task->Load(Form("%s/TRD.Performance.root", gSystem->ExpandPathName("$PWD")))){ |
128 | Error("makeResults.C", Form("Load data container for task %s failed.", task->GetName())); |
129 | delete task; |
130 | return; |
131 | } |
132 | |
133 | if(!task->PostProcess()){ |
134 | Error("makeResults.C", Form("Processing data container for task %s failed.", task->GetName())); |
135 | delete task; |
136 | return; |
137 | } |
138 | for(Int_t ipic=0; ipic<task->GetNRefFigures(); ipic++){ |
139 | c->Clear(); |
140 | if(!task->GetRefFigure(ipic)) continue; |
ee8fb199 |
141 | c->SaveAs(Form("%s_Fig%02d.gif", task->GetName(), ipic), "gif"); |
ef307cfe |
142 | } |
143 | delete task; |
144 | } |
145 | |
146 | //______________________________________________________ |
199fb43b |
147 | void processESD(TNamed *otask) |
ef307cfe |
148 | { |
199fb43b |
149 | AliTRDcheckESD *esd = dynamic_cast<AliTRDcheckESD*>(otask); |
150 | if(!esd){ |
151 | Info("makeResults.C", "Processing of task AliTRDcheckESD failed."); |
152 | delete otask; |
153 | return; |
154 | } |
155 | |
156 | if(!esd->Load(Form("%s/TRD.Performance.root", gSystem->ExpandPathName("$PWD")))){ |
157 | Error("makeResults.C", Form("Load data container for task %s failed.", esd->GetName())); |
158 | delete esd; |
159 | return; |
160 | } |
161 | |
162 | esd->Terminate(); |
163 | |
bbe8aaad |
164 | c->Clear(); |
165 | Int_t ipic=0; |
166 | while((esd->GetRefFigure(ipic))){ |
199fb43b |
167 | c->SaveAs(Form("%s_Fig%02d.gif", esd->GetName(), ipic)); |
bbe8aaad |
168 | c->Clear(); |
199fb43b |
169 | ipic++; |
170 | } |
171 | delete esd; |
d797b5bb |
172 | } |