ATLAS Offline Software
testSensitiveDetectors.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
3 
4 def setupTestOutputCfg(flags,**kwargs):
5 
6  kwargs.setdefault("streamName","MuonSimTestStream")
7  kwargs.setdefault("AcceptAlgs",[])
8 
9  result = ComponentAccumulator()
10 
14  from MuonSensitiveDetectorsR4.SensitiveDetectorsCfg import OutputSimContainersCfg
15  container_items = ["xAOD::TruthParticleContainer#",
16  "xAOD::TruthParticleAuxContainer#",
17  "McEventCollection#"] + OutputSimContainersCfg(flags)
18 
19 
20 
21  from xAODMetaDataCnv.InfileMetaDataConfig import propagateMetaData, MetaDataHelperLists
22  from AthenaConfiguration.Enums import MetadataCategory
23 
24  mdLists = MetaDataHelperLists()
25  for mdCategory in (MetadataCategory.FileMetaData, MetadataCategory.EventStreamInfo):
26  lists, caConfig = propagateMetaData(flags, kwargs["streamName"], mdCategory)
27  mdLists += lists
28  result.merge(caConfig)
29  kwargs.setdefault("MetadataItemList" , mdLists.mdItems)
30  kwargs.setdefault("HelperTools", mdLists.helperTools)
31  from AthenaServices.MetaDataSvcConfig import MetaDataSvcCfg
32 
33  result.merge(MetaDataSvcCfg(flags,
34  tools=mdLists.mdTools,
35  toolNames=mdLists.mdToolNames))
36  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
37  kwargs.setdefault("ItemList", container_items)
38  result.merge(OutputStreamCfg(flags, **kwargs))
39  return result
40 
41 if __name__=="__main__":
42  from MuonGeoModelTestR4.testGeoModel import setupGeoR4TestCfg, SetupArgParser, executeTest
43  parser = SetupArgParser()
44  parser.set_defaults(nEvents = -1)
45  parser.set_defaults(outRootFile="SimHits.pool.root")
46 
47  args = parser.parse_args()
48  from AthenaConfiguration.AllConfigFlags import initConfigFlags
49  flags = initConfigFlags()
50 
51  from AthenaConfiguration.Enums import ProductionStep
52  flags.Common.ProductionStep = ProductionStep.Simulation
53 
54  from SimulationConfig.SimEnums import SimulationFlavour
55  flags.Sim.ISF.Simulator = SimulationFlavour.AtlasG4
56  flags.addFlag("Output.MuonSimTestStreamFileName", args.outRootFile)
57 
58  flags, cfg = setupGeoR4TestCfg(args, flags)
59 
60  from BeamEffects.BeamEffectsAlgConfig import BeamEffectsAlgCfg
61  cfg.merge(BeamEffectsAlgCfg(flags))
62 
63  from G4AtlasAlg.G4AtlasAlgConfig import G4AtlasAlgCfg
64  cfg.merge(G4AtlasAlgCfg(flags))
65 
71 
72  from xAODTruthCnv.xAODTruthCnvConfig import GEN_EVNT2xAODCfg
73  cfg.merge(GEN_EVNT2xAODCfg(flags,name="GEN_EVNT2xAOD",AODContainerName="TruthEvent"))
74 
75  cfg.merge(setupTestOutputCfg(flags))
76  executeTest(cfg)
77 
G4AtlasAlgConfig.G4AtlasAlgCfg
def G4AtlasAlgCfg(flags, name="G4AtlasAlg", **kwargs)
Definition: G4AtlasAlgConfig.py:12
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
InfileMetaDataConfig.propagateMetaData
def propagateMetaData(flags, streamName="", category=None)
Definition: InfileMetaDataConfig.py:130
python.testSensitiveDetectors.setupTestOutputCfg
def setupTestOutputCfg(flags, **kwargs)
Definition: testSensitiveDetectors.py:4
BeamEffectsAlgConfig.BeamEffectsAlgCfg
def BeamEffectsAlgCfg(flags, name="BeamEffectsAlg", **kwargs)
Definition: BeamEffectsAlgConfig.py:101
python.MdtCablingTester.SetupArgParser
def SetupArgParser()
Definition: MdtCablingTester.py:3
xAODTruthCnvConfig.GEN_EVNT2xAODCfg
def GEN_EVNT2xAODCfg(flags, name="GEN_EVNT2xAOD", **kwargs)
Definition: xAODTruthCnvConfig.py:5
python.testGeoModel.executeTest
def executeTest(cfg)
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py:193
python.testGeoModel.setupGeoR4TestCfg
def setupGeoR4TestCfg(args, flags=None)
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py:103
MuonG4SDConfig.OutputSimContainersCfg
def OutputSimContainersCfg(flags)
Definition: MuonG4SDConfig.py:64
python.MetaDataSvcConfig.MetaDataSvcCfg
def MetaDataSvcCfg(flags, toolNames=[], tools=[])
Definition: MetaDataSvcConfig.py:6
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19