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