]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/macros/RunPerformanceTrain.C
new cuts and tasks added
[u/mrichter/AliRoot.git] / PWG1 / 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
16aliroot -b -q 'RunPerformanceTrainTPC.C("AliESDs.root",2,kFALSE,kTRUE,kTRUE)'
17
183. Start train macro (real data from lustre)
19
20aliroot -b -q 'RunPerformanceTrainTPC.C("AliESDs.root",2,kFALSE,kTRUE,kFALSE)'
21
22*/
8c0b219b 23
a62207f1 24//_____________________________________________________________________________
9372eb77 25void RunPerformanceTrainTPC(Char_t *file="esd.root", Int_t magField = 2, Bool_t bUseMCInfo=kFALSE, Bool_t bUseESDfriend=kTRUE, Bool_t bGrid=kTRUE)
8c0b219b 26{
9372eb77 27 //
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 //
39 Int_t iPWG1perfTPC = 1; // Test TPC performance
40 Int_t iPWG1perfTRD = 0; // Test TRD performance
41 Int_t iPWG1perfITS = 0; // Test ITS performance
42 Int_t iPWG1perfCalo = 0; // Test Calo performance
43 Int_t iPWG1perfMuonTrig = 0; // Test Muon Trigger performance
44 Int_t iPWG1perfMuonEff = 0; // Test Muon Efficiency performance
45 Int_t iPWG1perfTOF = 0; // Test TOF-TPC matching performance
46 Int_t iPWG1perfPrimVertex = 0; // Test Primary Vertex performance
47 Int_t iPWG1v0QA = 0; // V0 algorithm QA task
48
49 //
50 // Load Libraries
51 //
52 gSystem->Load("libANALYSIS");
53 gSystem->Load("libANALYSISalice");
54 gSystem->Load("libTENDER");
55 gSystem->Load("libCORRFW");
56
57 gSystem->Load("libTPCcalib.so");
58 gSystem->Load("libPWG1");
59
60 gSystem->Load("libPHOSUtils");
61 gSystem->Load("libEMCALUtils");
62 gSystem->Load("libPWG4PartCorrBase");
63 gSystem->Load("libPWG4PartCorrDep");
64
65 gSystem->Load("libPWG3muon.so"); // The class is here
66
67 //
68 // OCDB Configuration
69 //
70 AliCDBManager *cdbManager = AliCDBManager::Instance();
71 cdbManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
72 cdbManager->SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd()));
73 cdbManager->SetRun(0);
74 //cdbManager->SetCacheFlag(kFALSE);
75 // initialize magnetic field from the GRP manager.
76 if(magField==0) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 0., 0., AliMagF::k2kG));
77 if(magField==1) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k2kG));
78 if(magField==2) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
79
80 //AliGRPManager grpMan;
81 //grpMan.ReadGRPEntry();
82 //grpMan.SetMagField();
83 //AliRunInfo *runInfo = grpMan.GetRunInfo();
84
85 //
86 // Load geometry
87 //
88 AliGeomManager::LoadGeometry();
89
a62207f1 90 //
91 // Swtich off all AliInfo (too much output!)
92 //
8c0b219b 93 AliLog::SetGlobalLogLevel(AliLog::kError);
8c0b219b 94
a62207f1 95 //
96 // Create input ESD chain
97 //
9372eb77 98 /*
a62207f1 99 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
100 TChain* chain = CreateESDChain(list,nFiles,fistFile);
101 if(!chain) {
102 Error("RunPerformanceTrain","ESD chain not created!");
103 return;
8c0b219b 104 }
9372eb77 105 */
106 TChain *chain = new TChain("esdTree");
107 if(!chain) {
108 Error("RunPerformanceTrain","ESD chain not created!");
109 return;
110 }
111 chain->Add(file);
8c0b219b 112 chain->Lookup();
8c0b219b 113
a62207f1 114 //
115 // Create analysis manager
116 //
117 AliAnalysisManager *mgr = new AliAnalysisManager;
118 if(!mgr) {
119 Error("RunPerformanceTrain","AliAnalysisManager not set!");
120 return;
8c0b219b 121 }
122
a62207f1 123 //
124 // Set ESD input handler
125 //
126 AliESDInputHandler* esdH = new AliESDInputHandler;
127 if(!esdH) {
128 Error("RunPerformanceTrain","AliESDInputHandler not created!");
129 return;
8c0b219b 130 }
a62207f1 131 if(bUseESDfriend) esdH->SetActiveBranches("ESDfriend");
132 mgr->SetInputEventHandler(esdH);
133
9372eb77 134 /*
135 //
136 // Set RecPoints and ESD input handler
137 //
138 AliESDInputHandlerRP* rpH = new AliESDInputHandlerRP;
139 if(!rpH) {
140 Error("RunPerformanceTrain","AliESDInputHandlerRP not created!");
141 return;
142 }
143 if(bUseESDfriend) rpH->SetActiveBranches("ESDfriend");
144 mgr->SetInputEventHandler(rpH);
145 */
146
a62207f1 147 //
148 // Set MC input handler
149 //
150 if(bUseMCInfo) {
151 AliMCEventHandler* mcH = new AliMCEventHandler;
9372eb77 152 if(!mcH) {
a62207f1 153 Error("RunPerformanceTrain","AliMCEventHandler not created!");
154 return;
155 }
156 mcH->SetReadTR(kTRUE);
157 mgr->SetMCtruthEventHandler(mcH);
8c0b219b 158 }
9372eb77 159
160
a62207f1 161 //
162 // Add task to AliAnalysisManager
163 //
9372eb77 164
165 //
166 // TPC performance
167 //
168 if(iPWG1perfTPC) {
169 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskPerformanceTPC.C");
170 AliPerformanceTask *tpcQA = AddTaskPerformanceTPC(bUseMCInfo,bUseESDfriend);
171 if(!tpcQA) {
172 Error("RunPerformanceTrain","AliPerformanceTask not created!");
a62207f1 173 return;
9372eb77 174 }
175 }
176 else {
177 Printf("RunPerformanceTrain: TPC Performance - EXCLUDED!");
178 }
179 //
180 // TRD perormance
181 //
182 if(iPWG1perfTRD) {
183 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTrainPerformanceTRD.C");
184 if(!AddTrainPerformanceTRD(bUseMCInfo,bUseESDfriend)) {
185 Error("RunPerformanceTrain","TrainPerformanceTRD not created!");
186 return;
187 }
188 } else {
189 Printf("RunPerformanceTrain: TRD TrainPerformanceTRD - EXCLUDED!");
190 }
191 //
192 // ITS performance
193 //
194 if(iPWG1perfITS) {
195 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskPerformanceITS.C");
196 AliAnalysisTaskITSTrackingCheck *itsQA = AddTaskPerformanceITS(bUseMCInfo);
197 if(!itsQA) {
198 Error("RunPerformanceTrain","AliAnalysisTaskITSTrackingCheck not created!");
199 return;
200 }
201 }
202 else {
203 Printf("RunPerformanceTrain: AliAnalysisTaskITSTrackingCheck - EXCLUDED!");
204 }
205 //
206 // Calorimeter Performance
207 //
208 if(iPWG1perfCalo) {
209 gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskCalorimeterQA.C");
210 AliAnalysisTaskParticleCorrelation *taskCaloQA = AddTaskCalorimeterQA("ESD",bUseMCInfo,kFALSE);
211 if(!taskCaloQA) {
212 Error("RunPerformanceTrain","AliAnalysisTaskParticleCorrelation not created!");
213 return;
214 }
215 mgr->AddTask(taskCaloQA);
216 }
217 else {
218 Printf("RunPerformanceTrain: AliAnalysisTaskParticleCorrelation - EXCLUDED!");
219 }
220 //
221 // Muon Trigger
222 //
223 if(iPWG1perfMuonTrig) {
224 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskMTRchamberEfficiency.C");
225 AliAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency();
226 if(!taskMuonTrig) {
227 Error("RunPerformanceTrain","AliAnalysisTaskTrigChEff not created!");
228 return;
229 }
230 mgr->AddTask(taskMuonTrig);
231 }
232 else {
233 Printf("RunPerformanceTrain: AliAnalysisTaskTrigChEff - EXCLUDED!");
234 }
235 //
236 // Muon Efficiency
237 //
238 if(iPWG1perfMuonEff) {
239 //
240 }
241 else {
242 Printf("RunPerformanceTrain: Muon Efficiency - EXCLUDED!");
243 }
244 //
245 // TOF performance
246 //
247 if(iPWG1perfTOF) {
248 //
249 }
250 else {
251 Printf("RunPerformanceTrain: TOF - EXCLUDED!");
252 }
253 //
254 // PWG1 Primary Vertex
255 //
256 if(iPWG1perfPrimVertex) {
257 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskVertexESD.C");
258 AliAnalysisTaskVertexESD *taskPrimVertex = AddTaskVertexESD();
259 if(!taskPrimVertex) {
260 Error("RunPerformanceTrain","AliAnalysisTaskVertexESD not created!");
261 return;
262 }
263 }
264 else {
265 Printf("RunPerformanceTrain: AliAnalysisTaskVertexESD - EXCLUDED!");
266 }
267 //
268 // PWG1 V0 QA
269 //
270 if (iPWG1v0QA) {
271 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskV0QA.C");
272 AliAnalysisTaskV0QA *taskv0QA = AddTaskV0QA(bUseMCInfo);
273 if(!taskv0QA) {
274 Error("RunPerformanceTrain","AliAnalysisTaskV0QA not created!");
275 return;
276 }
277 }
278 else {
279 Printf("RunPerformanceTrain: AliAnalysisTaskV0QA - EXCLUDED!");
8c0b219b 280 }
281
a62207f1 282 //
283 // Disable debug printouts
284 //
285 mgr->SetDebugLevel(0);
8c0b219b 286
a62207f1 287 if (!mgr->InitAnalysis())
288 return;
8c0b219b 289
a62207f1 290 mgr->PrintStatus();
9372eb77 291 //mgr->StartAnalysis("local",chain, nEvents, firstEvent);
a62207f1 292 mgr->StartAnalysis("local",chain);
8c0b219b 293}
a62207f1 294