Using modern software technologies for detector and event visualization

N. V. Khomutov JINR, Dubna, Russia

Developments of Researches in Lepton Flavor Physics with Muons ! Tokyo ❋ 5-7 April 2018 1 Paraview

● ParaView is an open-source, multi-platform data analysis and visualization application for extremely large datasets using distributed memory computing resources ● Developed jointly by Sandia National Labs + Los Alamos National Lab + Kitware Inc. ● Latest binary release 5.4.1 (2017-Aug), available for /Mac/Windows ● ParaView is based on VTK and libraries with Python embedding http://www.paraview.org

2 Paraview Main Features

● An open, flexible, and intuitive user interface ● Cross-platforms data analysis ● Client-Server architecture ● Multiple simultaneous data views ● An extensible, modular architecture based on open standards ● Support for distributed computation models to process large data sets on desktop and HPC systems ● Animation possibilities

3 Paraview User Interface

● Menu Bar ● Toolbars

● Pipeline Browser

● Object inspector

● 3D View

4 Two major workflow Paraview modes

● Standalone Mode Client

Data Render Server Server

● Client-Server Mode Client 1 HPC System

Data Render Client 2 ServerData RenderServer ServerData RenderServer ServerData RenderServer Server Server Client `n`

5 Visualization Toolkit

● VTK is an open-source, freely available software system for 3D computer graphics, image processing, and visualization ● VTK is cross-platform and runs on Linux, Windows, Mac, and platforms ● Integrates seamlessly with a variety of windowing systems including Qt, FLTK, wxWindows, Tcl/, Python/Tk, Java, X11, , Windows, Cocoa, and Carbon ● VTK has excellent support for distributed-memory parallel processing under MPI ● VTK development was started in December 1993 by Will Schroeder, Ken Martin and Bill Lorensen https://www.vtk.org 6 VTK is Language Agnostic

● The core functionality of VTK is written in ++ to maximize efficiency ● VTK’s build system has built-in support to generate primary bindings to Python, Java, and Tcl. ● Interpreted layer generated automatically by VTK wrapping process

7 HepRep XML format

● HepRep format is the basic part of a complete generic interface for client-server HEP Event Display Representables. ● The .heprep file is an XML format, which means that it is self- describing and a hierarchical structure. ● HepRep was not developed specifically for Geant4 but is intended as a generic interface between data sources and display clients. ● HepRep does not have exactly the same set of graphics primitives as Geant4. Geant4 solves this by decomposing some of the more complex Geant4 shapes into simpler polygons. ● HepRep v2.0 served by BaBar HepEventServer since Dec 2000 http://www.slac.stanford.edu/BFROOT/ 8 Geant4 -> HepRep XML -> Paraview

● Install Geant4 with following option: DGEANT4_USE_SYSTEM_ZLIB=ON (by default is OFF) ● Command macros to produce HepRep XML file /vis/open HepRepXML /vis/drawVolume /vis/viewer/flush ● Adam L. Lyon (FNAL g-2 Collaboration) developed plugin for Paraview named ‘GeantToVTK-1.4’

9 Muon g-2 Event Display

Main developer: V. Krylov, JINR

● The main goal is to create a complex application in order to visualize interactive 3D model of Muon g-2 framework for demonstrative and supervisory tasks ● The application should receive significant spot check of data from common online data stream and visualize it in intuitive and well apprehensible forms ● Event Monitor was developed as multithreaded and multi-document application based on Python v2.7 cross- platform language and VTK toolkit v6.3.0 ● Connection to online data steam is implemented

by ZeroMQ network client 10 HepRep XML -> Paraview -> VTK

● Memory size and loading time problems o g-2 Geometry.heprep.zip file size is 60.9 GBytes o it includes more then 13,535 graphical objects o workstation need more then 16 GBytes RAM! o Paraview loading time ~ 10 min (MAC workstation) ● Need to translate HepRep to VTK multi block format o g-2 Geometry.vtm.zip file size is 62 MBytes o it includes more then 13,535 vtk files o Loading time ~ 25 sec (notebook)

11 Muon g-2 Event Display user interface

12 Muon g-2 Event Display calorimeters histograms

13 Muon g-2 Event Display presentation view

14 Examples of PIBETA/PEN detector visualisation with VTK

15 Thank you!

16 HepRep XML file example 17 Muon g-2 Event Display Prerequisites

● Along with Python v2.7 the following libraries are used: ➢ Conda v4.3.17 (3-clause BSD license), you should use this repository on Mac OS platform ➢ Python v2.7.3 x64 (GPL compatibility); ➢ VTK Toolkit v6.3.0 x64 (BSD license), the Visualization Toolkit is an open-source cross-platform software system for 3D computer graphics; ➢ wxPython v4.0.0rc x64 (LGPL License), cross-platform GUI toolkit for the Python; ➢ PyZMQ v16.0.2 amd64 (LGPL License), this is the Python bindings for ØMQ. ZeroMQ is a network concurrency framework; ➢ Matplotlib v2.0.0 (PSF License), Python 2D plotting library; ➢ Numpy v1.12.2 (New BSD License), this is well known fundamental package for scientific computing with Python. ➢ Python.app v1.2 (License Unspecified) to use on Mac OS platform only

18 GEANT (GEometry ANd Tracking)

● This is a toolkit for the simulation of the passage of particles through matter. ● The first version of GEANT dates to 1974 ● The first version of GEANT3 dates to 1982 ● Last version of GEANT3 was v3.21 near 2000 ● It was written in FORTRAN and eventually maintained as part of CERNLIB. ● It is available under the GNU General Public License with the exception of some hadronic interaction code contributed by the FLUKA collaboration.

19