Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
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
Charlotte Cavanagh
calypso
Commits
6a36c53a
Commit
6a36c53a
authored
2 years ago
by
Carl Gwilliam
Browse files
Options
Downloads
Patches
Plain Diff
Fix LOS dealing with ATLAS vs FASER coords
parent
a40f55b9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Generators/GeneratorUtils/python/ShiftLOSConfig.py
+0
-5
0 additions, 5 deletions
Generators/GeneratorUtils/python/ShiftLOSConfig.py
Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfigNew_Test.py
+30
-10
30 additions, 10 deletions
...ation/G4Faser/G4FaserAlg/test/G4FaserAlgConfigNew_Test.py
with
30 additions
and
15 deletions
Generators/GeneratorUtils/python/ShiftLOSConfig.py
+
0
−
5
View file @
6a36c53a
...
@@ -7,8 +7,6 @@ from AthenaConfiguration.MainServicesConfig import AthSequencer
...
@@ -7,8 +7,6 @@ from AthenaConfiguration.MainServicesConfig import AthSequencer
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
,
ConfigurationError
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
,
ConfigurationError
from
AthenaConfiguration.ComponentFactory
import
CompFactory
from
AthenaConfiguration.ComponentFactory
import
CompFactory
from
SGComps.AddressRemappingConfig
import
InputOverwriteCfg
from
GeneratorUtils.ShiftLOS
import
ShiftLOS
from
GeneratorUtils.ShiftLOS
import
ShiftLOS
...
@@ -17,9 +15,6 @@ def ShiftLOSCfg(ConfigFlags, **kwargs) :
...
@@ -17,9 +15,6 @@ def ShiftLOSCfg(ConfigFlags, **kwargs) :
cfg
=
ComponentAccumulator
()
cfg
=
ComponentAccumulator
()
# Rename old truth collection to add ATLAS coord to can still use BeamTruthEvent for the one in FASER Coords
cfg
.
merge
(
InputOverwriteCfg
(
"
McEventCollection
"
,
"
BeamTruthEvent
"
,
"
McEventCollection
"
,
"
BeamTruthEvent_ATLASCoord
"
))
shift
=
ShiftLOS
(
name
=
kwargs
.
setdefault
(
"
name
"
,
"
ShiftLOS
"
))
shift
=
ShiftLOS
(
name
=
kwargs
.
setdefault
(
"
name
"
,
"
ShiftLOS
"
))
shift
.
InputMCEventKey
=
kwargs
.
setdefault
(
"
InputMCEventKey
"
,
"
BeamTruthEvent_ATLASCoord
"
)
shift
.
InputMCEventKey
=
kwargs
.
setdefault
(
"
InputMCEventKey
"
,
"
BeamTruthEvent_ATLASCoord
"
)
shift
.
OutputMCEventKey
=
kwargs
.
setdefault
(
"
OutputMCEventKey
"
,
"
BeamTruthEvent
"
)
shift
.
OutputMCEventKey
=
kwargs
.
setdefault
(
"
OutputMCEventKey
"
,
"
BeamTruthEvent
"
)
...
...
This diff is collapsed.
Click to expand it.
Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfigNew_Test.py
+
30
−
10
View file @
6a36c53a
...
@@ -58,11 +58,21 @@ if __name__ == '__main__':
...
@@ -58,11 +58,21 @@ if __name__ == '__main__':
import
sys
import
sys
ConfigFlags
.
fillFromArgs
(
sys
.
argv
[
1
:])
ConfigFlags
.
fillFromArgs
(
sys
.
argv
[
1
:])
# from math import atan
doShiftLOS
=
(
ConfigFlags
.
Sim
.
Beam
.
xangle
or
ConfigFlags
.
Sim
.
Beam
.
yangle
or
# from AthenaCommon.SystemOfUnits import GeV, TeV, cm, m
ConfigFlags
.
Sim
.
Beam
.
xshift
or
ConfigFlags
.
Sim
.
Beam
.
yshift
)
# from AthenaCommon.PhysicalConstants import pi
# import ParticleGun as PG
from
math
import
atan
# ConfigFlags.Sim.Gun = {"Generator" : "SingleParticle", "pid" : 11, "energy" : PG.LogSampler(10*GeV, 1*TeV), "theta" : PG.GaussianSampler(0, atan((10*cm)/(7*m)), oneside = True), "phi" : [0, 2*pi], "mass" : 0.511, "radius" : -10*cm, "randomSeed" : 12345}
from
AthenaCommon.SystemOfUnits
import
GeV
,
TeV
,
cm
,
m
from
AthenaCommon.PhysicalConstants
import
pi
import
ParticleGun
as
PG
ConfigFlags
.
Sim
.
Gun
=
{
"
Generator
"
:
"
SingleParticle
"
,
"
pid
"
:
11
,
"
energy
"
:
PG
.
LogSampler
(
10
*
GeV
,
1
*
TeV
),
"
theta
"
:
PG
.
GaussianSampler
(
0
,
atan
((
10
*
cm
)
/
(
7
*
m
)),
oneside
=
True
),
"
phi
"
:
[
0
,
2
*
pi
],
"
mass
"
:
0.511
,
"
radius
"
:
-
10
*
cm
,
"
randomSeed
"
:
12345
}
if
doShiftLOS
:
pgConfig
=
ConfigFlags
.
Sim
.
Gun
pgConfig
[
"
McEventKey
"
]
=
"
BeamTruthEvent_ATLASCoord
"
ConfigFlags
.
Sim
.
Gun
=
pgConfig
#
#
# By being a little clever, we can steer the geometry setup from the command line using GeoModel.FaserVersion
# By being a little clever, we can steer the geometry setup from the command line using GeoModel.FaserVersion
...
@@ -97,12 +107,16 @@ if __name__ == '__main__':
...
@@ -97,12 +107,16 @@ if __name__ == '__main__':
print
(
"
Input.Files =
"
,
ConfigFlags
.
Input
.
Files
)
print
(
"
Input.Files =
"
,
ConfigFlags
.
Input
.
Files
)
#
#
# If so, and only one file that ends in .events read as HepMC
# If so, and only one file that ends in .events
or .hepmc
read as HepMC
#
#
if
len
(
ConfigFlags
.
Input
.
Files
)
==
1
and
(
ConfigFlags
.
Input
.
Files
[
0
].
endswith
(
"
.events
"
)
or
ConfigFlags
.
Input
.
Files
[
0
].
endswith
(
"
.hepmc
"
)):
if
len
(
ConfigFlags
.
Input
.
Files
)
==
1
and
(
ConfigFlags
.
Input
.
Files
[
0
].
endswith
(
"
.events
"
)
or
ConfigFlags
.
Input
.
Files
[
0
].
endswith
(
"
.hepmc
"
)):
from
HEPMCReader.HepMCReaderConfig
import
HepMCReaderCfg
from
HEPMCReader.HepMCReaderConfig
import
HepMCReaderCfg
cfg
.
merge
(
HepMCReaderCfg
(
ConfigFlags
))
if
doShiftLOS
:
cfg
.
merge
(
HepMCReaderCfg
(
ConfigFlags
,
McEventKey
=
"
BeamTruthEvent_ATLASCoord
"
))
else
:
cfg
.
merge
(
HepMCReaderCfg
(
ConfigFlags
))
from
McEventSelector.McEventSelectorConfig
import
McEventSelectorCfg
from
McEventSelector.McEventSelectorConfig
import
McEventSelectorCfg
cfg
.
merge
(
McEventSelectorCfg
(
ConfigFlags
))
cfg
.
merge
(
McEventSelectorCfg
(
ConfigFlags
))
...
@@ -113,6 +127,12 @@ if __name__ == '__main__':
...
@@ -113,6 +127,12 @@ if __name__ == '__main__':
else
:
else
:
from
AthenaPoolCnvSvc.PoolReadConfig
import
PoolReadCfg
from
AthenaPoolCnvSvc.PoolReadConfig
import
PoolReadCfg
cfg
.
merge
(
PoolReadCfg
(
ConfigFlags
))
cfg
.
merge
(
PoolReadCfg
(
ConfigFlags
))
if
doShiftLOS
:
from
SGComps.AddressRemappingConfig
import
InputOverwriteCfg
# Rename old truth collection to add ATLAS coord to can still use BeamTruthEvent for the one in FASER Coords
cfg
.
merge
(
InputOverwriteCfg
(
"
McEventCollection
"
,
"
BeamTruthEvent
"
,
"
McEventCollection
"
,
"
BeamTruthEvent_ATLASCoord
"
))
#
#
# If not, configure the particle gun as requested, or using defaults
# If not, configure the particle gun as requested, or using defaults
#
#
...
@@ -122,6 +142,7 @@ if __name__ == '__main__':
...
@@ -122,6 +142,7 @@ if __name__ == '__main__':
#
#
from
FaserParticleGun.FaserParticleGunConfig
import
FaserParticleGunCfg
from
FaserParticleGun.FaserParticleGunConfig
import
FaserParticleGunCfg
cfg
.
merge
(
FaserParticleGunCfg
(
ConfigFlags
))
cfg
.
merge
(
FaserParticleGunCfg
(
ConfigFlags
))
from
McEventSelector.McEventSelectorConfig
import
McEventSelectorCfg
from
McEventSelector.McEventSelectorConfig
import
McEventSelectorCfg
cfg
.
merge
(
McEventSelectorCfg
(
ConfigFlags
))
cfg
.
merge
(
McEventSelectorCfg
(
ConfigFlags
))
...
@@ -135,8 +156,7 @@ if __name__ == '__main__':
...
@@ -135,8 +156,7 @@ if __name__ == '__main__':
# Shift LOS
# Shift LOS
#
#
if
(
ConfigFlags
.
Sim
.
Beam
.
xangle
or
ConfigFlags
.
Sim
.
Beam
.
yangle
or
if
doShiftLOS
:
ConfigFlags
.
Sim
.
Beam
.
xshift
or
ConfigFlags
.
Sim
.
Beam
.
yshift
):
import
McParticleEvent.Pythonizations
import
McParticleEvent.Pythonizations
from
GeneratorUtils.ShiftLOSConfig
import
ShiftLOSCfg
from
GeneratorUtils.ShiftLOSConfig
import
ShiftLOSCfg
...
@@ -150,7 +170,7 @@ if __name__ == '__main__':
...
@@ -150,7 +170,7 @@ if __name__ == '__main__':
from
G4FaserAlg.G4FaserAlgConfigNew
import
G4FaserAlgCfg
from
G4FaserAlg.G4FaserAlgConfigNew
import
G4FaserAlgCfg
cfg
.
merge
(
G4FaserAlgCfg
(
ConfigFlags
))
cfg
.
merge
(
G4FaserAlgCfg
(
ConfigFlags
))
##
#cfg.getEventAlgo("OutputStreamHITS").ItemList += ["McEventCollection#BeamTruthEvent_ATLASCoord"]
#cfg.getEventAlgo("OutputStreamHITS").ItemList += ["McEventCollection#BeamTruthEvent_ATLASCoord"]
#
#
# Dump config
# Dump config
#
#
...
...
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