User Tools

Site Tools


asc:tutorials:2014october

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
asc:tutorials:2014october [2014/10/29 14:29]
asc [Using ATLAS connect]
asc:tutorials:2014october [2014/10/29 21:17] (current)
asc [xAOD tutorial at ANL (October 28-29, 2014)]
Line 4: Line 4:
 However, the lessons given below are simplified for a faster start. Also, the last 2 lessons are designed for the ANL cluster that uses condor for job submissions. However, the lessons given below are simplified for a faster start. Also, the last 2 lessons are designed for the ANL cluster that uses condor for job submissions.
 In addition, we we will test US ATLAS connect as explained at the bottom of this page. In addition, we we will test US ATLAS connect as explained at the bottom of this page.
 +
 +Agenda of this tutorial is [[https://indico.cern.ch/event/330836/]].
  
  
Line 272: Line 274:
  
 <code bash> <code bash>
-source setup.sh 
 mkdir lesson_3; cd lesson_3 mkdir lesson_3; cd lesson_3
 +source setup.sh    # setup ATLAS enviroment
 rcSetup -u; rcSetup Base,2.0.12 rcSetup -u; rcSetup Base,2.0.12
 rc find_packages  # find needed packages rc find_packages  # find needed packages
Line 326: Line 328:
  
  
 +<note tip>If the program fails saying that some shared library has a wrong format, clean ROOTCORE as "rc clean", and then compile everything again with "rc find_packages; rc compile"</note> 
 + 
 ====== Lesson 4: Filling histograms ====== ====== Lesson 4: Filling histograms ======
  
-Now we will make a number of changes to the above program. We will fill 2 histograms with pT of jets and muons. +Now we will make a number of changes to the above program. For a quick start, do this:
-To do this we will need a number of changes:+
  
-1) We need to link several ATLAS packages.  
- 
-<code> 
- PACKAGE_DEP = EventLoop xAODRootAccess xAODEventInfo GoodRunsLists xAODJet xAODTrigger xAODEgamma JetSelectorTools JetResolution xAODMuon 
-</code> 
- 
-in "cmt/Makefile.RootCore". We linked more packaged than needed to illustrate what can be linked.  Use "rc version" to check their versions. 
- 
-2) Then we need to modify 2 places to put histograms  
- 
-<code python> 
-MyAnalysis/MyxAODAnalysis.h # used to define pointers to histograms 
-Root/MyxAODAnalysis.cxx     # initialized histograms and our analysis code that loops over jets and muons 
-</code> 
- 
-1) and 3) have been already added to the next example. Let us run this code to see how it works: 
  
 <code bash> <code bash>
-source setup.sh 
 mkdir lesson_4; cd lesson_4 mkdir lesson_4; cd lesson_4
 </code> </code>
 +
 +Then setup atlas environment:
  
 <code bash> <code bash>
 +source setup.sh    # setup ATLAS environment
 rcSetup -u; rcSetup Base,2.0.12 rcSetup -u; rcSetup Base,2.0.12
 rc find_packages  # find needed packages rc find_packages  # find needed packages
Line 369: Line 357:
 cd MyAnalysis/util  # go to the analysis code  cd MyAnalysis/util  # go to the analysis code 
 </code> </code>
 +
 +
 +
  
 <note warning>The main analysis is in Root/MyxAODAnalysis.cxx. Please change the path to goodrunlist (on line 108) and recompile with "rc compile". </note> <note warning>The main analysis is in Root/MyxAODAnalysis.cxx. Please change the path to goodrunlist (on line 108) and recompile with "rc compile". </note>
Line 384: Line 375:
  
 How does this work? Your analysis code is testRun.cxx. We pass "submitDir" which will be the output directory with ROOT file. How does this work? Your analysis code is testRun.cxx. We pass "submitDir" which will be the output directory with ROOT file.
-The actual analysis should be put to "Root/MyxAODAnalysis.cxx" as explained above. This example has an access to muon and jet containers, plus it reads goodrunlist.+The actual analysis should be put to "Root/MyxAODAnalysis.cxx" as explained above. This example has an access to muon and jet containers, plus it reads goodrunlist. This is what was done: 
 + 
 +1) We linked several ATLAS packages.  
 + 
 +<code> 
 + PACKAGE_DEP = EventLoop xAODRootAccess xAODEventInfo GoodRunsLists xAODJet xAODTrigger xAODEgamma JetSelectorTools JetResolution xAODMuon 
 +</code> 
 + 
 +in "cmt/Makefile.RootCore". We linked more packaged than needed to illustrate what can be linked.  Use "rc version" to check their versions. 
 + 
 +2) Then we  modified 2 places to put histograms  
 + 
 +<code python> 
 +MyAnalysis/MyxAODAnalysis.h # used to define pointers to histograms 
 +Root/MyxAODAnalysis.cxx     # initialized histograms and our analysis code that loops over jets and muons 
 +</code> 
 + 
 + 
 + 
  
 The output of this example is in "submitDir/hist-sample.root". Open  it with ROOT: The output of this example is in "submitDir/hist-sample.root". Open  it with ROOT:
Line 400: Line 410:
  
  
-Now we run the above job on multiple codes of same computer and merge histogram outputs at the end. +Now we run the above job on multiple cores of same computer and merge histogram outputs at the end. 
 The execution of this program does not use anything from ATLAS. It uses basic Linux commands. The execution of this program does not use anything from ATLAS. It uses basic Linux commands.
 Prepare a fresh directory: Prepare a fresh directory:
Line 435: Line 445:
  
  
-We have made a few changes for this lesson compared to lesson 4. +We have made a few changes for in this  lesson compared to lesson 4. 
 For example, we changed 'testRun.cxx' file and included a For example, we changed 'testRun.cxx' file and included a
 small script "A_RUN" that launches several jobs in parallel. Open the file "A_RUN" and study it.  What it does is this:  small script "A_RUN" that launches several jobs in parallel. Open the file "A_RUN" and study it.  What it does is this: 
Line 445: Line 455:
 The output will go to the directory "outputs", while input files and logfiles will be put to "inputs" directory.  The output will go to the directory "outputs", while input files and logfiles will be put to "inputs" directory. 
  
-Now run "./A_RUN" to launch 2 jobs using 2 cores. Each job will read a portion of the original "inputdata.txt"   
  
-You can monitor jobs with the command (launched in separate terminal):+Now let us  launch 2 jobs using 2 cores. Each job will read a portion of the original "inputdata.txt". Do this: 
 + 
 +<code bash> 
 +./A_RUN 
 +</code>   
 + 
 +You can monitor jobs with this command (launched in separate terminal):
  
 <code bash> <code bash>
Line 453: Line 468:
 </code> </code>
  
-Ones the jobs are done, you can merge the output files to "hist.root":+When the jobs are done, you can merge the output files to "hist.root":
 <code bash> <code bash>
 hadd -f hist.root outputs/*/hist-run*.root hadd -f hist.root outputs/*/hist-run*.root
 </code> </code>
 +
 +
 +If it does not work: debug it as:
 +<code>
 +testRun 00
 +</code>
 +The command runs one job using the input list inputs/list00.  It  shows where the problem is.
 +(Typically, this is due to wrong location of the goodrunlist)
 +
 +
 +If you run this program second time, clean the output directory:
 +
 +<code>
 +rm -rf outputs/*
 +</code>
 +(ROOTCORE does not like existing output directories)
 +
  
 **Attention:** **Attention:**
Line 513: Line 545:
 </code> </code>
  
-When the jobs are done, the output files will be inside "Jobs" directory. Merge the ROOT outputs into one file as:+When the jobs are done, the output files will be inside the "Job" directory. Merge the ROOT outputs into one file as:
  
 <code bash> <code bash>
Line 541: Line 573:
 See the instruction on how  See the instruction on how 
 {{:asc:tutorials:atlas_connect_handout_-_xaod_2014.pdf| to use ATLAS connect for this tutorial}} {{:asc:tutorials:atlas_connect_handout_-_xaod_2014.pdf| to use ATLAS connect for this tutorial}}
 +
 +
 +
 +======Using Eclipse to develop ATLAS code======
 +
 +[[asc:tutorials:eclipse| here is the link to this tutorial]]
  
 //[[[email protected]|Sergei Chekanov (ANL)]] 2014/10/09 13:50// //[[[email protected]|Sergei Chekanov (ANL)]] 2014/10/09 13:50//
asc/tutorials/2014october.1414592953.txt.gz · Last modified: 2014/10/29 14:29 by asc