]>
Commit | Line | Data |
---|---|---|
1ee39b3a | 1 | // Usage: |
9e985d64 | 2 | // makeResults.C("tasks", "file_list", ""task_id, kGRID) |
1ee39b3a | 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 | |
7 | // "PID" : TRD PID - pion efficiency | |
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 | |
9e985d64 | 16 | // task_id : identifier of task speciality as defined by the AddMacro.C. |
17 | // (e.g. AddTRDresolution.C defines "" for barrel tracks, "K" for kink tracks and "SA" for stand alone tracks) | |
1ee39b3a | 18 | // kGRID : specify if files are comming from a GRID collection [default kFALSE] |
19 | // | |
20 | // HOW TO BUILD THE FILE LIST | |
21 | // 1. locally | |
22 | // ls -1 BaseDir/RUN*/TRD.Performance.root > files.lst | |
23 | // | |
24 | // 2. on Grid | |
25 | // char *BaseDir="/alice/cern.ch/user/m/mfasel/MinBiasProd/results/ppMinBias80000/"; | |
26 | // TGrid::Connect("alien://"); | |
27 | // TGridResult *res = gGrid->Query(BaseDir, "%/TRD.Performance.root"); | |
28 | // TGridCollection *col = gGrid->OpenCollectionQuery(res); | |
29 | // col->Reset(); | |
30 | // TMap *map = 0x0; | |
31 | // while(map = (TMap*)col->Next()){ | |
32 | // TIter it((TCollection*)map); | |
33 | // TObjString *info = 0x0; | |
34 | // while(info=(TObjString*)it()){ | |
35 | // printf("alien://%s\n", col->GetLFN(info->GetString().Data())); | |
36 | // } | |
37 | // } | |
38 | // | |
39 | // The files which will be processed are the intersection between the | |
40 | // condition on the tasks and the files in the file list. | |
41 | // | |
42 | // Authors: | |
43 | // Alex Bercuci (A.Bercuci@gsi.de) | |
44 | // Markus Fasel (m.Fasel@gsi.de) | |
45 | // | |
46 | ||
47 | #if ! defined (__CINT__) || defined (__MAKECINT__) | |
48 | #include <fstream> | |
49 | #include "TError.h" | |
50 | #include <TClass.h> | |
51 | #include <TCanvas.h> | |
52 | #include <TH1.h> | |
53 | #include <TGraph.h> | |
54 | #include <TObjArray.h> | |
55 | #include <TObjString.h> | |
56 | #include <TString.h> | |
57 | #include <TROOT.h> | |
58 | #include <TStyle.h> | |
59 | #include <TGrid.h> | |
60 | #include <TGridResult.h> | |
61 | #include <TGridCollection.h> | |
62 | ||
02213fef | 63 | #include "AliLog.h" |
64 | ||
65 | #include "PWG1/TRD/AliTRDrecoTask.h" | |
66 | #include "PWG1/TRD/AliTRDcheckESD.h" | |
1ee39b3a | 67 | |
68 | #endif | |
69 | ||
db37d6f8 | 70 | Char_t *libs[] = {"libProofPlayer.so", "libANALYSIS.so", "libANALYSISalice.so", "libTENDER.so", "libPWG1.so"}; |
1ee39b3a | 71 | // define setup |
72 | TCanvas *c = 0x0; | |
73 | Bool_t mc(kFALSE), friends(kFALSE); | |
b795b480 | 74 | Bool_t summary(kTRUE); |
1ee39b3a | 75 | |
02213fef | 76 | void processTRD(TNamed* task, const Char_t *filename); |
77 | void processESD(TNamed* task, const Char_t *filename); | |
b795b480 | 78 | void makeResults(Char_t *opt = "ALL", const Char_t *files="QAResults.root", Char_t *cid = "", Bool_t kGRID=kFALSE, Bool_t dosummary = kTRUE) |
1ee39b3a | 79 | { |
80 | if(kGRID){ | |
81 | if(!gSystem->Getenv("GSHELL_ROOT")){ | |
82 | Error("makeResults.C", "AliEn not initialized."); | |
83 | return; | |
84 | } | |
85 | TGrid::Connect("alien://"); | |
86 | } | |
87 | ||
88 | // Load Libraries in interactive mode | |
89 | Int_t nlibs = static_cast<Int_t>(sizeof(libs)/sizeof(Char_t *)); | |
90 | for(Int_t ilib=0; ilib<nlibs; ilib++){ | |
91 | if(gSystem->Load(libs[ilib]) >= 0) continue; | |
92 | Error("makeResults.C", Form("Failed to load %s.", libs[ilib])); | |
93 | return; | |
94 | } | |
95 | ||
99535225 | 96 | mc = AliTRDpwg1Helper::HasReadMCData(opt); |
97 | friends = AliTRDpwg1Helper::HasReadFriendData(opt); | |
1ee39b3a | 98 | |
99 | gStyle->SetOptStat(0); | |
100 | gStyle->SetOptFit(0); | |
02213fef | 101 | TString outputFile; |
102 | if(!TString(files).EndsWith(".root")){ | |
103 | outputFile = Form("%s/QAResults.root", gSystem->ExpandPathName("$PWD")); | |
99535225 | 104 | AliTRDpwg1Helper::MergeProd("QAResults.root", files); |
02213fef | 105 | } else { |
106 | outputFile = files; | |
107 | } | |
99535225 | 108 | Int_t fSteerTask = AliTRDpwg1Helper::ParseOptions(opt); |
1ee39b3a | 109 | |
b795b480 | 110 | if(!dosummary){ |
2ae60201 | 111 | summary = kFALSE; |
b795b480 | 112 | if(!c) c=new TCanvas("c", "Performance", 10, 10, 800, 500); |
113 | } | |
1ee39b3a | 114 | |
115 | TClass *ctask = new TClass; | |
116 | AliAnalysisTask *task = 0x0; | |
99535225 | 117 | for(Int_t itask = AliTRDpwg1Helper::kNTRDQATASKS; itask--;){ |
118 | if(!TESTBIT(fSteerTask, itask)) continue; | |
119 | new(ctask) TClass(AliTRDpwg1Helper::fgkTRDtaskClassName[itask]); | |
1ee39b3a | 120 | task = (AliAnalysisTask*)ctask->New(); |
92d6d80c | 121 | task->SetName(Form("%s%s", task->GetName(), cid)); |
058c3053 | 122 | printf(" *** task %s, output file %s\n", task->GetName(), outputFile.Data()); |
02213fef | 123 | if(task->IsA()->InheritsFrom("AliTRDrecoTask")) processTRD(task, outputFile.Data()); |
058c3053 | 124 | else if(strcmp(task->IsA()->GetName(), "AliTRDcheckESD")==0) processESD(task, outputFile.Data()); |
125 | else if(strcmp(task->IsA()->GetName(), "AliTRDinfoGen")==0)processGEN(task, outputFile.Data()); | |
126 | else{ | |
127 | Error("makeResults.C", Form("Handling of class task \"%s\" not implemented.", task->IsA()->GetName())); | |
128 | delete task; | |
129 | } | |
1ee39b3a | 130 | } |
131 | delete ctask; | |
132 | delete c; | |
133 | } | |
134 | ||
135 | ||
136 | //______________________________________________________ | |
02213fef | 137 | void processTRD(TNamed *otask, const Char_t *filename) |
1ee39b3a | 138 | { |
97d0ccba | 139 | printf("process[%s] : %s\n", otask->GetName(), otask->GetTitle()); |
92d6d80c | 140 | Int_t debug(0); |
1ee39b3a | 141 | AliTRDrecoTask *task = dynamic_cast<AliTRDrecoTask*>(otask); |
92d6d80c | 142 | task->SetDebugLevel(debug); |
143 | AliLog::SetClassDebugLevel(otask->IsA()->GetName(), debug); | |
1ee39b3a | 144 | task->SetMCdata(mc); |
145 | task->SetFriends(friends); | |
146 | ||
02213fef | 147 | //if(!task->Load(Form("%s/AnalysisResults.root", gSystem->ExpandPathName("$PWD")))){ |
148 | if(!task->Load(filename)){ | |
1ee39b3a | 149 | Error("makeResults.C", Form("Load data container for task %s failed.", task->GetName())); |
150 | delete task; | |
151 | return; | |
152 | } | |
153 | ||
154 | if(!task->PostProcess()){ | |
155 | Error("makeResults.C", Form("Processing data container for task %s failed.", task->GetName())); | |
156 | delete task; | |
157 | return; | |
158 | } | |
b795b480 | 159 | if(summary) task->MakeSummary(); |
160 | else{ | |
161 | for(Int_t ipic=0; ipic<task->GetNRefFigures(); ipic++){ | |
162 | c->Clear(); | |
163 | if(!task->GetRefFigure(ipic)) continue; | |
164 | c->SaveAs(Form("%s_Fig%02d.gif", task->GetName(), ipic), "gif"); | |
165 | } | |
1ee39b3a | 166 | } |
167 | delete task; | |
168 | } | |
169 | ||
170 | //______________________________________________________ | |
02213fef | 171 | void processESD(TNamed *otask, const Char_t *filename) |
1ee39b3a | 172 | { |
97d0ccba | 173 | printf("process[%s] : %s\n", otask->GetName(), otask->GetTitle()); |
3d2a3dff | 174 | |
1ee39b3a | 175 | AliTRDcheckESD *esd = dynamic_cast<AliTRDcheckESD*>(otask); |
176 | if(!esd){ | |
3d2a3dff | 177 | Info("makeResults.C", Form("Processing of task %s failed.", otask->GetName())); |
1ee39b3a | 178 | delete otask; |
179 | return; | |
180 | } | |
02213fef | 181 | //if(!esd->Load(Form("%s/AnalysisResults.root", gSystem->ExpandPathName("$PWD")), "TRD_Performance")){ |
182 | if(!esd->Load(filename, "TRD_Performance")){ | |
1ee39b3a | 183 | Error("makeResults.C", Form("Load data container for task %s failed.", esd->GetName())); |
184 | delete esd; | |
185 | return; | |
186 | } | |
02213fef | 187 | esd->Terminate(NULL); |
b795b480 | 188 | |
189 | if(summary) esd->MakeSummary(); | |
190 | else{ | |
191 | for(Int_t ipic(0); ipic<esd->GetNRefFigures(); ipic++){ | |
192 | c->Clear(); | |
193 | if(!esd->GetRefFigure(ipic)) continue; | |
194 | c->SaveAs(Form("%s_Fig%02d.gif", esd->GetName(), ipic)); | |
195 | } | |
1ee39b3a | 196 | } |
197 | delete esd; | |
198 | } | |
058c3053 | 199 | |
200 | //______________________________________________________ | |
201 | void processGEN(TNamed *otask, const Char_t *filename) | |
202 | { | |
203 | printf("process[%s] : %s\n", otask->GetName(), otask->GetTitle()); | |
204 | ||
205 | AliTRDinfoGen *info = dynamic_cast<AliTRDinfoGen*>(otask); | |
206 | ||
207 | if(!info->Load(filename, "TRD_Performance")){ | |
208 | Error("makeResults.C", Form("Load data container for task %s failed.", info->GetName())); | |
209 | delete info; | |
210 | return; | |
211 | } | |
212 | if(!summary){ | |
213 | for(Int_t ipic(0); ipic<info->GetNRefFigures(); ipic++){ | |
214 | c->Clear(); | |
215 | if(!info->GetRefFigure(ipic)) continue; | |
216 | c->SaveAs(Form("%s_Fig%02d.gif", info->GetName(), ipic)); | |
217 | } | |
218 | } | |
219 | ||
220 | delete info; | |
221 | } |