3 This is a grand unified example of the ALICE Analysis Framework for
4 EMCal analysis on Local, Local CAF, PROOF, GRID interactive, GRID
5 batch, and AliEn PLUGIN.
7 Notice: Everything is working today. Really!
10 ---------------------------------------------------------------------
14 You can skip this PAR section for your first use of the example if you
15 just want to see how things work. The PAR files in the example were
16 built with ROOT v5-23-04 and AliRoot v4-16-Rev-11. See VM20090529.pdf
17 file with updated build instructions for ROOT v5-23-04 and AliROOT
18 v4-16-Rev-11. If you have write access to $ALICE_ROOT, you can install
19 AliAnalysisTaskElectron.cxx and make a new PAR file as follows:
21 edit $ALICE_ROOT/PWG4/PWG4PartCorrLinkDef.h to include AliAnalysisTaskElectron
22 edit $ALICE_ROOT/PWG4/libPWG4PartCorr.pkg to include AliAnalysisTaskElectron
23 edit $ALICE_ROOT/PWG4/CMake_libPWG4PartCorr.txt to include AliAnalysisTaskElectron
24 cp <yourlocalarea>/AliAnalysisTaskElectron.cxx $ALICE_ROOT/PWG4/PartCorr
25 cp <yourlocalarea>/AliAnalysisTaskElectron.h $ALICE_ROOT/PWG4/PartCorr
30 mv PWG4PartCorr.par <your workarea>
33 ---------------------------------------------------------------------
35 local usage (your laptop, workstation, PDSF account, etc.):
38 ssh -X <username>@pdsf.nersc.gov
39 cp ~kread/.chos $HOME/.chos (to invoke SciLinux 4.4)
40 logout and log back in
41 source /project/projectdirs/alice/alisetup.csh
43 All of the files at /afs/cern.ch/user/k/kread/public/all/v416 need to be
44 copied to your local workarea (except for README and PDF files).
46 If not at PDSF, need a valid local matching ROOT and AliROOT installation.
47 (See /afs/cern.ch/user/k/kread/public/all/v416/VM20090529.pdf)
51 Change this line in anaElectron.C to point to your local AliESDs.root
53 char * kInDir = "/afs/cern.ch/user/k/kread/PWG4/data/"
57 anaElectron(0,"ConfigAnalysisElectron")
61 ---------------------------------------------------------------------
63 CAF local usage (including for files on GRID):
65 All of the files at /afs/cern.ch/user/k/kread/public/all/v416 need to be
66 copied to your local workarea.
68 Your valid public and private keys need to be properly located in
69 /afs/cern.ch/user/<username>/.globus.
71 ssh -X <username>@lxplus.cern.sh
74 source /afs/cern.ch/alice/caf/caf-lxplus.sh -alien v4-16-Release
77 Edit ESDlist.txt to point to the location of your AliESDs.root files
78 (including those on the GRID).
82 anaElectron(1,"ConfigAnalysisElectron")
86 ---------------------------------------------------------------------
88 PROOF usage within CERN:
90 All of the files at /afs/cern.ch/user/k/kread/public/all/v416 need to be
91 copied to your local workarea.
93 The lines in anaElectron.C to need to look like this (which is the default):
94 char* myproofname = "alicecaf";
95 //char* myproofname = "kread@localhost";
98 Your valid public and private keys need to be properly located in
101 ssh -X <username>@lxplus.cern.sh (or other computer at CERN)
105 You need a valid matching local ROOT and AliROOT installation with ROOT
106 v5-23-04 or higher. (See
107 /afs/cern.ch/user/k/kread/public/all/v416/VM20090529.pdf if necessary.)
109 source /afs/cern.ch/alice/caf/caf-lxplus.sh -alien v4-16-Release
112 Edit this line in anaElectron.C to point to the appropriate CAF
114 char * kmydataset = "/COMMON/COMMON/LHC09a4_run8101X"
116 To access files in AliEN, first type
118 gEnv->SetValue("XSec.GSI.DelegProxy","2")
122 anaElectron(2,"ConfigAnalysisElectron")
125 For instructions concerning how to stage data files to CAF and how
126 to inspect what data is already staged, see:
127 http://aliceinfo.cern.ch/Offline/Activities/Analysis/CAF/index.html
129 If you do not use the provided PAR files, then you will need to add
130 the following lines at the beginning of
131 AliAnalysisTaskElectron::Terminate in AliAnalysisTaskElectron.cxx,
133 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
134 if (mgr->GetAnalysisType()==AliAnalysisManager::kProofAnalysis) return;
136 These lines work for all modes of anaElectron.cxx. So, you can install
137 a revised version of AliAnalysisTaskElectron.cxx at $ALICE_ROOT/PWG4/PartCorr .
139 ---------------------------------------------------------------------
141 remote PROOF usage (not at CERN):
143 This is a GREAT feature, but you will need a local installation with
144 ROOT v5-23-04 built with --globus, AliROOT v4-16-Rev-nn, and probably
145 write-access to $ALICE_ROOT.
146 (See /afs/cern.ch/user/k/kread/public/all/v416/VM20090529.pdf. Remote
147 PROOF access is not possible without at least ROOT v5-23-02b.) This
148 requires some understanding of PAR file manipulation. If you have
149 already been using the example, first type this and be sure not to do it
150 in the $ALICE_ROOT area:
153 /bin/rm -rf ANALYSIS ANALYSISalice AOD ESD STEERBase PWG4PartCorr
155 All of the files at /afs/cern.ch/user/k/kread/public/all/v416 need to
156 be copied to your local workarea. You should only have the (provided)
157 PAR file versions (not untarred versions) of the AliRoot
158 subdirectories present in your workarea.
160 Modify these lines in anaElectron.C to look like this, replacing
161 "kread" with your lxplus.cern.ch username:
162 //char* myproofname = "alicecaf";
163 char* myproofname = "kread@localhost";
165 Your valid public and private keys need to be properly located in
168 ssh -L 1093:alicecaf.cern.ch:1093 -fN <username>@lxplus.cern.ch
173 source /tmp/gclient_env_$UID
174 export alien_CLOSE_SE="ALICE::CNAF::SE"
175 export XrdSecGSISRVNAMES="lxfsrd0506.cern.ch"
177 Edit this line in anaElectron.C to point to the appropriate CAF
179 char * kmydataset = "/COMMON/COMMON/LHC09a4_run8101X"
183 anaElectron(2,"ConfigAnalysisElectron")
186 For instructions concerning how to stage data files to CAF and how
187 to inspect what data is already staged, see:
188 http://aliceinfo.cern.ch/Offline/Activities/Analysis/CAF/index.html .
190 The macro will create PAR files in $HOME/.proof/packages. If you have
191 trouble you can look at what is there and also uncomment appropriate
192 lines in anaElectron.C to ClearPackages.
194 You can see PROOF slave log files by creating a file GetProofLogs.C with these
197 gEnv->SetValue("XSec.GSI.DelegProxy","2");
198 logs=TProof::Mgr("kread@localhost")->GetSessionLogs(0);
200 //logs->Grep("segmentation violation");
201 logs->Save("*","logs.txt");
204 and then relaunching root and typing:
210 If you do not use the provided PAR files, then you will need to add
211 the following lines at the beginning of
212 AliAnalysisTaskElectron::Terminate in AliAnalysisTaskElectron.cxx,
214 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
215 if (mgr->GetAnalysisType()==AliAnalysisManager::kProofAnalysis) return;
217 These lines work for all modes of anaElectron.cxx. So, you can install
218 a revised version of AliAnalysisTaskElectron.cxx at $ALICE_ROOT/PWG4/PartCorr .
220 ---------------------------------------------------------------------
224 Copy all of the files at /afs/cern.ch/user/k/kread/public/all/v416 to your
227 Change all instances of username "kread" and to your username in
228 anaElectron.jdl and mergeElectron.jdl. Change email address in
229 mergeElectron.jdl. There is no need to change the jobid number inside
232 Need a valid local ROOT installation built with --enable-globus.
233 Need a valid local alien grid shell installed.
234 (If running locally and not at PDSF or lxplus, see
235 /afs/cern.ch/user/k/kread/public/all/v416/VM20090529.pdf.)
237 Your valid public and private keys need to be properly located in
243 source /tmp/gclient_env_$UID
244 export alien_CLOSE_SE="ALICE::CNAF::SE"
247 aliensh (to get to GRID home directory)
249 Make the following directories (if not done already):
254 mkdir work3/output/merge
256 Need to upload files (including par and jdl files) to GRID.
259 cp file:yourlocalfile.ext gridfile.ext (being sure to spell out the GRID
262 cp file:yourlocalfile.ext .
264 Or, exit from aliensh and type locally:
265 alien_cp localfile.ext alien://alice/cern.ch/user/<first-initial>/<username>/work3/gridfile.ext
267 Do not try to skip the complete GRID file name like this:
268 alien_cp localfile.ext alien://alice/cern.ch/user/<first-initial>/<username>/work3/
270 anaElectron.sh needs to be uploaded to the GRID to $HOME/bin.
271 anaElectron.sh sets the mode to GRID.
276 submit anaElectron.jdl
278 To change input data.
281 rm mycollect.xml (need to remove before uploading new version)
282 Use the desired run number and pattern in the find command, perhaps using the -l switch:
283 find -x mycollect /alice/sim/PDC_08b/LHC08d8/30009/0* AliESDs.root > mycollect.xml
285 find -x mycollect -l 200 /alice/sim/PDC_08b/LHC08d9/40010/* AliESDs.root > mycollect.xml
287 alien_cp mycollect.xml alien://alice/cern.ch/user/<first-initial>/<username>/work3/mycollect.xml
297 spy <jobid> anaElectron.log
299 If job fails with status E or EV, then to obtain stdout and other output type:
300 registerOutput <jobid>
302 Available GRID productions monitored via MonaLisa are listed here:
303 http://pcalimonitor.cern.ch/job_details.jsp
305 The choice of $alien_CLOSE_SE is very important. You can see the status of ALICE grid
306 storage elements here:
308 http://pcalimonitor.cern.ch/stats?page=SE/table
311 ---------------------------------------------------------------------
315 Copy all of the files at /afs/cern.ch/user/k/kread/public/all/v416 to your
318 Change all instances of username "kread" to your username in
319 anaElectron.jdl and mergeElectron.jdl. Change email address in
320 mergeElectron.jdl. There is no need to change the jobid number inside
323 Need a valid local ROOT installation built with --enable-globus.
324 Need a valid local alien grid shell installed.
325 (If running locally and not at PDSF or lxplus, see
326 /afs/cern.ch/user/k/kread/public/all/v416/VM20090529.pdf.)
328 Your valid public and private keys need to be properly located in
334 source /tmp/gclient_env_$UID
335 export alien_CLOSE_SE="ALICE::CNAF::SE"
337 Copy new xml file manually to AliEn (after deleting any existing copy in $HOME/work3) by typing
338 alien_cp mycollect.xml alien://alice/cern.ch/user/<first-initial>/<username>/work3/mycollect.xml
344 anaElectron(4,"ConfigAnalysisElectron")
347 Ignore warning messages from plugin about missing myAnalysis.C and
348 analysis.root which are not needed here.
350 Files should be automatically uploaded to grid and job launched.
351 aliensh is launched in order to monitor job. Exiting aliensh after
352 jobs are done will automatically invoke merge and copy merged output
353 histograms to local workarea.
355 Note that above we interactively submit the plugin job using mode=4.
356 However, do not change the mode to 4 inside the file anaElectron.sh
357 which is executed on each GRID compute node. That needs to remain
360 See GRID usage section above for more about copying to/from GRID and
362 Make directories on the GRID (if not done already) as follows:
369 mkdir work3/output/merge
373 ---------------------------------------------------------------------
375 GRID via AliEn plugin for simpler macro
377 An earlier, simpler, separate stand-alone example of EMCal analysis
378 with the AliEn plugin is presently available at
379 /afs/cern.ch/user/k/kread/public/plugin.
381 Copy the tar file to your local workarea.
383 tar -xvf plugin-example.tar
385 Need a valid local ROOT installation built with --enable-globus.
386 Need a valid local alien grid shell installed.
387 (If running locally and not at PDSF or lxplus, see
388 /afs/cern.ch/user/k/kread/public/all/v416/VM20090529.pdf.)
390 Your valid public and private keys need to be properly located in
396 source /tmp/gclient_env_$UID
397 export alien_CLOSE_SE="ALICE::CNAF::SE"
404 Edit CreateAlienHandler.C to select different input data available on GRID.
405 See GRID section above for more about copying to/from GRID and monitoring jobs.
408 These are the instructions for the anaElctron helper macro when used
409 with AliRoot v4-17. All of the v416 files and instructions (located at
410 /afs/cern.ch/user/k/kread/public/all/v416) are appropriate for use
411 with AliRoot v4-17 except for the following which are different:
413 anaElectron.C, anaElectron.jdl, and all of the *.par files.
415 The PAR files in this subdirectory were built using ROOT v5-23-04 and
418 The warnings about input and output containers being automatically created are
421 For remote PROOF, follow the usual instructions but set up two tunnels:
422 ssh -L 1093:alicecaf.cern.ch:1093 -fN <username>@lxplus.cern.ch
423 ssh -L 11094:alicecaf.cern.ch:11094 -fN <username>@lxplus.cern.ch
425 As usual, for PROOF, if you don't use these PAR files, then you will need
426 to add these lines at the beginning of AliAnalysisTaskElectron::Terminate in
427 AliAnalysisTaskElectron.cxx:
429 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
430 if (mgr->GetAnalysisType()==AliAnalysisManager::kProofAnalysis) return;
432 To build PWG4PartCorrDep.par:
434 copy AliAnalysisTaskElectron.cxx and AliAnalysisTaskElectron.h to $ALICE_ROOT/PWG4/PartCorrDep
435 edit $ALICE_ROOT/PWG4/PWG4PartCorrDepLinkDef.h to include AliAnalysisTaskElectron
436 edit $ALICE_ROOT/PWG4/libPWG4PartCorrDep.pkg to include AliAnalysisTaskElectron
437 edit $ALICE_ROOT/PWG4/CMake_libPWG4PartCorrDep.txt to include AliAnalysisTaskElectron
439 For PLUGIN mode, we have to work around a new small bug in the AliEn
440 plugin for v4-17-03. Please, ignore the fact that an irrelevant xml
441 file (30010.xml) is generated for PLUGIN mode and uploaded to the
442 grid. This satisfies some (uneccesary) requirements in the plugin for
443 this release and will be fixed in the future.
446 mylauncher.C is a robust file upload and grid submit helper. Just
447 edit the first few lines (after, of course, defining alien_CLOSE_SE
448 and doing alien-token-init). Adjust it as needed and you may
449 prefer it to the plugin. Even for manual grid submitters, it
450 can really simplify uploading and make it more robust.
452 The environment variable alien_CLOSE_SE needs to be defined locally,
453 and be defined BEFORE you do alien-token-init. (I will change the
454 other READMEs to reflect this.) Then, and only then, you will find
455 that it is listed in /tmp/gclient_env_$UID. It needs to be there in
456 order to be defined later within aliensh. Within aliensh you can see if
457 things are OK by typing echo $alien_CLOSE_SE. And, of course, outside
458 of aliensh, you can type echo $alien_CLOSE_SE.
460 My recommendation to enforce this is either to put
461 export alien_CLOSE_SE="ALICE::CNAF::SE"
463 in your login profile or initial setup script or to make the following local alias:
465 alias myaliti='export alien_CLOSE_SE="ALICE::CNAF::SE";alien-token-init'
467 For tcsh/csh, that would of course be
469 alias myaliti 'setenv alien_CLOSE_SE "ALICE::CNAF::SE";alien-token-init'
471 Then, by just typing "myaliti" (which means my alien token init),
472 everything will be OK concerning alien_CLOSE_SE and you will never forget
475 Next, people who use bash will continue to type "source
476 /tmp/glient_env_$uid" after typing myaliti.
478 However, they can to this in their login files
480 alias myalige='source /tmp/gclient_env_$UID'
482 (That stands for my alien globus environment.)
484 Then, they just always type
489 Tcsh/csh users never even need to type "bash" (since they can't source
490 that bash file in the /tmp area) if they do the following.
492 1. Prepare a new file in your util subdirectory and call it
493 $HOME/util/gclient_env.csh. It should be just like
494 /tmp/gclient_env_$uid, except remove all the equal signs and change
495 the word export to setenv everywhere. You only need to do that once.
496 And you need to make two changes in the new file:
498 a. Comment out one line and let the myaliti alias do it:
499 #setenv alien_CLOSE_SE "ALICE::CNAF::SE"
501 b. Replace the corresponding line about the volatile GBBOX_ENVFILE with this sed magic:
503 setenv GBBOX_ENVFILE `grep ENVFILE /tmp/gclient_env_$uid | sed s/"export GBBOX_ENVFILE="/""/`
508 alias myalige 'source $HOME/util/gclient_env.csh'
510 So, these users never need to type "bash", but also just always type
516 The symmetry of myaliti, myalige is why I didn't put alien_CLOSE_SE
517 in my login script. By defining myaliti1, myaliti2, ... myaliti5
518 with different, favored SE's in advance, then based on varying storage
519 element health you can type
521 myaliti3 (or 4 or 5 or whatever is best, and avoid mis-typing)
526 Next, note that interactive copying to your alien space does not allow
527 graceful overwriting. You need to delete any existing copy of a
528 desired file before you copy a new one to the grid with that name.
529 (mylauncher.C detects this and does it automatically.)
533 --------------------------------------------------
535 Note that mylauncher.C opens the way to arbitrary file upload,
536 download, and copy, and multiple simultaneous, coordinated submits.
537 That could be useful for systematic analyses involving scores or