Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eic_tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIC
tutorials
eic_tutorial
Commits
efedcb81
Commit
efedcb81
authored
4 years ago
by
Whitney Armstrong
Browse files
Options
Downloads
Patches
Plain Diff
modified: part3/simulating_detectors.md
parent
f5e6e223
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/docs/part3/simulating_detectors.md
+128
-1
128 additions, 1 deletion
src/docs/part3/simulating_detectors.md
with
128 additions
and
1 deletion
src/docs/part3/simulating_detectors.md
+
128
−
1
View file @
efedcb81
...
@@ -29,10 +29,137 @@ benefits.
...
@@ -29,10 +29,137 @@ benefits.
This part of the tutorial will use the python interface but converting to C++
This part of the tutorial will use the python interface but converting to C++
or XML should be straightforward.
or XML should be straightforward.
## Simulation setup
##
##
# Setup using Python/C++
To be completed.
```
python
#!/usr/bin/env python
from
__future__
import
absolute_import
,
unicode_literals
import
os
import
time
import
logging
import
DDG4
from
DDG4
import
OutputLevel
as
Output
from
g4units
import
keV
,
GeV
,
mm
,
ns
,
MeV
def
run
():
os
.
environ
[
'
G4UI_USE_TCSH
'
]
=
"
1
"
kernel
=
DDG4
.
Kernel
()
description
=
kernel
.
detectorDescription
()
kernel
.
loadGeometry
(
str
(
"
file:
"
+
"
solid_sidis.xml
"
))
DDG4
.
importConstants
(
description
)
geant4
=
DDG4
.
Geant4
(
kernel
)
geant4
.
setupUI
(
'
tcsh
'
,
vis
=
False
,
macro
=
'
macro/gps.mac
'
)
geant4
.
setupTrackingField
(
stepper
=
'
ClassicalRK4
'
,
equation
=
'
Mag_UsualEqRhs
'
)
rndm
=
DDG4
.
Action
(
kernel
,
'
Geant4Random/Random
'
)
rndm
.
Seed
=
854321
rndm
.
initialize
()
rndm
.
showStatus
()
run1
=
DDG4
.
RunAction
(
kernel
,
'
Geant4TestRunAction/RunInit
'
)
run1
.
Property_int
=
12345
run1
.
Property_double
=
-
5e15
*
keV
run1
.
Property_string
=
'
Startrun: Hello_2
'
run1
.
enableUI
()
kernel
.
registerGlobalAction
(
run1
)
kernel
.
runAction
().
adopt
(
run1
)
prt
=
DDG4
.
EventAction
(
kernel
,
'
Geant4ParticlePrint/ParticlePrint
'
)
prt
.
OutputLevel
=
Output
.
INFO
prt
.
OutputType
=
3
# Print both: table and tree
kernel
.
eventAction
().
adopt
(
prt
)
geant4
.
setupROOTOutput
(
'
RootOutput
'
,
'
derp_
'
+
time
.
strftime
(
'
%Y-%m-%d_%H-%M
'
))
gen
=
DDG4
.
GeneratorAction
(
kernel
,
"
Geant4GeneratorActionInit/GenerationInit
"
)
kernel
.
generatorAction
().
adopt
(
gen
)
gen
.
enableUI
()
gen
=
DDG4
.
GeneratorAction
(
kernel
,
"
Geant4GeneratorWrapper/GPS
"
)
gen
.
Uses
=
'
G4GeneralParticleSource
'
#gen.OutputLevel = Output.WARNING
#gen.Mask = 1
gen
.
enableUI
()
kernel
.
generatorAction
().
adopt
(
gen
)
gen
=
DDG4
.
GeneratorAction
(
kernel
,
"
Geant4InteractionMerger/InteractionMerger
"
)
gen
.
OutputLevel
=
0
# generator_output_level
gen
.
enableUI
()
kernel
.
generatorAction
().
adopt
(
gen
)
gen
=
DDG4
.
GeneratorAction
(
kernel
,
"
Geant4PrimaryHandler/PrimaryHandler
"
)
#gen.OutputLevel = 0 # generator_output_level
gen
.
enableUI
()
kernel
.
generatorAction
().
adopt
(
gen
)
part
=
DDG4
.
GeneratorAction
(
kernel
,
"
Geant4ParticleHandler/ParticleHandler
"
)
kernel
.
generatorAction
().
adopt
(
part
)
part
.
MinimalKineticEnergy
=
100000
*
GeV
#part.OutputLevel = 5 # generator_output_level
part
.
enableUI
()
f2
=
DDG4
.
Filter
(
kernel
,
'
ParticleRejectFilter/OpticalPhotonRejector
'
)
f2
.
particle
=
'
opticalphoton
'
f3
=
DDG4
.
Filter
(
kernel
,
'
ParticleSelectFilter/OpticalPhotonSelector
'
)
f3
.
particle
=
'
opticalphoton
'
kernel
.
registerGlobalFilter
(
f2
)
kernel
.
registerGlobalFilter
(
f3
)
seq
,
act
=
geant4
.
setupDetector
(
'
LightGasCherenkov
'
,
'
PhotoMultiplierSDAction
'
)
act
.
adopt
(
f3
)
seq
,
act
=
geant4
.
setupDetector
(
'
HeavyGasCherenkov
'
,
'
PhotoMultiplierSDAction
'
)
act
.
adopt
(
f3
)
seq
,
act
=
geant4
.
setupTracker
(
'
GEMTracker_SIDIS
'
)
seq
,
act
=
geant4
.
setupCalorimeter
(
'
FAECPreShower
'
)
seq
,
act
=
geant4
.
setupCalorimeter
(
'
FAECShower
'
)
seq
,
act
=
geant4
.
setupCalorimeter
(
'
LAECPreShower
'
)
seq
,
act
=
geant4
.
setupCalorimeter
(
'
LAECShower
'
)
phys
=
geant4
.
setupPhysics
(
'
QGSP_BERT
'
)
geant4
.
addPhysics
(
str
(
'
Geant4PhysicsList/Myphysics
'
))
ph
=
DDG4
.
PhysicsList
(
kernel
,
'
Geant4OpticalPhotonPhysics/OpticalPhotonPhys
'
)
ph
.
VerboseLevel
=
0
ph
.
enableUI
()
phys
.
adopt
(
ph
)
ph
=
DDG4
.
PhysicsList
(
kernel
,
'
Geant4CerenkovPhysics/CerenkovPhys
'
)
ph
.
MaxNumPhotonsPerStep
=
10
ph
.
MaxBetaChangePerStep
=
10.0
ph
.
TrackSecondariesFirst
=
True
ph
.
VerboseLevel
=
0
ph
.
enableUI
()
phys
.
adopt
(
ph
)
# Add global range cut
rg
=
geant4
.
addPhysics
(
'
Geant4DefaultRangeCut/GlobalRangeCut
'
)
rg
.
RangeCut
=
0.7
*
mm
phys
.
dump
()
kernel
.
configure
()
kernel
.
initialize
()
kernel
.
run
()
kernel
.
terminate
()
if
__name__
==
"
__main__
"
:
run
()
```
### Setup using XML
To be completed.
To be completed.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment