Setup of Athena

I assume that we are working with Athena release 14.2.20 at cern, and it has already been setup, via

source ~/cmthome/setup.sh -tag=14.2.20,32
or similar commands on your account.

In the tutorial we will work with the UserAnalysis-package which we will therefore check out in our Athena working directory, via

cmt co -r UserAnalysis-00-13-04 PhysicsAnalysis/AnalysisCommon/UserAnalysis
go to
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt
and type
cmt config
source setup.sh
gmake
I guess the gmake step is not necessary, so you might skip this command. We change now to
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/share
and edit the following lines in the main joboption file Analysis.Skeleton_topOptions.py
// ServiceMgr.EventSelector.InputCollections = [ "AOD.pool.root" ]
ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/groups/PAT/Tutorial/AtlasOffline-14.2.10/AODs/valid1.005200.T1_McAtNlo_Jimmy.recon.AOD.e322_s435_r432_tid022496/AOD.022496._00001.pool.root.1" ]
where we just give an example input file. Now we test the whole setup so far, via
athena.py AnalysisSkeleton_topOptions.py
root AnalysisSkeleton.aan.root

Now, we want to run the exact same job with ganga!

Since we have already a setup Athena enviroment and we are in the run-directory, we well just type

get_files -jo HelloWorldOptions.py
as we will need the HelloWorldOptions.py for our Ganga test.

Starting with Ganga

Start again a clean shell and setup ganga with the lines given above. If you start ganga for the first time, type
ganga -g
This creates a file, named .gangarc. Ganga will produce quite a lot of files during its runtime. The directory of the files can be changed by editing the .gangarc file and add the following line
gangadir = /project/atlas/Users/yourusernamehere/gangadir

Now we can start the first time Ganga, by simply typing

ganga

typing

jobs
will give you an opverview of your jobs. Jobs can be killed and removed via
jobs(JOBID).remove() 
To quit again, just press CTRL-D.

Simple Ganga Jobs

Now go to your project directory
cd /project/atlas/Users/yourusernamehere
and create myscript.sh
#!/bin/sh
echo 'myscript.sh running...'
echo "----------------------"
/bin/hostname
echo "HELLO!"
echo "----------------------"
and gangaScript.py. Do not forget to modify the following to your directory structure+
j = Job()
j.application=Executable()
j.application.exe=File('/project/atlas/Users/yourusernamehere/myscript.sh')
j.backend=PBS()
j.submit() 
The imprtant point is here that we have chosen LCG() as backend, i.e. the script will be executed on the grid. Now start ganga again and submit the job to the LCG-grid
execfile("./gangaScript.py")
the status can be tested with
jobs
You can see the output of the job when it has finished under
/project/atlas/Users/yourusernamehere/gangadir/workspace/yourusernamehere/LocalAMGA/0
if 0 was the job ID. This was our first grid-job submitted via ganga!

Using Ganga on the batch system

Now, we setup Athena 14.2.20 again and go to the UserAnalysis package, which we have checked out before

source ~/cmthome/setup.sh -tag=14.2.20
cd /afs/cern.ch/user/u/userid/Athena/14.2.20/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt
cmt config
source setup.sh
Currently there is a problem in Athena 14.x.y which introduces some Python conflicts. Here is a workaround. You have to delete /afs/cern.ch/sw/lcg/external/Python/2.5/slc4_ia32_gcc34/lib/python2.5 out of the Python Path Variable $PYTHONPATH. In order to so, just print it via
echo $PYTHONPATH
The take the above entry away and set the remain variable again
export PYTHONPATH=...
We change to the run directroy and create a file named gangaHello.py
config["Athena"]["ATLAS_SOFTWARE"] = "/afs/cern.ch/atlas/software/releases"
j = Job()
j.application=Athena()
j.application.exclude_from_user_area=["*.o","*.root*","*.exe"]
j.application.prepare(athena_compile=True)
j.application.option_file='$HOME/Athena/14.2.20/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/HelloWorldOptions.py'
j.application.max_events='10'
j.backend=Local()
j.submit() 
This Ganga Job means the following
  • Line 1 defines the job
  • Line 2 sets it as an Athena job
  • Line 3 makes a tarball of the local packages which are to be sent to the Grid for execution
  • Line 4 tells ganga that this package should be compiled at the host
  • Line 5 points the job to the job options
  • Line 6 sets the number of events
  • Line 7 tells the job to run on the Local machine
  • Line 8 submits the job
Now we are running a script locally, by starting ganga and type
execfile("./gangaHello.py")
To run this job on the batch system, we only have to change the following in the previously defined Ganga Job.
#j.backend=Local()
j.backend=LSF(queue='5nm')

Athena Analysis within Ganga

Now we want to have our own analysis code running with ganga. In order to simulate that, we will just edit two lines (260) on PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/AnalysisSkeleton.cxx to

  m_h_elecpt     = new TH1F("elec_pt","pt el",50,0,250.*GeV);
  sc = m_thistSvc->regHist("/AANT/GangaDemo/elec_pt",m_h_elecpt);
So, if the directory GangaDemo will appear in our output root file, then we are sure that our version has been used. Before starting, we test if everything is compiling
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt
cmt config
source setup.sh
gmake

Again, We change to the run directroy and create a file named gangaAnalysis.py

config["Athena"]["ATLAS_SOFTWARE"] = "/afs/cern.ch/atlas/software/releases"
j = Job()
j.name='AnalysisExample'
j.application=Athena()
j.application.exclude_from_user_area=["*.o","*.root*","*.exe"]
j.application.prepare(athena_compile=True)
j.application.option_file='$HOME/Athena/14.2.20/PhysicsAnalysis/AnalysisCommon/UserAnalysis/share/AnalysisSkeleton_topOptions.py'
j.inputdata=ATLASLocalDataset()
j.inputdata.names=['/afs/cern.ch/atlas/groups/PAT/Tutorial/AtlasOffline-14.2.10/AODs/valid1.005200.T1_McAtNlo_Jimmy.recon.AOD.e322_s435_r432_tid022496/AOD.022496._00001.pool.root.1']
j.application.max_events='-1'
#j.splitter=AthenaSplitterJob()
#j.splitter.numsubjobs=2
#j.merger=AthenaOutputMerger()
j.outputdata=ATLASOutputDataset()
j.outputdata.outputdata=['AnalysisSkeleton.aan.root']
j.outputdata.location = '$HOME/Athena/Ganga_Output'
j.backend=LSF(queue='atlascatshort')
j.submit()
and run it in ganga via
execfile("./gangaAnalysis.py")

Ganga can also handle job-Splitting and job-Merging. For this, you just have to decomment the following lines in the above Job definition

#j.splitter=AthenaSplitterJob()
#j.splitter.numsubjobs=2
#j.merger=AthenaOutputMerger()
Obviously you have to use a larger input sample for this to be effective.

Further comments

t.b.d.

-- MaxBaak - 11 Sep 2008

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2008-09-12 - unknown
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback