TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGPP / macros / RunPerformanceTrain.C
CommitLineData
8c0b219b 1//
a62207f1 2// Macro to run performance QA train
3// locally. The TPC performance task is attached.
4//
8c0b219b 5//
a62207f1 6//13.10.2009 - J.Otwinowski@gsi.de
9372eb77 7//
8//
9
10/*
11Quick Start:
12
131. Start train macro (real data from GSI::SE). Source your own Alien environment.
14
15source /u/jacek/alien/set_alien_env.sh
850814d6 16aliroot -b -q 'RunPerformanceTrain.C("AliESDs.root",2,kFALSE,kTRUE,kTRUE)'
9372eb77 17
183. Start train macro (real data from lustre)
19
850814d6 20aliroot -b -q 'RunPerformanceTrain.C("AliESDs.root",2,kFALSE,kTRUE,kFALSE)'
9372eb77 21
22*/
8c0b219b 23
a62207f1 24//_____________________________________________________________________________
5188bc99 25void RunPerformanceTrain(Char_t *file="esd.root", Int_t runNumber = 2, const char* triggerClass ="CINT1B-ABCE-NOPF-ALL", Bool_t bUseMCInfo=kFALSE, Bool_t bUseESDfriend=kTRUE, Bool_t bGrid=kFALSE)
8c0b219b 26{
a62207f1 27 //
9372eb77 28 // Grid settings
29 // use GSI::SE
30 if(bGrid) {
31 gSystem->Setenv("alien_CLOSE_SE","ALICE::GSI::SE");
32 TGrid * alien = TGrid::Connect("alien://",0,0,"t");
33 gSystem->Setenv("alien_CLOSE_SE","ALICE::GSI::SE");
34 }
35
36 //
37 // Train Configuration
38 //
2bfe5463 39 Int_t iPWGPPperfTPC = 1; // Test TPC performance
40 Int_t iPWGPPperfTRD = 0; // Test TRD performance
41 Int_t iPWGPPperfITS = 0; // Test ITS performance
42 Int_t iPWGPPperfCalo = 0; // Test Calo performance
43 Int_t iPWGPPperfMuonTrig = 0; // Test Muon Trigger performance
44 Int_t iPWGPPperfMuonEff = 0; // Test Muon Efficiency performance
45 Int_t iPWGPPperfTOF = 0; // Test TOF-TPC matching performance
46 Int_t iPWGPPperfPrimVertex = 0; // Test Primary Vertex performance
47 Int_t iPWGPPv0QA = 0; // V0 algorithm QA task
9372eb77 48
49 //
50 // Load Libraries
51 //
52 gSystem->Load("libANALYSIS");
53 gSystem->Load("libANALYSISalice");
af472fff 54 gSystem->Load("libTender");
9372eb77 55 gSystem->Load("libCORRFW");
56
57 gSystem->Load("libTPCcalib.so");
2bfe5463 58 gSystem->Load("libPWGPP");
9372eb77 59
60 gSystem->Load("libPHOSUtils");
61 gSystem->Load("libEMCALUtils");
62 gSystem->Load("libPWG4PartCorrBase");
63 gSystem->Load("libPWG4PartCorrDep");
64
40a0a69c 65 gSystem->Load("libPWGmuon.so"); // The class is here
9372eb77 66
67 //
68 // OCDB Configuration
69 //
70 AliCDBManager *cdbManager = AliCDBManager::Instance();
5188bc99 71 cdbManager->SetDefaultStorage("local:///lustre/alice/alien/alice/data/2009/OCDB");
72 //cdbManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
73 //cdbManager->SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd()));
74 cdbManager->SetRun(runNumber);
9372eb77 75 //cdbManager->SetCacheFlag(kFALSE);
76 // initialize magnetic field from the GRP manager.
5188bc99 77 //if(magField==0) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 0., 0., AliMagF::k2kG));
78 //if(magField==1) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k2kG));
79 //if(magField==2) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
80
81 /*
82 AliGRPManager grpMan;
83 grpMan.ReadGRPEntry();
84 grpMan.SetMagField();
85 AliRunInfo *runInfo = grpMan.GetRunInfo();
9372eb77 86
87 //
88 // Load geometry
89 //
5188bc99 90 */
9372eb77 91 AliGeomManager::LoadGeometry();
92
93 //
a62207f1 94 // Swtich off all AliInfo (too much output!)
95 //
8c0b219b 96 AliLog::SetGlobalLogLevel(AliLog::kError);
8c0b219b 97
a62207f1 98 //
99 // Create input ESD chain
100 //
9372eb77 101 /*
a62207f1 102 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
103 TChain* chain = CreateESDChain(list,nFiles,fistFile);
104 if(!chain) {
105 Error("RunPerformanceTrain","ESD chain not created!");
106 return;
8c0b219b 107 }
9372eb77 108 */
109 TChain *chain = new TChain("esdTree");
110 if(!chain) {
111 Error("RunPerformanceTrain","ESD chain not created!");
112 return;
113 }
114 chain->Add(file);
8c0b219b 115 chain->Lookup();
8c0b219b 116
a62207f1 117 //
118 // Create analysis manager
119 //
120 AliAnalysisManager *mgr = new AliAnalysisManager;
121 if(!mgr) {
122 Error("RunPerformanceTrain","AliAnalysisManager not set!");
123 return;
8c0b219b 124 }
125
a62207f1 126 //
127 // Set ESD input handler
128 //
129 AliESDInputHandler* esdH = new AliESDInputHandler;
130 if(!esdH) {
131 Error("RunPerformanceTrain","AliESDInputHandler not created!");
132 return;
8c0b219b 133 }
a62207f1 134 if(bUseESDfriend) esdH->SetActiveBranches("ESDfriend");
135 mgr->SetInputEventHandler(esdH);
136
9372eb77 137 /*
138 //
139 // Set RecPoints and ESD input handler
140 //
141 AliESDInputHandlerRP* rpH = new AliESDInputHandlerRP;
142 if(!rpH) {
143 Error("RunPerformanceTrain","AliESDInputHandlerRP not created!");
144 return;
145 }
146 if(bUseESDfriend) rpH->SetActiveBranches("ESDfriend");
147 mgr->SetInputEventHandler(rpH);
148 */
149
a62207f1 150 //
151 // Set MC input handler
152 //
153 if(bUseMCInfo) {
154 AliMCEventHandler* mcH = new AliMCEventHandler;
9372eb77 155 if(!mcH) {
a62207f1 156 Error("RunPerformanceTrain","AliMCEventHandler not created!");
157 return;
158 }
159 mcH->SetReadTR(kTRUE);
160 mgr->SetMCtruthEventHandler(mcH);
8c0b219b 161 }
9372eb77 162
163
a62207f1 164 //
165 // Add task to AliAnalysisManager
166 //
9372eb77 167
168 //
169 // TPC performance
170 //
2bfe5463 171 if(iPWGPPperfTPC) {
172 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskPerformanceTPC.C");
5188bc99 173 AliPerformanceTask *tpcQA = AddTaskPerformanceTPC(bUseMCInfo,bUseESDfriend,triggerClass);
9372eb77 174 if(!tpcQA) {
175 Error("RunPerformanceTrain","AliPerformanceTask not created!");
a62207f1 176 return;
9372eb77 177 }
178 }
179 else {
180 Printf("RunPerformanceTrain: TPC Performance - EXCLUDED!");
181 }
182 //
183 // TRD perormance
184 //
2bfe5463 185 if(iPWGPPperfTRD) {
186 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTrainPerformanceTRD.C");
9372eb77 187 if(!AddTrainPerformanceTRD(bUseMCInfo,bUseESDfriend)) {
188 Error("RunPerformanceTrain","TrainPerformanceTRD not created!");
189 return;
190 }
191 } else {
192 Printf("RunPerformanceTrain: TRD TrainPerformanceTRD - EXCLUDED!");
193 }
194 //
195 // ITS performance
196 //
2bfe5463 197 if(iPWGPPperfITS) {
198 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskPerformanceITS.C");
9372eb77 199 AliAnalysisTaskITSTrackingCheck *itsQA = AddTaskPerformanceITS(bUseMCInfo);
200 if(!itsQA) {
201 Error("RunPerformanceTrain","AliAnalysisTaskITSTrackingCheck not created!");
202 return;
203 }
204 }
205 else {
206 Printf("RunPerformanceTrain: AliAnalysisTaskITSTrackingCheck - EXCLUDED!");
207 }
208 //
209 // Calorimeter Performance
210 //
2bfe5463 211 if(iPWGPPperfCalo) {
9372eb77 212 gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskCalorimeterQA.C");
213 AliAnalysisTaskParticleCorrelation *taskCaloQA = AddTaskCalorimeterQA("ESD",bUseMCInfo,kFALSE);
214 if(!taskCaloQA) {
215 Error("RunPerformanceTrain","AliAnalysisTaskParticleCorrelation not created!");
216 return;
217 }
218 mgr->AddTask(taskCaloQA);
219 }
220 else {
221 Printf("RunPerformanceTrain: AliAnalysisTaskParticleCorrelation - EXCLUDED!");
222 }
223 //
224 // Muon Trigger
225 //
2bfe5463 226 if(iPWGPPperfMuonTrig) {
227 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskMTRchamberEfficiency.C");
9372eb77 228 AliAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency();
229 if(!taskMuonTrig) {
230 Error("RunPerformanceTrain","AliAnalysisTaskTrigChEff not created!");
231 return;
232 }
233 mgr->AddTask(taskMuonTrig);
234 }
235 else {
236 Printf("RunPerformanceTrain: AliAnalysisTaskTrigChEff - EXCLUDED!");
237 }
238 //
239 // Muon Efficiency
240 //
2bfe5463 241 if(iPWGPPperfMuonEff) {
acff170f 242 gROOT->LoadMacro("$ALICE_ROOT/PWG3/muondep/AddTaskMUONTrackingEfficiency.C");
243 AliAnalysisTaskMuonTrackingEff *taskMuonTrackEff = AliAnalysisTaskMuonTrackingEff();
244 if(!taskMuonTrackEff) {
245 Error("RunPerformanceTrain","AliAnalysisTaskMuonTrackingEff not created!");
246 return;
247 }
248 mgr->AddTask(taskMuonTrackEff);
9372eb77 249 }
250 else {
251 Printf("RunPerformanceTrain: Muon Efficiency - EXCLUDED!");
252 }
253 //
254 // TOF performance
255 //
2bfe5463 256 if(iPWGPPperfTOF) {
9372eb77 257 //
258 }
259 else {
260 Printf("RunPerformanceTrain: TOF - EXCLUDED!");
261 }
262 //
2bfe5463 263 // PWGPP Primary Vertex
9372eb77 264 //
2bfe5463 265 if(iPWGPPperfPrimVertex) {
266 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskVertexESD.C");
9372eb77 267 AliAnalysisTaskVertexESD *taskPrimVertex = AddTaskVertexESD();
268 if(!taskPrimVertex) {
269 Error("RunPerformanceTrain","AliAnalysisTaskVertexESD not created!");
270 return;
271 }
272 }
273 else {
274 Printf("RunPerformanceTrain: AliAnalysisTaskVertexESD - EXCLUDED!");
275 }
276 //
2bfe5463 277 // PWGPP V0 QA
9372eb77 278 //
2bfe5463 279 if (iPWGPPv0QA) {
280 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskV0QA.C");
9372eb77 281 AliAnalysisTaskV0QA *taskv0QA = AddTaskV0QA(bUseMCInfo);
282 if(!taskv0QA) {
283 Error("RunPerformanceTrain","AliAnalysisTaskV0QA not created!");
284 return;
285 }
286 }
287 else {
288 Printf("RunPerformanceTrain: AliAnalysisTaskV0QA - EXCLUDED!");
8c0b219b 289 }
290
a62207f1 291 //
292 // Disable debug printouts
293 //
294 mgr->SetDebugLevel(0);
8c0b219b 295
a62207f1 296 if (!mgr->InitAnalysis())
297 return;
8c0b219b 298
a62207f1 299 mgr->PrintStatus();
9372eb77 300 //mgr->StartAnalysis("local",chain, nEvents, firstEvent);
a62207f1 301 mgr->StartAnalysis("local",chain);
8c0b219b 302}
a62207f1 303