ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
ThinningUtils
python
ThinGeantTruthConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2
3
__doc__ =
"""
4
Instantiate the TRT Standalone Thinning
5
"""
6
7
from
AthenaCommon.Logging
import
logging
8
from
AthenaConfiguration.ComponentFactory
import
CompFactory
9
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
10
from
AthenaConfiguration.Enums
import
LHCPeriod
11
12
def
ThinGeantTruthCfg
(flags, name="ThinGeantTruthAlg", **kwargs):
13
14
mlog = logging.getLogger(name)
15
mlog.info(
"Starting Geant4 Truth Thinning configuration"
)
16
acc = ComponentAccumulator()
17
kwargs.setdefault(
"StreamName"
,
"StreamAOD"
)
18
kwargs.setdefault(
"keepEGamma"
, flags.Reco.EnableEgamma)
19
kwargs.setdefault(
"keepMuons"
, flags.Reco.EnableCombinedMuon)
20
if
flags.GeoModel.Run >= LHCPeriod.Run4:
21
kwargs.setdefault(
"EtaMaxEGammaTruth"
, 4.1)
22
kwargs.setdefault(
"FwdElectronsKey"
,
"ForwardElectrons"
)
23
24
acc.addEventAlgo(CompFactory.ThinGeantTruthAlg(name, **kwargs))
25
mlog.info(
"Geant4 Truth Thinning configured"
)
26
return
acc
27
28
29
if
__name__ ==
"__main__"
:
30
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
31
from
AthenaConfiguration.TestDefaults
import
defaultTestFiles
32
from
AthenaConfiguration.ComponentAccumulator
import
printProperties
33
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
34
flags = initConfigFlags()
35
flags.Input.Files = defaultTestFiles.RDO_RUN2
36
flags.Output.doWriteAOD =
True
# To test the AOD parts
37
flags.lock()
38
acc = MainServicesCfg(flags)
39
acc.merge(
ThinGeantTruthCfg
(flags))
40
mlog = logging.getLogger(
"ThinGeantTruthConfigTest"
)
41
printProperties(
42
mlog,
43
acc.getEventAlgo(
"ThinGeantTruthAlg"
),
44
nestLevel=1,
45
printDefaults=
True
,
46
)
47
48
with
open(
"thingeanttruchcfg.pkl"
,
"wb"
)
as
f:
49
acc.store(f)
python.ThinGeantTruthConfig.ThinGeantTruthCfg
ThinGeantTruthCfg(flags, name="ThinGeantTruthAlg", **kwargs)
Definition
ThinGeantTruthConfig.py:12
Generated on
for ATLAS Offline Software by
1.17.0