TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGPP / PilotTrain / PilotAnalysis.C
CommitLineData
fe0275ad 1#include "Riostream.h"
f59ecfbc 2void LoadLibraries();
3void AddAnalysisTasks();
4class AliAnalysisAlien;
5AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode);
6
c2e39978 7// Collision type: 0 = p-p 1 = Pb-Pb
07682040 8Int_t iCollisionType = 0;
fc84f098 9// Trigger mask.
10// Still need to change:
11UInt_t kTriggerInt = AliVEvent::kAnyINT;
12UInt_t kTriggerMuonAll = AliVEvent::kMUL7 | AliVEvent::kMUSH7 | AliVEvent::kMUU7 | AliVEvent::kMUS7;
13UInt_t kTriggerMuonBarell = AliVEvent::kMUU7;
14UInt_t kTriggerEMC = AliVEvent::kEMC7;
15UInt_t kTriggerHM = AliVEvent::kHighMult;
16// Main trigger mask used:
17UInt_t kTriggerMask = kTriggerInt;
18
19Int_t runNumbers[5] = {154780};
574b2e7b 20
cc0ef64f 21Bool_t doCDBconnect = 1;
0e23e583 22Bool_t doEventStat = 1;
07682040 23Bool_t doCentrality = 0;
cc0ef64f 24Bool_t doQAsym = 1;
25Bool_t doVZERO = 1; // there is a 2nd file
26Bool_t doVertex = 1;
27Bool_t doSPD = 1; // needs RP
c2e39978 28Bool_t doTPC = 1;
cc0ef64f 29Bool_t doSDD = 1; // needs RP
30Bool_t doSSDdEdx = 1;
07682040 31
fc84f098 32Bool_t doTRD = 1;
cc0ef64f 33Bool_t doITS = 1;
fc84f098 34Bool_t doITSsaTracks = 1;
35Bool_t doITSalign = 1;
cc0ef64f 36Bool_t doCALO = 1;
37Bool_t doMUONTrig = 1;
38Bool_t doImpParRes = 1;
39Bool_t doMUON = 1;
40Bool_t doTOF = 1;
41Bool_t doHMPID = 1;
fc84f098 42Bool_t doT0 = 1;
43Bool_t doZDC = 1;
44Bool_t doPIDResponse = 1;
45Bool_t doPIDqa = 1; //new
46Bool_t doFMD = 1; // new
a05adbe9 47
9bdd18e3 48Bool_t doMUONEff = 0; // NEEDS geometry
49Bool_t doV0 = 0; // NEEDS MCtruth
f59ecfbc 50
9bdd18e3 51TString train_name = "QA"; // QA local folder name
07682040 52TString train_tag = (iCollisionType)?"_Pb-Pb":"_p-p"; // Train special tag appended to
9bdd18e3 53 // visible name. ("sim", "pp", ...)
54 // Name in train page (DON'T CHANGE)
55TString visible_name = Form("QA$2_$3%s", train_tag.Data()); //# FIXED #
2bfe5463 56TString job_comment = "PWGPP QA kAnyInt, QAsym(add kMUU7 and kEMC7) CALO (add kEMC7) triggers"; // Can add observations here
9bdd18e3 57 // Job tag (DON'T CHANGE)
ab93cb3c 58TString job_tag = Form("%s: %s", visible_name.Data(), job_comment.Data());
9bdd18e3 59 // Package versions - Modify as needed
fc84f098 60TString root_version = "v5-28-00e-1";
61TString aliroot_version = "v4-21-29-AN";
9bdd18e3 62 // Production directory - change as needed for test mode
fc84f098 63TString grid_datadir = "/alice/data/2011/LHC11c";
9bdd18e3 64 // Work directory in GRID (DON'T CHANGE)
65TString grid_workdir = "/alice/cern.ch/user/a/alidaq/QA/QA$2";
66 // Job splitting
46ff50c9 67Int_t grid_split = 20; // Splitting
9bdd18e3 68 // Debug level
2251e21b 69Int_t debug_level = 1; // Debugging
35b82dbf 70 // File merging
71Int_t maxMergeFiles = 10; // Max files to merge in a chunk
9bdd18e3 72 // Data pattern - change as needed for test mode
fc84f098 73TString data_pattern = "*ESDs/pass1/*ESDs.root";
9bdd18e3 74 // Output directory (DON'T CHANGE)
75TString alien_outdir = "$1/QA$2";
76 // Input collection (production mode)
77TString data_collection = "$1/qa1.xml";
78TString mergeExcludes = ""; // Files to be excluded for merging
35b82dbf 79TString mergeDirName = "QA$2";
a9b5fbe0 80TString terminateFiles = "trending.root"; // Files produced during Terminate
fe0275ad 81
574b2e7b 82Bool_t useProductionMode = kTRUE;
83Bool_t useMergeViaJDL = kTRUE;
46ff50c9 84Bool_t useFastReadOption = kFALSE;
44a84424 85Bool_t useOverwriteMode = kTRUE;
574b2e7b 86Bool_t useDevelopmentVersion = kFALSE;
fe0275ad 87
f59ecfbc 88void PilotAnalysis(const char *plugin_mode = "full")
89{
9bdd18e3 90 TString smode(plugin_mode);
91 smode.ToLower();
92 if (smode == "test") useProductionMode = kFALSE;
93 if (!useProductionMode) {
94 TGrid::Connect("alien://");
95 if (!gGrid || !gGrid->IsConnected()) {
96 ::Error("PilotAnalysis", "No grid connection");
97 return;
98 }
99 }
fe0275ad 100 // Write configuration
101 TString cdir = gSystem->WorkingDirectory();
102 gSystem->MakeDirectory(train_name);
103 gSystem->ChangeDirectory(train_name);
104 ofstream out;
105 out.open(Form("%sConfig.C",train_name.Data()), ios::out);
106 out << "{" << endl;
107 out << " train_name = " << "\"" << train_name.Data() << "\";" << endl;
108 out << " root_version = " << "\"" << root_version.Data() << "\";" << endl;
109 out << " aliroot_version = " << "\"" << aliroot_version.Data() << "\";" << endl;
110 out << " grid_datadir = " << "\"" << grid_datadir.Data() << "\";" << endl;
111 if (!alien_outdir.Length()) alien_outdir = Form("output_%s",train_name.Data());
112 out << " alien_outdir = " << "\"" << alien_outdir.Data() << "\";" << endl;
113 out << " doQAsim = " << doQAsym << ";" << endl;
114 out << " doVZERO = " << doVZERO << ";" << endl;
115 out << " doVertex = " << doVertex << ";" << endl;
116 out << " doSPD = " << doSPD << ";" << endl;
117 out << " doSDD = " << doSDD << ";" << endl;
574b2e7b 118 out << " doSSDdEdx = " << doSSDdEdx << ";" << endl;
fe0275ad 119 out << " doTPC = " << doTPC << ";" << endl;
a05adbe9 120 out << " doTRD = " << doTRD << ";" << endl;
07682040 121 out << " doITS = " << doITS << ";" << endl;
122 out << " doITSsaTracks = " << doITSsaTracks << ";" << endl;
123 out << " doITSalign = " << doITSalign << ";" << endl;
d42843d3 124 out << " doZDC = " << doZDC << ";" << endl;
a05adbe9 125 out << " doImpParRes = " << doImpParRes << ";" << endl;
126 out << " doMUON = " << doMUON << ";" << endl;
c1c35c14 127 out << " doTOF = " << doTOF << ";" << endl;
128 out << " doHMPID = " << doHMPID << ";" << endl;
07682040 129 out << " doZDC = " << doZDC << ";" << endl;
130 out << " doT0 = " << doT0 << ";" << endl;
fc84f098 131 out << " doPIDResponse = " << doPIDResponse << ";" << endl;
132 out << " doPIDqa = " << doPIDqa << ";" << endl;
133 out << " doFMD = " << doFMD << ";" << endl;
fe0275ad 134 out << " doEventStat = " << doEventStat << ";" << endl;
07682040 135 if (iCollisionType) out << " doCentrality = " << doCentrality << ";" << endl;
fe0275ad 136 out << "}" << endl;
137 out.close();
138
f59ecfbc 139 // Load libraries
2bfe5463 140 gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TRD -I$ALICE_ROOT/PWGPP");
f59ecfbc 141 LoadLibraries();
142 // Create manager
143 AliAnalysisManager *mgr = new AliAnalysisManager("PilotAnalysis", "Production train");
fc84f098 144 if (!strcmp(plugin_mode,"test")) mgr->SetNSysInfo(100);
f59ecfbc 145 // Input handler
146 AliESDInputHandlerRP *esdHandler = new AliESDInputHandlerRP();
574b2e7b 147 esdHandler->SetReadFriends(kTRUE);
f59ecfbc 148 esdHandler->SetActiveBranches("ESDfriend");
149 mgr->SetInputEventHandler(esdHandler);
9bdd18e3 150 mgr->SetDebugLevel(debug_level);
fe0275ad 151
f59ecfbc 152 // AnalysisTasks
153 AddAnalysisTasks();
154 // Grid handler
fe0275ad 155 AliAnalysisAlien *alienHandler = CreateAlienHandler(plugin_mode);
f59ecfbc 156 mgr->SetGridHandler(alienHandler);
157 if (mgr->InitAnalysis()) {
158 mgr->PrintStatus();
8a67db85 159 if (!strcmp(plugin_mode, "local")) mgr->StartAnalysis("local");
160 else mgr->StartAnalysis("grid");
f59ecfbc 161 }
162}
163
164void LoadLibraries()
165{
e583cb58 166 gSystem->Load("libANALYSIS");
167 gSystem->Load("libANALYSISalice");
168 gSystem->Load("libCORRFW");
af472fff 169 gSystem->Load("libTender");
f59ecfbc 170 gSystem->Load("libPWG0base.so");
171 gSystem->Load("libPWG0dep.so");
172 gSystem->Load("libPWG0selectors.so");
2bfe5463 173 gSystem->Load("libPWGPP.so");
e583cb58 174
e583cb58 175 if (doCALO) {
176 gSystem->Load("libEMCALUtils");
07682040 177 gSystem->Load("libPHOSUtils");
e583cb58 178 gSystem->Load("libPWG4PartCorrBase");
179 gSystem->Load("libPWG4PartCorrDep");
f59ecfbc 180 }
fc84f098 181 if(doMUON || doMUONTrig) {
40a0a69c 182 gSystem->Load("libPWGHFbase");
183 gSystem->Load("libPWGmuon");
184 gSystem->Load("libPWGmuondep");
fc84f098 185 }
186 if (doFMD) {
187 gSystem->Load("libPWG2forward2");
188 }
f59ecfbc 189}
190
191void AddAnalysisTasks()
192{
574b2e7b 193 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
194 mgr->SetCommonFileName("QAresults.root");
46ff50c9 195 // Statistics task
fc84f098 196 mgr->AddStatisticsTask(kTriggerMask);
574b2e7b 197 //
2251e21b 198 // CDB connection
199 //
200 if (doCDBconnect) {
2bfe5463 201 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskCDBconnect.C");
2251e21b 202 AliTaskCDBconnect *taskCDB = AddTaskCDBconnect();
203 if (!taskCDB) return;
8a67db85 204 taskCDB->SetRunNumber(runNumbers[0]);
2251e21b 205 }
206
207 //
574b2e7b 208 // Event Statistics (Jan Fiete)
209 //
574b2e7b 210 if (doEventStat) {
211 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
44a84424 212 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kFALSE /*MC*/);
9bdd18e3 213// mgr->RegisterExtraFile("event_stat.root");
214 if (!terminateFiles.IsNull()) terminateFiles += ",";
215 terminateFiles += "event_stat.root";
574b2e7b 216 }
44a84424 217
218 //
46ff50c9 219 // Centrality (A. Toia)
44a84424 220 //
221 if (doCentrality) {
07682040 222 if (!iCollisionType) {
223 printf("Disabling centrality task for p-p\n");
224 doCentrality = kFALSE;
225 } else {
226 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
227 AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
228 }
44a84424 229 }
230
f59ecfbc 231 // Vertexing (A. Dainese)
232 //
233 if (doVertex) {
2bfe5463 234 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskVertexESD.C");
fc84f098 235 AliAnalysisTaskVertexESD* taskvertexesd = AddTaskVertexESD(kFALSE, kTriggerMask);
236 taskvertexesd->SelectCollisionCandidates(kTriggerMask);
f59ecfbc 237 }
238
239 // TPC QA (E. Sicking)
240 //
241 if (doQAsym) {
fc84f098 242 // offline trigger in AddTask
2bfe5463 243 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskQAsym.C");
fc84f098 244 AliAnalysisTaskSE * taskqasim = AddTaskQAsym(0, kTriggerMask, kTriggerHM, kTriggerEMC, kTriggerMuonBarell);
245 // taskqasim->SelectCollisionCandidates(); // Set by AddTask
f59ecfbc 246 }
247 //
248 // VZERO QA (C. Cheshkov)
249 //
250 if (doVZERO) {
2bfe5463 251 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskVZEROQA.C");
f59ecfbc 252 AliAnalysisTaskSE * taskv0qa = AddTaskVZEROQA(0);
e583cb58 253// taskv0qa->SelectCollisionCandidates();
f59ecfbc 254 }
f59ecfbc 255 //
13cf30d6 256 // TPC (Jacek Otwinowski & Michael Knichel & Weilin Yu)
f59ecfbc 257 //
b843fdc9 258 //
259 // Optionally MC information can be used by setting the 1st argument to true
260 // Optionally friends information can be switched off by setting the 2st argument
261 // to false
262 // Optionally highMult axis can be used by setting the 3st argument to true (for PbPb)
f59ecfbc 263 if (doTPC) {
2bfe5463 264 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/TPC/macros/AddTaskPerformanceTPCdEdxQA.C");
13cf30d6 265 // low multiplicity (pp)
266 //AliPerformanceTask *tpcQA = AddTaskPerformanceTPCdEdxQA(kFALSE, kTRUE, kFALSE);
267 // high multiplicity (Pb-Pb)
268 AliPerformanceTask *tpcQA = AddTaskPerformanceTPCdEdxQA(kFALSE, kTRUE, kTRUE);
fc84f098 269 tpcQA->SelectCollisionCandidates(kTriggerMask);
f59ecfbc 270 }
271 //
272 // SPD (A. Mastroserio)
273 //
274 if (doSPD) {
2bfe5463 275 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskSPDQA.C");
f59ecfbc 276 AliAnalysisTaskSE* taskspdqa = AddTaskSPDQA();
fc84f098 277 taskspdqa->SelectCollisionCandidates(kTriggerMask);
e583cb58 278 }
f59ecfbc 279 //
280 // SDD (F. Prino)
281 //
282 if (doSDD) {
2bfe5463 283 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddSDDPoints.C");
f59ecfbc 284 AliAnalysisTaskSE* tasksdd = AddSDDPoints();
fc84f098 285 tasksdd->SelectCollisionCandidates(kTriggerMask);
f59ecfbc 286 }
574b2e7b 287 //
288 // SSD dEdx (Marek Chojnacki)
289 //
290 if (doSSDdEdx) {
2bfe5463 291 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskdEdxSSDQA.C");
574b2e7b 292 AliAnalysisTaskSE* taskssddedx = AddTaskdEdxSSDQA();
fc84f098 293 taskssddedx->SelectCollisionCandidates(kTriggerMask);
574b2e7b 294 }
8e52a034 295
e583cb58 296 //
297 // ITS
298 //
299 if (doITS) {
fc84f098 300 // hardcoded non-zero trigger mask
2bfe5463 301 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskPerformanceITS.C");
c2e39978 302 AliAnalysisTaskITSTrackingCheck *itsQA = 0;
303 AliAnalysisTaskITSTrackingCheck *itsQACent0010 = 0;
304 AliAnalysisTaskITSTrackingCheck *itsQACent3050 = 0;
305 AliAnalysisTaskITSTrackingCheck *itsQACent6080 = 0;
306 if(iCollisionType==0) {
307 itsQA = AddTaskPerformanceITS(kFALSE);
308 } else {
309 itsQA = AddTaskPerformanceITS(kFALSE);
310 itsQACent0010 = AddTaskPerformanceITS(kFALSE,kFALSE,kFALSE,3500,10000);
311 itsQACent3050 = AddTaskPerformanceITS(kFALSE,kFALSE,kFALSE,590,1570);
312 itsQACent6080 = AddTaskPerformanceITS(kFALSE,kFALSE,kFALSE,70,310);
313 }
e583cb58 314 }
8e52a034 315 //
07682040 316 // ITS saTracks, align (F.Prino)
317 //
318 if (doITSsaTracks) {
fc84f098 319 // offline trigger in AddTask
2bfe5463 320 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskITSsaTracks.C");
07682040 321 AliAnalysisTaskITSsaTracks *itssaTracks = AddTaskITSsaTracks(kFALSE,kFALSE);
fc84f098 322 itssaTracks->SelectCollisionCandidates(kTriggerMask);
07682040 323 }
324 if (doITSalign) {
fc84f098 325 // no offline trigger selection
2bfe5463 326 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskITSAlign.C");
07682040 327 AliAnalysisTaskITSAlignQA *itsAlign = AddTaskITSAlign(0,2011);
328 }
329 //
8e52a034 330 // TRD (Alex Bercuci, M. Fasel)
331 //
332 if(doTRD) {
fc84f098 333 // no offline trigger selection
2bfe5463 334 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTrainPerformanceTRD.C");
92238d29 335 // steer individual TRD tasks
336 Bool_t
337 doCheckESD(kTRUE), // AliTRDcheckESD
338 doCheckDET(kTRUE), // AliTRDcheckDET
339 doEffic(kTRUE), // AliTRDefficiency
340 doResolution(kTRUE),// AliTRDresolution
341 doCheckPID(kTRUE), // AliTRDcheckPID
342 doV0Monitor(kFALSE);// AliTRDv0Monitor
343 AddTrainPerformanceTRD(Translate(doCheckESD, doCheckDET, doEffic, doResolution, doCheckPID, doV0Monitor));
8e52a034 344 }
345
346 //
d42843d3 347 // ZDC (Chiara Oppedisano)
348 //
349 if(doZDC) {
fc84f098 350 // hardcoded kMB trigger mask
2bfe5463 351 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/ZDC/AddTaskZDCQA.C");
d42843d3 352 AliAnalysisTaskSE *taskZDC = AddTaskZDCQA();
fc84f098 353 taskZDC->SelectCollisionCandidates(kTriggerMask);
d42843d3 354 }
355 //
8e52a034 356 // Calorimetry (Gustavo Conesa)
357 //
358
359 if(doCALO) {
360 gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/QA/AddTaskCalorimeterQA.C");
07682040 361 AliAnalysisTaskParticleCorrelation *taskCaloQA = AddTaskCalorimeterQA("ESD", 2011, kFALSE, kFALSE);
2efff183 362 taskCaloQA->SetDebugLevel(0);
fc84f098 363 // offline mask set in AddTask to kMB
364 taskCaloQA->SelectCollisionCandidates(kTriggerMask);
365 // Add a new calo task with EMC1 trigger only
366 taskCaloQA = AddTaskCalorimeterQA("ESD", 2011, kFALSE, kFALSE, "", "EMC7");
367 taskCaloQA->SetDebugLevel(0);
368 taskCaloQA->SelectCollisionCandidates(kTriggerEMC);
8e52a034 369 }
370
371 //
372 // Muon Trigger
373 //
374
375 if(doMUONTrig) {
fc84f098 376 // no offline trigger selection
2bfe5463 377 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskMTRchamberEfficiency.C");
8e52a034 378 AliAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency();
379 }
380
381 //
fc84f098 382 // Muon Efficiency (not used)
8e52a034 383 //
384
385 if(doMUONEff) {
386 gROOT->LoadMacro("$ALICE_ROOT/PWG3/muondep/AddTaskMUONTrackingEfficiency.C");
387 AliAnalysisTaskMuonTrackingEff *taskMuonTrackEff = AddTaskMUONTrackingEfficiency();
388 }
389
390 //
fc84f098 391 // V0-Decay Reconstruction (Ana Marin) (not used)
8e52a034 392 //
393
394 if (doV0) {
2bfe5463 395 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskV0QA.C");
8e52a034 396 AliAnalysisTaskV0QA *taskv0QA = AddTaskV0QA(kFALSE);
397 }
c1c35c14 398 //
a05adbe9 399 // Impact parameter resolution (xianbao.yuan@pd.infn.it, andrea.dainese@pd.infn.it)
400 //
401 if (doImpParRes) {
2bfe5463 402 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskImpParRes.C");
c2e39978 403 AliAnalysisTaskSE* taskimpparres=0;
404 if(iCollisionType==0) {
405 taskimpparres= AddTaskImpParRes();
406 } else {
407 taskimpparres= AddTaskImpParRes(kFALSE,-1,kFALSE,kFALSE);
408 }
fc84f098 409 taskimpparres->SelectCollisionCandidates(kTriggerMask);
a05adbe9 410 }
c1c35c14 411 //
a05adbe9 412 // MUON QA (Philippe Pillot)
413 //
414 if (doMUON) {
fc84f098 415 // trigger analysis internal
a05adbe9 416 gROOT->LoadMacro("$ALICE_ROOT/PWG3/muon/AddTaskMuonQA.C");
417 AliAnalysisTaskSE* taskmuonqa= AddTaskMuonQA();
418 }
c1c35c14 419 //
420 // TOF (Francesca Bellini)
421 //
422 if (doTOF) {
2bfe5463 423 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/TOF/AddTaskTOFQA.C");
c1c35c14 424 AliAnalysisTaskTOFqa *tofQA = AddTaskTOFQA();
fc84f098 425 tofQA->SelectCollisionCandidates(kTriggerMask);
426 }
427 //
428 // PIDResponse(JENS)
429 //
430 if (doPIDqa) {
431 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
432 AliAnalysisTaskPIDResponse *PIDResponse = AddTaskPIDResponse();
433 PIDResponse->SelectCollisionCandidates(kTriggerMask);
c1c35c14 434 }
fc84f098 435
436 //
437 // PIDqa(JENS)
438 //
439 if (doPIDqa) {
440 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
441 AliAnalysisTaskPIDqa *PIDQA = AddTaskPIDqa();
442 PIDQA->SelectCollisionCandidates(kTriggerMask);
443 }
444
c1c35c14 445 //
446 // HMPID QA (Giacomo Volpe)
447 //
448 if (doHMPID) {
2bfe5463 449 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/HMPID/AddTaskHmpidQA.C");
c1c35c14 450 AliAnalysisTaskSE* taskhmpidqa= AddTaskHmpidQA(kFALSE);
fc84f098 451 // offline mask set in AddTask to kMB
452 taskhmpidqa->SelectCollisionCandidates(kTriggerMask);
c1c35c14 453 }
fc84f098 454 // T0 QA (Alla Mayevskaya)
07682040 455 if (doT0) {
fc84f098 456 // no offline trigger selection
2bfe5463 457 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/T0/AddTaskT0QA.C");
fc84f098 458 AliT0AnalysisTaskQA* taskt0qa= AddTaskT0QA();
459 taskt0qa->SelectCollisionCandidates(kTriggerMask);
07682040 460 }
fc84f098 461 // FMD QA (Christian Holm Christiansen)
462 if (doFMD) {
463 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskForwardQA.C");
464 // Parameters: usemc, usecentrality
465 AliAnalysisTaskSE *forwardQA = (AliAnalysisTaskSE *)AddTaskForwardQA(kFALSE, kFALSE);
466 // No offline trigger config. needed (see #84077)
467 }
f59ecfbc 468}
469
470//______________________________________________________________________________
471AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode)
472{
473// Check if user has a valid token, otherwise make one. This has limitations.
474// One can always follow the standard procedure of calling alien-token-init then
475// source /tmp/gclient_env_$UID in the current shell.
f59ecfbc 476 AliAnalysisAlien *plugin = new AliAnalysisAlien();
477// Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
478 plugin->SetRunMode(plugin_mode);
9bdd18e3 479 if (useProductionMode) {
480 plugin->SetProductionMode();
481 plugin->AddDataFile(data_collection);
482 }
fe0275ad 483 plugin->SetJobTag(job_tag);
fc84f098 484 plugin->SetNtestFiles(2);
9bdd18e3 485 plugin->SetCheckCopy(kFALSE);
35b82dbf 486 plugin->SetMergeDirName(mergeDirName);
f59ecfbc 487// Set versions of used packages
f59ecfbc 488 plugin->SetAPIVersion("V1.1x");
fe0275ad 489 plugin->SetROOTVersion(root_version);
490 plugin->SetAliROOTVersion(aliroot_version);
f59ecfbc 491// Declare input data to be processed.
492// Method 1: Create automatically XML collections using alien 'find' command.
493// Define production directory LFN
fe0275ad 494 plugin->SetGridDataDir(grid_datadir);
f59ecfbc 495// Set data search pattern
fe0275ad 496 plugin->SetDataPattern(data_pattern);
f59ecfbc 497// ...then add run numbers to be considered
498// if (!iAODanalysis) plugin->SetRunRange(run_range[0], run_range[1]);
2bfe5463 499// plugin->SetOutputSingleFolder("outpu$ALICE_ROOT/PWGPP/T0/Addt");
9bdd18e3 500 if (!useProductionMode) {
501 plugin->SetRunPrefix("000");
502 plugin->SetOutputToRunNo();
503 for (Int_t i=0; i<2; i++) {
504 if (!runNumbers[i]) break;
505 plugin->AddRunNumber(runNumbers[i]);
506 }
507 }
f59ecfbc 508// Define alien work directory where all files will be copied. Relative to alien $HOME.
9bdd18e3 509 plugin->SetGridWorkingDir(grid_workdir);
f59ecfbc 510// Declare alien output directory. Relative to working directory.
fe0275ad 511 if (alien_outdir.IsNull()) alien_outdir = Form("output_%s",train_name.Data());
512 plugin->SetGridOutputDir(alien_outdir);
f59ecfbc 513
574b2e7b 514 if (useDevelopmentVersion) {
515 plugin->EnablePackage("STEERBase");
516 plugin->EnablePackage("ESD");
517 plugin->EnablePackage("AOD");
518 plugin->EnablePackage("ANALYSIS");
519 plugin->EnablePackage("ANALYSISalice");
520 }
f59ecfbc 521
522// Declare the analysis source files names separated by blancs. To be compiled runtime
523// using ACLiC on the worker nodes.
524// Declare all libraries (other than the default ones for the framework. These will be
525// loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
bf90a869 526 plugin->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TRD");
574b2e7b 527
af472fff 528 plugin->SetAdditionalLibs("libCORRFW.so libTender.so libPWG0base.so libPWG0dep.so libPWG0selectors.so libPWGPP.so \
07682040 529 libEMCALUtils.so libPHOSUtils.so libPWG4PartCorrBase.so libPWG4PartCorrDep.so \
40a0a69c 530 libPWGHFbase.so libPWGmuon.so libPWGmuondep.so libPWG2forward2.so");
f59ecfbc 531
532// Declare the output file names separated by blancs.
f59ecfbc 533 plugin->SetDefaultOutputs();
35b82dbf 534 plugin->SetMaxMergeFiles(maxMergeFiles);
f59ecfbc 535 plugin->SetNrunsPerMaster(1);
f59ecfbc 536
537 // Put default output files to archive
f59ecfbc 538 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
539 TIter next(mgr->GetOutputs());
540 AliAnalysisDataContainer *output;
574b2e7b 541 if (!mergeExcludes.IsNull()) plugin->SetMergeExcludes(mergeExcludes);
9bdd18e3 542 if (!terminateFiles.IsNull()) plugin->SetTerminateFiles(terminateFiles);
f59ecfbc 543// Set friends
f59ecfbc 544// Optionally set a name for the generated analysis macro (default MyAnalysis.C)
fe0275ad 545 plugin->SetAnalysisMacro(Form("%s.C", train_name.Data()));
9bdd18e3 546// Optionally set a name for the generated validation script
547 plugin->SetValidationScript("validation.sh");
f59ecfbc 548// Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
9bdd18e3 549 plugin->SetSplitMaxInputFileNumber(grid_split);
f59ecfbc 550// Optionally set number of failed jobs that will trigger killing waiting sub-jobs.
551// plugin->SetMaxInitFailed(5);
9bdd18e3 552// Optionally modify the number of replicas
07682040 553 plugin->SetNumberOfReplicas(5);
f59ecfbc 554// Optionally resubmit threshold.
555// plugin->SetMasterResubmitThreshold(90);
556// Optionally set time to live (default 30000 sec)
557 plugin->SetTTL(70000);
558// Optionally set input format (default xml-single)
559 plugin->SetInputFormat("xml-single");
560// Optionally modify the name of the generated JDL (default analysis.jdl)
fe0275ad 561 plugin->SetJDLName(Form("%s.jdl", train_name.Data()));
f59ecfbc 562// Optionally modify the executable name (default analysis.sh)
fe0275ad 563 plugin->SetExecutable(Form("%s.sh", train_name.Data()));
f59ecfbc 564// Optionally modify job price (default 1)
565 plugin->SetPrice(1);
566// Optionally modify split mode (default 'se')
567 plugin->SetSplitMode("se");
568 plugin->SetExecutableCommand("aliroot -b -q");
574b2e7b 569// Merge via JDL
570 plugin->SetMergeViaJDL(useMergeViaJDL);
571// Use fastread option
572 plugin->SetFastReadOption(useFastReadOption);
573// UseOverwrite mode
574 plugin->SetOverwriteMode(useOverwriteMode);
9bdd18e3 575/*********************************************************
576 *** PROOF MODE SPECIFIC SETTINGS ************
577 *********************************************************/
578// Proof cluster
579// plugin->SetProofCluster("alice-caf");
580 plugin->SetProofCluster("skaf.saske.sk");
581// Dataset to be used
582 plugin->SetProofDataSet("/alice/data/LHC10e_000128175_p1#esdTree");
583// May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard
584 plugin->SetProofReset(0);
585// May limit number of workers
35b82dbf 586 plugin->SetNproofWorkers(1);
9bdd18e3 587// May use a specific version of root installed in proof
588 plugin->SetRootVersionForProof("current_dbg");
589// May set the aliroot mode. Check http://aaf.cern.ch/node/83
590 plugin->SetAliRootMode("ALIROOT"); // Loads AF libs by default
591// May request ClearPackages (individual ClearPackage not supported)
592 plugin->SetClearPackages(kFALSE);
593// Plugin test mode works only providing a file containing test file locations
2bfe5463 594 plugin->SetFileForTestMode(gSystem->ExpandPathName("$ALICE_ROOT/PWGPP/PilotTrain/files.txt"));
f59ecfbc 595 return plugin;
596}