3 void AddAnalysisTasks();
4 class AliAnalysisAlien;
5 AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode);
7 Int_t runNumbers[5] = {121040};
9 Bool_t doCDBconnect = 1;
11 Bool_t doVZERO = 1; // there is a 2nd file
13 Bool_t doSPD = 1; // needs RP
15 Bool_t doEventStat = 1;
16 Bool_t doSDD = 1; // needs RP
22 Bool_t doMUONTrig = 1;
23 Bool_t doImpParRes = 1;
26 Bool_t doMUONEff = 0; // NEEDS geometry
27 Bool_t doV0 = 0; // NEEDS MCtruth
29 TString train_name = "QA"; // QA local folder name
30 TString train_tag = ""; // Train special tag appended to
31 // visible name. ("sim", "pp", ...)
32 // Name in train page (DON'T CHANGE)
33 TString visible_name = Form("QA$2_$3%s", train_tag.Data()); //# FIXED #
34 TString job_comment = "PWG1 QA train"; // Can add observations here
35 // Job tag (DON'T CHANGE)
36 TString job_tag = Form("%s: %s", visible_name.Data(), job_comment.Data());
37 // Package versions - Modify as needed
38 TString root_version = "v5-27-05";
39 TString aliroot_version = "v4-20-07-AN";
40 // Production directory - change as needed for test mode
41 TString grid_datadir = "/alice/data/2010/LHC10c";
42 // Work directory in GRID (DON'T CHANGE)
43 TString grid_workdir = "/alice/cern.ch/user/a/alidaq/QA/QA$2";
45 Int_t grid_split = 20; // Splitting
47 Int_t debug_level = 1; // Debugging
48 // Data pattern - change as needed for test mode
49 TString data_pattern = "*ESDs/pass2/*ESDs.root";
50 // Output directory (DON'T CHANGE)
51 TString alien_outdir = "$1/QA$2";
52 // Input collection (production mode)
53 TString data_collection = "$1/qa1.xml";
54 TString mergeExcludes = ""; // Files to be excluded for merging
55 TString terminateFiles = ""; // Files produced during Terminate
57 Bool_t useProductionMode = kTRUE;
58 Bool_t useMergeViaJDL = kTRUE;
59 Bool_t useFastReadOption = kTRUE;
60 Bool_t useOverwriteMode = kFALSE;
61 Bool_t useDevelopmentVersion = kFALSE;
63 void PilotAnalysis(const char *plugin_mode = "full")
65 TString smode(plugin_mode);
67 if (smode == "test") useProductionMode = kFALSE;
68 if (!useProductionMode) {
69 TGrid::Connect("alien://");
70 if (!gGrid || !gGrid->IsConnected()) {
71 ::Error("PilotAnalysis", "No grid connection");
75 // Write configuration
76 TString cdir = gSystem->WorkingDirectory();
77 gSystem->MakeDirectory(train_name);
78 gSystem->ChangeDirectory(train_name);
80 out.open(Form("%sConfig.C",train_name.Data()), ios::out);
82 out << " train_name = " << "\"" << train_name.Data() << "\";" << endl;
83 out << " root_version = " << "\"" << root_version.Data() << "\";" << endl;
84 out << " aliroot_version = " << "\"" << aliroot_version.Data() << "\";" << endl;
85 out << " grid_datadir = " << "\"" << grid_datadir.Data() << "\";" << endl;
86 if (!alien_outdir.Length()) alien_outdir = Form("output_%s",train_name.Data());
87 out << " alien_outdir = " << "\"" << alien_outdir.Data() << "\";" << endl;
88 out << " doQAsim = " << doQAsym << ";" << endl;
89 out << " doVZERO = " << doVZERO << ";" << endl;
90 out << " doVertex = " << doVertex << ";" << endl;
91 out << " doSPD = " << doSPD << ";" << endl;
92 out << " doSDD = " << doSDD << ";" << endl;
93 out << " doSSDdEdx = " << doSSDdEdx << ";" << endl;
94 out << " doTPC = " << doTPC << ";" << endl;
95 out << " doTRD = " << doTRD << ";" << endl;
96 out << " doImpParRes = " << doImpParRes << ";" << endl;
97 out << " doMUON = " << doMUON << ";" << endl;
98 out << " doEventStat = " << doEventStat << ";" << endl;
103 gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TRD");
106 AliAnalysisManager *mgr = new AliAnalysisManager("PilotAnalysis", "Production train");
107 mgr->SetNSysInfo(100);
109 AliESDInputHandlerRP *esdHandler = new AliESDInputHandlerRP();
110 esdHandler->SetReadFriends(kTRUE);
111 esdHandler->SetActiveBranches("ESDfriend");
112 mgr->SetInputEventHandler(esdHandler);
113 mgr->SetDebugLevel(debug_level);
114 mgr->SetSaveCanvases(kFALSE);
119 AliAnalysisAlien *alienHandler = CreateAlienHandler(plugin_mode);
120 mgr->SetGridHandler(alienHandler);
121 if (mgr->InitAnalysis()) {
123 mgr->StartAnalysis("grid");
129 gSystem->Load("libANALYSIS");
130 gSystem->Load("libANALYSISalice");
131 gSystem->Load("libCORRFW");
132 gSystem->Load("libTENDER");
133 gSystem->Load("libPWG0base.so");
134 gSystem->Load("libPWG0dep.so");
135 gSystem->Load("libPWG0selectors.so");
136 gSystem->Load("libPWG1.so");
137 gSystem->Load("libPWG2.so");
138 gSystem->Load("libPWG2forward.so");
141 gSystem->Load("libEMCALUtils");
142 gSystem->Load("libPWG4PartCorrBase");
143 gSystem->Load("libPWG4PartCorrDep");
146 gSystem->Load("libPWG3base");
147 gSystem->Load("libPWG3muon");
148 gSystem->Load("libPWG3muondep");
152 void AddAnalysisTasks()
154 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
155 mgr->SetCommonFileName("QAresults.root");
160 gROOT->LoadMacro("$ALICE_ROOT/PWG1/PilotTrain/AddTaskCDBconnect.C");
161 AliTaskCDBconnect *taskCDB = AddTaskCDBconnect();
162 if (!taskCDB) return;
166 // Event Statistics (Jan Fiete)
169 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
170 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
171 // mgr->RegisterExtraFile("event_stat.root");
172 if (!terminateFiles.IsNull()) terminateFiles += ",";
173 terminateFiles += "event_stat.root";
175 // Vertexing (A. Dainese)
178 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskVertexESD.C");
179 AliAnalysisTaskVertexESD* taskvertexesd = AddTaskVertexESD();
180 taskvertexesd->SelectCollisionCandidates();
183 // TPC QA (E. Sicking)
186 gROOT->LoadMacro("$ALICE_ROOT/PWG1/PilotTrain/AddTaskQAsym.C");
187 AliAnalysisTaskSE * taskqasim = AddTaskQAsym(0);
188 taskqasim->SelectCollisionCandidates();
191 // VZERO QA (C. Cheshkov)
194 gROOT->LoadMacro("$ALICE_ROOT/PWG1/PilotTrain/AddTaskVZEROQA.C");
195 AliAnalysisTaskSE * taskv0qa = AddTaskVZEROQA(0);
196 // taskv0qa->SelectCollisionCandidates();
199 // TPC (Jacek Otwinowski)
202 gROOT->LoadMacro("$(ALICE_ROOT)/PWG1/TPC/macros/AddTaskPerformanceTPCQA.C");
203 AliPerformanceTask *tpcQA = AddTaskPerformanceTPCQA(kFALSE, kTRUE);
206 // SPD (A. Mastroserio)
209 gROOT->LoadMacro("$ALICE_ROOT/PWG1/PilotTrain/AddTaskSPDQA.C");
210 AliAnalysisTaskSE* taskspdqa = AddTaskSPDQA();
211 taskspdqa->SelectCollisionCandidates();
217 gROOT->LoadMacro("$ALICE_ROOT/PWG1/PilotTrain/AddSDDPoints.C");
218 AliAnalysisTaskSE* tasksdd = AddSDDPoints();
219 tasksdd->SelectCollisionCandidates();
222 // SSD dEdx (Marek Chojnacki)
225 gROOT->LoadMacro("$ALICE_ROOT/PWG1/PilotTrain/AddTaskdEdxSSDQA.C");
226 AliAnalysisTaskSE* taskssddedx = AddTaskdEdxSSDQA();
227 taskssddedx->SelectCollisionCandidates();
234 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskPerformanceITS.C");
235 AliAnalysisTaskITSTrackingCheck *itsQA = AddTaskPerformanceITS(kFALSE);
238 // TRD (Alex Bercuci, M. Fasel)
241 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTrainPerformanceTRD.C");
242 // steer individual TRD tasks
244 doCheckESD(kTRUE), // AliTRDcheckESD
245 doCheckDET(kTRUE), // AliTRDcheckDET
246 doEffic(kTRUE), // AliTRDefficiency
247 doResolution(kTRUE),// AliTRDresolution
248 doCheckPID(kTRUE), // AliTRDcheckPID
249 doV0Monitor(kFALSE);// AliTRDv0Monitor
250 AddTrainPerformanceTRD(Translate(doCheckESD, doCheckDET, doEffic, doResolution, doCheckPID, doV0Monitor));
254 // Calorimetry (Gustavo Conesa)
258 gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/QA/AddTaskCalorimeterQA.C");
259 AliAnalysisTaskParticleCorrelation *taskCaloQA = AddTaskCalorimeterQA("ESD", kTRUE, kFALSE);
260 taskCaloQA->SetDebugLevel(0);
268 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskMTRchamberEfficiency.C");
269 AliAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency();
277 gROOT->LoadMacro("$ALICE_ROOT/PWG3/muondep/AddTaskMUONTrackingEfficiency.C");
278 AliAnalysisTaskMuonTrackingEff *taskMuonTrackEff = AddTaskMUONTrackingEfficiency();
282 // V0-Decay Reconstruction (Ana Marin)
286 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskV0QA.C");
287 AliAnalysisTaskV0QA *taskv0QA = AddTaskV0QA(kFALSE);
289 // Impact parameter resolution (xianbao.yuan@pd.infn.it, andrea.dainese@pd.infn.it)
292 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/AddTaskImpParRes.C");
293 AliAnalysisTaskSE* taskimpparres= AddTaskImpParRes();
294 taskimpparres->SelectCollisionCandidates();
296 // MUON QA (Philippe Pillot)
299 gROOT->LoadMacro("$ALICE_ROOT/PWG3/muon/AddTaskMuonQA.C");
300 AliAnalysisTaskSE* taskmuonqa= AddTaskMuonQA();
304 //______________________________________________________________________________
305 AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode)
307 // Check if user has a valid token, otherwise make one. This has limitations.
308 // One can always follow the standard procedure of calling alien-token-init then
309 // source /tmp/gclient_env_$UID in the current shell.
310 if (!AliAnalysisGrid::CreateToken()) return NULL;
311 AliAnalysisAlien *plugin = new AliAnalysisAlien();
312 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
313 plugin->SetRunMode(plugin_mode);
314 if (useProductionMode) {
315 plugin->SetProductionMode();
316 plugin->AddDataFile(data_collection);
318 plugin->SetJobTag(job_tag);
319 plugin->SetNtestFiles(3);
320 plugin->SetCheckCopy(kFALSE);
321 plugin->SetOneStageMerging(kTRUE);
322 // Set versions of used packages
323 plugin->SetAPIVersion("V1.1x");
324 plugin->SetROOTVersion(root_version);
325 plugin->SetAliROOTVersion(aliroot_version);
326 // Declare input data to be processed.
327 // Method 1: Create automatically XML collections using alien 'find' command.
328 // Define production directory LFN
329 plugin->SetGridDataDir(grid_datadir);
330 // Set data search pattern
331 plugin->SetDataPattern(data_pattern);
332 // ...then add run numbers to be considered
333 // if (!iAODanalysis) plugin->SetRunRange(run_range[0], run_range[1]);
334 // plugin->SetOutputSingleFolder("output");
335 if (!useProductionMode) {
336 plugin->SetRunPrefix("000");
337 plugin->SetOutputToRunNo();
338 for (Int_t i=0; i<2; i++) {
339 if (!runNumbers[i]) break;
340 plugin->AddRunNumber(runNumbers[i]);
343 // Define alien work directory where all files will be copied. Relative to alien $HOME.
344 plugin->SetGridWorkingDir(grid_workdir);
345 // Declare alien output directory. Relative to working directory.
346 if (alien_outdir.IsNull()) alien_outdir = Form("output_%s",train_name.Data());
347 plugin->SetGridOutputDir(alien_outdir);
349 if (useDevelopmentVersion) {
350 plugin->EnablePackage("STEERBase");
351 plugin->EnablePackage("ESD");
352 plugin->EnablePackage("AOD");
353 plugin->EnablePackage("ANALYSIS");
354 plugin->EnablePackage("ANALYSISalice");
357 // Declare the analysis source files names separated by blancs. To be compiled runtime
358 // using ACLiC on the worker nodes.
359 // Declare all libraries (other than the default ones for the framework. These will be
360 // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
361 plugin->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TRD");
363 plugin->SetAdditionalLibs("libCORRFW.so libTENDER.so libPWG0base.so libPWG0dep.so libPWG0selectors.so libPWG1.so libPWG2.so \
364 libPWG2forward.so libEMCALUtils.so libPWG4PartCorrBase.so libPWG4PartCorrDep.so \
365 libPWG3base.so libPWG3muon.so libPWG3muondep.so");
367 // Declare the output file names separated by blancs.
368 // (can be like: file.root or file.root@ALICE::Niham::File)
369 plugin->SetDefaultOutputs();
370 plugin->SetMaxMergeFiles(20);
371 plugin->SetNrunsPerMaster(1);
373 // Put default output files to archive
374 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
375 TIter next(mgr->GetOutputs());
376 AliAnalysisDataContainer *output;
377 if (!mergeExcludes.IsNull()) plugin->SetMergeExcludes(mergeExcludes);
378 if (!terminateFiles.IsNull()) plugin->SetTerminateFiles(terminateFiles);
380 // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
381 plugin->SetAnalysisMacro(Form("%s.C", train_name.Data()));
382 // Optionally set a name for the generated validation script
383 plugin->SetValidationScript("validation.sh");
384 // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
385 plugin->SetSplitMaxInputFileNumber(grid_split);
386 // Optionally set number of failed jobs that will trigger killing waiting sub-jobs.
387 // plugin->SetMaxInitFailed(5);
388 // Optionally modify the number of replicas
389 plugin->SetNumberOfReplicas(4);
390 // Optionally resubmit threshold.
391 // plugin->SetMasterResubmitThreshold(90);
392 // Optionally set time to live (default 30000 sec)
393 plugin->SetTTL(70000);
394 // Optionally set input format (default xml-single)
395 plugin->SetInputFormat("xml-single");
396 // Optionally modify the name of the generated JDL (default analysis.jdl)
397 plugin->SetJDLName(Form("%s.jdl", train_name.Data()));
398 // Optionally modify the executable name (default analysis.sh)
399 plugin->SetExecutable(Form("%s.sh", train_name.Data()));
400 // Optionally modify job price (default 1)
402 // Optionally modify split mode (default 'se')
403 plugin->SetSplitMode("se");
404 plugin->SetExecutableCommand("aliroot -b -q");
406 plugin->SetMergeViaJDL(useMergeViaJDL);
407 // Use fastread option
408 plugin->SetFastReadOption(useFastReadOption);
410 plugin->SetOverwriteMode(useOverwriteMode);
411 /*********************************************************
412 *** PROOF MODE SPECIFIC SETTINGS ************
413 *********************************************************/
415 // plugin->SetProofCluster("alice-caf");
416 plugin->SetProofCluster("skaf.saske.sk");
417 // Dataset to be used
418 plugin->SetProofDataSet("/alice/data/LHC10e_000128175_p1#esdTree");
419 // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard
420 plugin->SetProofReset(0);
421 // May limit number of workers
422 plugin->SetNproofWorkers(20);
423 // May use a specific version of root installed in proof
424 plugin->SetRootVersionForProof("current_dbg");
425 // May set the aliroot mode. Check http://aaf.cern.ch/node/83
426 plugin->SetAliRootMode("ALIROOT"); // Loads AF libs by default
427 // May request ClearPackages (individual ClearPackage not supported)
428 plugin->SetClearPackages(kFALSE);
429 // Plugin test mode works only providing a file containing test file locations
430 plugin->SetFileForTestMode(gSystem->ExpandPathName("$ALICE_ROOT/PWG1/PilotTrain/files.txt"));