-
Notifications
You must be signed in to change notification settings - Fork 513
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·62 lines (56 loc) · 2.58 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·62 lines (56 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
#
# This example exercises the Geant4 fast simulation route on the front absorber.
#
# A fast simulation model replaces the detailed transport through a region of
# the geometry by a function from the particle that enters it to the particles
# that leave it. The model shipped here, `toyAbsorber`, is a placeholder: it
# returns the incident particle carrying on in its direction with an
# exponentially attenuated energy. What the example demonstrates is the
# machinery, not the physics.
#
# `G4.fastSimEnvelope` names the volume the model stands in for: AFaM, the
# mother of the whole absorber. The regions Geant4 needs in order to consult the
# model are derived from it by walking its subtree and collecting the media,
# because a region can only ever be "every volume of a given material".
#
# The setup is PIPE and ABSO only, which keeps the run short and puts the
# absorber in the path of everything.
set -x
EVENTS=5
MODULES="-m PIPE ABSO"
GEN="-g pythia8pp"
# The same seed in both runs, so the two simulations see the SAME primaries and
# the comparison is paired. Without it o2-sim picks a seed per run and the
# difference between the two is mostly different events.
SEED="--seed 12345"
# Alignment is irrelevant here and switching it off keeps the example from
# needing a CCDB connection and an alien token.
COMMON="align-geom.mDetectors=none"
# --------------------------------------------------------------- 1. reference
# Detailed transport, for comparison.
mkdir -p full && cd full
o2-sim-serial -n ${EVENTS} ${GEN} ${SEED} -e TGeant4 ${MODULES} -o full \
--configKeyValues "${COMMON}" > logfull 2>&1
cd ..
# -------------------------------------------------------------------- 2. fast
# G4.fastSimModels is what switches the feature on; with it empty (the default)
# nothing about the simulation changes.
mkdir -p fast && cd fast
o2-sim-serial -n ${EVENTS} ${GEN} ${SEED} -e TGeant4 ${MODULES} -o fast \
--configKeyValues "${COMMON};\
G4.fastSimModels=toyAbsorber;\
G4.fastSimEnvelope=AFaM;\
G4.fastSimMinEnergy=1.0" > logfast 2>&1
cd ..
# ----------------------------------------------------------------- 3. compare
# The model prints once at setup; if this line is missing the region name did
# not resolve to a medium and nothing was applied.
grep -h "fast simulation" fast/logfast
# Tracks written per event. The absorber normally turns one incident hadron into
# a shower, and the toy model returns a single particle instead, so the fast run
# has to produce far fewer.
for d in full fast; do
echo "=== ${d}"
root -l -b -q "$(dirname "$0")/countTracks.macro(\"${d}/${d}\")"
done