Alignment Intro

This introduction shows how to get the Alignment running. The examples are from TT-alignment and are based on Alignment v5r1.

Step 1. Setting up environment

To run the alignment you don't need to any packages locally. Just set up the runtime environment
   shell> lb-run Alignment/latest bash --norc
Have a look at the output to see which version is picked up.

Step 2. Preparing files

If you create a new directory and copy the config-files for every job, you can always return and check what settings you used.

So first prepare a folder for your run and copy the two example configuration files there

The configuration files are commented and you can find further explanations on the linked pages. Adjust the files as needed.

Step 3. Run a job

The alingment can be run on lxplus but you probably want to use CAF.

shell> cd <<your-dir>>
shell> $ESCHEROPTS/gaudipariter.py -n 8 -e 10000 -p 6 ./general-settings.py ./input-data.py | tee output.txt

This will run the alginment job over 10000 events, split it for 6 cores and make 8 iterations:
gaudipariter.py -n [number of iterations] -e [number of events] -p [number of cores]

There are different python-scripts you can use to start a job. They are explained in the TAlignmentManual

Usually you want to start form a clearly specified alignment database. To do this you can use the -d flag. -d can be used multiple times, later databases overwriting earlier ones:
$ESCHEROPTS/gaudipariter.py -n 8 -e 10000 -p 6 -d ~/db/Survey.db -d ~/db/TTnominal.db ./general-settings.py ./input-data.py This will start with the detector positions defined in Survey.db but set all TT values back to nominal (i.e. 0). This command will not work out of the box since you will be missing these databases. Check the list of generally available alignment databases.

To simplify starting the alignment jobs you might want to create a shell script.

Step 4. Understanding the results

The command above will create a subdirectory for each iteration called IterN. In these subdirectories you find the following files:
  • alignlog.txt : a summery of the most important infos
  • Alginment.db: the resulting DB
  • *.root: histograms produced by the monitoring algorithms
  • logfile.txt.gz: the output form the gaudi job

gaudipariter does not print anything while running. output.txt will therefore be empty until the job finishes. The logfile in each subdirectory is filled continuesly however. So to monitor the progress of a running job this file:
shell> less Iter0/logfile.txt
(To follow the output press [Shift] + [F].)

As soon as the job is finished output.txt will be filled and an additional alinglog.txt is created in the main directory. Since output.txt allows to find out which DB was used for a job, it is a good idea to keep this file. alinglog.txt contains all summaries of the iterations and is probably the first thing you want to look at. It's content is explained on the linked page.

More Info

Tips

using CAF

CAF are machines more powerful then lxplus that can be used for alignment jobs. Since these can not be submitted to the grid. To use CAF you first need to ask the responsible person (Joel Closier in June 2010) to grant you access.

To start an interactive shell on a CAF machine use:

bsub -Is -q lhcbinter /bin/tcsh -l
(It might be a good idea to put this into an alias.)

create a shell script

#!/bin/tcsh
$ESCHEROPTS/gaudipariter.py -n 8 -e 25000 -p 8 -d $HOME/db/Survey.db $1 `pwd`/general-settings.py `pwd`/input-data.py | tee output.txt
$1 in there allows to specify additional databases by adding
"-d ~/db/additional.db"
to the command line

Be sure to source the script. (Otherwise you lose the environment and need to SetupAlignment inside your script again.)

Using the Grid

Usually it's not possible to use the Grid for alignment jobs as one want to do multiple iteration with gaudipariter.py instead of the standard one iteration with gaudirun.py used by default on the Grid. It is possible however to use a trick to run the alignment jobs on the CERN computers of the grid.

  • make a python executable that runs gaudipariter.py on your options and then make a .tar.gz archive out of the AlignmentResults folder; for example if your option file is called alignMC.py:

#!/usr/bin/env python
import os, sys

cmd = 'gaudipariter.py -n3 -p1 -e200000 '+os.getcwd()+'/alignMC.py'

# Run the command
os.system('echo "Here is the command that will run:"')
os.system('echo "'+cmd+'"')
os.system(cmd)

# Compress AlignmentResults
os.system('echo "Compress folder AlignmentResults:"')
os.system('tar -zcvf AlignmentResults.tar.gz AlignmentResults')

N.B. always run on only one core (-p1) as the Grid currently does not support multithreaded applications.

  • make your python script executable: chmod 755 runAlignment.py (if your script is called runAlignment.py)

  • Write a ganga script to submit the job. Notice that if you indicated the PFNs to run over directly in the alignment option file you need to run at CERN.

# Setup application
app = GaudiPython(project='Alignment',version='v9r2') 
app.script = [ File('runAlignment.py') ]
        
# Setup Job
j = Job( name='VeloResolution', application=app )
j.name = 'Alignment'
j.inputsandbox += ['alignMC.py']
j.outputfiles += [LocalFile('*.tar.gz')]     
j.backend = Dirac()
j.backend.settings['Destination'] = 'LCG.CERN.ch'
j.submit()

-- NicolaChiapolini - 22-Jul-2010

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r8 - 2018-06-13 - GiulioDujany
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb 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