-
Notifications
You must be signed in to change notification settings - Fork 1
/
steering.py
67 lines (57 loc) · 2.35 KB
/
steering.py
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
63
64
65
#steering.py
from DDSim.DD4hepSimulation import DD4hepSimulation
SIM = DD4hepSimulation()
from g4units import mm, GeV, MeV
# Register optical physics and Cerenkov process to the default physics
def setupCerenkov(kernel):
from DDG4 import PhysicsList
seq = kernel.physicsList()
cerenkov = PhysicsList(kernel, "Geant4CerenkovPhysics/CerenkovPhys")
cerenkov.MaxNumPhotonsPerStep = 10
cerenkov.MaxBetaChangePerStep = 10.0
cerenkov.TrackSecondariesFirst = False
cerenkov.VerboseLevel = 0
cerenkov.enableUI()
seq.adopt(cerenkov)
ph = PhysicsList(kernel, "Geant4OpticalPhotonPhysics/OpticalGammaPhys")
ph.addParticleConstructor("G4OpticalPhoton")
ph.VerboseLevel = 0
ph.BoundaryInvokeSD = True
ph.enableUI()
seq.adopt(ph)
return None
SIM.physics.setupUserPhysics(setupCerenkov)
# Associate the Geant4OpticalTrackerAction to these detectors
# this action register total energy of the opt photon as a single hit
# and kills the optical photon, so no time is wasted tracking them
SIM.action.mapActions["ARCBARREL"] = "Geant4OpticalTrackerAction"
SIM.action.mapActions["ARCENDCAP"] = "Geant4OpticalTrackerAction"
SIM.action.mapActions["ARC_DETECTORNAME"] = "Geant4OpticalTrackerAction"
# Disable user tracker particle handler, so hits can be associated to photons
SIM.part.userParticleHandler = ""
# Register hit with low energy, compatible with zero
SIM.filter.tracker = "edep0"
# Define filter, so detector is only sensitive to optical photons
SIM.filter.filters["opticalphotons"] = dict(
name="ParticleSelectFilter/OpticalPhotonSelector",
parameter={"particle": "opticalphoton"},
)
SIM.filter.mapDetFilter["ARCBARREL"] = "opticalphotons"
SIM.filter.mapDetFilter["ARCENDCAP"] = "opticalphotons"
SIM.filter.mapDetFilter["ARC_DETECTORNAME"] = "opticalphotons"
# Particle gun settings: pions with fixed energy, random direction
SIM.numberOfEvents = 1
SIM.enableGun = True
SIM.gun.energy = "50*GeV"
SIM.gun.particle = "e+"
SIM.gun.multiplicity = 1
SIM.gun.position = "0 0 -20*cm"
SIM.gun.direction = "0 0 1"
# SIM.gun.momentumMin = 0.1*GeV
# SIM.gun.momentumMax = 0.11*GeV
SIM.compactFile = "./compact/arc_v0.xml"
SIM.outputFile = "arcsim_e+_50GeV.root"
SIM.runType = "batch"
#SIM.runType = "qt"
#SIM.outputConfig.forceDD4HEP = True
#SIM.macroFile ='vis.mac'