Skip to content

Commit 6ea7c4a

Browse files
committed
Add LHCb and CMS GDML geometries. Assign colors based on material Z
1 parent 35d9121 commit 6ea7c4a

File tree

9 files changed

+496249
-30
lines changed

9 files changed

+496249
-30
lines changed

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
44
DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6"
55
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
66
FHist = "68837c9b-b678-4cd5-9925-8a54edc8f695"
7+
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
78
Geant4 = "559df036-b7a0-42fd-85df-7d5dd9d70f44"
89
Geant4_jll = "872b6946-528a-5ac7-9145-d37eec569368"
910
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using Geant4
2+
using Geant4.SystemOfUnits
3+
using GLMakie # to force loading G4Vis extension
4+
5+
#detname = "LHCb_Upgrade_fullLHCb"
6+
detname = "cms2018"
7+
8+
#---Create the detector geometry from a GDML file----------------------------------------------
9+
detector = G4JLDetectorGDML("$(@__DIR__)/$(detname).gdml"; validate_schema=false);
10+
#---Create the Application---------------------------------------------------------------------
11+
app = G4JLApplication(;detector = detector, ## detector defined with a GDML file
12+
physics_type = FTFP_BERT, ## what physics list to instantiate
13+
);
14+
configure(app)
15+
initialize(app) ## Initialize Geant4 kernel (including the geometry)
16+
17+
world = GetWorldVolume()
18+
19+
#---Create the display scene-------------------------------------------------------------------
20+
set_theme!(backgroundcolor = :black)
21+
fig = Figure(size=(1280, 720))
22+
sc = LScene(fig[1,1], show_axis=false)
23+
Camera3D(sc.scene, upvector=Vec3f(0, 1, 0))
24+
rotate_cam!(sc.scene, Vec3f(π, 0, 0))
25+
26+
# Cut out a wedge from θ1 to θ2
27+
θ1, θ2 = 0, π / 2 # 0° to 90° wedge removed
28+
29+
# Part 1: everything with angle > θ2
30+
n1 = Vec3f(sin(θ2), -cos(θ2), 0)
31+
draw!(sc, world, maxlevel=5, clip_planes=[Makie.Plane3f(n1, 0f0)]);
32+
# Part 2: everything with angle < θ1
33+
n2 = Vec3f(-sin(θ1), cos(θ1), 0)
34+
draw!(sc, world, maxlevel=5, clip_planes=[Makie.Plane3f(n2, 0f0)]);
35+
display(fig)
36+
37+
save("$(@__DIR__)/$(detname).png", fig)

docs/src/examples/LHCb_Upgrade_fullLHCb.gdml

Lines changed: 366528 additions & 0 deletions
Large diffs are not rendered by default.
235 KB
Loading

0 commit comments

Comments
 (0)