TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / PWG / DevNanoAOD / runGridESE.C
CommitLineData
5cb630d4 1#if !defined (__CINT__) || (defined(__MAKECINT__))
2#include <iostream>
3#include "AliAnalysisGrid.h"
4#include "TSystem.h"
5#include "TROOT.h"
6#include "AliAnalysisManager.h"
7#include "AliAnalysisGrid.h"
8#include "AliVEventHandler.h"
9#include "AliAODInputHandler.h"
10#include "AliAnalysisAlien.h"
11#include "AliMCEventHandler.h"
12#include "AliPhysicsSelectionTask.h"
13#include "TRegexp.h"
14#include "AliTriggerAnalysis.h"
15#include "TChain.h"
16#include "AliAnalysisTaskPIDResponse.h"
17#include "AliAODHandler.h"
18#include "AliAnalysisTaskNanoAODFilter.h"
19#include "AliESEHelpers.h"
20
21#endif
22void LoadLibs();
23
24class AliAnalysisGrid;
25class AliESETrkCut;
26class AliESEEvtCut;
27
28AliESETrkCut * TrkCuts() {
29
30 AliESETrkCut * trk = new AliESETrkCut;
31
32 AliSpectraAODTrackCuts * trcuts = new AliSpectraAODTrackCuts("TrackCuts");
33 trcuts->SetDCA(100000);
34 trcuts->SetTrackBits(1);
35 trcuts->SetPt(50);
36 trcuts->SetPtTOFMatching(0.6);
37 trcuts->SetEta(-0.8,0.8);
38 trcuts->SetMinTPCcls(70);
39 trcuts->PrintCuts();
40
41 trk->SetTrackCuts(trcuts);
42 trk->Init();
43
44 return trk;
45
46}
47
48AliESEEvtCut * EvtCuts(Int_t mc) {
49
50 AliESEEvtCut * evt = new AliESEEvtCut;
51
52 AliSpectraAODEventCuts * evcuts = new AliSpectraAODEventCuts("EventCuts");
53 evcuts->SetQVectorCut(0,100);
54 evcuts->SetCentralityCutMax(100);
55 evcuts->SetCentralityCutMin(0);
56 if(mc>0)evcuts->SetIsMC(kTRUE);
57 TFile * fCalib = new TFile("./calibV0New.root");
58 evcuts->SetCalibFile(fCalib);
59 evcuts->SetIsLHC10h(kTRUE);
60 evcuts->PrintCuts();
61 // evcuts->SetEventSelectionBit(AliVEvent::kAny);
62
63 evt->SetEventCuts(evcuts);
64 evt->Init();
65
66 return evt;
67
68}
69
70//______________________________________________________________________________
71void runGridESE(
72 const char *gridmode = "test", // Set the run mode (can be "full", "test", "offline", "submit" or "terminate"). Full & T
73 const char * taskname = "DevNanoAOD",
74 const int iMCtruth = 2,
75 const char * addTaskString = ".x AddTaskNanoAODFilter.C(%d,1)" //
76 )
77{
78 LoadLibs();
79 // analysis manager
80 AliAnalysisManager* mgr = new AliAnalysisManager("NanoAOD Filter", "NanoAOD filter for nanoAOD production");
81
82 AliAnalysisGrid *plugin = CreateAlienHandler(taskname, gridmode);
83 plugin->SetFileForTestMode("files.txt"); // file should contain path name to a local directory containg *ESDs.root or AOD etc
84 mgr->SetGridHandler(plugin);
85
86
87 AliAODInputHandler* iH = new AliAODInputHandler();
88 mgr->SetInputEventHandler(iH);
89
90 // Define aod output handler
91 AliAODHandler* aodOutputHandler = new AliAODHandler();
92 aodOutputHandler->SetOutputFileName("AliAOD.NanoAOD.root");
93 mgr->SetOutputEventHandler(aodOutputHandler);
94
95 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
96 AliAnalysisTaskPIDResponse *taskPID=AddTaskPIDResponse(iMCtruth);
97 taskPID->SetUseTPCEtaCorrection(kTRUE);
98
99 // create task
100 cout << "Macro: "<< addTaskString << " " << Form(addTaskString, iMCtruth) << endl;
101
102 AliAnalysisTaskNanoAODFilter * task = (AliAnalysisTaskNanoAODFilter*) gROOT->ProcessLine(Form(addTaskString, iMCtruth));
103
104 // Set Track event and vertex cuts here!
105 task->SetVarList("pt,theta,phi,cstNSigmaTPCPi,cstNSigmaTPCKa,cstNSigmaTPCPr,cstNSigmaTOFPi,cstNSigmaTOFKa,cstNSigmaTOFPr,cstBayesTPCPi,cstBayesTPCKa,cstBayesTPCPr,cstBayesTOFPi,cstBayesTOFKa,cstBayesTOFPr");
106 task->SetVarListHead("cstCentr,cstQVec");
107 AliESETrkCut * trkCuts = TrkCuts();
108 AliESEEvtCut * evtCuts = EvtCuts(iMCtruth);
109 evtCuts->SetTrackCuts(trkCuts->GetTrackCuts());
110 AliAnalysisESESetter * setter = new AliAnalysisESESetter;
111 setter->SetEventCuts(evtCuts->GetEventCuts());
112
113 task->SetTrkCuts(trkCuts);
114 task->SetEvtCuts(evtCuts);
115 task->SetSetter(setter);
116
117 //task->SelectCollisionCandidates(AliVEvent::kMB);// FIXME
118 // enable debug printouts
119 mgr->SetDebugLevel(10);
120 // mgr->SetNSysInfo(100);
121 if (!mgr->InitAnalysis()) return;
122 mgr->PrintStatus();
123
124 // start analysis
125 // Always read the same file:
126 TChain * chain = new TChain("aodTree");
127 chain->Add("./AliAOD.root");
128
129 Printf("Starting Analysis....");
130 mgr->StartAnalysis("grid", chain,123456789);
131
132}
133
134//______________________________________________________________________________
135
136AliAnalysisGrid* CreateAlienHandler(const char *taskname, const char *gridmode)
137{
138 AliAnalysisAlien *plugin = new AliAnalysisAlien();
139 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
140 plugin->SetRunMode(gridmode);
141
142 // Set versions of used packages
143 plugin->SetAPIVersion("V1.1x");
144 plugin->SetROOTVersion("v5-34-08-5");
145 plugin->SetAliROOTVersion("v5-05-73-AN");
146
147 // Declare input data to be processed.
148 // plugin->SetCheckCopy(kFALSE);
149
150 // Method 1: Create automatically XML collections using alien 'find' command.
151 // Define production directory LFN
152 plugin->SetGridDataDir("/alice/sim/LHC11a10a_bis");
153 // On real reconstructed data:
154 // plugin->SetGridDataDir("/alice/data/2009/LHC09d");
155 // Set data search pattern
156 //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES
157 // Data pattern for reconstructed data
158 plugin->SetDataPattern("*AOD120/*/AliAOD.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
159 // plugin->SetDataPattern("ESDs/pass2/AOD038/*AliAOD.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
160 // plugin->SetRunPrefix("000"); // real data
161 // ...then add run numbers to be considered
162 Int_t runlist[1]={137366};
163 for (Int_t ind=0; ind<1; ind++) {
164// plugin->AddRunNumber(138275);
165 plugin->AddRunNumber(runlist[ind]);
166 }
167 //plugin->SetRunRange(114917,115322);
168 plugin->SetNrunsPerMaster(10); // 1
169 plugin->SetOutputToRunNo();
170 // comment out the next line when using the "terminate" option, unless
171 // you want separate merged files for each run
172 plugin->SetMergeViaJDL();
173
174 // Method 2: Declare existing data files (raw collections, xml collections, root file)
175 // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
176 // XML collections added via this method can be combined with the first method if
177 // the content is compatible (using or not tags)
178 // plugin->AddDataFile("tag.xml");
179 // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");
180
181 // Define alien work directory where all files will be copied. Relative to alien $HOME.
182 plugin->SetGridWorkingDir(taskname);
183
184 // Declare alien output directory. Relative to working directory.
185 plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out
186
187 // Declare the analysis source files names separated by blancs. To be compiled runtime
188 // using ACLiC on the worker nodes.
189 // plugin->SetAnalysisSource("AliAnalysisTaskEx01.cxx");
190
191 // Declare all libraries (other than the default ones for the framework. These will be
192 // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
230b7aff 193 plugin->SetAdditionalLibs("libPWGLFspectra libPWGDevNanoAOD");
5cb630d4 194
195 // Declare the output file names separated by blancs.
196 // (can be like: file.root or file.root@ALICE::Niham::File)
197 // To only save certain files, use SetDefaultOutputs(kFALSE), and then
198 // SetOutputFiles("list.root other.filename") to choose which files to save
199 plugin->SetDefaultOutputs();
200 //plugin->SetOutputFiles("list.root");
201
202 // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
203 plugin->SetAnalysisMacro(Form("%s.C",taskname));
204
205 // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
206 plugin->SetSplitMaxInputFileNumber(100);
207
208 // Optionally modify the executable name (default analysis.sh)
209 plugin->SetExecutable(Form("%s.sh",taskname));
210
211 // set number of test files to use in "test" mode
212 plugin->SetNtestFiles(10);
213
214 // Optionally resubmit threshold.
215 plugin->SetMasterResubmitThreshold(90);
216
217 // Optionally set time to live (default 30000 sec)
218 plugin->SetTTL(30000);
219
220 // Optionally set input format (default xml-single)
221 plugin->SetInputFormat("xml-single");
222
223 // Optionally modify the name of the generated JDL (default analysis.jdl)
224 plugin->SetJDLName(Form("%s.jdl",taskname));
225
226 // Optionally modify job price (default 1)
227 plugin->SetPrice(1);
228
229 // Optionally modify split mode (default 'se')
230 plugin->SetSplitMode("se");
231
232 return plugin;
233}
234
235
236
237void LoadLibs() {
230b7aff 238 gSystem->Load("libCore");
239 gSystem->Load("libGeom");
240 gSystem->Load("libPhysics");
5cb630d4 241 gSystem->Load("libVMC");
242 gSystem->Load("libTree");
243 gSystem->Load("libProof");
244 gSystem->Load("libMatrix");
245 gSystem->Load("libMinuit");
246 gSystem->Load("libSTEERBase");
247 gSystem->Load("libESD");
248 gSystem->Load("libAOD");
249 gSystem->Load("libANALYSIS");
250 // return;
251 gSystem->Load("libOADB");
252 gSystem->Load("libANALYSISalice");
230b7aff 253 gSystem->Load("libTender");
5cb630d4 254 gSystem->Load("libCORRFW");
255
230b7aff 256 // gSystem->Load("libNanoAOD");
5cb630d4 257 gSystem->Load("libPWGLFspectra");
258 gSystem->Load("libPWGDevNanoAOD");
259
260}