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=
True,macro=
'macro/run.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)
129 logger.info(
"# Setup global filters fur use in sensitive detectors")
131 f2 =
DDG4.Filter(kernel,
'ParticleRejectFilter/OpticalPhotonRejector')
132 f2.particle =
'opticalphoton'
133 f3 =
DDG4.Filter(kernel,
'ParticleSelectFilter/OpticalPhotonSelector')
134 f3.particle =
'opticalphoton'
139 kernel.registerGlobalFilter(f2)
140 kernel.registerGlobalFilter(f3)
143 logger.info(
"# First the PID detectors")
144 seq, act = geant4.setupDetector(
'ForwardRICH',
'PhotoMultiplierSDAction')
170 logger.info(
"# Now build the physics list:")
171 phys = geant4.setupPhysics(
'QGSP_BERT')
172 geant4.addPhysics(str(
'Geant4PhysicsList/Myphysics'))
174 ph =
DDG4.PhysicsList(kernel,
'Geant4OpticalPhotonPhysics/OpticalPhotonPhys')
180 ph.MaxNumPhotonsPerStep = 10
181 ph.MaxBetaChangePerStep = 10.0
182 ph.TrackSecondariesFirst =
True
192 rg = geant4.addPhysics(
'Geant4DefaultRangeCut/GlobalRangeCut')
193 rg.RangeCut = 0.7 * mm
215 if __name__ ==
"__main__":