1 //====================================================================================================================================================
3 Bool_t RunAnalysisTaskMFTExample(const Char_t *runType="local", // "grid" and "local" types have been tested
4 const Char_t *runMode="full") {
6 // enum {kGenerated, kReconstructed};
10 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
12 mgr = new AliAnalysisManager("AM","Analysis Manager");
14 AliAODInputHandler* inputHandler = new AliAODInputHandler();
15 mgr->SetInputEventHandler(inputHandler);
17 if (!strcmp(runType,"grid")) mgr->SetGridHandler(CreateAlienHandler(runMode));
19 gROOT->LoadMacro("AliAnalysisTaskMFTExample.cxx++g");
20 AliAnalysisTaskMFTExample *task = new AliAnalysisTaskMFTExample("AliAnalysisTaskMFTExample");
22 // in cm, taken from Fig. 7.4 of the ITS Upgrade TDR, in the hypothesis of ~80 tracks participating to the vtx
23 task -> SetVtxResolutionITS(5.e-4, 5.e-4, 4.e-4);
24 task -> SetVertexMode(AliAnalysisTaskMFTExample::kGenerated);
28 // create output container(s)
29 AliAnalysisDataContainer *histogramList = mgr->CreateContainer("list", TList::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
31 // connect input and output
32 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
33 mgr->ConnectOutput(task, 1, histogramList);
42 if (!strcmp(runType,"grid")) {
43 printf("Starting MFT analysis on the grid");
44 mgr->StartAnalysis("grid");
47 else if (!strcmp(runType,"local")) {
48 printf("Starting MFT analysis locally");
49 mgr->StartAnalysis("local", GetInputLocalData());
52 else AliError(Form("Specified run type %s is not supported", runType));
60 //====================================================================================================================================================
62 AliAnalysisGrid* CreateAlienHandler(const Char_t *runMode) {
64 // Set up the analysis plugin in case of a grid analysis
66 TString rootVersion = "v5-34-08-6";
67 TString alirootVersion = "vAN-20140727";
69 AliAnalysisAlien *analysisPlugin = new AliAnalysisAlien();
70 if (!analysisPlugin) { Printf("Error : analysisPlugin is null !!!"); return kFALSE; }
71 analysisPlugin->SetAPIVersion("V1.1x");
72 analysisPlugin->SetROOTVersion(rootVersion.Data());
73 analysisPlugin->SetAliROOTVersion(alirootVersion.Data());
74 analysisPlugin->SetExecutableCommand("aliroot -b -q");
76 // Overwrite all generated files, datasets and output results from a previous session
77 analysisPlugin->SetOverwriteMode();
78 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
79 analysisPlugin->SetRunMode(runMode); // VERY IMPORTANT
81 analysisPlugin->SetAdditionalRootLibs("CORRFW");
82 analysisPlugin->SetAdditionalRootLibs("PWGmuon");
84 // Location of Data and Working dir
85 analysisPlugin->SetGridDataDir("/alice/cern.ch/user/a/auras/MFT/simulations_2014/PbPb/jpsi_prompt/pix20um20um_plane400um/");
86 analysisPlugin->SetDataPattern("*/AliAOD.Muons.root");
87 analysisPlugin->SetRunPrefix("");
88 analysisPlugin->SetGridWorkingDir("MFT/analysis_2014/PbPb/jpsi_prompt/pix20um20um_plane400um/");
90 // Declare alien output directory. Relative to working directory.
91 analysisPlugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output
92 // Declare the analysis source files names separated by blancs. To be compiled runtime using ACLiC on the worker nodes.
93 analysisPlugin->SetAnalysisSource("AliAnalysisTaskMFTExample.cxx");
94 // Declare all libraries (other than the default ones for the framework. These will be
95 // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
96 analysisPlugin->SetAdditionalLibs("libCORRFW.so libPWGmuon.so AliAnalysisTaskMFTExample.h AliAnalysisTaskMFTExample.cxx");
98 analysisPlugin->AddIncludePath("-I.");
100 analysisPlugin->SetOutputToRunNo();
102 // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
103 analysisPlugin->SetAnalysisMacro("MFTAnalysis.C");
105 // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
106 analysisPlugin->SetSplitMaxInputFileNumber(100);
107 // Number of runs per master job
108 analysisPlugin->SetNrunsPerMaster(1);
110 // Optionally modify the executable name (default analysis.sh)
111 analysisPlugin->SetExecutable("MFTAnalysis.sh");
113 // Optionally set number of failed jobs that will trigger killing waiting sub-jobs.
114 analysisPlugin->SetMaxInitFailed(5);
115 // Optionally resubmit threshold.
116 analysisPlugin->SetMasterResubmitThreshold(90);
117 // Optionally set time to live (default 30000 sec)
118 analysisPlugin->SetTTL(30000);
119 // Optionally set input format (default xml-single)
120 analysisPlugin->SetInputFormat("xml-single");
121 // Optionally modify the name of the generated JDL (default analysis.jdl)
122 analysisPlugin->SetJDLName("MFTAnalysis.jdl");
123 // Optionally modify job price (default 1)
124 analysisPlugin->SetPrice(1);
125 // Optionally modify split mode (default 'se')
126 analysisPlugin->SetSplitMode("se");
128 analysisPlugin->SetNtestFiles(5);
129 // analysisPlugin->SetMergeViaJDL(1);
130 analysisPlugin->SetOverwriteMode(kTRUE);
132 return analysisPlugin;
136 //====================================================================================================================================================
138 TChain* GetInputLocalData() {
140 // Set up the chain of input events in case of a local analysis
142 TChain *chain = new TChain("aodTree");
143 chain->Add("./AliAOD.Muons.root");
149 //====================================================================================================================================================
153 gSystem->AddIncludePath("-I$ALICE_ROOT/include ");
155 gSystem->Load("libTree") ;
156 gSystem->Load("libGeom") ;
157 gSystem->Load("libVMC") ;
158 gSystem->Load("libMinuit") ;
159 gSystem->Load("libPhysics") ;
160 gSystem->Load("libSTEERBase") ;
161 gSystem->Load("libESD") ;
162 gSystem->Load("libAOD") ;
163 gSystem->Load("libANALYSIS") ;
164 gSystem->Load("libOADB") ;
165 gSystem->Load("libANALYSISalice") ;
166 gSystem->Load("libCORRFW") ;
167 gSystem->Load("libPWGmuon") ;
171 //====================================================================================================================================================