3 from __future__
import absolute_import, unicode_literals
8 from DDG4
import OutputLevel
as Output
9 from g4units
import keV, GeV, mm, ns, MeV
11 logging.basicConfig(format=
'%(levelname)s: %(message)s', level=logging.WARNING)
12 logger = logging.getLogger(__name__)
16 os.environ[
'G4UI_USE_TCSH'] =
"1"
18 description = kernel.detectorDescription()
19 kernel.loadGeometry(str(
"file:" +
"GenericRICH_example.xml"))
23 geant4.printDetectors()
29 rootoutput = geant4.setupROOTOutput(
'RootOutput',
'derp_' + time.strftime(
'%Y-%m-%d_%H-%M'), mc_truth=
True)
30 rootoutput.HandleMCTruth =
True
32 logger.info(
"# Configure UI")
33 geant4.setupUI(
'tcsh',vis=
False,macro=
'macro/gps.mac')
35 logger.info(
"# Configure G4 magnetic field tracking")
36 geant4.setupTrackingField()
38 logger.info(
"# Setup random generator")
44 logger.info(
"# Configure Run actions")
60 geant4.setupGun(
'electron',
'e-',3.0*GeV)
128 logger.info(
"# Setup global filters fur use in sensitive detectors")
130 f2 =
DDG4.Filter(kernel,
'ParticleRejectFilter/OpticalPhotonRejector')
131 f2.particle =
'opticalphoton'
132 f3 =
DDG4.Filter(kernel,
'ParticleSelectFilter/OpticalPhotonSelector')
133 f3.particle =
'opticalphoton'
138 kernel.registerGlobalFilter(f2)
139 kernel.registerGlobalFilter(f3)
142 logger.info(
"# First the PID detectors")
143 seq, act = geant4.setupDetector(
'ForwardRICH',
'PhotoMultiplierSDAction')
169 logger.info(
"# Now build the physics list:")
170 phys = geant4.setupPhysics(
'QGSP_BERT')
171 geant4.addPhysics(str(
'Geant4PhysicsList/Myphysics'))
173 ph =
DDG4.PhysicsList(kernel,
'Geant4OpticalPhotonPhysics/OpticalPhotonPhys')
179 ph.MaxNumPhotonsPerStep = 10
180 ph.MaxBetaChangePerStep = 10.0
181 ph.TrackSecondariesFirst =
True
191 rg = geant4.addPhysics(
'Geant4DefaultRangeCut/GlobalRangeCut')
192 rg.RangeCut = 0.7 * mm
214 if __name__ ==
"__main__":