3-5 July 2006
CERN, Geneva
Europe/Zurich timezone

Interfacing Python and the C++ Frameworks used by High Energy Physicists

3 Jul 2006, 16:35
40-SS-D01 (CERN, Geneva)


CERN, Geneva

Python in Science Python in Science


Dr Pere Mato (CERN)


In this paper we present the developments in the area of interfacing Python with large-scale C++ frameworks, driven by the needs of the new generation of High Energy Physics experiments currently in preparation at CERN. The physics software being developed for detector simulation, data reconstruction, and data analysis is mainly written in C++. Yet, scripting is an essential functionality of the complete software system that we are providing to the physicists, and therefore it is essential to have a performing, easy to code to, and flexible interface from C++ to Python. Python is being used for application configuration, rapid prototyping, and interactive physics analysis. The Python interface has been built on top of the extended C++ reflection capabilities provided by such tools as CINT and Reflex. This reflection information, in terms of dynamic loadable libraries, can be used for the creation of Python bindings to C++ classes, functions, variables, etc., in a fully automated manner, since this information is already provided for by many end-user libraries for other purposes, such as object persistency. A consistent and automatic mapping of any C++ construct into an equi- purpose Python construct is achieved easily and elegantly. We finalize with a few use case examples demonstrating the capabilities of this interface.

Primary authors

Dr Pere Mato (CERN) Dr Wim Lavrijsen (LBNL)

Presentation materials