ATLAS Offline Software
Loading...
Searching...
No Matches
L0MuonS1TGCValidationConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
6
8 flags,
9 name="TgcL0TruthValidationAlg",
10 **kwargs):
11 """Configure the ROOT-independent TGC truth-validation calculation."""
12 acc = ComponentAccumulator()
13 if "TrackExtrapolator" not in kwargs:
14 from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg
15 kwargs.setdefault(
16 "TrackExtrapolator",
17 acc.popToolsAndMerge(AtlasExtrapolatorCfg(flags)))
18 acc.addEventAlgo(CompFactory.L0Muon.TgcL0TruthValidationAlg(name, **kwargs))
19 return acc
20
21
23 flags,
24 name="TgcL0RootOutputAlg",
25 outputFile="L0MuonTGCValidation.root",
26 **kwargs):
27 """Configure the MuonTester event-level TTree backend."""
28 acc = ComponentAccumulator()
29 histSvc = CompFactory.THistSvc(
30 Output=[f"L0MUONTGCVALID DATAFILE='{outputFile}' OPT='RECREATE'"])
31 acc.addService(histSvc)
32 acc.addEventAlgo(CompFactory.L0Muon.TgcL0RootOutputAlg(name, **kwargs))
33 return acc
34
35
37 flags,
38 outputFile="L0MuonTGCValidation.root",
39 rootOutputKwargs=None,
40 **kwargs):
41 """Configure truth validation and its MuonTester TTree backend."""
42 acc = ComponentAccumulator()
43 validation_key = kwargs.setdefault(
44 "OutputKey", "L0MuonTGCValidationEvent")
45 root_kwargs = dict(rootOutputKwargs or {})
46 root_kwargs.setdefault("InputKey", validation_key)
47 acc.merge(TgcL0TruthValidationAlgCfg(flags, **kwargs))
48 acc.merge(TgcL0RootOutputAlgCfg(
49 flags, outputFile=outputFile, **root_kwargs))
50 return acc
51
52
53if __name__ == "__main__":
54 from AthenaConfiguration.AllConfigFlags import initConfigFlags
55 from L0MuonS1TGC.L0MuonS1TGCConfig import L0MuonTGCSimCfg
56 from MuonConfig.MuonConfigUtils import executeTest
57 from MuonGeoModelTestR4.testGeoModel import (
58 MuonPhaseIITestDefaults,
59 SetupArgParser,
60 setupGeoR4TestCfg,
61 )
62
63 parser = SetupArgParser()
64 parser.set_defaults(inputFile=MuonPhaseIITestDefaults.RDO_R3)
65 parser.set_defaults(nEvents=10)
66 args = parser.parse_args()
67
68 flags = initConfigFlags()
69 flags.Common.MsgSuppression = False
70 flags, acc = setupGeoR4TestCfg(args, flags)
71
72 validation_candidate_key = "L0MuonTGCValidationCandidates"
73 validation_segment_key = "L0MuonTGCValidationSegments"
74 acc.merge(
75 L0MuonTGCSimCfg(
76 flags,
77 ValidationCandidateKey=validation_candidate_key,
78 ValidationSegmentKey=validation_segment_key,
79 )
80 )
81 acc.merge(
83 flags,
84 CandidateKey=validation_candidate_key,
85 SegmentKey=validation_segment_key,
86 )
87 )
88 executeTest(acc)
TgcL0RootOutputAlgCfg(flags, name="TgcL0RootOutputAlg", outputFile="L0MuonTGCValidation.root", **kwargs)
L0MuonS1TGCTruthValidationCfg(flags, outputFile="L0MuonTGCValidation.root", rootOutputKwargs=None, **kwargs)
TgcL0TruthValidationAlgCfg(flags, name="TgcL0TruthValidationAlg", **kwargs)