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]
17 // HOW TO BUILD THE FILE LIST
19 // ls -1 BaseDir/RUN*/TRD.Calib*.root > files.lst
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);
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()));
36 // The files which will be processed are the intersection between the
37 // condition on the tasks and the files in the file list.
40 // Don't forget to load first the libraries
41 // gSystem->Load("libMemStat")
42 // gSystem->Load("libMemStatGui")
43 // gSystem->Load("libANALYSIS")
44 // gSystem->Load("libANALYSISalice")
45 // gSystem->Load("libTender")
46 // gSystem->Load("libSTAT")
47 // gSystem->Load("libPWGPP");
48 // gSystem->Load("libNetx") ;
49 // gSystem->Load("libRAliEn");
52 // Alex Bercuci (A.Bercuci@gsi.de)
53 // Markus Fasel (m.Fasel@gsi.de)
56 #if ! defined (__CINT__) || defined (__MAKECINT__)
59 #include "PWGPP/TRD/AliTRDrecoTask.h"
64 #include <TGridResult.h>
65 #include <TGridCollection.h>
69 Char_t const *libs[] = {"libProofPlayer.so", "libANALYSIS.so", "libANALYSISalice.so", "libTender.so", "libSTAT.so", "libPWGPP.so", "libPWGmuon.so"};
72 TClass *ctask = new TClass;
74 Bool_t fMC(kFALSE), fFriends(kFALSE);
75 Char_t const *fFiles(NULL);
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)
81 if(!gSystem->Getenv("GSHELL_ROOT")){
82 Error("makeCalibResults.C", "AliEn not initialized.");
85 TGrid::Connect("alien://");
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]));
96 fMC = HasReadMCData(opt);
97 fFriends = HasReadFriendData(opt);
100 gStyle->SetOptStat(0);
101 gStyle->SetOptFit(0);
102 Int_t fSteerTask = ParseOptions(opt);
104 if(!c) c=new TCanvas("c", "Calibration", 10, 10, 800, 500);
106 for(Int_t itask = AliTRDpwgppHelper::kNTRDQATASKS; itask<AliTRDpwgppHelper::NTRDTASKS; itask++){
107 if(!TESTBIT(fSteerTask, itask)) continue;
109 case AliTRDpwgppHelper::kPIDRefMaker:
110 calibrateTRD(itask, "AliTRDpidRefMakerLQ", "PIDrefMaker");
111 //calibrateTRD(itask, "AliTRDpidRefMakerNN", "PIDrefMaker");
123 //______________________________________________________
124 void calibrateTRD(Int_t itask, Char_t const* ntask, Char_t const* nfile)
126 if(!ntask) ntask=AliTRDpwgppHelper::fgkTRDtaskClassName[itask];
127 new(ctask) TClass(ntask);
129 Error("makeCalibResults.C", Form("Asking for wrong class name [%s].", ntask));
132 AliTRDrecoTask *task = static_cast<AliTRDrecoTask*>(ctask->New());
134 Error("makeCalibResults.C", Form("Class name [%s] does not inherit from AliTRDrecoTask.", ntask));
137 if(!nfile) nfile=Form("TRD.Calib%s.root", task->GetName());
138 if(fFiles) mergeProd(Form("TRD.Calib%s.root", nfile), fFiles);
139 task->SetDebugLevel(0);
140 task->SetMCdata(fMC);
141 task->SetFriends(fFriends);
142 AliLog::SetClassDebugLevel(ntask, 3);
144 if(!task->Load(nfile)){
145 Error("makeCalibResults.C", Form("Loading data container for task[%s] failed.", ntask));
149 if(!task->PostProcess()){
150 Error("makeCalibResults.C", Form("Processing data container for task[%s] failed.", ntask));
154 for(Int_t ipic=0; ipic<task->GetNRefFigures(); ipic++){
156 if(!task->GetRefFigure(ipic)) continue;
157 c->SaveAs(Form("%s_Fig%02d.gif", task->GetName(), ipic));