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>
47 #include "qaRec/AliTRDrecoTask.h"
53 Char_t *libs[] = {"libProofPlayer.so", "libANALYSIS.so", "libTRDqaRec.so"};
55 void makeResults(Char_t *opt = "ALL", const Char_t *files=0x0)
57 // Load Libraries in interactive mode
58 Int_t nlibs = static_cast<Int_t>(sizeof(libs)/sizeof(Char_t *));
59 for(Int_t ilib=0; ilib<nlibs; ilib++){
60 if(gSystem->Load(libs[ilib]) >= 0) continue;
61 printf("Failed to load %s.\n", libs[ilib]);
66 gStyle->SetOptStat(0);
68 Bool_t friends = kTRUE;
70 // select tasks to process; we should move it to an
71 // individual function and move the task identifiers
72 // outside the const space
74 TObjArray *tasksArray = tasks.Tokenize(" ");
76 for(Int_t isel = 0; isel < tasksArray->GetEntriesFast(); isel++){
77 TString s = (dynamic_cast<TObjString *>(tasksArray->UncheckedAt(isel)))->String();
78 if(s.CompareTo("ALL") == 0){
79 for(Int_t itask = 1; itask < NQATASKS; itask++) SETBIT(fSteerTask, itask);
81 } else if(s.CompareTo("NOFR") == 0){
83 } else if(s.CompareTo("NOMC") == 0){
86 Bool_t foundOpt = kFALSE;
87 for(Int_t itask = 1; itask < NTRDTASKS; itask++){
88 if(s.CompareTo(fgkTRDtaskOpt[itask]) != 0) continue;
89 SETBIT(fSteerTask, itask);
93 if(!foundOpt) Info("makeResults.C", Form("Task %s not implemented (yet).", s.Data()));
96 // extra rules for calibration tasks
97 if(TSTBIT(fSteerTask, kClErrParam)) SETBIT(fSteerTask, kResolution);
98 if(TSTBIT(fSteerTask, kPIDRefMaker)) SETBIT(fSteerTask, kPIDChecker);
99 if(TSTBIT(fSteerTask, kAlignment)) SETBIT(fSteerTask, kResolution);
101 // file merger object
102 TFileMerger *fFM = 0x0;
103 TClass *ctask = new TClass;
104 AliTRDrecoTask *task = 0x0;
107 if(gSystem->AccessPathName(Form("%s/merge", gSystem->ExpandPathName("$PWD")))) gSystem->Exec(Form("mkdir -v %s/merge", gSystem->ExpandPathName("$PWD")));
109 for(Int_t itask = 1; itask<NTRDTASKS; itask++){
110 if(!TSTBIT(fSteerTask, itask)) continue;
112 new(ctask) TClass(fgkTRDtaskClassName[itask]);
113 task = (AliTRDrecoTask*)ctask->New();
114 task->SetDebugLevel(0);
116 task->SetFriends(friends);
120 TString mark(Form("%s.root", task->GetName()));
123 ifstream filestream(files);
124 while(getline(filestream, filename)){
125 if(Int_t(filename.find(mark.Data())) < 0) continue;
129 nFiles = !gSystem->AccessPathName(Form("TRD.Task%s.root", task->GetName()));
133 Info("makeResults.C", Form("No Files found for Task %s", task->GetName()));
137 Info("makeResults.C", Form(" Processing %d files for task %s ...", nFiles, task->GetName()));
140 fFM = new TFileMerger(kTRUE);
141 fFM->OutputFile(Form("%s/merge/TRD.Task%s.root", gSystem->ExpandPathName("$PWD"), task->GetName()));
143 ifstream file(files);
144 while(getline(file, filename)){
145 if(Int_t(filename.find(mark.Data())) < 0) continue;
146 fFM->AddFile(filename.c_str());
150 if(!task->Load(Form("%s/merge/TRD.Task%s.root", gSystem->ExpandPathName("$PWD"), task->GetName()))){
155 if(!task->Load(Form("%s/TRD.Task%s.root", gSystem->ExpandPathName("$PWD"), task->GetName()))){
161 printf("Processing ...\n");
163 TCanvas *c=new TCanvas();
164 for(Int_t ipic=0; ipic<task->GetNRefFigures(); ipic++){
165 if(!task->GetRefFigure(ipic)) continue;
166 c->SaveAs(Form("%s_fig%d.gif", task->GetName(), ipic));