AthenaBL
This package is an attempt to reduce misery and desperation when preparing analysis jobOptions in athena. It provides bits of code to configure:
- Inputfiles using wildcards and paths from local directories or castor
- Geometry, conditions and data source: real data or simulation (autoConfiguration used by default)
- Use of TAGs for filtering
- Filtering based on event number
- Interactive tools
Installation
Setup athena and go to your workarea.
cp -r ~blenzi/public/AthenaBL .
cd AthenaBL/cmt
cmt config
gmake
Functionalities
Opening a file
Done by
openFile.py
. Accepts wildcards and paths from local directories and castor. One needs to define the variable
inputfile
as a list or string. If
geo
is specified, the given geometry is used and loaded. On autoConfiguration, one has to say
geo = True
to load it. Conditions (
cond
) and data source (
data = True
) can also be specified, but are defined automatically by default. If you want to define them manually:
autoConfiguration = False
cond = 'COMCOND-ES1PST-001-00'
geo = 'ATLAS-GEO-08-00-02'
data = True
Autoconfiguration
The geometry, conditions, field, data source, etc are configured automatically by default. You can also specify what to configure, re-defining the variable
autoConfiguration
before adding
openFile.py
:
autoConfiguration = False
# or
autoConfiguration = ['FieldAndGeo']
# or
autoConfiguration = ['ProjectName', 'RealOrSim', 'FieldAndGeo', 'BeamType', 'ConditionsTag', 'DoTruth', 'LumiFlags'] # , 'InputType' not handled for DESD_COLLCAND
Analyses with TAGs
Create a
PoolFileCatalog
beforehand, using the command
pool_insertFileToCatalog
for local files or using
getCastorFiles.py for files on castor. In your jobOptions, set the
inputfile
to the TAG(s) that you want to use and include the following lines:
TAG_query = 'EventNumber == 872430'
include("AthenaBL/useTAG.py")
Event filter
To loop only on a subset of the events you can use the event filter. Specify either a list of event numbers or a file containing one entry per line, adding the lines:
events = [872430]
# or
events = 'my_events.txt'
include("AthenaBL/eventFilter.py")
the script will determine automatically the
EventInfo
collection, provided only one is present. If this is not the case, set the variable
evt_info
to the proper collection.
Accesing files in castor
The script
getCastorFiles.py
can provide a list of files selected with wildcards, which is used by
openFile.py
. It can be run from the command line to check this list, to insert files into a PoolFileCatalog (
-I
option), and to copy the files locally (
-c
option). For help:
getCastorFiles.py -h
Interactive use of athena
By launching:
athena -i myJobOptions.py AthenaBL/interact.py
the job will be initialized and proceed to the first event. The following functions / variables are provided:
-
sg
variable, the StoreGateSvc. To load a collection: sg['StacoMuonCollection']
, or sg.retrieve('EventInfo')
-
getNextEvent()
: goes to the next event accepted by the filter, if present
-
getEventNumber()
: the number of the current event
-
tict
(TrackInCaloTools) and text
(TrackExtrapolatorToCalo) if doTrackInCaloTools = True
Examples
The
test
directory contains examples of analysis using TAGs and event filter. A very simple jobOptions file could be:
inputfile = '/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/ESD/f189/data09_900GeV.00142191.physics_MinBias.recon.ESD.f189/*'
include("AthenaBL/openFile.py")
# Add your jobOptions here
--
BrunoLenzi - 15-Dec-2009