2 // makeResults.C("tasks?file_list")
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 // "CAL" : TRD calibration
8 // "PID" : TRD PID - pion efficiency
9 // "PIDR" : TRD PID - reference data
10 // "DET" : Basic TRD Detector checks
11 // "NOFR" : Data set does not have AliESDfriends.root
12 // "NOMC" : Data set does not have Monte Carlo Informations (real data), so all tasks which rely
13 // on MC information are switched off
14 // file_list : is the list of the files to be processed.
15 // They should contain the full path. Here is an example:
16 // /lustre_alpha/alice/TRDdata/HEAD/1.0GeV/RUN0/TRD.TaskResolution.root
17 // /lustre_alpha/alice/TRDdata/HEAD/2.0GeV/RUN1/TRD.TaskResolution.root
18 // /lustre_alpha/alice/TRDdata/HEAD/3.0GeV/RUN2/TRD.TaskResolution.root
19 // /lustre_alpha/alice/TRDdata/HEAD/2.0GeV/RUN0/TRD.TaskDetChecker.root
20 // /lustre_alpha/alice/TRDdata/HEAD/2.0GeV/RUN1/TRD.TaskDetChecker.root
21 // /lustre_alpha/alice/TRDdata/HEAD/2.0GeV/RUN2/TRD.TaskDetChecker.root
22 // /lustre_alpha/alice/TRDdata/HEAD/2.0GeV/RUN0/TRD.TaskTrackingEff.root
24 // The files which will be processed are the initersaction between the
25 // condition on the tasks and the files iin the file list.
28 // Alex Bercuci (A.Bercuci@gsi.de)
29 // Markus Fasel (m.Fasel@gsi.de)
32 #if ! defined (__CINT__) || defined (__MAKECINT__)
36 #include <TFileMerger.h>
40 #include <TObjArray.h>
41 #include <TObjString.h>
48 #include "qaRec/AliTRDrecoTask.h"
54 Char_t *libs[] = {"libProofPlayer.so", "libANALYSIS.so", "libTRDqaRec.so", "libPyROOT"};
56 void makeResults(Char_t *args = "ALL")
58 // Load Libraries in interactive mode
59 Int_t nlibs = static_cast<Int_t>(sizeof(libs)/sizeof(Char_t *));
60 for(Int_t ilib=0; ilib<nlibs; ilib++){
61 if(gSystem->Load(libs[ilib]) >= 0) continue;
62 printf("Failed to load %s.\n", libs[ilib]);
67 gStyle->SetOptStat(0);
69 Bool_t friends = kTRUE;
71 const Char_t *dir = 0x0;
73 TObjArray *argsArray = TString(args).Tokenize("?");
74 switch(argsArray->GetEntriesFast()){
76 tasks = ((TObjString*)(*argsArray)[0])->String();
80 tasks = ((TObjString*)(*argsArray)[0])->String();
81 dir = ((TObjString*)(*argsArray)[1])->GetName();
84 printf("Macro accepts 2 arguments separated by a '?'.\n");
85 printf("arg #1 : list of tasks/options\n");
86 printf("arg #2 : list of files to be processed\n");
90 // select tasks to process; we should move it to an
91 // individual function and move the task identifiers
92 // outside the const space
93 TObjArray *tasksArray = tasks.Tokenize(" ");
95 for(Int_t isel = 0; isel < tasksArray->GetEntriesFast(); isel++){
96 TString s = (dynamic_cast<TObjString *>(tasksArray->UncheckedAt(isel)))->String();
97 if(s.CompareTo("ALL") == 0){
98 for(Int_t itask = 1; itask < NTRDTASKS; itask++) SETBIT(fSteerTask, itask - 1);
100 } else if(s.CompareTo("NOFR") == 0){
102 } else if(s.CompareTo("NOMC") == 0){
105 Bool_t foundOpt = kFALSE;
106 for(Int_t itask = 1; itask < NTRDTASKS; itask++){
107 if(s.CompareTo(fgkTRDtaskOpt[itask]) != 0) continue;
108 SETBIT(fSteerTask, itask - 1);
112 if(!foundOpt) Info("makeResults.C", Form("Task %s not implemented (yet).", s.Data()));
116 // file merger object
117 TFileMerger *fFM = new TFileMerger();
119 AliTRDrecoTask *task = 0x0;
122 if(gSystem->AccessPathName(Form("%s/merge", gSystem->ExpandPathName("$PWD")))) gSystem->Exec(Form("mkdir -v %s/merge", gSystem->ExpandPathName("$PWD")));
124 printf("\n\tPROCESSING DATA FOR TASKS [%b]:\n", fSteerTask);
125 for(Int_t itask = 0; itask <NTRDTASKS; itask++){
126 if(!TSTBIT(fSteerTask, itask)) continue;
128 ctask = new TClass(fgkTRDtaskClassName[itask]);
129 task = (AliTRDrecoTask*)ctask->New();
130 task->SetDebugLevel(0);
132 task->SetFriends(friends);
137 ifstream filestream(dir);
138 while(getline(filestream, filename)){
139 if(Int_t(filename.find(task->GetName())) < 0) continue;
140 if(Int_t(filename.find("merge")) >= 0) continue;
144 printf("No Files found for Task %s\n", task->GetName());
149 printf("Processing %d files for task %s ...\n", nFiles, task->GetName());
153 fFM = new(fFM) TFileMerger(kTRUE);
154 fFM->OutputFile(Form("%s/merge/TRD.Task%s.root", gSystem->ExpandPathName("$PWD"), task->GetName()));
156 while(getline(file, filename)){
157 if(Int_t(filename.find(task->GetName())) < 0) continue;
158 if(Int_t(filename.find("merge")) >= 0) continue;
159 fFM->AddFile(filename.c_str());
163 task->Load(Form("%s/merge/TRD.Task%s.root", gSystem->ExpandPathName("$PWD"), task->GetName()));
165 getline(file, filename);
166 task->Load(filename.c_str());
170 TCanvas *c=new TCanvas();
171 for(Int_t ipic=0; ipic<task->GetNRefFigures(); ipic++){
172 task->GetRefFigure(ipic);
173 c->SaveAs(Form("%s_fig%d.gif", task->GetName(), ipic));