]>
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") |
2bfe5463 | 47 | // gSystem->Load("libPWGPP.so"); |
1ee39b3a | 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" |
2bfe5463 | 59 | #include "PWGPP/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 | ||
fe80554e | 69 | Char_t const *libs[] = {"libProofPlayer.so", "libANALYSIS.so", "libANALYSISalice.so", "libTENDER.so", "libSTAT.so", "libPWGPP.so", "libPWGmuon.so"}; |
7c365e61 | 70 | |
1ee39b3a | 71 | // define setup |
7c365e61 | 72 | TClass *ctask = new TClass; |
73 | TCanvas *c(NULL); | |
74 | Bool_t fMC(kFALSE), fFriends(kFALSE); | |
75 | Char_t const *fFiles(NULL); | |
1ee39b3a | 76 | |
7c365e61 | 77 | void calibrateTRD(Int_t itask, Char_t const* ntask=NULL, Char_t const* nfile=NULL); |
78 | void makeCalibResults(Char_t *opt, Char_t const *files=NULL, Bool_t kGRID=kFALSE) | |
1ee39b3a | 79 | { |
80 | if(kGRID){ | |
81 | if(!gSystem->Getenv("GSHELL_ROOT")){ | |
82 | Error("makeCalibResults.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("makeCalibResults.C", Form("Failed to load %s.", libs[ilib])); | |
93 | return; | |
94 | } | |
95 | ||
7c365e61 | 96 | fMC = HasReadMCData(opt); |
97 | fFriends = HasReadFriendData(opt); | |
98 | fFiles = files; | |
1ee39b3a | 99 | |
100 | gStyle->SetOptStat(0); | |
101 | gStyle->SetOptFit(0); | |
102 | Int_t fSteerTask = ParseOptions(opt); | |
103 | ||
104 | if(!c) c=new TCanvas("c", "Calibration", 10, 10, 800, 500); | |
105 | ||
2bfe5463 | 106 | for(Int_t itask = AliTRDpwgppHelper::kNTRDQATASKS; itask<AliTRDpwgppHelper::NTRDTASKS; itask++){ |
99535225 | 107 | if(!TESTBIT(fSteerTask, itask)) continue; |
7c365e61 | 108 | switch(itask){ |
2bfe5463 | 109 | case AliTRDpwgppHelper::kPIDRefMaker: |
7c365e61 | 110 | calibrateTRD(itask, "AliTRDpidRefMakerLQ", "PIDrefMaker"); |
111 | //calibrateTRD(itask, "AliTRDpidRefMakerNN", "PIDrefMaker"); | |
112 | break; | |
113 | default: | |
114 | calibrateTRD(itask); | |
115 | break; | |
116 | } | |
1ee39b3a | 117 | } |
118 | delete ctask; | |
119 | delete c; | |
120 | } | |
121 | ||
122 | ||
123 | //______________________________________________________ | |
7c365e61 | 124 | void calibrateTRD(Int_t itask, Char_t const* ntask, Char_t const* nfile) |
1ee39b3a | 125 | { |
2bfe5463 | 126 | if(!ntask) ntask=AliTRDpwgppHelper::fgkTRDtaskClassName[itask]; |
7c365e61 | 127 | new(ctask) TClass(ntask); |
128 | if(!ctask){ | |
129 | Error("makeCalibResults.C", Form("Asking for wrong class name [%s].", ntask)); | |
130 | return; | |
131 | } | |
132 | AliTRDrecoTask *task = static_cast<AliTRDrecoTask*>(ctask->New()); | |
133 | if(!task){ | |
134 | Error("makeCalibResults.C", Form("Class name [%s] does not inherit from AliTRDrecoTask.", ntask)); | |
135 | return; | |
136 | } | |
cd49893a | 137 | if(!nfile) nfile=Form("TRD.Calib%s.root", task->GetName()); |
7c365e61 | 138 | if(fFiles) mergeProd(Form("TRD.Calib%s.root", nfile), fFiles); |
1ee39b3a | 139 | task->SetDebugLevel(0); |
7c365e61 | 140 | task->SetMCdata(fMC); |
141 | task->SetFriends(fFriends); | |
142 | AliLog::SetClassDebugLevel(ntask, 3); | |
1ee39b3a | 143 | |
7c365e61 | 144 | if(!task->Load(nfile)){ |
145 | Error("makeCalibResults.C", Form("Loading data container for task[%s] failed.", ntask)); | |
146 | delete task; | |
147 | return; | |
148 | } | |
1ee39b3a | 149 | if(!task->PostProcess()){ |
7c365e61 | 150 | Error("makeCalibResults.C", Form("Processing data container for task[%s] failed.", ntask)); |
1ee39b3a | 151 | delete task; |
152 | return; | |
153 | } | |
154 | for(Int_t ipic=0; ipic<task->GetNRefFigures(); ipic++){ | |
155 | c->Clear(); | |
156 | if(!task->GetRefFigure(ipic)) continue; | |
157 | c->SaveAs(Form("%s_Fig%02d.gif", task->GetName(), ipic)); | |
158 | } | |
159 | delete task; | |
160 | } | |
161 |