ATLAS Offline Software
MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/python/MuonTruthAlgsConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 
5 
6 def TruthSegmentMakerCfg(flags, name = "TruthSegmentMakerAlg", **kwargs):
7  result = ComponentAccumulator()
8  if not flags.Input.isMC:
9  return result
10 
11  from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsGeometryContextAlgCfg
12  result.merge(ActsGeometryContextAlgCfg(flags))
13  containerNames = []
14 
15  if flags.Detector.EnableMDT: containerNames+=["MDT_SDO"]
16  if flags.Detector.EnableRPC: containerNames+=["RPC_SDO"]
17  if flags.Detector.EnableTGC: containerNames+=["TGC_SDO"]
18  if flags.Detector.EnableMM: containerNames+=["MM_SDO"]
19  if flags.Detector.EnablesTGC: containerNames+=["sTGC_SDO"]
20  kwargs.setdefault("SimHitKeys", containerNames)
21 
22  the_alg = CompFactory.MuonR4.TruthSegmentMaker(name, **kwargs)
23  result.addEventAlgo(the_alg, primary = True)
24  return result
25 
26 def MeasToSimHitAssocAlgCfg(flags, name="MeasToSimHitConvAlg", **kwargs):
27  result = ComponentAccumulator()
28  from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsGeometryContextAlgCfg
29  result.merge(ActsGeometryContextAlgCfg(flags))
30  the_alg = CompFactory.MuonR4.PrepDataToSimHitAssocAlg(name, **kwargs)
31  result.addEventAlgo(the_alg, primary = True)
32  return result
33 
35  result = ComponentAccumulator()
36  if not flags.Input.isMC:
37  return result
38  from MuonConfig.MuonDataPrepConfig import PrimaryMeasContNamesCfg
39  for cont_name in PrimaryMeasContNamesCfg(flags):
40  simHits = ""
41  if "xMdt" in cont_name:
42  simHits = "MDT_SDO"
43  elif "xRpc" in cont_name:
44  simHits = "RPC_SDO"
45  elif "xTgc" in cont_name:
46  simHits = "TGC_SDO"
47  elif "MM" in cont_name:
48  simHits = "MM_SDO"
49  else:
50  simHits = "sTGC_SDO"
51  result.merge(MeasToSimHitAssocAlgCfg(flags,
52  name=f"{cont_name}PrepDataToSimHitAssoc",
53  SimHits = simHits,
54  Measurements=cont_name,
55  AssocPull = 1. if cont_name=="xAODsTgcPads" else 3. ))
56  return result
57 
59  result = ComponentAccumulator()
60  from MuonConfig.MuonDataPrepConfig import PrimaryMeasContNamesCfg
61  prdContainer = PrimaryMeasContNamesCfg(flags)
62  if flags.Detector.GeometryMDT:
63  the_alg = CompFactory.MuonR4.PrdMultiTruthMaker("PrdMultiTruthMakerMdt",
64  PrdContainer = [prd for prd in prdContainer if "xMdt" in prd],
65  WriteKey = "MDT_TruthMap")
66  result.addEventAlgo(the_alg)
67  if flags.Detector.GeometryRPC:
68  the_alg = CompFactory.MuonR4.PrdMultiTruthMaker("PrdMultiTruthMakerRpc",
69  PrdContainer = [prd for prd in prdContainer if "xRpc" in prd],
70  WriteKey = "RPC_TruthMap")
71  result.addEventAlgo(the_alg)
72  if flags.Detector.GeometryTGC:
73  the_alg = CompFactory.MuonR4.PrdMultiTruthMaker("PrdMultiTruthMakerTgc",
74  PrdContainer = [prd for prd in prdContainer if "xTgc" in prd],
75  WriteKey = "TGC_TruthMap")
76  result.addEventAlgo(the_alg)
77  if flags.Detector.GeometryMM:
78  the_alg = CompFactory.MuonR4.PrdMultiTruthMaker("PrdMultiTruthMakerMm",
79  PrdContainer = [prd for prd in prdContainer if "MM" in prd],
80  WriteKey = "MM_TruthMap")
81  result.addEventAlgo(the_alg)
82  if flags.Detector.GeometrysTGC:
83  the_alg = CompFactory.MuonR4.PrdMultiTruthMaker("PrdMultiTruthMakerSTGC",
84  PrdContainer = [prd for prd in prdContainer if "sTgc" in prd],
85  WriteKey = "STGC_TruthMap")
86  result.addEventAlgo(the_alg)
87  return result
88 
89 def MuonTruthAlgsCfg(flags):
90  result = ComponentAccumulator()
91  result.merge(TruthHitAssociationCfg(flags))
92  from MuonConfig.MuonDataPrepConfig import PrimaryMeasContNamesCfg
93  PrdLinkInputs = [( "xAOD::UncalibratedMeasurementContainer" ,
94  "StoreGateSvc+{cont_name}.simHitLink".format(cont_name = cont_name)) for cont_name in PrimaryMeasContNamesCfg(flags) ]
95  result.merge(TruthSegmentMakerCfg(flags, ExtraInputs = PrdLinkInputs))
96  result.merge(PrdMultiTruthMakerCfg(flags))
97  return result
MuonTruthAlgsConfig.TruthSegmentMakerCfg
def TruthSegmentMakerCfg(flags, name="TruthSegmentMakerAlg", **kwargs)
Definition: MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/python/MuonTruthAlgsConfig.py:6
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
vtune_athena.format
format
Definition: vtune_athena.py:14
MuonTruthAlgsConfig.TruthHitAssociationCfg
def TruthHitAssociationCfg(flags)
Definition: MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/python/MuonTruthAlgsConfig.py:34
MuonTruthAlgsConfig.MuonTruthAlgsCfg
def MuonTruthAlgsCfg(flags)
Definition: MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/python/MuonTruthAlgsConfig.py:89
MuonTruthAlgsConfig.PrdMultiTruthMakerCfg
def PrdMultiTruthMakerCfg(flags)
Definition: MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/python/MuonTruthAlgsConfig.py:58
AlignmentAlgsConfig.ActsGeometryContextAlgCfg
def ActsGeometryContextAlgCfg(flags, name="GeometryContextAlg", **kwargs)
Setup the Geometry context algorithm.
Definition: AlignmentAlgsConfig.py:125
MuonTruthAlgsConfig.MeasToSimHitAssocAlgCfg
def MeasToSimHitAssocAlgCfg(flags, name="MeasToSimHitConvAlg", **kwargs)
Definition: MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/python/MuonTruthAlgsConfig.py:26
python.MuonDataPrepConfig.PrimaryMeasContNamesCfg
def PrimaryMeasContNamesCfg(flags)
Definition: MuonDataPrepConfig.py:6