]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG1/macros/RunPerformanceTrain.C
removing osolete macros
[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 'RunPerformanceTrain.C("AliESDs.root",2,kFALSE,kTRUE,kTRUE)'
17
18 3. Start train macro (real data from lustre)
19
20 aliroot -b -q 'RunPerformanceTrain.C("AliESDs.root",2,kFALSE,kTRUE,kFALSE)'
21
22 */
23
24 //_____________________________________________________________________________
25 void 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)
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:///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);
75   //cdbManager->SetCacheFlag(kFALSE);
76   // initialize magnetic field from the GRP manager.
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();
86  
87   //
88   // Load geometry
89   //
90   */
91   AliGeomManager::LoadGeometry();
92
93   //
94   // Swtich off all AliInfo (too much output!)
95   //
96   AliLog::SetGlobalLogLevel(AliLog::kError);
97
98   //
99   // Create input ESD chain
100   //
101   /*
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;
107   }
108   */
109   TChain  *chain = new TChain("esdTree");
110   if(!chain) { 
111     Error("RunPerformanceTrain","ESD chain not created!");
112     return;
113   }
114   chain->Add(file);
115   chain->Lookup();
116
117   //
118   // Create analysis manager
119   //
120   AliAnalysisManager *mgr = new AliAnalysisManager;
121   if(!mgr) { 
122     Error("RunPerformanceTrain","AliAnalysisManager not set!");
123     return;
124   }
125
126   //
127   // Set ESD input handler
128   //
129   AliESDInputHandler* esdH = new AliESDInputHandler;
130   if(!esdH) { 
131     Error("RunPerformanceTrain","AliESDInputHandler not created!");
132     return;
133   }
134   if(bUseESDfriend) esdH->SetActiveBranches("ESDfriend");
135   mgr->SetInputEventHandler(esdH);
136
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
150   //
151   // Set MC input handler
152   //
153   if(bUseMCInfo) {
154     AliMCEventHandler* mcH = new AliMCEventHandler;
155     if(!mcH) { 
156       Error("RunPerformanceTrain","AliMCEventHandler not created!");
157       return;
158     }
159     mcH->SetReadTR(kTRUE);
160     mgr->SetMCtruthEventHandler(mcH);
161   }
162
163
164   //
165   // Add task to AliAnalysisManager
166   //
167
168   //
169   // TPC performance
170   //
171   if(iPWG1perfTPC) {
172     gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskPerformanceTPC.C");
173     AliPerformanceTask *tpcQA = AddTaskPerformanceTPC(bUseMCInfo,bUseESDfriend,triggerClass);
174     if(!tpcQA) { 
175       Error("RunPerformanceTrain","AliPerformanceTask not created!");
176       return;
177     }
178   } 
179   else {
180     Printf("RunPerformanceTrain: TPC Performance - EXCLUDED!");
181   }
182   //
183   // TRD perormance
184   //
185   if(iPWG1perfTRD) {
186     gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTrainPerformanceTRD.C");
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   //
197   if(iPWG1perfITS) {
198     gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskPerformanceITS.C");
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   //
211   if(iPWG1perfCalo) {
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   //
226   if(iPWG1perfMuonTrig) {
227     gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskMTRchamberEfficiency.C");
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   //
241   if(iPWG1perfMuonEff) {
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);
249   } 
250   else {
251     Printf("RunPerformanceTrain: Muon Efficiency - EXCLUDED!");
252   }
253   //
254   // TOF performance
255   //
256   if(iPWG1perfTOF) {
257   //
258   } 
259   else {
260     Printf("RunPerformanceTrain: TOF - EXCLUDED!");
261   }
262   //
263   // PWG1 Primary Vertex
264   //
265   if(iPWG1perfPrimVertex) {
266     gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskVertexESD.C");
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   //
277   // PWG1 V0 QA
278   //
279   if (iPWG1v0QA) {
280     gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskV0QA.C");
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!");
289   }
290
291   //
292   // Disable debug printouts
293   //
294   mgr->SetDebugLevel(0);
295
296   if (!mgr->InitAnalysis())
297     return;
298
299   mgr->PrintStatus();
300   //mgr->StartAnalysis("local",chain, nEvents, firstEvent);
301   mgr->StartAnalysis("local",chain);
302 }
303