Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
calypso
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
Savannah Rose Shively
calypso
Commits
8c65b741
Commit
8c65b741
authored
4 years ago
by
Dave Casper
Committed by
Alan Basil Barkley Yeung
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Create script to run only generator
parent
5b9edec4
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
Simulation/G4Faser/G4FaserAlg/test/runGen.py
+137
-0
137 additions, 0 deletions
Simulation/G4Faser/G4FaserAlg/test/runGen.py
with
137 additions
and
0 deletions
Simulation/G4Faser/G4FaserAlg/test/runGen.py
0 → 100755
+
137
−
0
View file @
8c65b741
#!/usr/bin/env python
if
__name__
==
"
__main__
"
:
import
os
import
sys
import
GaudiPython
import
ParticleGun
as
PG
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
from
AthenaConfiguration.ComponentFactory
import
CompFactory
from
AthenaCommon.AppMgr
import
*
from
AthenaCommon.Logging
import
log
,
logging
from
AthenaCommon.SystemOfUnits
import
TeV
from
AthenaCommon.PhysicalConstants
import
pi
from
AthenaCommon.Constants
import
VERBOSE
,
INFO
from
AthenaCommon.Configurable
import
Configurable
from
CalypsoConfiguration.AllConfigFlags
import
ConfigFlags
from
CalypsoConfiguration.MainServicesConfig
import
MainServicesCfg
from
AthenaPoolCnvSvc.PoolReadConfig
import
PoolReadCfg
from
McEventSelector.McEventSelectorConfig
import
McEventSelectorCfg
from
OutputStreamAthenaPool.OutputStreamConfig
import
OutputStreamCfg
# from FaserGeoModel.FaserGeoModelConfig import FaserGeometryCfg
# from G4FaserAlg.G4FaserAlgConfigNew import G4FaserAlgCfg
# from G4FaserServices.G4FaserServicesConfigNew import G4GeometryNotifierSvcCfg
#
# Set up logging and new style config
#
log
.
setLevel
(
VERBOSE
)
Configurable
.
configurableRun3Behavior
=
True
#
# Input settings (Generator file)
#
# from AthenaConfiguration.TestDefaults import defaultTestFiles
# ConfigFlags.Input.Files = defaultTestFiles.EVNT
#
# Alternatively, these must ALL be explicitly set to run without an input file
# (if missing, it will try to read metadata from a non-existent file and crash)
#
ConfigFlags
.
Input
.
Files
=
[
""
]
ConfigFlags
.
Input
.
isMC
=
True
ConfigFlags
.
Input
.
RunNumber
=
12345
ConfigFlags
.
Input
.
Collections
=
[
""
]
ConfigFlags
.
Input
.
ProjectName
=
"
mc19
"
ConfigFlags
.
Common
.
isOnline
=
False
ConfigFlags
.
Beam
.
Type
=
"
collisions
"
ConfigFlags
.
Beam
.
Energy
=
7
*
TeV
# Informational, does not affect simulation
ConfigFlags
.
GeoModel
.
FaserVersion
=
"
FASER-01
"
# Always needed
ConfigFlags
.
IOVDb
.
GlobalTag
=
"
OFLCOND-XXXX-XXX-XX
"
# Always needed; only the OFLCOND part matters
# Workaround for bug/missing flag; unimportant otherwise
ConfigFlags
.
addFlag
(
"
Input.InitialTimeStamp
"
,
0
)
# Workaround to avoid problematic ISF code
ConfigFlags
.
GeoModel
.
Layout
=
"
Development
"
#
# Output settings
#
ConfigFlags
.
Output
.
HITSFileName
=
"
my.EVT.pool.root
"
# ConfigFlags.GeoModel.GeoExportFile = "faserGeo.db" # Optional dump of geometry for browsing in vp1light
#
# Geometry-related settings
# Do not change!
#
# ConfigFlags.Detector.SimulateVeto = True
# ConfigFlags.Detector.GeometryVeto = True
# ConfigFlags.Detector.SimulateTrigger= True
# ConfigFlags.Detector.GeometryTrigger= True
# ConfigFlags.Detector.SimulatePreshower = True
# ConfigFlags.Detector.GeometryPreshower = True
# ConfigFlags.Detector.SimulateFaserSCT = True
# ConfigFlags.Detector.GeometryFaserSCT = True
# ConfigFlags.Detector.SimulateUpstreamDipole = True
# ConfigFlags.Detector.SimulateCentralDipole = True
# ConfigFlags.Detector.SimulateDownstreamDipole = True
# ConfigFlags.Detector.GeometryUpstreamDipole = True
# ConfigFlags.Detector.GeometryCentralDipole = True
# ConfigFlags.Detector.GeometryDownstreamDipole = True
ConfigFlags
.
GeoModel
.
Align
.
Dynamic
=
False
ConfigFlags
.
Sim
.
ReleaseGeoModel
=
False
#
# All flags should be set before calling lock
#
ConfigFlags
.
lock
()
#
# Construct ComponentAccumulator
#
acc
=
MainServicesCfg
(
ConfigFlags
)
#
# Particle Gun generator (comment out to read generator file)
# Raw energies (without units given) are interpreted as MeV
#
pg
=
PG
.
ParticleGun
()
pg
.
McEventKey
=
"
GEN_EVENT
"
pg
.
randomSeed
=
123456
pg
.
sampler
.
pid
=
-
13
pg
.
sampler
.
mom
=
PG
.
EThetaMPhiSampler
(
energy
=
1
*
TeV
,
theta
=
[
0
,
pi
/
20
],
phi
=
[
0
,
2
*
pi
],
mass
=
105.71
)
pg
.
sampler
.
pos
=
PG
.
PosSampler
(
x
=
[
-
5
,
5
],
y
=
[
-
5
,
5
],
z
=-
2100.0
,
t
=
0.0
)
acc
.
addEventAlgo
(
pg
,
"
AthBeginSeq
"
)
# to run *before* G4
#
# Only one of these two should be used in a given job
# (MCEventSelectorCfg for generating events with no input file,
# PoolReadCfg when reading generator data from an input file)
#
acc
.
merge
(
McEventSelectorCfg
(
ConfigFlags
))
# acc.merge(PoolReadCfg(ConfigFlags))
#
# Output stream configuration
#
acc
.
merge
(
OutputStreamCfg
(
ConfigFlags
,
"
HITS
"
,
[
"
EventInfo#*
"
,
"
McEventCollection#TruthEvent
"
,
"
McEventCollection#GEN_EVENT
"
,
"
ScintHitCollection#*
"
,
"
FaserSiHitCollection#*
"
],
disableEventTag
=
True
))
# acc.getEventAlgo("OutputStreamHITS").AcceptAlgs = ["G4FaserAlg"] # optional
acc
.
getEventAlgo
(
"
OutputStreamHITS
"
).
WritingTool
.
ProcessingTag
=
"
StreamHITS
"
# required
#
# Here is the configuration of the Geant4 pieces
#
# acc.merge(FaserGeometryCfg(ConfigFlags))
# acc.merge(G4FaserAlgCfg(ConfigFlags))
# acc.addService(G4GeometryNotifierSvcCfg(ConfigFlags, ActivateLVNotifier=True))
#
# Verbosity
#
# ConfigFlags.dump()
# logging.getLogger('forcomps').setLevel(VERBOSE)
# acc.foreach_component("*").OutputLevel = VERBOSE
# acc.foreach_component("*ClassID*").OutputLevel = INFO
# acc.getService("StoreGateSvc").Dump=True
# acc.getService("ConditionStore").Dump=True
# acc.printConfig()
f
=
open
(
'
FaserG4AppCfg_EVNT.pkl
'
,
'
wb
'
)
acc
.
store
(
f
)
f
.
close
()
#
# Execute and finish
#
sys
.
exit
(
int
(
acc
.
run
(
maxEvents
=
500
).
isFailure
()))
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