]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MFT/RunAnalysisTaskMFTExample.C
New MFT Analysis Tools
[u/mrichter/AliRoot.git] / MFT / RunAnalysisTaskMFTExample.C
CommitLineData
ed68e08f 1//====================================================================================================================================================
2
d30a0b7b 3Bool_t RunAnalysisTaskMFTExample(const Char_t *runType="local", // "grid" and "local" types have been tested
4 const Char_t *runMode="full") {
5
ed68e08f 6 // enum {kGenerated, kReconstructed};
d30a0b7b 7
8 LoadLibs();
9
10 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
11 if (mgr) delete mgr;
12 mgr = new AliAnalysisManager("AM","Analysis Manager");
13
14 AliAODInputHandler* inputHandler = new AliAODInputHandler();
15 mgr->SetInputEventHandler(inputHandler);
16
ed68e08f 17 if (!strcmp(runType,"grid")) mgr->SetGridHandler(CreateAlienHandler(runMode));
d30a0b7b 18
19 gROOT->LoadMacro("AliAnalysisTaskMFTExample.cxx++g");
20 AliAnalysisTaskMFTExample *task = new AliAnalysisTaskMFTExample("AliAnalysisTaskMFTExample");
21
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);
ed68e08f 24 task -> SetVertexMode(AliAnalysisTaskMFTExample::kGenerated);
d30a0b7b 25
26 mgr->AddTask(task);
27
28 // create output container(s)
9aa4fd6b 29 AliAnalysisDataContainer *histogramList = mgr->CreateContainer("list", TList::Class(), AliAnalysisManager::kOutputContainer, "AnalysisMFT_Output.root");
d30a0b7b 30
31 // connect input and output
32 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
9aa4fd6b 33 mgr->ConnectOutput(task, 1, histogramList);
34
d30a0b7b 35 // RUN ANALYSIS
36
37 TStopwatch timer;
38 timer.Start();
39 mgr->InitAnalysis();
40 mgr->PrintStatus();
41
42 if (!strcmp(runType,"grid")) {
43 printf("Starting MFT analysis on the grid");
44 mgr->StartAnalysis("grid");
45 }
46
47 else if (!strcmp(runType,"local")) {
48 printf("Starting MFT analysis locally");
49 mgr->StartAnalysis("local", GetInputLocalData());
50 }
51
52 else AliError(Form("Specified run type %s is not supported", runType));
53
54 timer.Stop();
55 timer.Print();
56 return kTRUE;
57
58}
59
60//====================================================================================================================================================
61
ed68e08f 62AliAnalysisGrid* CreateAlienHandler(const Char_t *runMode) {
d30a0b7b 63
64 // Set up the analysis plugin in case of a grid analysis
65
ed68e08f 66 TString rootVersion = "v5-34-08-6";
67 TString alirootVersion = "vAN-20140727";
d30a0b7b 68
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");
75
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
80
81 analysisPlugin->SetAdditionalRootLibs("CORRFW");
82 analysisPlugin->SetAdditionalRootLibs("PWGmuon");
83
84 // Location of Data and Working dir
ed68e08f 85 analysisPlugin->SetGridDataDir("/alice/cern.ch/user/a/auras/MFT/simulations_2014/PbPb/jpsi_prompt/pix20um20um_plane400um/");
86 analysisPlugin->SetDataPattern("*/AliAOD.Muons.root");
d30a0b7b 87 analysisPlugin->SetRunPrefix("");
ed68e08f 88 analysisPlugin->SetGridWorkingDir("MFT/analysis_2014/PbPb/jpsi_prompt/pix20um20um_plane400um/");
d30a0b7b 89
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");
97
98 analysisPlugin->AddIncludePath("-I.");
99
100 analysisPlugin->SetOutputToRunNo();
101
102 // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
103 analysisPlugin->SetAnalysisMacro("MFTAnalysis.C");
104
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);
109
110 // Optionally modify the executable name (default analysis.sh)
111 analysisPlugin->SetExecutable("MFTAnalysis.sh");
112
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");
127
128 analysisPlugin->SetNtestFiles(5);
129 // analysisPlugin->SetMergeViaJDL(1);
130 analysisPlugin->SetOverwriteMode(kTRUE);
131
132 return analysisPlugin;
133
134}
135
136//====================================================================================================================================================
137
138TChain* GetInputLocalData() {
139
140 // Set up the chain of input events in case of a local analysis
141
142 TChain *chain = new TChain("aodTree");
143 chain->Add("./AliAOD.Muons.root");
144
145 return chain;
146
147}
148
149//====================================================================================================================================================
150
151void LoadLibs() {
152
153 gSystem->AddIncludePath("-I$ALICE_ROOT/include ");
154
155 gSystem->Load("libTree.so") ;
156 gSystem->Load("libGeom.so") ;
157 gSystem->Load("libVMC.so") ;
158 gSystem->Load("libMinuit.so") ;
159 gSystem->Load("libPhysics.so") ;
160 gSystem->Load("libSTEERBase.so") ;
161 gSystem->Load("libESD.so") ;
162 gSystem->Load("libAOD.so") ;
163 gSystem->Load("libANALYSIS.so") ;
164 gSystem->Load("libOADB.so") ;
165 gSystem->Load("libANALYSISalice.so") ;
166 gSystem->Load("libCORRFW.so") ;
167 gSystem->Load("libPWGmuon.so") ;
168
169}
170
171//====================================================================================================================================================