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
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
16 // kGRID : specify if files are comming from a GRID collection [default kFALSE]
18 // HOW TO BUILD THE FILE LIST
20 // ls -1 BaseDir/RUN*/TRD.Performance.root > files.lst
23 // char *BaseDir="/alice/cern.ch/user/m/mfasel/MinBiasProd/results/ppMinBias80000/";
24 // TGrid::Connect("alien://");
25 // TGridResult *res = gGrid->Query(BaseDir, "%/TRD.Performance.root");
26 // TGridCollection *col = gGrid->OpenCollectionQuery(res);
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()));
37 // The files which will be processed are the intersection between the
38 // condition on the tasks and the files in the file list.
41 // Alex Bercuci (A.Bercuci@gsi.de)
42 // Markus Fasel (m.Fasel@gsi.de)
45 #if ! defined (__CINT__) || defined (__MAKECINT__)
52 #include <TObjArray.h>
53 #include <TObjString.h>
58 #include <TGridResult.h>
59 #include <TGridCollection.h>
61 #include "qaRec/AliTRDrecoTask.h"
65 #include "AliTRDperformanceTrain.h"
67 //#include "../../PWG1/macros/AddPerformanceTask.h"
69 Char_t *libs[] = {"libProofPlayer.so", "libANALYSIS.so", "libTRDqaRec.so"};
72 Bool_t mc(kFALSE), friends(kFALSE);
74 void processTRD(TNamed* task);
75 void processESD(TNamed* task);
76 void makeResults(Char_t *opt = "ALL", const Char_t *files=0x0, Bool_t kGRID=kFALSE)
79 if(!gSystem->Getenv("GSHELL_ROOT")){
80 Error("makeResults.C", "AliEn not initialized.");
83 TGrid::Connect("alien://");
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]));
94 mc = HasReadMCData(opt);
95 friends = HasReadFriendData(opt);
97 gStyle->SetOptStat(0);
99 if(files) mergeProd("TRD.Performance.root", files);
100 Int_t fSteerTask = ParseOptions(opt);
102 if(!c) c=new TCanvas("c", "Performance", 10, 10, 800, 500);
104 TClass *ctask = new TClass;
105 AliAnalysisTask *task = 0x0;
106 for(Int_t itask = NTRDQATASKS; itask--;){
107 if(!TSTBIT(fSteerTask, itask)) continue;
108 new(ctask) TClass(fgkTRDtaskClassName[itask]);
109 task = (AliAnalysisTask*)ctask->New();
111 if(task->IsA()->InheritsFrom("AliTRDrecoTask")) processTRD(task);
112 else processESD(task);
119 //______________________________________________________
120 void processTRD(TNamed *otask)
122 AliTRDrecoTask *task = dynamic_cast<AliTRDrecoTask*>(otask);
123 task->SetDebugLevel(0);
125 task->SetFriends(friends);
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()));
133 if(!task->PostProcess()){
134 Error("makeResults.C", Form("Processing data container for task %s failed.", task->GetName()));
138 for(Int_t ipic=0; ipic<task->GetNRefFigures(); ipic++){
140 if(!task->GetRefFigure(ipic)) continue;
141 c->SaveAs(Form("%s_Fig%02d.gif", task->GetName(), ipic), "gif");
146 //______________________________________________________
147 void processESD(TNamed *otask)
149 AliTRDcheckESD *esd = dynamic_cast<AliTRDcheckESD*>(otask);
151 Info("makeResults.C", "Processing of task AliTRDcheckESD failed.");
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()));
166 while((esd->GetRefFigure(ipic))){
167 c->SaveAs(Form("%s_Fig%02d.gif", esd->GetName(), ipic));