Running the examples
The pages in this section are generated from the Literate sources in docs/src/examples and run with the current version of Geom4hep.jl when the documentation is built. They show the code together with its output and plots. Each page has links to download the example as a Jupyter notebook or a plain Julia script.
| Example | Content |
|---|---|
| Shapes | Creating shapes, calling the shape functions and drawing them |
| Volumes | Building a hierarchy of volumes and drawing it |
| Navigation | Closing a geometry, following rays through it and X-ray images |
| GDML | Reading GDML files: the CMS 2018 detector |
| GDML Rendering | Rendering the CMS and LHCb detectors with GLMakie |
| RoundCube | Porting a Geant4 solid built from boolean operations, and checking it |
| Benchmarks | Timing the shape functions with the methodology of VecGeom |
Setting up an environment
The examples use extra packages for plotting (CairoMakie or GLMakie). The simplest way to run them is with the environment of this documentation, which lists every package they need:
git clone https://github.com/JuliaHEP/Geom4hep.jl.git
cd Geom4hep.jl
julia --project=docs -e 'import Pkg; Pkg.develop(path="."); Pkg.instantiate()'
julia --project=docs docs/src/examples/Shapes.jlTo run an example downloaded from these pages instead, put it in a directory with the Project.toml of the documentation, run julia --project=. -e 'import Pkg; Pkg.instantiate()' (which installs the registered Geom4hep), and then the example, or open the notebook in Jupyter.
The repository has more examples in the examples directory, with their own environment: X-ray images on GPUs (XRay.jl), density slices of the CMS detector (Render.jl), interactive drawing of a detector (DrawDetector.jl) and the comparison of the shape benchmarks with VecGeom (Benchmarks.jl).