ATLAS Offline Software
Loading...
Searching...
No Matches
python.InDetGNNHardScatterSelectionConfig Namespace Reference

Functions

 AsgPtEtaSelectionToolCfg (flags, name="AsgPtEtaSelectionTool", **kwargs)
 AsgPtEtaSelectionToolGapCfg (flags, name="AsgPtEtaSelectionTool", **kwargs)
 AsgViewFromSelectionAlgCfg (flags, name="AsgViewFromSelectionAlg", **kwargs)
 GNNHSSelectionAlgCfg (flags, input, minPt)
 GNNHSOverlapRemovalToolCfg (flags, name="GNNHS_OverlapRemovalToolCfg", **kwargs)
 GNNHSOverlapRemovalAlgCfg (flags, name="GNNHS_OverlapRemovalAlg", overlapInputNames=None, overlapOutputNames=None, **kwargs)
 GNNToolCfg (flags, name="HardScatterSelectionGNNTool", **kwargs)
 GNNHSVertexDecoratorAlgCfg (flags, name="GNNHS_VertexDecoratorAlg", **kwargs)
 GNNSequenceCfg (flags, doOverlapRemoval=True)

Variables

 flags = initConfigFlags()
 Files
 MaxEvents
 top_acc = MainServicesCfg(flags)
 OutputLevel
 withDetails
 True
 summariseProps
 sc = top_acc.run(1)

Function Documentation

◆ AsgPtEtaSelectionToolCfg()

python.InDetGNNHardScatterSelectionConfig.AsgPtEtaSelectionToolCfg ( flags,
name = "AsgPtEtaSelectionTool",
** kwargs )

Definition at line 11 of file InDetGNNHardScatterSelectionConfig.py.

11def AsgPtEtaSelectionToolCfg(flags, name="AsgPtEtaSelectionTool", **kwargs):
12 cfg = ComponentAccumulator()
13 kwargs.setdefault("maxEta", 2.5)
14 cfg.setPrivateTools(CompFactory.CP.AsgPtEtaSelectionTool(name, **kwargs))
15 return cfg
16

◆ AsgPtEtaSelectionToolGapCfg()

python.InDetGNNHardScatterSelectionConfig.AsgPtEtaSelectionToolGapCfg ( flags,
name = "AsgPtEtaSelectionTool",
** kwargs )

Definition at line 17 of file InDetGNNHardScatterSelectionConfig.py.

17def AsgPtEtaSelectionToolGapCfg(flags, name="AsgPtEtaSelectionTool", **kwargs):
18 kwargs.setdefault("etaGapLow", 1.37)
19 kwargs.setdefault("etaGapHigh", 1.52)
20 return AsgPtEtaSelectionToolCfg(flags, name, **kwargs)
21

◆ AsgViewFromSelectionAlgCfg()

python.InDetGNNHardScatterSelectionConfig.AsgViewFromSelectionAlgCfg ( flags,
name = "AsgViewFromSelectionAlg",
** kwargs )

Definition at line 22 of file InDetGNNHardScatterSelectionConfig.py.

22def AsgViewFromSelectionAlgCfg(flags, name="AsgViewFromSelectionAlg", **kwargs):
23 cfg = ComponentAccumulator()
24 kwargs.setdefault("selection", "selectPtEta")
25 kwargs.setdefault("deepCopy", False)
26 cfg.addEventAlgo(CompFactory.CP.AsgViewFromSelectionAlg(name, **kwargs))
27 return cfg
28

◆ GNNHSOverlapRemovalAlgCfg()

python.InDetGNNHardScatterSelectionConfig.GNNHSOverlapRemovalAlgCfg ( flags,
name = "GNNHS_OverlapRemovalAlg",
overlapInputNames = None,
overlapOutputNames = None,
** kwargs )

Definition at line 87 of file InDetGNNHardScatterSelectionConfig.py.

88 overlapInputNames = None, overlapOutputNames = None, **kwargs):
89 cfg = ComponentAccumulator()
90
91 kwargs.setdefault("OutputLabel", "passesOR")
92 kwargs.setdefault("affectingSystematicsFilter", ".*")
93
94 for obj in overlapInputNames:
95 kwargs.setdefault(obj, overlapInputNames[obj])
96 kwargs.setdefault(obj+"Decoration", kwargs["OutputLabel"] + ",as_char")
97
98 extraInputs = set(kwargs.get("ExtraInputs", set()))
99 for inputContainer in overlapInputNames.values():
100 extraInputs.add(("xAOD::IParticleContainer", f"StoreGateSvc+{inputContainer}.selectPtEta"))
101 kwargs["ExtraInputs"] = list(extraInputs)
102
103 overlap_outputs = [
104 ("SG::AuxVectorBase", f"StoreGateSvc+{overlapInputNames['jets']}.passesOR"),
105 ("xAOD::IParticleContainer", f"StoreGateSvc+{overlapInputNames['jets']}.passesOR"),
106 ("SG::AuxVectorBase", f"StoreGateSvc+{overlapInputNames['electrons']}.passesOR"),
107 ("xAOD::IParticleContainer", f"StoreGateSvc+{overlapInputNames['electrons']}.passesOR"),
108 ("SG::AuxVectorBase", f"StoreGateSvc+{overlapInputNames['muons']}.passesOR"),
109 ("xAOD::IParticleContainer", f"StoreGateSvc+{overlapInputNames['muons']}.passesOR"),
110 ("SG::AuxVectorBase", f"StoreGateSvc+{overlapInputNames['photons']}.passesOR"),
111 ("xAOD::IParticleContainer", f"StoreGateSvc+{overlapInputNames['photons']}.passesOR"),
112 ]
113
114 kwargs.setdefault("overlapTool", cfg.popToolsAndMerge(GNNHSOverlapRemovalToolCfg(flags)))
115
116 cfg.addEventAlgo(CompFactory.CP.OverlapRemovalAlg(name, ExtraOutputs=overlap_outputs, **kwargs))
117
118 or_container_types = {
119 "jets": ["xAOD::JetContainer", "xAOD::IParticleContainer"],
120 "electrons": ["xAOD::ElectronContainer", "xAOD::IParticleContainer"],
121 "muons": ["xAOD::MuonContainer", "xAOD::IParticleContainer"],
122 "photons": ["xAOD::PhotonContainer", "xAOD::EgammaContainer", "xAOD::IParticleContainer"],
123 }
124
125 for obj in overlapInputNames:
126 output_name = overlapOutputNames[obj]
127 view_outputs = [("xAOD::AuxContainerBase", f"StoreGateSvc+{output_name}Aux.")]
128 for out_type in or_container_types[obj]:
129 view_outputs.append((out_type, f"StoreGateSvc+{output_name}"))
130 view_outputs.extend([
131 ("SG::AuxVectorBase", f"StoreGateSvc+{output_name}.passesOR"),
132 ("xAOD::IParticleContainer", f"StoreGateSvc+{output_name}.passesOR"),
133 ("SG::AuxVectorBase", f"StoreGateSvc+{output_name}.selectPtEta"),
134 ("xAOD::IParticleContainer", f"StoreGateSvc+{output_name}.selectPtEta"),
135 ])
136
137 cfg.addEventAlgo(CompFactory.CP.AsgViewFromSelectionAlg(
138 name = "GNNHS_"+obj+"_ORSelectionAlg",
139 input = overlapInputNames[obj],
140 output = output_name,
141 selection = [kwargs["OutputLabel"]+",as_char"],
142 deepCopy = True,
143 ExtraOutputs = view_outputs))
144
145 return cfg
146
147
148# GNNTool + VertexDecoratorAlg configs
149
STL class.

◆ GNNHSOverlapRemovalToolCfg()

python.InDetGNNHardScatterSelectionConfig.GNNHSOverlapRemovalToolCfg ( flags,
name = "GNNHS_OverlapRemovalToolCfg",
** kwargs )

Definition at line 55 of file InDetGNNHardScatterSelectionConfig.py.

55def GNNHSOverlapRemovalToolCfg(flags, name="GNNHS_OverlapRemovalToolCfg", **kwargs):
56 cfg = ComponentAccumulator()
57
58 kwargs.setdefault("InputLabel", "selectPtEta")
59 kwargs.setdefault("OutputLabel", "passesOR")
60 kwargs.setdefault("OutputPassValue", True)
61
62 subtool_kwargs={}
63 for prop in ["InputLabel", "OutputLabel", "OutputPassValue"]:
64 subtool_kwargs[prop] = kwargs[prop]
65
66 kwargs.setdefault("EleEleORT", CompFactory.ORUtils.EleEleOverlapTool(**subtool_kwargs))
67 kwargs.setdefault("EleMuORT", CompFactory.ORUtils.EleMuSharedTrkOverlapTool(**subtool_kwargs))
68 kwargs.setdefault("EleJetORT", CompFactory.ORUtils.EleJetOverlapTool(**subtool_kwargs))
69 kwargs.setdefault(
70 "MuJetORT",
71 CompFactory.ORUtils.MuJetOverlapTool(
72 PVContainerName=(
73 "PrimaryVertices_initial"
74 if flags.Tracking.PriVertex.sortingSetup is VertexSortingSetup.GNNSorting
75 else "PrimaryVertices"
76 ),
77 **subtool_kwargs
78 )
79 )
80 kwargs.setdefault("PhoEleORT", CompFactory.ORUtils.DeltaROverlapTool(**subtool_kwargs))
81 kwargs.setdefault("PhoMuORT", CompFactory.ORUtils.DeltaROverlapTool(**subtool_kwargs))
82 kwargs.setdefault("PhoJetORT", CompFactory.ORUtils.DeltaROverlapTool(**subtool_kwargs))
83
84 cfg.setPrivateTools(CompFactory.ORUtils.OverlapRemovalTool(name, **kwargs))
85 return cfg
86

◆ GNNHSSelectionAlgCfg()

python.InDetGNNHardScatterSelectionConfig.GNNHSSelectionAlgCfg ( flags,
input,
minPt )

Definition at line 29 of file InDetGNNHardScatterSelectionConfig.py.

29def GNNHSSelectionAlgCfg(flags, input, minPt):
30 cfg = ComponentAccumulator()
31
32 selectionTool = None
33 if input in ["Electrons", "Photons", "AntiKt4EMTopoJets"]:
34 selectionTool = cfg.popToolsAndMerge(
35 AsgPtEtaSelectionToolGapCfg(flags, minPt = minPt))
36 elif input in ["Muons"]:
37 selectionTool = cfg.popToolsAndMerge(
38 AsgPtEtaSelectionToolCfg(flags, minPt = minPt))
39
40 selection_outputs = [
41 ("SG::AuxVectorBase", f"StoreGateSvc+{input}.selectPtEta"),
42 ("xAOD::IParticleContainer", f"StoreGateSvc+{input}.selectPtEta"),
43 ]
44
45 cfg.addEventAlgo(CompFactory.CP.AsgSelectionAlg(
46 name = "GNNHS_"+input+"_SelectionAlg",
47 selectionTool = selectionTool,
48 selectionDecoration = "selectPtEta,as_char",
49 particles = input,
50 ExtraOutputs = selection_outputs))
51
52 return cfg
53
54

◆ GNNHSVertexDecoratorAlgCfg()

python.InDetGNNHardScatterSelectionConfig.GNNHSVertexDecoratorAlgCfg ( flags,
name = "GNNHS_VertexDecoratorAlg",
** kwargs )

Definition at line 155 of file InDetGNNHardScatterSelectionConfig.py.

155def GNNHSVertexDecoratorAlgCfg(flags, name="GNNHS_VertexDecoratorAlg", **kwargs):
156 cfg = ComponentAccumulator()
157
158 kwargs.setdefault("photonsIn", "Photons")
159
160 if "gnnTool" not in kwargs:
161
162 kwargs.setdefault("gnnTool", cfg.popToolsAndMerge(
163 GNNToolCfg(flags,
164 nnFile="InDetGNNHardScatterSelection/v1.2/HSGNN_baseline_v1.2.onnx")))
165
166 if "TrackVertexAssociationTool" not in kwargs:
167 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import TTVAToolCfg
168 kwargs.setdefault(
169 "TrackVertexAssociationTool",
170 cfg.popToolsAndMerge(
171 TTVAToolCfg(
172 flags,
173 "TrackVertexAssociationTool_GNNHS",
174 VertexContName=(
175 "PrimaryVertices_initial"
176 if flags.Tracking.PriVertex.sortingSetup is VertexSortingSetup.GNNSorting
177 else "PrimaryVertices"
178 ),
179 )
180 ),
181 )
182
183
184 vertex_extra_inputs = set(kwargs.get("ExtraInputs", set()))
185 for cont in ["electronsIn", "muonsIn", "photonsIn", "jetsIn"]:
186 if cont in kwargs:
187 vertex_extra_inputs.add(("xAOD::IParticleContainer", f"StoreGateSvc+{kwargs[cont]}"))
188 if "photonsIn" in kwargs:
189 photons_key = kwargs["photonsIn"]
190 vertex_extra_inputs.update({
191 ("xAOD::IParticleContainer", f"StoreGateSvc+{photons_key}.zCommon"),
192 ("xAOD::IParticleContainer", f"StoreGateSvc+{photons_key}.caloPointingZ"),
193 ("xAOD::IParticleContainer", f"StoreGateSvc+{photons_key}.zCommonError"),
194 })
195 kwargs["ExtraInputs"] = list(vertex_extra_inputs)
196
197 cfg.addEventAlgo(CompFactory.InDetGNNHardScatterSelection.VertexDecoratorAlg(name, **kwargs))
198 return cfg
199
200
201# Global Sequence

◆ GNNSequenceCfg()

python.InDetGNNHardScatterSelectionConfig.GNNSequenceCfg ( flags,
doOverlapRemoval = True )

Definition at line 202 of file InDetGNNHardScatterSelectionConfig.py.

202def GNNSequenceCfg(flags, doOverlapRemoval=True):
203 cfg = ComponentAccumulator()
204
205 selectionSvc = CompFactory.CP.SelectionNameSvc("SelectionNameSvc")
206 cfg.addService(selectionSvc)
207
208 inputCollections = {
209 "jets": (
210 "AntiKt4EMTopoCustomVtxGNNJets"
211 if flags.Tracking.PriVertex.sortingSetup is VertexSortingSetup.GNNSorting
212 else "AntiKt4EMTopoJets"
213 ),
214 "electrons": "Electrons",
215 "muons": "Muons",
216 "photons": "Photons",
217 }
218
219 ptThresholds = {
220 "jets": 15000,
221 "electrons": 4500,
222 "muons": 3000,
223 "photons": 10000,
224 }
225
226 for obj in inputCollections:
227 cfg.merge(GNNHSSelectionAlgCfg(flags, input = inputCollections[obj],
228 minPt = ptThresholds[obj]))
229
230 if doOverlapRemoval:
231 # OverlapRemovalAlg is configured with affectingSystematicsFilter,
232 # so the CP systematics service is only needed in this branch.
233 cfg.addService(CompFactory.CP.SystematicsSvc("SystematicsSvc"))
234 overlapOutputNames = {
235 "muons": f'{inputCollections["muons"]}_OR',
236 "electrons": f'{inputCollections["electrons"]}_OR',
237 "photons": f'{inputCollections["photons"]}_OR',
238 "jets": f'{inputCollections["jets"]}_OR',
239 }
240 cfg.merge(GNNHSOverlapRemovalAlgCfg(flags, overlapInputNames = inputCollections,
241 overlapOutputNames = overlapOutputNames))
242 else:
243 # If overlap removal is disabled, use original containers
244 overlapOutputNames = inputCollections
245
246 from PhotonVertexSelection.PhotonVertexSelectionConfig import DecoratePhotonPointingAlgCfg
247 photon_key = overlapOutputNames["photons"]
248 cfg.merge(
249 DecoratePhotonPointingAlgCfg(
250 flags,
251 PhotonContainerKey=photon_key,
252 ExtraInputs=[
253 ("xAOD::EgammaContainer", f"StoreGateSvc+{photon_key}"),
254 ],
255 ExtraOutputs=[
256 ("xAOD::IParticleContainer", f"StoreGateSvc+{photon_key}.zCommon"),
257 ("xAOD::IParticleContainer", f"StoreGateSvc+{photon_key}.caloPointingZ"),
258 ("xAOD::IParticleContainer", f"StoreGateSvc+{photon_key}.zCommonError"),
259 ],
260 )
261 )
262
263 cfg.merge(
264 GNNHSVertexDecoratorAlgCfg(
265 flags,
266 vertexIn=(
267 "PrimaryVertices_initial"
268 if flags.Tracking.PriVertex.sortingSetup is VertexSortingSetup.GNNSorting
269 else "PrimaryVertices"
270 ),
271 electronsIn=overlapOutputNames["electrons"],
272 muonsIn=overlapOutputNames["muons"],
273 photonsIn=overlapOutputNames["photons"],
274 jetsIn=overlapOutputNames["jets"],
275 )
276 )
277
278 return cfg
279
280

◆ GNNToolCfg()

python.InDetGNNHardScatterSelectionConfig.GNNToolCfg ( flags,
name = "HardScatterSelectionGNNTool",
** kwargs )

Definition at line 150 of file InDetGNNHardScatterSelectionConfig.py.

150def GNNToolCfg(flags, name="HardScatterSelectionGNNTool", **kwargs):
151 acc = ComponentAccumulator()
152 acc.setPrivateTools(CompFactory.InDetGNNHardScatterSelection.GNNTool(name, **kwargs))
153 return acc
154

Variable Documentation

◆ Files

python.InDetGNNHardScatterSelectionConfig.Files

Definition at line 287 of file InDetGNNHardScatterSelectionConfig.py.

◆ flags

python.InDetGNNHardScatterSelectionConfig.flags = initConfigFlags()

Definition at line 283 of file InDetGNNHardScatterSelectionConfig.py.

◆ MaxEvents

python.InDetGNNHardScatterSelectionConfig.MaxEvents

Definition at line 288 of file InDetGNNHardScatterSelectionConfig.py.

◆ OutputLevel

python.InDetGNNHardScatterSelectionConfig.OutputLevel

Definition at line 304 of file InDetGNNHardScatterSelectionConfig.py.

◆ sc

python.InDetGNNHardScatterSelectionConfig.sc = top_acc.run(1)

Definition at line 310 of file InDetGNNHardScatterSelectionConfig.py.

◆ summariseProps

python.InDetGNNHardScatterSelectionConfig.summariseProps

Definition at line 305 of file InDetGNNHardScatterSelectionConfig.py.

◆ top_acc

python.InDetGNNHardScatterSelectionConfig.top_acc = MainServicesCfg(flags)

Definition at line 292 of file InDetGNNHardScatterSelectionConfig.py.

◆ True

python.InDetGNNHardScatterSelectionConfig.True

Definition at line 305 of file InDetGNNHardScatterSelectionConfig.py.

◆ withDetails

python.InDetGNNHardScatterSelectionConfig.withDetails

Definition at line 305 of file InDetGNNHardScatterSelectionConfig.py.