]>
Commit | Line | Data |
---|---|---|
1ee39b3a | 1 | // Usage: |
2 | // makeCalibResults.C("task", "file_list", kGRID) | |
3 | // tasks : "one/more of the following separated by space: | |
4 | // "CAL" : TRD calibration | |
5 | // "ALGN" : TRD alignment | |
6 | // "PIDR" : TRD PID - reference data | |
7 | // "CLRES": Cluster position and error parameterization | |
8 | // "NOFR" : Data set does not have AliESDfriends.root | |
9 | // "NOMC" : Data set does not have Monte Carlo Informations (real data), so all tasks which rely | |
10 | // on MC information are switched off | |
11 | // file_list : is the list of the files to be processed. | |
12 | // They should contain the full path. Here is an example: | |
13 | // /lustre/alice/local/TRDdata/SIM/P-Flat/TRUNK/RUN0/TRD.CalibName.root | |
14 | // or for GRID alien:///alice/cern.ch/user/m/mfasel/MinBiasProd/results/ppMinBias80000/1/TRD.Calib%.root | |
15 | // kGRID : specify if files are comming from a GRID collection [default kFALSE] | |
16 | // | |
17 | // HOW TO BUILD THE FILE LIST | |
18 | // 1. locally | |
19 | // ls -1 BaseDir/RUN*/TRD.Calib*.root > files.lst | |
20 | // | |
21 | // 2. on Grid | |
22 | // char *BaseDir="/alice/cern.ch/user/m/mfasel/MinBiasProd/results/ppMinBias80000/"; | |
23 | // TGrid::Connect("alien://"); | |
24 | // TGridResult *res = gGrid->Query(BaseDir, "%/TRD.Calib%.root"); | |
25 | // TGridCollection *col = gGrid->OpenCollectionQuery(res); | |
26 | // col->Reset(); | |
27 | // TMap *map = 0x0; | |
28 | // while(map = (TMap*)col->Next()){ | |
29 | // TIter it((TCollection*)map); | |
30 | // TObjString *info = 0x0; | |
31 | // while(info=(TObjString*)it()){ | |
32 | // printf("alien://%s\n", col->GetLFN(info->GetString().Data())); | |
33 | // } | |
34 | // } | |
35 | // | |
36 | // The files which will be processed are the intersection between the | |
37 | // condition on the tasks and the files in the file list. | |
38 | // | |
39 | // In compiled mode : | |
40 | // Don't forget to load first the libraries | |
41 | // gSystem->Load("libMemStat.so") | |
42 | // gSystem->Load("libMemStatGui.so") | |
43 | // gSystem->Load("libANALYSIS.so") | |
44 | // gSystem->Load("libANALYSISalice.so") | |
7c365e61 | 45 | // gSystem->Load("libTENDER.so") |
1ee39b3a | 46 | // gSystem->Load("libSTAT.so") |
47 | // gSystem->Load("libPWG1.so"); | |
48 | // gSystem->Load("libNetx.so") ; | |
49 | // gSystem->Load("libRAliEn.so"); | |
50 | // | |
51 | // Authors: | |
52 | // Alex Bercuci (A.Bercuci@gsi.de) | |
53 | // Markus Fasel (m.Fasel@gsi.de) | |
54 | // | |
55 | ||
56 | #if ! defined (__CINT__) || defined (__MAKECINT__) | |
57 | ||
7c365e61 | 58 | #include "AliLog.h" |
59 | #include "PWG1/TRD/AliTRDrecoTask.h" | |
1ee39b3a | 60 | #include <fstream> |
61 | #include <TCanvas.h> | |
62 | #include <TStyle.h> | |
63 | #include <TGrid.h> | |
64 | #include <TGridResult.h> | |
65 | #include <TGridCollection.h> | |
66 | ||
67 | #endif | |
68 | ||
69 | #include "AliTRDperformanceTrain.h" | |
70 | #include "helper.C" | |
71 | //#include "../../PWG1/macros/AddPerformanceTask.h" | |
72 | ||
7c365e61 | 73 | Char_t const *libs[] = {"libProofPlayer.so", "libANALYSIS.so", "libANALYSISalice.so", "libTENDER.so", "libSTAT.so", "libPWG1.so"}; |
74 | ||
1ee39b3a | 75 | // define setup |
7c365e61 | 76 | TClass *ctask = new TClass; |
77 | TCanvas *c(NULL); | |
78 | Bool_t fMC(kFALSE), fFriends(kFALSE); | |
79 | Char_t const *fFiles(NULL); | |
1ee39b3a | 80 | |
7c365e61 | 81 | void calibrateTRD(Int_t itask, Char_t const* ntask=NULL, Char_t const* nfile=NULL); |
82 | void makeCalibResults(Char_t *opt, Char_t const *files=NULL, Bool_t kGRID=kFALSE) | |
1ee39b3a | 83 | { |
84 | if(kGRID){ | |
85 | if(!gSystem->Getenv("GSHELL_ROOT")){ | |
86 | Error("makeCalibResults.C", "AliEn not initialized."); | |
87 | return; | |
88 | } | |
89 | TGrid::Connect("alien://"); | |
90 | } | |
91 | ||
92 | // Load Libraries in interactive mode | |
93 | Int_t nlibs = static_cast<Int_t>(sizeof(libs)/sizeof(Char_t *)); | |
94 | for(Int_t ilib=0; ilib<nlibs; ilib++){ | |
95 | if(gSystem->Load(libs[ilib]) >= 0) continue; | |
96 | Error("makeCalibResults.C", Form("Failed to load %s.", libs[ilib])); | |
97 | return; | |
98 | } | |
99 | ||
7c365e61 | 100 | fMC = HasReadMCData(opt); |
101 | fFriends = HasReadFriendData(opt); | |
102 | fFiles = files; | |
1ee39b3a | 103 | |
104 | gStyle->SetOptStat(0); | |
105 | gStyle->SetOptFit(0); | |
106 | Int_t fSteerTask = ParseOptions(opt); | |
107 | ||
108 | if(!c) c=new TCanvas("c", "Calibration", 10, 10, 800, 500); | |
109 | ||
1ee39b3a | 110 | for(Int_t itask = NTRDQATASKS; itask<NTRDTASKS; itask++){ |
111 | if(!TSTBIT(fSteerTask, itask)) continue; | |
7c365e61 | 112 | switch(itask){ |
113 | case kPIDRefMaker: | |
114 | calibrateTRD(itask, "AliTRDpidRefMakerLQ", "PIDrefMaker"); | |
115 | //calibrateTRD(itask, "AliTRDpidRefMakerNN", "PIDrefMaker"); | |
116 | break; | |
117 | default: | |
118 | calibrateTRD(itask); | |
119 | break; | |
120 | } | |
1ee39b3a | 121 | } |
122 | delete ctask; | |
123 | delete c; | |
124 | } | |
125 | ||
126 | ||
127 | //______________________________________________________ | |
7c365e61 | 128 | void calibrateTRD(Int_t itask, Char_t const* ntask, Char_t const* nfile) |
1ee39b3a | 129 | { |
7c365e61 | 130 | if(!ntask) ntask=fgkTRDtaskClassName[itask]; |
131 | new(ctask) TClass(ntask); | |
132 | if(!ctask){ | |
133 | Error("makeCalibResults.C", Form("Asking for wrong class name [%s].", ntask)); | |
134 | return; | |
135 | } | |
136 | AliTRDrecoTask *task = static_cast<AliTRDrecoTask*>(ctask->New()); | |
137 | if(!task){ | |
138 | Error("makeCalibResults.C", Form("Class name [%s] does not inherit from AliTRDrecoTask.", ntask)); | |
139 | return; | |
140 | } | |
cd49893a | 141 | if(!nfile) nfile=Form("TRD.Calib%s.root", task->GetName()); |
7c365e61 | 142 | if(fFiles) mergeProd(Form("TRD.Calib%s.root", nfile), fFiles); |
1ee39b3a | 143 | task->SetDebugLevel(0); |
7c365e61 | 144 | task->SetMCdata(fMC); |
145 | task->SetFriends(fFriends); | |
146 | AliLog::SetClassDebugLevel(ntask, 3); | |
1ee39b3a | 147 | |
7c365e61 | 148 | if(!task->Load(nfile)){ |
149 | Error("makeCalibResults.C", Form("Loading data container for task[%s] failed.", ntask)); | |
150 | delete task; | |
151 | return; | |
152 | } | |
1ee39b3a | 153 | if(!task->PostProcess()){ |
7c365e61 | 154 | Error("makeCalibResults.C", Form("Processing data container for task[%s] failed.", ntask)); |
1ee39b3a | 155 | delete task; |
156 | return; | |
157 | } | |
158 | for(Int_t ipic=0; ipic<task->GetNRefFigures(); ipic++){ | |
159 | c->Clear(); | |
160 | if(!task->GetRefFigure(ipic)) continue; | |
161 | c->SaveAs(Form("%s_Fig%02d.gif", task->GetName(), ipic)); | |
162 | } | |
163 | delete task; | |
164 | } | |
165 |