Updated macros for Grid/AAF + new macros for trains
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / macros / runGridCascadePbPb.C
CommitLineData
fba64b41 1/// **** to run the macro: ***********
f9a6cab5 2// alien-token-init username
f9a6cab5 3// root -l runGrid.C
4
5class AliAnalysisGrid;
6
fba64b41 7void runGridCascadePbPb( Bool_t useMC = kTRUE, // kTRUE if analysing a MC sample
8 Bool_t runperformancetask = kTRUE,
9 Float_t centrlowlim = 0.,
10 Float_t centruplim = 90.,
11 TString centrest = "V0M",
12 Float_t vtxlim = 10.,
13 Bool_t kextrasel = kFALSE,
14 Bool_t acccut = kFALSE,
15 Bool_t krelaunchvertexers = kFALSE,
16 TString anatype = "AOD",//"ESD",
17 const char *plugin_mode ="full") {
f9a6cab5 18
19 // Load common libraries
20 gSystem->Load("libCore.so");
21 gSystem->Load("libTree.so");
22 gSystem->Load("libGeom.so");
23 gSystem->Load("libVMC.so");
24 gSystem->Load("libPhysics.so");
25 gSystem->Load("libMinuit.so");
26 gSystem->Load("libGui.so");
27 gSystem->Load("libXMLParser.so");
28 gSystem->Load("libSTEERBase.so");
29 gSystem->Load("libESD.so");
30 gSystem->Load("libCDB.so");
31 gSystem->Load("libAOD");
32 gSystem->Load("libANALYSIS");
33 gSystem->Load("libANALYSISalice");
34 gSystem->Load("libCORRFW");
35 gSystem->Load("libProof.so");
36 gSystem->Load("libRAWDatabase.so");
37 gSystem->Load("libSTEER.so");
38
39 //__________________________________________________________________________
40 // Use AliRoot includes to compile our task
41 gROOT->ProcessLine(".include $ALICE_ROOT/include");
42
43 //__________________________________________________________________________
44 // Create and configure the alien handler plugin
45// gROOT->LoadMacro("CreateAlienHandler.C");
fba64b41 46 AliAnalysisGrid *alienHandler = CreateAlienHandler(plugin_mode, runperformancetask, useMC, anatype);
f9a6cab5 47 if (!alienHandler) return;
48
49 //__________________________________________________________________________
50 // Create the analysis manager
51 AliAnalysisManager *mgr = new AliAnalysisManager("CascadePbPbanalysis");
52
53 //__________________________________________________________________________
54 // Connect plug-in to the analysis manager
55 mgr->SetGridHandler(alienHandler);
56
fba64b41 57 // Input handlers
58 AliESDInputHandler* esdH = new AliESDInputHandler();
59 AliAODInputHandler* aodH = new AliAODInputHandler();
60 if (anatype=="ESD") mgr->SetInputEventHandler(esdH);
61 else mgr->SetInputEventHandler(aodH);
62 if (runperformancetask&&(anatype=="ESD")) {
63 AliMCEventHandler* mcHandler = new AliMCEventHandler();
64 mgr->SetMCtruthEventHandler(mcHandler);
65 }
66
f9a6cab5 67 //__________________________________________________________________________
fba64b41 68 // Add tasks
69
70 // Physics selection
71 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
72 AliPhysicsSelectionTask *physSel = AddTaskPhysicsSelection(useMC);
73
74 // Centrality selection
75 if (anatype == "ESD") {
76 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
77 AliCentralitySelectionTask *taskCentr = AddTaskCentrality();
78 if (useMC){
79 taskCentr->SetMCInput();
80 taskCentr->DontUseCleaning();
81 }
82 }
83
84 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
85 AliAnalysisTaskPIDResponse *pidTask = AddTaskPIDResponse(useMC);
f9a6cab5 86
87 if (runperformancetask) {
88 gROOT->LoadMacro("AliAnalysisTaskCheckPerformanceCascadePbPb.cxx++g");
89 AliAnalysisTaskCheckPerformanceCascadePbPb *task = new AliAnalysisTaskCheckPerformanceCascadePbPb("TaskPerformanceCascade");
fba64b41 90 task->SetApplyAccCut (acccut);
91 task->SetRejectEventPileUp (kFALSE); // selects pile up
f9a6cab5 92 } else {
93 gROOT->LoadMacro("AliAnalysisTaskCheckCascadePbPb.cxx++g");
94 AliAnalysisTaskCheckCascadePbPb *task = new AliAnalysisTaskCheckCascadePbPb("TaskCascade");
f9a6cab5 95 }
fba64b41 96 task->SetRelaunchV0CascVertexers (krelaunchvertexers);
97 task->SetAnalysisType (anatype);
f9a6cab5 98 task->SetQualityCutZprimVtxPos (kTRUE); // selects vertices in +-10cm
99 task->SetQualityCutNoTPConlyPrimVtx (kTRUE); // retains only events with tracking + SPD vertex
100 task->SetQualityCutTPCrefit (kTRUE); // requires TPC refit flag to be true to select a track
101 task->SetQualityCut80TPCcls (kTRUE); // rejects tracks that have less than 80 clusters in the TPC
102 task->SetExtraSelections (kextrasel); // used to add other selection cuts
103 task->SetCentralityLowLim (centrlowlim); // setting centrality selection vriables
104 task->SetCentralityUpLim (centruplim);
105 task->SetCentralityEst (centrest);
106 task->SetVertexRange (vtxlim);
107
108 mgr->AddTask(task);
109
f9a6cab5 110 task->SelectCollisionCandidates();
fba64b41 111
f9a6cab5 112 //Create containers for input/output
113 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
114 if (runperformancetask) AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist", TList::Class(), AliAnalysisManager::kOutputContainer, "CascadePerformance.root");
115 else AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist", TList::Class(), AliAnalysisManager::kOutputContainer, "Cascades.root");
116 //__________________________________________________________________________
117 // Connect input/output
118 mgr->ConnectInput(task, 0, cinput);
119 mgr->ConnectOutput(task, 1, coutput1);
120
121 //__________________________________________________________________________
122 // Disbale debug printouts
123 mgr->SetDebugLevel(3);
124 AliLog::SetGlobalLogLevel(AliLog::kFatal);
125 AliLog::SetGlobalDebugLevel(0);
126
127 //__________________________________________________________________________
128 if (!mgr->InitAnalysis()) return;
129 mgr->PrintStatus();
130 // Start analysis in grid.
131 mgr->StartAnalysis("grid");
132};
133
134//__________________________________________________________________________
135
fba64b41 136AliAnalysisGrid* CreateAlienHandler(const char *plugin_mode, Bool_t runperformancetask, Bool_t useMC, TString anatype) {
f9a6cab5 137 //__________________________________________________________________________
138 // Check if user has a valid token, otherwise make one. This has limitations.
139 // One can always follow the standard procedure of calling alien-token-init then
140 // source /tmp/gclient_env_$UID in the current shell.
141 AliAnalysisAlien *plugin= new AliAnalysisAlien();
142
143 //__________________________________________________________________________
144 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
145 plugin->SetRunMode(plugin_mode);
146
147 plugin->SetNtestFiles(1);
148 //__________________________________________________________________________
149 // Set versions of used packages
150 plugin->SetAPIVersion("V1.1x");
151
152 //__________________________________________________________________________
153 // On GRID - current
fba64b41 154 plugin->SetROOTVersion("v5-30-06-1");
155 plugin->SetAliROOTVersion("v5-03-01-AN");
f9a6cab5 156
157 //__________________________________________________________________________
158 // Declare input data to be processed.
159 // Method 1: Create automatically XML collections using alien 'find' command.
160 if (useMC) {
fba64b41 161 //plugin->SetGridDataDir("/alice/sim/LHC11a10b_bis"); // Define production directory
162 //plugin->SetGridDataDir("/alice/sim/LHC11a10b_plus");
163 plugin->SetGridDataDir("/alice/sim/2011/LHC11f5");
f9a6cab5 164 // Set data search pattern
fba64b41 165 if (anatype == "ESD") plugin->SetDataPattern("*ESDs.root");
166 else plugin->SetDataPattern("AOD081/*AOD.root");
167 plugin->AddRunNumber(137124);
168
169
f9a6cab5 170 } else {
171 plugin->SetGridDataDir("/alice/data/2010/LHC10h"); // Define production directory LFN
fba64b41 172 if (anatype == "ESD") {
173 plugin->SetDataPattern("ESDs/pass2/*/*ESDs.root"); // Set data search pattern
174 plugin->SetRunPrefix("000");
175 } else plugin->SetDataPattern("*AOD.root");
176 //plugin->SetRunRange(80000,80000); // ...then add run numbers to be considered
177 plugin->AddRunNumber(138534);
f9a6cab5 178 }
fba64b41 179 // Method 2: Use your input collection
180 //plugin->AddDataFile("/alice/cern.ch/user/m/mnicassi/139105.xml");
f9a6cab5 181 //__________________________________________________________________________
182 // Define alien work directory where all files will be copied. Relative to alien $HOME.
fba64b41 183 if (runperformancetask) plugin->SetGridWorkingDir("workperfcentral");
184 else plugin->SetGridWorkingDir("workdata");
185 plugin->SetGridOutputDir("output");
f9a6cab5 186
fba64b41 187 //__________________________________________________________________________
f9a6cab5 188 if (runperformancetask) plugin->SetAnalysisSource("AliAnalysisTaskCheckPerformanceCascadePbPb.cxx");
189 else plugin->SetAnalysisSource("AliAnalysisTaskCheckCascadePbPb.cxx");
190
191 //__________________________________________________________________________
192 //Enable same others packages
193 //plugin->EnablePackage("PWG3dielectron.par");
194
195 //__________________________________________________________________________
196 // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
197 plugin->SetAnalysisMacro("testmacro.C");
198 //Add all extra files (task.cxx/.h)
199 if (runperformancetask) {
200 plugin->SetAdditionalLibs("AliAnalysisTaskCheckPerformanceCascadePbPb.h AliAnalysisTaskCheckPerformanceCascadePbPb.cxx");
201 // Optionally modify the executable name (default analysis.sh)
202 plugin->SetExecutable("CascadePerformancePbPb.sh");
f9a6cab5 203 } else {
fba64b41 204 plugin->SetAdditionalLibs("AliAnalysisTaskCheckCascadePbPb.h AliAnalysisTaskCheckCascadePbPb.cxx ");
f9a6cab5 205 // Optionally modify the executable name (default analysis.sh)
206 plugin->SetExecutable("CascadePbPb.sh");
207
208 }
fba64b41 209
f9a6cab5 210 //__________________________________________________________________________
211 // Declare the output file names separated by blancs.
212 // (can be like: file.root or file.root@ALICE::Niham::File)
fba64b41 213 //plugin->SetDefaultOutputs(kFALSE);
214 //if (runperformancetask) plugin->SetOutputFiles("CascadePerformance.root");
215 //else plugin->SetOutputFiles("Cascades.root");
f9a6cab5 216
217 // Optionally define the files to be archived.
fba64b41 218 //plugin->SetOutputArchive("root_archive.zip:*.root log_archive.zip:stdout,stderr");
f9a6cab5 219
220 //__________________________________________________________________________
221 // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
222 plugin->SetSplitMaxInputFileNumber(100);
223 // Optionally set number of failed jobs that will trigger killing waiting sub-jobs.
224 plugin->SetMasterResubmitThreshold(90);
225 // Optionally set time to live (default 30000 sec)
226 plugin->SetTTL(30000);
227 // Optionally set input format (default xml-single)
228 plugin->SetInputFormat("xml-single");
229 // Optionally modify the name of the generated JDL (default analysis.jdl)
230 if (runperformancetask) plugin->SetJDLName("TaskCheckPerformanceCascadePbPb.jdl");
231 else plugin->SetJDLName("TaskCheckCascadePbPb.jdl");
232
f9a6cab5 233 // Optionally modify job price (default 1)
234 plugin->SetPrice(1);
235
236 // Merge via JDL
237 // comment out the next line when using the "terminate" option, unless
238 // you want separate merged files for each run
fba64b41 239/* plugin->SetMergeViaJDL(kTRUE); // run first in full mode, then in terminate
240 plugin->SetOneStageMerging(kFALSE);
241 plugin->SetMaxMergeFiles(50);
242 plugin->SetMaxMergeStages(2);// to define the number of stages
243*/
f9a6cab5 244 // Optionally set number of runs per master
fba64b41 245// plugin->SetNrunsPerMaster(1);
f9a6cab5 246 //
247 plugin->SetOutputToRunNo();
248 // Optionally modify split mode (default 'se')
249 plugin->SetSplitMode("se");
250 plugin->SetUser("mnicassi");
251 return plugin;
252}
253