Viewing the geometry
Last updated on 2026-07-10 | Edit this page
Estimated time: 20 minutes
Overview
Questions
- How can we view the geometry?
Objectives
- Understand how to export the geometry with
dd_web_display. - Know of multiple ways in which to open ROOT TGeo geometries.
Introduction
Before we move to discussion of the detector plugins in the next part, let’s discuss visualization on your local system.
ROOT visualization
The geometry included in eic-shell can be viewed with
the ROOT geometry browser. However, we first need to export it from the
built-in DD4hep format to the ROOT TGeo format, with a small utility
program dd_web_display. To do this, we will need to ensure
we are in a directory where we have write access, such as the directory
~/eic/.
Note: If you are not inside eic-shell, you may need to
be connected to the internet as you run this command since a magnetic
fieldmap will need to be downloaded.
The dd_web_display utility will create a ROOT file in
the current directory that can be opened with the geometry viewer online
at the ANL geometry
viewer or the ROOT JSROOT
viewer, or a local ROOT installation. VSCode also has a JSROOT
extension which provides the same functionality as the browser.
Note: The version of JSROOT on the ANL geometry viewer is older than the ROOT JSROOT viewer version so some differences in the visualisation may be present.
The output file is by default named
detector_geometry.root this can be changed if you want to
look at several configurations using e.g.
For local ROOT installations, the following commands may be helpful:
The geometry viewer has to make decisions on what to draw in order to keep the number of facets small enough. This means that detectors with a large number of repeated components may not be drawn, or other detectors may not be drawn when those detectors are drawn. For this reason, we also have the subsystem-specific entry points xml files. For visualization of specific subsystems, these files are recommended.
Parameters describing how each component of the geometry should be vizualised are contained within the detector plugins and can be controlled through the xml description.
Exercise: view a subsystem
- Export a different detector configuration from the default
epic.xml, and export this to ROOT TGeo format. - Open the exported ROOT file in the geometry viewer at the ANL geometry viewer or the ROOT JSROOT viewer.
For example
dd_web_display -o vertex_geometry.root --export $DETECTOR_PATH/epic_vertex_only.xml
produces vertex_geometry.root; loading that file in either
viewer shows only the vertex barrel, which renders faster and is easier
to inspect than the full epic.xml.
Geant4 visualization
Warning: might not work for various reasons. If you are used to the Geant4 geometry visualisation or want to visually inspect where a subset of your event sample this is still possible using npsim.
BASH
npsim --runType qt --compactFile $DETECTOR_PATH/epic_vertex_only.xml --inputFiles root://dtn-eic.jlab.org//volatile/eic/EPIC/EVGEN/SIDIS/pythia6-eic/1.0.0/18x275/q2_0to1/pythia_ep_noradcor_18x275_q2_0.000000001_1.0_run9.ab.hepmc3.tree.root --macro macro/b0_vis.mac
This particular example uses pythia6 min-bias events stored on the
xrootd server at jlab. The visualization of particle tracks and the
detector is controlled by the macro/b0_vis.mac file.
Note: Geant4 does not try and limit its visualization of components
so depending on your machine the full detector might struggle, please be
patient. This performs much better outside of eic-shell but
takes a long time to set up the environment.
Other visualisation you might want
- ACTS Surfaces
- Material Map
- Event display
These are avaliable in various forms but not covered in this tutorial.
- The geometry, exported to the ROOT TGeo file, can be viewed with ROOT.