ATLAS Offline Software
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")
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
def ThinGeantTruthCfg(flags, name="ThinGeantTruthAlg", **kwargs)
Definition: ThinGeantTruthConfig.py:12
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
extractSporadic.printProperties
def printProperties(h, q, hLB)
Definition: extractSporadic.py:8
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19