Functional Analysis Description Language backend for accessing ATLAS xAOD files.
Project description
func_adl_xAOD
Backend that converts qastle
to run on an ATLAS xAOD backend.
Introduction
This allows you to query hierarchical data stored in a root file that has been written using the ATLAS xAOD format. This code allows you to query that.
Features
A short list of some of the features that are supported by the xAOD
C++ translator follows.
Python
Many, but not all, parts of the python
language are supported. As a general rule, anything that is a statement or flow control is not supported. So no if
or while
or for
statements, for example. Assignment isn't supported, which may sound limiting - but this is a functional implementation so it is less to than one might think.
What follows are the parts of the language that are covered:
- Function calls, method calls, and lambda calls (and lambda functions), with some limitations.
- Integer indexing into arrays
- Limited tuple support as a means of collecting information together, or as an output to a ROOT file or pandas
DataFrame
orawkward
array. - Limited list support (in same way as above). In particular, the
append
method is not supported as that modifies the list, rather than creating a new one. - Unary, Binary, and comparison operations. Only 2 argument comparisons are supported (e.g.
a > b
and nota > b > c
). - Using
and
andor
to combine conditional expressions. Note that this is written as&
and|
when writing an expression due to the factpython
demands abool
return fromand
andor
when written in code. - The conditional if expression (
10 if a > 10 else 20
) - Floating point numbers, integers, and strings.
xAOD Functions
You can call the functions that are supported by the C++ objects as long as the required arguments are primitive types. Listed below are special extra functions attached to various objects in the ATLAS xAOD data model.
The Event
The event object has the following special functions to access collections:
Jets
,Tracks
,EventInfo
,TruthParticles
,Electrons
,Muons
, andMissingET
. Each function takes a single argument, the name of the bank in the xAOD. For example, for the electrons one can pass"Electrons"
.
Adding new collections is fairly easy.
The Jet Object
Template functions don't make sense yet in python.
getAttribute
- this function is templated, so must be called as eithergetAttributeFloat
orgetAttributeVectorFloat
.
Math
- Math Operators: +, -, *, /, %
- Comparison Operators: <, <=, >, >=, ==, !=
- Unary Operators: +, -, not
- Math functions are pulled from the C++
cmath
library:sin
,cos
,tan
,acos
,asin
,atan
,atan2
,sinh
,cosh
,tanh
,asinh
,acosh
,atanh
,exp
,ldexp
,log
,ln
,log10
,exp2
,expm1
,ilogb
,log1p
,log2
,scalbn
,scalbln
,pow
,sqrt
,cbrt
,hypot
,erf
,erfc
,tgamma
,lgamma
,ceil
,floor
,fmod
,trunc
,round
,rint
,nearbyint
,remainder
,remquo
,copysign
,nan
,nextafter
,nexttoward
,fdim
,fmax
,fmin
,fabs
,abs
,fma
. - Do not use
math.sin
in a call. Howeversin
is just fine. If you do, you'll get an exception during resolution that it doesn't know how to translatemath
. - for things like
sum
,min
,max
, etc., use theSum
,Min
,Max
LINQ predicates.
Testing and Development
Setting up the development environment:
- After creating a virtual environment, do a setup-in-place:
pip install -e .[test]
To run tests:
pytest -m "not xaod_runner"
will run the fast tests.pytest -m "xaod_runner"
will run the slow tests that require docker installed on your command line.docker
is involved via pythonsos.system
- so it needs to be available to the test runner.- The CI on github is setup to run tests against python
3.7
,3.8
, and3.9
(only the non-xaod-runner tests).
Contributing:
- Develop in another repo or on a branch
- Submit a PR against the
master
branch.
In general, the master
branch should pass all tests all the time. Releases are made by tagging on the master branch.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file func_adl_xAOD-1.2a1.tar.gz
.
File metadata
- Download URL: func_adl_xAOD-1.2a1.tar.gz
- Upload date:
- Size: 41.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 415dc5ab3f6be6bfce0d0f0a428b570f7cc470d26cb1f6d35c6f221e1a5599eb |
|
MD5 | 01d4ffbd08374c9289c8b515bee213f7 |
|
BLAKE2b-256 | 8157ec83e58e17437b326b55eae8e097514ff3523e80b55e3648e02cc9370cbb |
File details
Details for the file func_adl_xAOD-1.2a1-py3-none-any.whl
.
File metadata
- Download URL: func_adl_xAOD-1.2a1-py3-none-any.whl
- Upload date:
- Size: 48.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05d9283ec78007c18a4f6e5aaf0156df84123c06c5f399129c046ec500dd4054 |
|
MD5 | 1e00589d349b6250758772a2706015e3 |
|
BLAKE2b-256 | fe9ee8d2172f1f0bf931f0a0924bfd7efd5c743a6aafec2a88ed46a76e897774 |