ATLAS Offline Software
Loading...
Searching...
No Matches
MuonBucketDumpConfig.py
Go to the documentation of this file.
1#Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
6
7def MuonHitDumperCfg(flags, name="MuonHitDumper", **kwargs):
8 result = ComponentAccumulator()
9 spCont = []
10 if flags.Detector.GeometryMDT or flags.Detector.GeometryRPC or flags.Detector.GeometryTGC:
11 spCont+=["MuonSpacePoints"]
12 if flags.Detector.GeometryMM or flags.Detector.GeometrysTGC:
13 spCont+=["NswSpacePoints"]
14 kwargs.setdefault("SpacePointKeys", spCont)
15 result.addEventAlgo(CompFactory.MuonR4.MlHitDumperAlg(name, **kwargs))
16 return result
17
18def BucketScoreDumpCfg(flags, name="GraphBucketFilterTool", **kwargs):
19 from MuonInference.InferenceConfig import GraphBucketFilterToolCfg
20 kwargs_copy = kwargs.copy()
21 kwargs_copy.setdefault("ReadSpacePoints", "MuonSpacePoints")
22 kwargs_copy.setdefault("WriteSpacePointKey", "")
23 kwargs_copy.setdefault("ModelPath", "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/edgecnn_multi_bucket_sparse_meta.onnx")
24 kwargs_copy.setdefault("BiasClass0", 1.0)
25 return GraphBucketFilterToolCfg(flags, name=name, **kwargs_copy)
26
27def MuonBucketDumpCfg(flags, name="MuonBucketDumper", **kwargs):
28 result = ComponentAccumulator()
29 from MuonSpacePointFormation.SpacePointFormationConfig import MuonSpacePointFormationCfg
30 result.merge(MuonSpacePointFormationCfg(flags))
31 kwargs.setdefault("isMC", flags.Input.isMC)
32
33 # Optional calorimeter chain + dumper
34 doCalo = bool(kwargs.pop("DoCaloDump", False))
35 if doCalo:
36 result.merge(CaloCellsDumperCfg(flags))
37
38 doMLBucketScore = bool(kwargs.pop("DoMLBucketScore", False))
39 doMLBucketFilter = bool(kwargs.pop("DoMLBucketFilter", False))
40 mlBucketBias = kwargs.pop("MLBucketBias", 1.0)
41 if doMLBucketScore:
42 kwargs.setdefault("DoMLBucketScore", True)
43 toolCfg = BucketScoreDumpCfg(flags, BiasClass0=mlBucketBias)
44 inferenceTool = result.popToolsAndMerge(toolCfg)
45 kwargs.setdefault("InferenceTool", inferenceTool)
46 if doMLBucketFilter:
47 kwargs.setdefault("DoMLBucketFilter", True)
48
49 from RngComps.RngCompsConfig import AthRNGSvcCfg
50 kwargs.setdefault("RndmSvc", result.getPrimaryAndMerge(AthRNGSvcCfg(flags)))
51 spCont = []
52 if flags.Detector.GeometryMDT or flags.Detector.GeometryRPC or flags.Detector.GeometryTGC:
53 spCont+=["MuonSpacePoints"]
54 if flags.Detector.GeometryMM or flags.Detector.GeometrysTGC:
55 spCont+=["NswSpacePoints"]
56
57 kwargs.setdefault("SpacePointKeys", spCont)
58
59 the_alg = CompFactory.MuonR4.BucketDumperAlg(name=name, **kwargs)
60 result.addEventAlgo(the_alg, primary = True)
61 return result
62
63def MuonSegmentDumpCfg(flags, name="MuonSegmentDumper", **kwargs):
64 result = ComponentAccumulator()
65 from MuonSpacePointFormation.SpacePointFormationConfig import MuonSpacePointFormationCfg
66 result.merge(MuonSpacePointFormationCfg(flags))
67
68 spCont = []
69 if flags.Detector.GeometryMDT or flags.Detector.GeometryRPC or flags.Detector.GeometryTGC:
70 spCont+=["MuonSpacePoints"]
71 if flags.Detector.GeometryMM or flags.Detector.GeometrysTGC:
72 spCont+=["NswSpacePoints"]
73
74 segCont = ""
75 if flags.Detector.GeometryMDT or flags.Detector.GeometryRPC or flags.Detector.GeometryTGC:
76 segCont = "MuonSegmentsFromR4"
77
78 kwargs.setdefault("SpacePointKeys", spCont)
79 kwargs.setdefault("SegmentKeys", segCont)
80
81 the_alg = CompFactory.MuonR4.SegmentDumperAlg(name=name, **kwargs)
82 result.addEventAlgo(the_alg, primary = True)
83 return result
84
85def CaloCellsDumperCfg(flags, name="CaloCellsDumper", **kwargs):
86 """
87 Configure calorimeter reconstruction up to cells and towers and dump:
88 - per-cell energy + position + identifier decoding
89 - per-tower energy + (eta,phi) + a derived direction vector Default input container key:
90 Default input container key:
91 - "AllCalo" (standard CaloCellContainer produced by CaloRecoCfg)
92 If you want supercells instead, pass:
93 CellContainerKey="SCell" (or whatever your CaloRecoCfg produces in your setup)
94 """
95 result = ComponentAccumulator()
96
97 # Make sure the reconstructed cell container exists from RDO
98 from CaloRec.CaloRecoConfig import CaloRecoCfg
99 result.merge(CaloRecoCfg(flags))
100
101 # Build calorimeter towers from cells (default container name is typically "CombinedTower")
102 from CaloRec.CaloTowerMakerConfig import CaloTowerMakerCfg
103 towerMaker = result.getPrimaryAndMerge(CaloTowerMakerCfg(flags))
104
105 kwargs.setdefault("CellContainerKey", "AllCalo")
106 kwargs.setdefault("MinCellEnergyMeV", 0.0)
107 kwargs.setdefault("MaxCells", -1) # -1 => no cap
108
109 kwargs.setdefault("TowerContainerKey", getattr(towerMaker, "TowerContainerName", "CombinedTower"))
110 kwargs.setdefault("MinTowerEnergyMeV", 0.0)
111 kwargs.setdefault("MaxTowers", -1) # -1 => no cap
112
113 result.addEventAlgo(CompFactory.MuonR4.CaloCellsDumperAlg(name, **kwargs))
114 return result
115
116def TruthMuonVertexDumpCfg(flags, name="TruthMuonVertexDumper", **kwargs):
117 result = ComponentAccumulator()
118 the_alg=CompFactory.MuonR4.TruthMuonVertexDumperAlg(name=name, **kwargs)
119 result.addEventAlgo(the_alg, primary = True)
120 return result
BucketScoreDumpCfg(flags, name="GraphBucketFilterTool", **kwargs)
MuonSegmentDumpCfg(flags, name="MuonSegmentDumper", **kwargs)
CaloCellsDumperCfg(flags, name="CaloCellsDumper", **kwargs)
TruthMuonVertexDumpCfg(flags, name="TruthMuonVertexDumper", **kwargs)
MuonHitDumperCfg(flags, name="MuonHitDumper", **kwargs)
MuonBucketDumpCfg(flags, name="MuonBucketDumper", **kwargs)