Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) Application of Geant4 Python Interface Koichi Murakami KEK / CRC Let's start with.

Slides:



Advertisements
Similar presentations
The Geant4 Kernel: Status and Recent Developments John Apostolakis, Gabriele Cosmo – CERN / PH Makoto Asai – SLAC On behalf the Geant4 collaboration April.
Advertisements

View-Based Application Development Lecture 1 1. Flows of Lecture 1 Before Lab Introduction to the Game to be developed in this workshop Comparison between.
Construction process lasts until coding and testing is completed consists of design and implementation reasons for this phase –analysis model is not sufficiently.
1 Automating Auto Tuning Jeffrey K. Hollingsworth University of Maryland
Acceptance Testing vs. Unit Testing: A Developers Perspective Owen Rogers Rob Styles
1 A Test Automation Tool For Java Applets Testing of Web Applications TATJA Program Demonstration Conclusions By Matthew Xuereb.
RDz and Process Integration Using Menu Manager and HATS to customize your RDz installation David Myers.
Molecular Biomedical Informatics Web Programming 1.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 23 – ASP.NET Outline 23.1 Introduction 23.2.NET Overview NET Framework ASP (Active.
Database System Concepts and Architecture
Executional Architecture
Enhancing Spotfire with the Power of R
Chapter Modules CSC1310 Fall Modules Modules Modules are the highest level program organization unit, usually correspond to source files and.
First Step on User Commands Makoto Asai (SLAC) Geant4 Users CERN Nov. 11th, 2002.
User Interface The full set of lecture notes of this Geant4 Course is available at
GEant4 Microdosimetry Analysis Tool - GEMAT Fan Lei, Peter Truscott & Petteri Nieminen SPENVIS/Geant4 Workshop, Leuven, Belgium 05 October 2005.
Geant4 v9.2p02 User Interface I Makoto Asai (SLAC) Geant4 Tutorial Course.
Apache Struts Technology
SCRIPTING LANGUAGE. The first interactive shells were developed in the 1960s to enable remote operation of the first time-sharing systems, and these,
Victor Serbo, SLAC30 September 2004, Interlaken, Switzerland JASSimApp plugin for JAS3: Interactive Geant4 GUI Serbo, Victor (SLAC) - presenter Donszelmann,
Visual Basic 6.0 Derived from BASIC Developed by Microsoft in 1998 An event driven programming language Associated with a development environment.
Doxygen: Source Code Documentation Generator John Tully.
Improvements in Interface, Intercoms and environments Koichi Murakami (KEK/CRC) Koichi Murakami Geant4 Collaboration Workshop (18/Sep/2007) 1.
JCE A Java-based Commissioning Environment tool Hiroyuki Sako, JAEA Hiroshi Ikeda, Visible Information Center Inc. SAD Workshop.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
SCRAM Software Configuration, Release And Management Background SCRAM has been developed to enable large, geographically dispersed and autonomous groups.
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
Manage Engine: Q Engine. What is it?  Tool developed by Manage Engine that allows one to test web applications using a variety of different tests to.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
15/Jul/054th Workshop on Geant4 Bio-medical Developments and Physics Validation 1 Python Interface for Geant4 Medical Applications K.Murakami (KEK) 15/Jul/05.
Bacon A Penetration and Auditing Framework Hernan Gips
JAS3 + AIDA LC Simulations Workshop SLAC 19 th May 2003.
JSP Java Server Pages Softsmith Infotech.
Validation and TestEm series Michel Maire for the Standard EM group LAPP (Annecy) July 2006.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Interface parallel session report Hajime Yoshida.
Java Root IO Part of the FreeHEP Java Library Tony Johnson Mark Dönszelmann
Tot 15 LTPDA Graphic User Interface summary and status N. Tateo 26/06/2007.
Contents 1.Introduction, architecture 2.Live demonstration 3.Extensibility.
V. Serbo, SLAC ACAT03, 1-5 December 2003 Interactive GUI for Geant4 by Victor Serbo, SLAC.
Root based event display Dmitry Romanov October 19, 2010.
W. Pokorski - CERN Simulation Project1 Python binding for Geant4 toolkit using Reflex/PyROOT tool Witek Pokorski EuroPython 2006, CERN, Geneva
The ALICE Simulation Strategy Andreas Morsch For the ALICE Offline Group Joint STAR/ALICE Offline Meeting Brookhaven National Laboratory, Upton, NY April.
SciDAC SSS Quarterly Report Sandia Labs August 27, 2004 William McLendon Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed.
SiD Workshop October 2013, SLACDmitry Onoprienko SiD Workshop SLAC, October 2013 Dmitry Onoprienko SLAC, SCA FreeHEP based software status: Jas 3, WIRED,
Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) Practical Usage of Geant4Py Koichi Murakami KEK / CRC Let's start with " >>> import.
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
ROOT 2005 Workshop, Sept UAL and ROOT The next episode in the UAL and ROOT integration V. Fine, N. Malitsky, R.Talman.
Geant4 Activities in Japan Some news from Takashi Sasaki, Koichi Murakami, Akinori Kimura and colleagues.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 14 Database Connectivity and Web Technologies.
INFSO-RI Enabling Grids for E-sciencE Using of GANGA interface for Athena applications A. Zalite / PNPI.
1 Exercises 0 Go inside the “hadrontherapy” directory: cd hadrontherapy Copy the Hadrontherapy example to your home folder: cp –r $G4INSTALL/examples/advanced/hadrontherapy.
Geant4 on Web for Education, … - recent updates - Koichi Murakami (KEK/CRC) Koichi MurakamiGeant4 FFJPL Meeting (02/Sep/2008)1.
Visual Programming Borland Delphi. Developing Applications Borland Delphi is an object-oriented, visual programming environment to develop 32-bit applications.
Object-Oriented Track Reconstruction in the PHENIX Detector at RHIC Outline The PHENIX Detector Tracking in PHENIX Overview Algorithms Object-Oriented.
Geant4 for (Medical) Education “ Geant4 for (Medical) Education ” Toolkit and Courseware Geant4 Medical Workshop in Lyon 21 July 2006 Universite-Lyon I.
GRID & Parallel Processing Koichi Murakami11 th Geant4 Collaboration Workshop / LIP - Lisboa (10-14/Oct./2006) 1 GRID-related activity in Japan Go Iwai,
The Holmes Platform and Applications
CMS High Level Trigger Configuration Management
Introduction Python is an interpreted, object-oriented and high-level programming language, which is different from a compiled one like C/C++/Java. Its.
Pipeline Execution Environment
GUI Parallel Session Hajime Yoshida
UI & Interfaces : latest updates
Introduction to MATLAB
Support for ”interactive batch”
LTPDA Graphic User Interface summary and status
A Virtual Implementation of VELA (CLARA)
Advanced Examples Alex Howard, Imperial College, UK
Java Analysis Studio - Status
Use of GEANT4 in CMS The OSCAR Project
Presentation transcript:

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) Application of Geant4 Python Interface Koichi Murakami KEK / CRC Let's start with " >>> import Geant4" A Geant4-Python Bridge

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 2Python Shell Environment front end shell script language Programming Language much easier than C++ supporting Object-Oriented programming providing multi-language binding (C-API) dynamic binding » modularization of software components » many third-party modules (just plug-in) » software component bus Runtime Performance slower than compiled codes, but not so slow. Performance can be tunable between speed and interactivity.

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 3 Motivation of Geant4-Python Bridge Improving functionalities of current Geant4 UI more powerful scripting environment » driving Geant4 on a Python front end » flow control, variables, arithmetic operation flexibility in the configuration of user applications Modularization of user classes with dynamic loading scheme » DetectorConstruction, PhysicsList, PrimaryGeneratorAction, UserAction-s » It helps avoid code duplication. quick prototyping and testing Software component bus interconnectivity with many Python external modules, » analysis tools (ROOT/AIDA), plotting tools (SciPy/matplotlib) middleware for application developers » GUI applications/web applications » much quicker development cycle

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 4 Geometry-A ParticleGun ExN03Geometry MedicalBeam ParticleBeam PhysicsList-EMstd PhysicsList-A PhysicsList-EmLowE ExN02Geometry Analysis-A Analysis-B Analysis-C User Application Geometry modules PGA modules PL modules Analysis modules import Modular Approach and Software Component Bus Python Bus Analysis ROOT AIDA GUI QT Wx Web App.

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 5 Geant4Py “Geant4Py” is included in the Geant4 distribution since the 8.1 release. please check the directory “environments/g4py/” Linux and MacOSX(10.4+XCode 2.3/4) are currently supported. A G4-Python bridge as “Natural Pythonization” of Geant4 start with just importing the module; » >>> import Geant4 not specific to particular applications same class names and their methods keeping compatibility with the current UI scheme minimal dependencies of external packages » only depending on Boost-Python C++ Library, which is a common, well-established and freely available library.

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 6 Currently, over 100 classes over different categories are exposed to Python. Classes for Geant4 managers » G4RunManager, G4EventManager, … UI classes » G4UImanager, G4UIterminal, G4UIcommand, … Utility classes » G4String, G4ThreeVector, G4RotationMatrix,... Classes of base classes of user actions » G4UserDetetorConstruction, G4UserPhysicsList, » G4UserXXXAction ―PrimaryGenerator, Run, Event, Stepping,... » can be inherited in Python side Classes having information to be analyzed » G4Step, G4Track, G4StepPoint, G4ParticleDefinition,... Classes for construction user inputs » G4ParticleGun, G4Box, G4PVPlacement,... NOT all methods are exposed. Only safe methods are exposed. » Getting internal information are exposed. » Some setter methods can easily break simulation results. What is Exposed to Python

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 7 Extensibility Your own classes can be exposed, and create your own modules in the Boost-Python manner. Once an abstract class is exposed to Python, you can implement/override its derived class in the Python side. BOOST_PYTHON_MODULE(mymodule){ class_ ("MyApplication", "my application").def("Configure", &MyApplication::Configure) ; class MyRunAction(G4UserRunAction): “””My Run Action””” def BeginOfRunAction(self, run): print "*** #event to be processed (BRA)=“, \ run.GetNumberOfEventToBeProcessed() def EndOfRunAction(self, run): print "*** run end run(ERA)=", run.GetRunID()

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 8 Compatibility with G4UImanager Geant4Py provides a bridge to G4UImanager. Keeping compatibility with current usability UI Commands gApplyUICommand(“/xxx/xxx”) allows to execute any G4UI commands. Current values can be obtained by gGetCurrentValues(“/xxx/xxx”). Existing G4 macro files can be reused. gControlExecute(“macro_file_name”) Front end shell can be activated from Python gStartUISession() starts G4UIsession. » g4py(Idle): // invoke a G4UI session » when exit the session, go back to the Python front end Python variables/methods starting “g” are global.

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 9 Predefined Modules We will also provide site-module package as predefined components for easy-to-use as well as good examples. Material » NIST materials via G4NistManager Geometry » “exN03” geometry as pre-defined geometry » “EZgeometry” ―provides functionalities for easy geometry setup Physics List » pre-defined physics lists » easy access to cross sections, stopping powers,... via G4EmCalculator Primary Generator Action » particle gun / particle beam Sensitive Detector » calorimeter type / tracker type Scorer » MC particle/vertex They can be used just by importing modules.

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 10 Yet Another Way to Create Geometry “EZgeom” module provides an easy way to create simple users geometries; structure of geometry construction is hidden; » Solid/Logical Volume/World Volume » “EZvolume” is the only gateway to a physical volume from users side. automatic creation of the world volume » volume size should be cared. creating CSG-solid volumes (Box, Tube, Sphere, …) changing volume materials creating nested volumes » placing a volume in the world by default creating replicas / voxelizing BOX volumes setting detector sensitivities setting visualization attributes

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 11 Example of using EZgeom package import NISTmaterials from EZsim import EZgeom from EZsim.EZgeom import G4EzVolume NISTmaterials.Construct() # set DetectorConstruction to the RunManager EZgeom.Construct() # reset world material air= gNistManager.FindOrBuildMaterial("G4_AIR") EZgeom.SetWorldMaterial(air) # dummy box detector_box=G4EzVolume("DetectorBox") detector_box.CreateBoxVolume(air, 20.*cm, 20.*cm, 40.*cm) detector_box_pv= detector_box.PlaceIt(G4ThreeVector(0.,0.,20.*cm)) # calorimeter placed inside the box cal= G4EzVolume("Calorimeter") nai= gNistManager.FindOrBuildMaterial("G4_SODIUM_IODIDE") cal.CreateBoxVolume(nai, 5.*cm, 5.*cm, 30.*cm) dd= 5.*cm for ical in range(-1, 2): calPos= G4ThreeVector(dd*ical, 0., 0.) cal.PlaceIt(calPos, ical+1, detector_box) 02 1 less than 20 lines!!

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 12 A Medical Application Example Several examples of using Python interface are/will be presented. An example of “water phantom dosimetry” This demo program shows that a Geant4 application well coworks with ROOT on the Python front end. You can look features of; dose calculation in a water phantom Python implementation of sensitive detector Python overloading of user actions on-line histogramming with ROOT visualization

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 13 Pythonization Level Various level of pythonized application can be realized. It is completely up to users! Optimized point depends on what you want to do in Python. There are two metrics; Execution Speed » wrap out current existing C++ components, and configure them » no performance loss in case of object controller Interactivity » more scripting in interactive analysis/rapid prototyping » pay performance penalty to interpretation in stepping actions.

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 14 Applications of Pythonization Execution Speed Interactivity/ Pythonization Productions changing conditions - physics validation/verification Coworking with other software components - interactive analysis Fully scripting - rapid prototyping - educational uses modularized “compiled” components. - detector construction - physics list - user actions, and handling components by scripting compiled modules and scripting user actions - filling histograms using “predefined” module and scripting Performance can be tunable between speed and interactivity. “radiotherapy simulation for different configurations of different facilities” “web application: Users can execute server applications via web browsers” “online histogramming with ROOT” “GUI control panel for educational uses: Various parameters (detector parameters, initial particles, processes, etc) can be changed on GUI” “plotting photon cross sections”

Koichi Murakami Geant4 Users Conference – LIP / Lisboa (9/Oct./2006) 15 Summary A Python interface of Geant4 (Geant4Py) has been well designed and Geant4Py is now included in the latest release, 8.1. check the “environments/g4py/” directory Python as a powerful scripting language much better interactivity » easy and flex configuration » rapid prototyping Python as “Software Component Bus” modularization of Geant4 application natural support for dynamic loading scheme interconnectivity with various kind of software components. » histogramming with ROOT These applications show the flexibility and usefulness of dynamic configuration of user applications using Python.