]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG1/macros/RunPerformanceTrain.C
new cuts and tasks added
[u/mrichter/AliRoot.git] / PWG1 / macros / RunPerformanceTrain.C
1 //
2 // Macro to run performance QA train
3 // locally. The TPC performance task is attached.
4 // 
5 //
6 //13.10.2009 -  J.Otwinowski@gsi.de
7 //
8 //
9
10 /*
11 Quick Start:
12
13 1. Start train macro (real data from GSI::SE). Source your own Alien environment.
14
15 source /u/jacek/alien/set_alien_env.sh
16 aliroot -b -q 'RunPerformanceTrainTPC.C("AliESDs.root",2,kFALSE,kTRUE,kTRUE)'
17
18 3. Start train macro (real data from lustre)
19
20 aliroot -b -q 'RunPerformanceTrainTPC.C("AliESDs.root",2,kFALSE,kTRUE,kFALSE)'
21
22 */
23
24 //_____________________________________________________________________________
25 void RunPerformanceTrainTPC(Char_t *file="esd.root", Int_t magField = 2, Bool_t bUseMCInfo=kFALSE, Bool_t bUseESDfriend=kTRUE, Bool_t bGrid=kTRUE)
26 {
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
90   //
91   // Swtich off all AliInfo (too much output!)
92   //
93   AliLog::SetGlobalLogLevel(AliLog::kError);
94
95   //
96   // Create input ESD chain
97   //
98   /*
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;
104   }
105   */
106   TChain  *chain = new TChain("esdTree");
107   if(!chain) { 
108     Error("RunPerformanceTrain","ESD chain not created!");
109     return;
110   }
111   chain->Add(file);
112   chain->Lookup();
113
114   //
115   // Create analysis manager
116   //
117   AliAnalysisManager *mgr = new AliAnalysisManager;
118   if(!mgr) { 
119     Error("RunPerformanceTrain","AliAnalysisManager not set!");
120     return;
121   }
122
123   //
124   // Set ESD input handler
125   //
126   AliESDInputHandler* esdH = new AliESDInputHandler;
127   if(!esdH) { 
128     Error("RunPerformanceTrain","AliESDInputHandler not created!");
129     return;
130   }
131   if(bUseESDfriend) esdH->SetActiveBranches("ESDfriend");
132   mgr->SetInputEventHandler(esdH);
133
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
147   //
148   // Set MC input handler
149   //
150   if(bUseMCInfo) {
151     AliMCEventHandler* mcH = new AliMCEventHandler;
152     if(!mcH) { 
153       Error("RunPerformanceTrain","AliMCEventHandler not created!");
154       return;
155     }
156     mcH->SetReadTR(kTRUE);
157     mgr->SetMCtruthEventHandler(mcH);
158   }
159
160
161   //
162   // Add task to AliAnalysisManager
163   //
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!");
173       return;
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!");
280   }
281
282   //
283   // Disable debug printouts
284   //
285   mgr->SetDebugLevel(0);
286
287   if (!mgr->InitAnalysis())
288     return;
289
290   mgr->PrintStatus();
291   //mgr->StartAnalysis("local",chain, nEvents, firstEvent);
292   mgr->StartAnalysis("local",chain);
293 }
294