]>
Commit | Line | Data |
---|---|---|
fba64b41 | 1 | /// **** to run the macro: *********** |
f9a6cab5 | 2 | // alien-token-init username |
f9a6cab5 | 3 | // root -l runGrid.C |
4 | ||
5 | class AliAnalysisGrid; | |
6 | ||
fba64b41 | 7 | void 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", | |
314cd92c | 12 | Bool_t kusecleaning = kTRUE, |
fba64b41 | 13 | Float_t vtxlim = 10., |
79313da9 | 14 | Int_t minnTPCcls = 70, |
fba64b41 | 15 | Bool_t kextrasel = kFALSE, |
79313da9 | 16 | Bool_t kacccut = kFALSE, |
fba64b41 | 17 | Bool_t krelaunchvertexers = kFALSE, |
18 | TString anatype = "AOD",//"ESD", | |
d08623be | 19 | TString gridoutputdir = "LHC10h_AOD086", |
20 | //the following are used for the Cascade task only | |
21 | TString datadir = "/alice/data/2010/LHC10h",///alice/data/2011/LHC11h_2", | |
22 | TString datapattern = "ESDs/pass2/AOD086/*/AliAOD.root", // "ESDs/pass2/*/*ESDs.root" // for data | |
fba64b41 | 23 | const char *plugin_mode ="full") { |
f9a6cab5 | 24 | |
25 | // Load common libraries | |
26 | gSystem->Load("libCore.so"); | |
27 | gSystem->Load("libTree.so"); | |
28 | gSystem->Load("libGeom.so"); | |
29 | gSystem->Load("libVMC.so"); | |
30 | gSystem->Load("libPhysics.so"); | |
31 | gSystem->Load("libMinuit.so"); | |
32 | gSystem->Load("libGui.so"); | |
33 | gSystem->Load("libXMLParser.so"); | |
34 | gSystem->Load("libSTEERBase.so"); | |
35 | gSystem->Load("libESD.so"); | |
36 | gSystem->Load("libCDB.so"); | |
37 | gSystem->Load("libAOD"); | |
38 | gSystem->Load("libANALYSIS"); | |
39 | gSystem->Load("libANALYSISalice"); | |
40 | gSystem->Load("libCORRFW"); | |
41 | gSystem->Load("libProof.so"); | |
42 | gSystem->Load("libRAWDatabase.so"); | |
43 | gSystem->Load("libSTEER.so"); | |
44 | ||
45 | //__________________________________________________________________________ | |
46 | // Use AliRoot includes to compile our task | |
47 | gROOT->ProcessLine(".include $ALICE_ROOT/include"); | |
48 | ||
49 | //__________________________________________________________________________ | |
50 | // Create and configure the alien handler plugin | |
51 | // gROOT->LoadMacro("CreateAlienHandler.C"); | |
d08623be | 52 | AliAnalysisGrid *alienHandler = CreateAlienHandler(plugin_mode, runperformancetask, useMC, anatype, gridoutputdir, datadir, datapattern); |
f9a6cab5 | 53 | if (!alienHandler) return; |
54 | ||
55 | //__________________________________________________________________________ | |
56 | // Create the analysis manager | |
57 | AliAnalysisManager *mgr = new AliAnalysisManager("CascadePbPbanalysis"); | |
58 | ||
59 | //__________________________________________________________________________ | |
60 | // Connect plug-in to the analysis manager | |
61 | mgr->SetGridHandler(alienHandler); | |
62 | ||
fba64b41 | 63 | // Input handlers |
64 | AliESDInputHandler* esdH = new AliESDInputHandler(); | |
65 | AliAODInputHandler* aodH = new AliAODInputHandler(); | |
66 | if (anatype=="ESD") mgr->SetInputEventHandler(esdH); | |
67 | else mgr->SetInputEventHandler(aodH); | |
68 | if (runperformancetask&&(anatype=="ESD")) { | |
69 | AliMCEventHandler* mcHandler = new AliMCEventHandler(); | |
70 | mgr->SetMCtruthEventHandler(mcHandler); | |
71 | } | |
72 | ||
f9a6cab5 | 73 | //__________________________________________________________________________ |
fba64b41 | 74 | // Add tasks |
75 | ||
d08623be | 76 | if (anatype=="ESD") { |
77 | // Physics selection | |
78 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
79 | AliPhysicsSelectionTask *physSel = AddTaskPhysicsSelection(useMC); | |
80 | // Centrality selection | |
fba64b41 | 81 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C"); |
82 | AliCentralitySelectionTask *taskCentr = AddTaskCentrality(); | |
83 | if (useMC){ | |
84 | taskCentr->SetMCInput(); | |
85 | taskCentr->DontUseCleaning(); | |
86 | } | |
87 | } | |
88 | ||
89 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); | |
90 | AliAnalysisTaskPIDResponse *pidTask = AddTaskPIDResponse(useMC); | |
f9a6cab5 | 91 | |
92 | if (runperformancetask) { | |
79313da9 | 93 | gROOT->LoadMacro("$ALICE_ROOT/PWGLF/STRANGENESS/Cascades/AliAnalysisTaskCheckPerformanceCascadePbPb.cxx++g"); |
94 | gROOT->LoadMacro("$ALICE_ROOT/PWGLF/STRANGENESS/Cascades/macros/AddTaskCheckPerformanceCascadePbPb.C"); | |
314cd92c | 95 | AliAnalysisTaskCheckPerformanceCascadePbPb *task = AddTaskCheckPerformanceCascadePbPb(minnTPCcls, centrlowlim, centruplim, centrest, kusecleaning, vtxlim,kextrasel ,kacccut ,krelaunchvertexers); |
79313da9 | 96 | |
f9a6cab5 | 97 | } else { |
79313da9 | 98 | gROOT->LoadMacro("$ALICE_ROOT/PWGLF/STRANGENESS/Cascades/AliAnalysisTaskCheckCascadePbPb.cxx++g"); |
99 | gROOT->LoadMacro("$ALICE_ROOT/PWGLF/STRANGENESS/Cascades/macros/AddTaskCheckCascadePbPb.C"); | |
314cd92c | 100 | AliAnalysisTaskCheckCascadePbPb *task = AddTaskCheckCascadePbPb(minnTPCcls, centrlowlim, centruplim, centrest, kusecleaning, vtxlim, kextrasel ,krelaunchvertexers); |
79313da9 | 101 | |
f9a6cab5 | 102 | } |
f9a6cab5 | 103 | |
f9a6cab5 | 104 | |
fba64b41 | 105 | |
f9a6cab5 | 106 | //Create containers for input/output |
107 | AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); | |
108 | if (runperformancetask) AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist", TList::Class(), AliAnalysisManager::kOutputContainer, "CascadePerformance.root"); | |
109 | else AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist", TList::Class(), AliAnalysisManager::kOutputContainer, "Cascades.root"); | |
110 | //__________________________________________________________________________ | |
111 | // Connect input/output | |
112 | mgr->ConnectInput(task, 0, cinput); | |
113 | mgr->ConnectOutput(task, 1, coutput1); | |
114 | ||
115 | //__________________________________________________________________________ | |
116 | // Disbale debug printouts | |
117 | mgr->SetDebugLevel(3); | |
118 | AliLog::SetGlobalLogLevel(AliLog::kFatal); | |
119 | AliLog::SetGlobalDebugLevel(0); | |
120 | ||
121 | //__________________________________________________________________________ | |
122 | if (!mgr->InitAnalysis()) return; | |
123 | mgr->PrintStatus(); | |
124 | // Start analysis in grid. | |
125 | mgr->StartAnalysis("grid"); | |
126 | }; | |
127 | ||
128 | //__________________________________________________________________________ | |
129 | ||
d08623be | 130 | AliAnalysisGrid* CreateAlienHandler(const char *plugin_mode, Bool_t runperformancetask, Bool_t useMC, TString anatype, TString gridoutputdir, TString datadir, TString datapattern) { |
f9a6cab5 | 131 | //__________________________________________________________________________ |
132 | // Check if user has a valid token, otherwise make one. This has limitations. | |
133 | // One can always follow the standard procedure of calling alien-token-init then | |
134 | // source /tmp/gclient_env_$UID in the current shell. | |
135 | AliAnalysisAlien *plugin= new AliAnalysisAlien(); | |
136 | ||
137 | //__________________________________________________________________________ | |
138 | // Set the run mode (can be "full", "test", "offline", "submit" or "terminate") | |
139 | plugin->SetRunMode(plugin_mode); | |
140 | ||
141 | plugin->SetNtestFiles(1); | |
142 | //__________________________________________________________________________ | |
143 | // Set versions of used packages | |
144 | plugin->SetAPIVersion("V1.1x"); | |
145 | ||
146 | //__________________________________________________________________________ | |
147 | // On GRID - current | |
fba64b41 | 148 | plugin->SetROOTVersion("v5-30-06-1"); |
d08623be | 149 | plugin->SetAliROOTVersion("v5-03-03-AN"); |
f9a6cab5 | 150 | |
151 | //__________________________________________________________________________ | |
152 | // Declare input data to be processed. | |
153 | // Method 1: Create automatically XML collections using alien 'find' command. | |
154 | if (useMC) { | |
d08623be | 155 | //plugin->SetGridDataDir("/alice/sim/LHC11a10a_bis"); // Define production directory |
fba64b41 | 156 | //plugin->SetGridDataDir("/alice/sim/LHC11a10b_plus"); |
157 | plugin->SetGridDataDir("/alice/sim/2011/LHC11f5"); | |
f9a6cab5 | 158 | // Set data search pattern |
fba64b41 | 159 | if (anatype == "ESD") plugin->SetDataPattern("*ESDs.root"); |
d08623be | 160 | else plugin->SetDataPattern("AOD090/*AOD.root"); |
fba64b41 | 161 | plugin->AddRunNumber(137124); |
162 | ||
163 | ||
f9a6cab5 | 164 | } else { |
d08623be | 165 | plugin->SetGridDataDir(datadir.Data()); // Define production directory LFN |
166 | plugin->SetDataPattern(datapattern.Data()); // Set data search pattern | |
df0c0483 | 167 | plugin->SetRunPrefix("000"); |
fba64b41 | 168 | //plugin->SetRunRange(80000,80000); // ...then add run numbers to be considered |
169 | plugin->AddRunNumber(138534); | |
df0c0483 | 170 | |
f9a6cab5 | 171 | } |
fba64b41 | 172 | // Method 2: Use your input collection |
173 | //plugin->AddDataFile("/alice/cern.ch/user/m/mnicassi/139105.xml"); | |
f9a6cab5 | 174 | //__________________________________________________________________________ |
175 | // Define alien work directory where all files will be copied. Relative to alien $HOME. | |
d08623be | 176 | plugin->SetGridWorkingDir(gridoutputdir.Data()); |
fba64b41 | 177 | plugin->SetGridOutputDir("output"); |
f9a6cab5 | 178 | |
fba64b41 | 179 | //__________________________________________________________________________ |
f9a6cab5 | 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"); | |
f9a6cab5 | 195 | } else { |
fba64b41 | 196 | plugin->SetAdditionalLibs("AliAnalysisTaskCheckCascadePbPb.h AliAnalysisTaskCheckCascadePbPb.cxx "); |
f9a6cab5 | 197 | // Optionally modify the executable name (default analysis.sh) |
198 | plugin->SetExecutable("CascadePbPb.sh"); | |
199 | ||
200 | } | |
fba64b41 | 201 | |
f9a6cab5 | 202 | //__________________________________________________________________________ |
203 | // Declare the output file names separated by blancs. | |
204 | // (can be like: file.root or file.root@ALICE::Niham::File) | |
fba64b41 | 205 | //plugin->SetDefaultOutputs(kFALSE); |
206 | //if (runperformancetask) plugin->SetOutputFiles("CascadePerformance.root"); | |
207 | //else plugin->SetOutputFiles("Cascades.root"); | |
f9a6cab5 | 208 | |
209 | // Optionally define the files to be archived. | |
fba64b41 | 210 | //plugin->SetOutputArchive("root_archive.zip:*.root log_archive.zip:stdout,stderr"); |
f9a6cab5 | 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 | ||
f9a6cab5 | 225 | // Optionally modify job price (default 1) |
226 | plugin->SetPrice(1); | |
227 | ||
228 | // Merge via JDL | |
229 | // comment out the next line when using the "terminate" option, unless | |
230 | // you want separate merged files for each run | |
fba64b41 | 231 | /* plugin->SetMergeViaJDL(kTRUE); // run first in full mode, then in terminate |
232 | plugin->SetOneStageMerging(kFALSE); | |
233 | plugin->SetMaxMergeFiles(50); | |
234 | plugin->SetMaxMergeStages(2);// to define the number of stages | |
235 | */ | |
f9a6cab5 | 236 | // Optionally set number of runs per master |
fba64b41 | 237 | // plugin->SetNrunsPerMaster(1); |
f9a6cab5 | 238 | // |
239 | plugin->SetOutputToRunNo(); | |
240 | // Optionally modify split mode (default 'se') | |
241 | plugin->SetSplitMode("se"); | |
242 | plugin->SetUser("mnicassi"); | |
243 | return plugin; | |
244 | } | |
245 |