1 /// **** to run the macro: ***********
2 // alien-token-init username
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",
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") {
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");
39 //__________________________________________________________________________
40 // Use AliRoot includes to compile our task
41 gROOT->ProcessLine(".include $ALICE_ROOT/include");
43 //__________________________________________________________________________
44 // Create and configure the alien handler plugin
45 // gROOT->LoadMacro("CreateAlienHandler.C");
46 AliAnalysisGrid *alienHandler = CreateAlienHandler(plugin_mode, runperformancetask, useMC, anatype);
47 if (!alienHandler) return;
49 //__________________________________________________________________________
50 // Create the analysis manager
51 AliAnalysisManager *mgr = new AliAnalysisManager("CascadePbPbanalysis");
53 //__________________________________________________________________________
54 // Connect plug-in to the analysis manager
55 mgr->SetGridHandler(alienHandler);
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);
67 //__________________________________________________________________________
71 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
72 AliPhysicsSelectionTask *physSel = AddTaskPhysicsSelection(useMC);
74 // Centrality selection
75 if (anatype == "ESD") {
76 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
77 AliCentralitySelectionTask *taskCentr = AddTaskCentrality();
79 taskCentr->SetMCInput();
80 taskCentr->DontUseCleaning();
84 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
85 AliAnalysisTaskPIDResponse *pidTask = AddTaskPIDResponse(useMC);
87 if (runperformancetask) {
88 gROOT->LoadMacro("AliAnalysisTaskCheckPerformanceCascadePbPb.cxx++g");
89 AliAnalysisTaskCheckPerformanceCascadePbPb *task = new AliAnalysisTaskCheckPerformanceCascadePbPb("TaskPerformanceCascade");
90 task->SetApplyAccCut (acccut);
91 task->SetRejectEventPileUp (kFALSE); // selects pile up
93 gROOT->LoadMacro("AliAnalysisTaskCheckCascadePbPb.cxx++g");
94 AliAnalysisTaskCheckCascadePbPb *task = new AliAnalysisTaskCheckCascadePbPb("TaskCascade");
96 task->SetRelaunchV0CascVertexers (krelaunchvertexers);
97 task->SetAnalysisType (anatype);
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);
110 task->SelectCollisionCandidates();
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);
121 //__________________________________________________________________________
122 // Disbale debug printouts
123 mgr->SetDebugLevel(3);
124 AliLog::SetGlobalLogLevel(AliLog::kFatal);
125 AliLog::SetGlobalDebugLevel(0);
127 //__________________________________________________________________________
128 if (!mgr->InitAnalysis()) return;
130 // Start analysis in grid.
131 mgr->StartAnalysis("grid");
134 //__________________________________________________________________________
136 AliAnalysisGrid* CreateAlienHandler(const char *plugin_mode, Bool_t runperformancetask, Bool_t useMC, TString anatype) {
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();
143 //__________________________________________________________________________
144 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
145 plugin->SetRunMode(plugin_mode);
147 plugin->SetNtestFiles(1);
148 //__________________________________________________________________________
149 // Set versions of used packages
150 plugin->SetAPIVersion("V1.1x");
152 //__________________________________________________________________________
154 plugin->SetROOTVersion("v5-30-06-1");
155 plugin->SetAliROOTVersion("v5-03-01-AN");
157 //__________________________________________________________________________
158 // Declare input data to be processed.
159 // Method 1: Create automatically XML collections using alien 'find' command.
161 //plugin->SetGridDataDir("/alice/sim/LHC11a10b_bis"); // Define production directory
162 //plugin->SetGridDataDir("/alice/sim/LHC11a10b_plus");
163 plugin->SetGridDataDir("/alice/sim/2011/LHC11f5");
164 // Set data search pattern
165 if (anatype == "ESD") plugin->SetDataPattern("*ESDs.root");
166 else plugin->SetDataPattern("AOD081/*AOD.root");
167 plugin->AddRunNumber(137124);
171 plugin->SetGridDataDir("/alice/data/2010/LHC10h"); // Define production directory LFN
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);
179 // Method 2: Use your input collection
180 //plugin->AddDataFile("/alice/cern.ch/user/m/mnicassi/139105.xml");
181 //__________________________________________________________________________
182 // Define alien work directory where all files will be copied. Relative to alien $HOME.
183 if (runperformancetask) plugin->SetGridWorkingDir("workperfcentral");
184 else plugin->SetGridWorkingDir("workdata");
185 plugin->SetGridOutputDir("output");
187 //__________________________________________________________________________
188 if (runperformancetask) plugin->SetAnalysisSource("AliAnalysisTaskCheckPerformanceCascadePbPb.cxx");
189 else plugin->SetAnalysisSource("AliAnalysisTaskCheckCascadePbPb.cxx");
191 //__________________________________________________________________________
192 //Enable same others packages
193 //plugin->EnablePackage("PWG3dielectron.par");
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");
204 plugin->SetAdditionalLibs("AliAnalysisTaskCheckCascadePbPb.h AliAnalysisTaskCheckCascadePbPb.cxx ");
205 // Optionally modify the executable name (default analysis.sh)
206 plugin->SetExecutable("CascadePbPb.sh");
210 //__________________________________________________________________________
211 // Declare the output file names separated by blancs.
212 // (can be like: file.root or file.root@ALICE::Niham::File)
213 //plugin->SetDefaultOutputs(kFALSE);
214 //if (runperformancetask) plugin->SetOutputFiles("CascadePerformance.root");
215 //else plugin->SetOutputFiles("Cascades.root");
217 // Optionally define the files to be archived.
218 //plugin->SetOutputArchive("root_archive.zip:*.root log_archive.zip:stdout,stderr");
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");
233 // Optionally modify job price (default 1)
237 // comment out the next line when using the "terminate" option, unless
238 // you want separate merged files for each run
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
244 // Optionally set number of runs per master
245 // plugin->SetNrunsPerMaster(1);
247 plugin->SetOutputToRunNo();
248 // Optionally modify split mode (default 'se')
249 plugin->SetSplitMode("se");
250 plugin->SetUser("mnicassi");