]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/macros/TaskBuzzer.C
Merge branch 'TPCdev' of https://git.cern.ch/reps/AliRoot into TPCdev
[u/mrichter/AliRoot.git] / ANALYSIS / macros / TaskBuzzer.C
CommitLineData
181f0d47 1#include "Riostream.h"
2#define BIT(n) (1ULL << (n))
3/*
4 This macro should be called by a script TaskBuzzer.sh like:
5 export ARG="TaskBuzzer.C($1)"
6 aliroot -b -q $ARG
7 Call: TaskBuzzer.sh "kCar00" or: TaskBuzzer.sh "kTender|kCar01"
8*/
9
10TString config_name;
11const char *ConfigName(UInt_t);
12void LoadLibraries();
13void AddAnalysisTasks();
14TChain *CreateChain(const char *, const char *);
15
16enum EBuzzerConfig {
17 kBaseline = 0x00, // Baseline EVstat
18 kCar00 = BIT(0), // QAsym
19 kCar01 = BIT(1), // VZERO
20 kCar02 = BIT(2), // Vertex
21 kCar03 = BIT(3), // SPD
22 kCar04 = BIT(4), // SDD
23 kCar05 = BIT(5), // SSDdEdx
24 kCar06 = BIT(6), // FMD
25 kCar07 = BIT(7), // ITS
26 kCar08 = BIT(8), // TPC
27 kCar09 = BIT(9), // TRD
28 kCar10 = BIT(10), // CALO
29 kCar11 = BIT(11), // MUONTrig
30 kTender = BIT(30), // TENDER
31 kAOD = BIT(31) // AOD
32};
33
34void TaskBuzzer(UInt_t config, const char *collection="wn.xml")
35{
36 printf("Running buzzer with: %s\n", ConfigName(config));
37 TGrid::Connect("alien://");
38 if (!gGrid || !gGrid->IsConnected()) {
39 ::Error("PilotAnalysis", "No grid connection");
40 return;
41 }
42 TChain *chain = CreateChain(collection, "ESD");
43 // Load libraries
44 gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TRD");
45 LoadLibraries();
46 // Create manager
47 AliAnalysisManager *mgr = new AliAnalysisManager("ESDfiltering", "Production train");
48 mgr->SetNSysInfo(100);
49 // Input handler
50 AliESDInputHandlerRP *esdHandler = new AliESDInputHandlerRP();
51// AliESDInputHandler *esdHandler = new AliESDInputHandler();
52 esdHandler->SetReadFriends(kTRUE);
53 esdHandler->SetActiveBranches("ESDfriend");
54 mgr->SetInputEventHandler(esdHandler);
55 if (config & kAOD) {
56 // AOD output handler
57 AliAODHandler* aodHandler = new AliAODHandler();
58 aodHandler->SetOutputFileName("AliAOD.root");
59 if (!mergeExcludes.IsNull()) mergeExcludes += " ";
60 mergeExcludes += "AliAOD.root";
61 mgr->SetOutputEventHandler(aodHandler);
62 }
63 // AnalysisTasks
64 AddAnalysisTasks(config);
65
66 mgr->SetDebugLevel(1);
67 if (mgr->InitAnalysis()) {
68 mgr->PrintStatus();
69 mgr->StartAnalysis("local", chain);
70 }
71}
72
73//______________________________________________________________________________
74void AddAnalysisTasks(UInt_t config)
75{
76 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
77 mgr->SetCommonFileName("QAresults.root");
78 //
79 // Event Statistics (Jan Fiete)
80 //
81
82 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
83 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
84 mgr->RegisterExtraFile("event_stat.root");
85 //
86 // Tender and supplies
87 //
88 if (config & kTender) {
89 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/TenderSupplies/AddTaskTender.C");
90 AliAnalysisTaskSE *tender = AddTaskTender();
91 // SelectCollisionCandidates ?? Tender has to derive from TaskSE
92 tender->SelectCollisionCandidates();
93 tender->SetDebugLevel(2);
94 }
95 // AOD creation with collision events
96 if (config & kAOD) {
97 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C");
98 mgr->RegisterExtraFile("AliAOD.Muons.root");
99 mgr->RegisterExtraFile("AliAOD.Dimuons.root");
100 AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(kFALSE, kTRUE, kTRUE, doEventStat);
101 }
102 // TPC QA (E. Sicking)
103 //
104 if (config & kCar00) {
2bfe5463 105 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskQAsym.C");
181f0d47 106 AliAnalysisTaskSE * taskqasim = AddTaskQAsym(0);
107 taskqasim->SelectCollisionCandidates();
108 }
109 //
110 // VZERO QA (C. Cheshkov)
111 //
112 if (config & kCar01) {
2bfe5463 113 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskVZEROQA.C");
181f0d47 114 AliAnalysisTaskSE * taskv0qa = AddTaskVZEROQA(0);
115// taskv0qa->SelectCollisionCandidates();
116 }
117 // Vertexing (A. Dainese)
118 //
119 if (config & kCar02) {
2bfe5463 120 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskVertexESD.C");
181f0d47 121 AliAnalysisTaskVertexESD* taskvertexesd = AddTaskVertexESD();
122 taskvertexesd->SelectCollisionCandidates();
123 }
124 //
125 // SPD (A. Mastroserio)
126 //
127 if (config & kCar03) {
2bfe5463 128 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskSPDQA.C");
181f0d47 129 AliAnalysisTaskSE* taskspdqa = AddTaskSPDQA();
130 taskspdqa->SelectCollisionCandidates();
131 }
132 //
133 // SDD (F. Prino)
134 //
135 if (config & kCar04) {
2bfe5463 136 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddSDDPoints.C");
181f0d47 137 AliAnalysisTaskSE* tasksdd = AddSDDPoints();
138 tasksdd->SelectCollisionCandidates();
139 }
140 //
141 // SSD dEdx (Marek Chojnacki)
142 //
143 if (config & kCar05) {
2bfe5463 144 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskdEdxSSDQA.C");
181f0d47 145 AliAnalysisTaskSE* taskssddedx = AddTaskdEdxSSDQA();
146 taskssddedx->SelectCollisionCandidates();
147 }
148
149 // FMD (Hans Hjersing Dalsgaard)
150 //
151 if (config & kCar06) {
2bfe5463 152 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskFMD.C");
181f0d47 153 AliAnalysisTaskSE* taskfmd = AddTaskFMD();
154 taskfmd->SelectCollisionCandidates();
155 }
156 //
157 // ITS
158 //
159 if (config & kCar07) {
2bfe5463 160 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskPerformanceITS.C");
181f0d47 161 AliAnalysisTaskITSTrackingCheck *itsQA = AddTaskPerformanceITS(kFALSE);
162 }
163 //
164 // TPC (Jacek Otwinowski)
165 //
166 if (config & kCar08) {
2bfe5463 167 gROOT->LoadMacro("$(ALICE_ROOT)/PWGPP/TPC/macros/AddTaskPerformanceTPCQA.C");
181f0d47 168 AliPerformanceTask *tpcQA = AddTaskPerformanceTPCQA(kFALSE, kTRUE);
169 }
170 //
171 // TRD (Alex Bercuci, M. Fasel)
172 //
173 if(config & kCar09) {
2bfe5463 174 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTrainPerformanceTRD.C");
181f0d47 175 AddTrainPerformanceTRD("ALL");
176 }
177
178 //
179 // Calorimetry (Gustavo Conesa)
180 //
181
182 if(config & kCar10) {
183 gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/QA/AddTaskCalorimeterQA.C");
184 AliAnalysisTaskParticleCorrelation *taskCaloQA = AddTaskCalorimeterQA("ESD", kTRUE, kFALSE);
185 taskCaloQA->SetDebugLevel(0);
186 }
187
188 //
189 // Muon Trigger
190 //
191
192 if(config & kCar11) {
2bfe5463 193 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskMTRchamberEfficiency.C");
181f0d47 194 AliAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency();
195 }
196
197 //
198 // Muon Efficiency
199 //
200/*
201 if(doMUONEff) {
202 gROOT->LoadMacro("$ALICE_ROOT/PWG3/muondep/AddTaskMUONTrackingEfficiency.C");
203 AliAnalysisTaskMuonTrackingEff *taskMuonTrackEff = AddTaskMUONTrackingEfficiency();
204 }
205
206 //
207 // V0-Decay Reconstruction (Ana Marin)
208 //
209
210 if (doV0) {
2bfe5463 211 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskV0QA.C");
181f0d47 212 AliAnalysisTaskV0QA *taskv0QA = AddTaskV0QA(kFALSE);
213 }
214*/
215}
216
217//______________________________________________________________________________
218const char *ConfigName(UInt_t config)
219{
220 config_name = "EVstat";
221 if (config & kTender) config_name += "+TENDER";
222 if (config & kAOD) config_name += "+AOD";
223 if (config & kCar00) config_name += "+QAsym";
224 if (config & kCar01) config_name += "+VZERO";
225 if (config & kCar02) config_name += "+Vertex";
226 if (config & kCar03) config_name += "+SPD";
227 if (config & kCar04) config_name += "+SDD";
228 if (config & kCar05) config_name += "+SSDdEdx";
229 if (config & kCar06) config_name += "+FMD";
230 if (config & kCar07) config_name += "+ITS";
231 if (config & kCar08) config_name += "+TPC";
232 if (config & kCar09) config_name += "+TRD";
233 if (config & kCar10) config_name += "+CALO";
234 if (config & kCar11) config_name += "+MUONTrig";
235 return config_name.Data();
236}
237
238//______________________________________________________________________________
239void LoadLibraries()
240{
241 gSystem->Load("libANALYSIS");
242 gSystem->Load("libANALYSISalice");
243 gSystem->Load("libCORRFW");
244 gSystem->Load("libTENDER");
245 gSystem->Load("libTENDERSupplies");
246 gSystem->Load("libPWG0base.so");
247 gSystem->Load("libPWG0dep.so");
248 gSystem->Load("libPWG0selectors.so");
2bfe5463 249 gSystem->Load("libPWGPP.so");
181f0d47 250 gSystem->Load("libPWG2.so");
251 gSystem->Load("libPWG2forward.so");
252 gSystem->Load("libEMCALUtils");
253 gSystem->Load("libPWG4PartCorrBase");
254 gSystem->Load("libPWG4PartCorrDep");
40a0a69c 255 gSystem->Load("libPWGHFbase");
256 gSystem->Load("libPWGmuon");
257 gSystem->Load("libPWGmuondep");
181f0d47 258// fast xrootd reading enabled
259 printf("!!! You requested FastRead option. Using xrootd flags to reduce timeouts. Note that this may skip some files that could be accessed !!!");
260 gEnv->SetValue("XNet.ConnectTimeout",10);
261 gEnv->SetValue("XNet.RequestTimeout",10);
262 gEnv->SetValue("XNet.MaxRedirectCount",2);
263 gEnv->SetValue("XNet.ReconnectTimeout",10);
264 gEnv->SetValue("XNet.FirstConnectMaxCnt",1);
265}
266
267//________________________________________________________________________________
268TChain* CreateChain(const char *xmlfile, const char *type)
269{
270// Create a chain using url's from xml file
271 TString treename = type;
272 treename.ToLower();
273 treename += "Tree";
274 printf("***************************************\n");
275 printf(" Getting chain of trees %s\n", treename.Data());
276 printf("***************************************\n");
277 TAlienCollection *coll = TAlienCollection::Open(xmlfile);
278 if (!coll) {
279 ::Error("CreateChain", "Cannot create an AliEn collection from %s", xmlfile);
280 return NULL;
281 }
282 TChain *chain = new TChain(treename);
283 coll->Reset();
284 while (coll->Next()) {
285 chain->Add(coll->GetTURL(""));
286 }
287 if (!chain->GetNtrees()) {
288 ::Error("CreateChain", "No tree found from collection %s", xmlfile);
289 return NULL;
290 }
291 return chain;
292}