]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/macros/runAnalysisTaskITSTPCalignment.C
striked out TF1Helper functionality ... was not supposed to be used in the
[u/mrichter/AliRoot.git] / PWG1 / macros / runAnalysisTaskITSTPCalignment.C
CommitLineData
51cfc50d 1void runAnalysisTaskITSTPCalignment()
2{
3 TStopwatch timer;
4 timer.Start();
5
6 //runProof("/ITS/dainesea/run104070#esdTree");
7 //runProof("/ITS/dainesea/run104070_newTPCalign#esdTree");
8 //runProof("/ALIREC/aliprod/run104671#esdTree");
9 //runProof("/ITS/dainesea/run104070_newTPCcalib#esdTree");
10 //runProof("/COMMON/COMMON/LHC09d9a_0.9TeV_0.5T#esdTree");
11 //runLocal("find /data/alice3/mikolaj/runs_pp/pass1/ -name AliESDs.root","tree");
12 //runLocal("find /data/alice3/mikolaj/ITSmisal -path */0.001/* -name AliESDs.root","tree");
13 //runLocal("find /data/alice3/mikolaj/TPCfullmisalignmentB0 -name AliESDs.root","tree");
14 //runLocal("find /data/alice3/mikolaj/TPCfullmisalignmentB5/ -name AliESDs.root -path \"*187824*\" ","tree");
15 //runLocal("find /data/alice3/mikolaj/TPCfullmisalignmentB5/ -name AliESDs.root","tree");
16 //runLocal("find /data/alice3/mikolaj/run104892test -name AliESDs.root","tree");
17 runAlienPlugin("terminate");
18
19 timer.Stop();
20 timer.Print();
21}
22
23//______________________________________________________________________________
24void runLocal(TString findCommand = "", TString options="")
25{
26
27 TString outputFilename = "outputITSTPCalignment.root";
28
29 //setupPar("STEERBase");
30 //setupPar("ESD");
31 //setupPar("AOD");
32 //setupPar("ANALYSIS");
33 //setupPar("ANALYSISalice");
34 gSystem->Load("libTree.so");
35 gSystem->Load("libGeom.so");
36 gSystem->Load("libVMC.so");
37 gSystem->Load("libPhysics.so");
38 gSystem->Load("libSTEERBase");
39 gSystem->Load("libESD");
40 gSystem->Load("libAOD");
41 gSystem->Load("libANALYSIS");
42 gSystem->Load("libANALYSISalice"); // The plugin is here
43
44 gSystem->AddIncludePath("-I$ALICE_ROOT/include");
45 gROOT->LoadMacro("AliRelAlignerKalman.cxx++");
46 gROOT->LoadMacro("AliRelAlignerKalmanArray.cxx++g");
47 gROOT->LoadMacro("AliAnalysisTaskITSTPCalignment.cxx++g");
48 gROOT->LoadMacro("AddTaskITSTPCalignment.C");
49 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
50
51 //add input files from list saved in a file
52 findCommand += ">ESDfiles.txt";
53 gSystem->Exec(findCommand);
54 TChain* chain = CreateESDChain("ESDfiles.txt",100000);
55
56 // analysis manager
57 AliAnalysisManager *mgr = new AliAnalysisManager("ITSTPCalignmentAnalysisManager");
58
59 // input handlers
60 AliVEventHandler* esdH = new AliESDInputHandler();
61 mgr->SetInputEventHandler(esdH);
62
63 //AliMCEventHandler* MCH = new AliMCEventHandler();
64 //mgr->SetMCtruthEventHandler(MCH);
65
66 //add the task
67 AliAnalysisTaskITSTPCalignment *task = AddTaskITSTPCalignment();
68
69 //start analysis
70 if (!mgr->InitAnalysis()) return;
71 mgr->PrintStatus();
72
73 mgr->StartAnalysis("local",chain);
74}
75
76//______________________________________________________________________________
77void runProof(const char* dataset, TString options="" )
78{
79
80 TString outputFilename = "outputITSTPCalignment.root";
81
82 printf("****** Connect to PROOF *******\n");
83 gEnv->SetValue("XSec.GSI.DelegProxy","2");
84 TProof::Open("mkrzewic@alicecaf.cern.ch");
85 //gProof->SetParallel();
86 gProof->ClearPackages();
87
88 // Enable the Analysis Package
89 gProof->UploadPackage("STEERBase.par");
90 gProof->EnablePackage("STEERBase");
91 gProof->UploadPackage("ESD.par");
92 gProof->EnablePackage("ESD");
93 gProof->UploadPackage("AOD.par");
94 gProof->EnablePackage("AOD");
95 gProof->UploadPackage("ANALYSIS.par");
96 gProof->EnablePackage("ANALYSIS");
97 gProof->UploadPackage("ANALYSISalice.par");
98 gProof->EnablePackage("ANALYSISalice");
99 gProof->UploadPackage("CORRFW.par");
100 gProof->EnablePackage("CORRFW");
101
102 //gProof->UploadPackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-18-12-AN/AF-v4-18-12-AN");
103 //gProof->EnablePackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-18-12-AN/AF-v4-18-12-AN");
104
105 gProof->Load("AliRelAlignerKalman.cxx++g");
106 gProof->Load("AliRelAlignerKalmanArray.cxx++g");
107 gProof->Load("AliAnalysisTaskITSTPCalignment.cxx++g");
108 gProof->Load("AddTaskITSTPCalignment.C");
109
110 // analysis manager
111 AliAnalysisManager *mgr = new AliAnalysisManager("ITSTPCalignmentAnalysisManager");
112
113 // input handlers
114 AliVEventHandler* esdH = new AliESDInputHandler();
115 mgr->SetInputEventHandler(esdH);
116
117 //add the task
118 AliAnalysisTaskITSTPCalignment *task = AddTaskITSTPCalignment();
119
120 //start analysis
121 if (!mgr->InitAnalysis()) return;
122 mgr->PrintStatus();
123
124 mgr->StartAnalysis("proof",dataset,10000,0);
125}
126
127//______________________________________________________________________________
128void runAlienPlugin(const char* pluginmode="full")
129{
130 //must be configured in CreateAlienHandler.C file
131
132 TString outputFilename = "outputITSTPCalignment.root";
133
134 // Load common libraries
135 gSystem->Load("libTree.so");
136 gSystem->Load("libGeom.so");
137 gSystem->Load("libVMC.so");
138 gSystem->Load("libPhysics.so");
139 gSystem->Load("libSTEERBase");
140 gSystem->Load("libESD");
141 gSystem->Load("libAOD");
142 gSystem->Load("libANALYSIS");
143 gSystem->Load("libANALYSISalice"); // The plugin is here
144
145 // Use AliRoot includes to compile our task
146 gSystem->AddIncludePath("-I$ALICE_ROOT/include");
147
148 /////////////////////////////////////////////////////////////////////////////////////////////
149 /////////////////////////////////////////////////////////////////////////////////////////////
150 /////////////////////////////////////////////////////////////////////////////////////////////
151 // Create and configure the alien handler plugin
152 // Check if user has a valid token, otherwise make one. This has limitations.
153 // One can always follow the standard procedure of calling alien-token-init then
154 // source /tmp/gclient_env_$UID in the current shell.
155 if (!AliAnalysisGrid::CreateToken()) return NULL;
156 AliAnalysisAlien *plugin = new AliAnalysisAlien();
157 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
158 plugin->SetRunMode(pluginmode);
159 // Set versions of used packages
160 plugin->SetAPIVersion("V1.1x");
161 plugin->SetROOTVersion("v5-26-00b-4");
162 plugin->SetAliROOTVersion("v4-19-11-AN");
163 // Declare input data to be processed.
164 // Method 1: Create automatically XML collections using alien 'find' command.
165 // Define production directory LFN
166 plugin->SetGridDataDir("/alice/data/2010/LHC10b");
167 // Set data search pattern
168 plugin->SetDataPattern("*/pass1/*AliESDs.root");
169 // ...then add run numbers to be considered
170 plugin->SetRunPrefix("000");
171 plugin->AddRunNumber(117222);
172 plugin->AddRunNumber(117220);
173 plugin->AddRunNumber(117112);
174 plugin->AddRunNumber(117099);
175 plugin->AddRunNumber(117048);
176 plugin->AddRunNumber(117048);
177 plugin->AddRunNumber(116288);
178 plugin->AddRunNumber(115322);
179 plugin->AddRunNumber(114931);
180 //plugin->AddRunNumber(117051);
181 //plugin->SetRunRange(117029,117121);
182 // Method 2: Declare existing data files (raw collections, xml collections, root file)
183 // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
184 // XML collections added via this method can be combined with the first method if
185 // the content is compatible (using or not tags)
186 // plugin->AddDataFile("/alice/cern.ch/user/m/mkrzewic/pp2009pass2.xml");
187 // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");
188 // Define alien work directory where all files will be copied. Relative to alien $HOME.
189 plugin->SetGridWorkingDir("analysisGridLHC10bPass1_3runs");
190 // Declare alien output directory. Relative to working directory.
191 plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output
192 // Declare the analysis source files names separated by blancs. To be compiled runtime
193 // using ACLiC on the worker nodes.
194 plugin->SetAnalysisSource("AliRelAlignerKalman.cxx AliRelAlignerKalmanArray.cxx AliAnalysisTaskITSTPCalignment.cxx");
195 // Declare all libraries (other than the default ones for the framework. These will be
196 // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
197 plugin->SetAdditionalLibs("AliRelAlignerKalman.h AliRelAlignerKalman.cxx AliRelAlignerKalmanArray.h AliRelAlignerKalmanArray.cxx AliAnalysisTaskITSTPCalignment.h AliAnalysisTaskITSTPCalignment.cxx");// AddTaskITSTPCalignment.C");
198 // Declare the output file names separated by blancs.
199 // (can be like: file.root or file.root@ALICE::Niham::File)
200 plugin->SetOutputFiles("outputITSTPCalignment.root");
201 // Optionally define the files to be archived.
202 // plugin->SetOutputArchive("log_archive.zip:stdout,stderr@ALICE::NIHAM::File root_archive.zip:*.root@ALICE::NIHAM::File");
203 plugin->SetOutputArchive("log_archive.zip:stdout,stderr");
204 // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
205 plugin->SetAnalysisMacro("AnalysisITSTPCalignmentGenerated.C");
206 // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
207 plugin->SetSplitMaxInputFileNumber(20);
208 // Optionally set number of failed jobs that will trigger killing waiting sub-jobs.
209 plugin->SetMaxInitFailed(5);
210 // Optionally resubmit threshold.
211 plugin->SetMasterResubmitThreshold(90);
212 // Optionally set time to live (default 30000 sec)
213 plugin->SetTTL(100000);
214 // Optionally set input format (default xml-single)
215 plugin->SetInputFormat("xml-single");
216 // Optionally modify the name of the generated JDL (default analysis.jdl)
217 plugin->SetJDLName("taskITSTPCalignment.jdl");
218 // Optionally modify job price (default 1)
219 plugin->SetPrice(1);
220 // Optionally modify split mode (default 'se')
221 plugin->SetSplitMode("se");
222 /////////////////////////////////////////////////////////////////////////////////////////////
223 /////////////////////////////////////////////////////////////////////////////////////////////
224 /////////////////////////////////////////////////////////////////////////////////////////////
225
226 // analysis manager
227 AliAnalysisManager *mgr = new AliAnalysisManager("ITSTPCalignmentAnalysisManager");
228
229 // input handlers
230 mgr->SetGridHandler(plugin);
231
232 //input handler
233 AliESDInputHandler* esdH = new AliESDInputHandler();
234 esdH->SetInactiveBranches("Calo FMD");
235 //esdH->SetReadFriends(kTRUE);
236 mgr->SetInputEventHandler(esdH);
237
238 gROOT->LoadMacro("AliRelAlignerKalman.cxx++g");
239 gROOT->LoadMacro("AliRelAlignerKalmanArray.cxx++g");
240 gROOT->LoadMacro("AliAnalysisTaskITSTPCalignment.cxx++g");
241 gROOT->LoadMacro("AddTaskITSTPCalignment.C");
242
243 //add the task
244 AliAnalysisTaskITSTPCalignment *task = AddTaskITSTPCalignment();
245
246 //mgr->SetDebugLevel(2);
247
248 if (!mgr->InitAnalysis()) return;
249 mgr->PrintStatus();
250 mgr->StartAnalysis("grid");
251}
252
253//______________________________________________________________________________
254Int_t setupPar(const char* pararchivename)
255{
256 ///////////////////
257 // Setup PAR File//
258 ///////////////////
259 if (pararchivename)
260 {
261 char processline[1024];
262 sprintf(processline,".! tar xvzf %s.par",pararchivename);
263 gROOT->ProcessLine(processline);
264 const char* ocwd = gSystem->WorkingDirectory();
265 gSystem->ChangeDirectory(pararchivename);
266
267 // check for BUILD.sh and execute
268 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh"))
269 {
270 printf("*******************************\n");
271 printf("*** Building PAR archive ***\n");
272 printf("*******************************\n");
273
274 if (gSystem->Exec("PROOF-INF/BUILD.sh"))
275 {
276 Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");
277 return -1;
278 }
279 }
280 // check for SETUP.C and execute
281 if (!gSystem->AccessPathName("PROOF-INF/SETUP.C"))
282 {
283 printf("*******************************\n");
284 printf("*** Setup PAR archive ***\n");
285 printf("*******************************\n");
286 gROOT->Macro("PROOF-INF/SETUP.C");
287 }
288
289 gSystem->ChangeDirectory("../");
290 }
291 return 1;
292}
293
294