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