Upload
amber-paul
View
213
Download
0
Tags:
Embed Size (px)
Citation preview
Browsing Data with GaudiPythonBrowsing Data with GaudiPython
Disclaimers:
1. I am an apprentice!
2. The porpoise: we think GaudiPython could be quite useful for a LHCb physicist…
Browsing data with GaudiPythonBrowsing data with GaudiPython
H. Dijkstra, H. Dijkstra, JA. HernandoJA. Hernando, T. Ruf,, T. Ruf,
GaudiPython: a gate…GaudiPython: a gate…
LHCb code is in Python
GaudiPython: (most) Gaudi framework accessible via Python (GaudiPython v*)
+ the Event Model classes (Data)
“Bender”: Extra Gaudi-classes + DaVinci Tools + ‘LoKi’ for analysis
Why Python?:
It is a simple, intuitive, powerful OO language
Ads: ie.: no pointers, dynamically typed, heterogeneous containers, dictionaries
It supports interactivity and introspection
It is one for all: use for scripting, for programming, for interactive data-analysis
GaudiPython (we have used for… but we can do more…):
XXX?Enviroment: we use PanoramixEnv
Creating a simple Application
Browsing Data
Quick way to develop monitoring algorithms (histograms)…
> source PanoramixEnv vXrY
> cd ~/cmtuser/Vis/Panoramix/vXrY/cmt
> source setup.csh
An illuminating example (T.Ruf): anaSpillOver.py An illuminating example (T.Ruf): anaSpillOver.py
Import Gaudi
Create a Gaudi Application
Select a Data file
Get the Event/Histo Svc
Book histos
An example: anaSpillOver.py, histogram monitoring algoAn example: anaSpillOver.py, histogram monitoring algo
Create your Algorithm
Execution per event
Get the clusters
And fill the Histos
Add your algorithm to the Application
Run!!!
Final Print out
An example: anaSpillOver.py: 1,2,3, how to run? An example: anaSpillOver.py: 1,2,3, how to run?
~>python anaSpillOver.py
~>python
Python 2.3.4 (#1, Jun 7 2004, 11:39:13)
>> import gaudimodule
>> gaudi = gaudimodule.AppMgr(outputLevel = 2, jobptions = ‘spillOverDicts.opts)
1
2
3
As an script! (console)
At the prompt: (console)
From the Emacs menu:
# get the prompt:
(menu) Python->start interpreter
# Execute a region (fraction) or buffer (all):
(menu) Python->execute region/buffer
# define a fucntion, execute region and use it in the promt!
> source PanoramixEnv vXrY
> cd ~/cmtuser/Vis/Panoramix/vXrY/cmt
> source setup.csh
The option files and the result, an Hbook fileThe option files and the result, an Hbook file
Dictionaries
Algo and options
Note: You can see histos and analyze ntuple from Python!!
PyROOT (HIPYS)
GaudyPython extension in GaudyPython extension in BenderBender: Vanya’s similar example : Vanya’s similar example
From Bender import Gaudi
Creating the ‘GaudiHisto’Algorithm
Getting the data
plot = (book + fill) histogram
Configuring Gaudoi
Creating my algorithm
NOTE: Vanya’s will exports GaudiAlgorithms from Bender to GaudiPython
Interactivity and Introspection: ginspector.pyInteractivity and Introspection: ginspector.py
But… What data is there?, What methods has my
data? What are the options? …
Exploring the data What methods?
Module inspection What functions? What classes?
>> evh = evt[‘Header’]
>> dir(evh)
>> print evh.evtNum()
>> import ginspector
>> help(ginspector)
ginspector.py: What is in the DST & TES?ginspector.py: What is in the DST & TES?
Inspecting Data: PATH
“Header” TYPE
“EventHeader” Methods:
evtNum()
runNum()
>>ginspector.inspectData(evt,”dst_data.txt”)
NOTE: in the next version: we can have also the arguments of the methods (gracias Pere)
Ginspector: What properties?Ginspector: What properties?
Inspecting Properties Name and Type
AppMgr
iAlgorithm List of properties
>> ginspector.inspectProperties(gaudi,’dst_properties.txt’)
A repository of scripts and catalog, and testsA repository of scripts and catalog, and tests Different uses of Python: (one for all..)
Scripting:
1. create joboptions
Hugo’s stripping
2. stage data in castor
3. send jobs
Programming:
1. Physics Analysis:
Vanya’s Bender
Interactive Analysis:
Monitoring:
spillOver (T.Ruf,H.D.)
With Panoramix
Reconstruction: (plans)
debug: event by event
Histos/Ntuple Analysis:
PyROOT (HIPYS)
it is time to replace your “kumacs”
In the repository : A repository of packages python modules
/python directory in the packages CMT will take care of PYTHONPATH
I catalog in the web: Python script name, author, description, comment
Test before a release (Brunel, DaVinci) Some problems (linux): i.e RTTC a simple script did not (almost solved now)! A set of meaningful GaudiPython test scripts before a release?
Other uses of GaudiPythonOther uses of GaudiPython
Visualization: Steer Panoramix from a Python script
What to draw and how: T. Ruf examples Testing/debugin:
Click in a object in Panoramric and get it in the Python prompt (i.e track)
Operate it in Python: i.e remove measurements and refit
Tracking Debuging/Prototyping the reconstruction event by
event In the Python prompt: tracks, extrapolator, fitter
Geometry Debugin/testing detector geometries/aligment
From Bender we can import to and update DetectorDescription classes
Debug/test Volumes, DetectorElements…
Enlarging the communityEnlarging the community
LHCb code is in Python
GaudiPython + Event Model classes (Data) + “Bender”
Making it more powerful (Pere, Vanya):
exposing to GaudiPython more features of Gaudi: NTuples
importing fron Bender common modules: GaudiAlgorithm
extending to DetDescription classes
We think it is useful for the Physicist:
Simple, intuitive, powerful, interactive language: scripts, programming, analysis
Allows easy browse of the data: create histograms, ntuples
convenient for: prototyping, debugging, analysis event per event
Enlarging the community:
a repository with pythons scripts and a catalog on the web (TR, JAH) standard
meaningful test with some GaudiPython scripts before a release?
(check of data size, spill over…etc)