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

Functions

 EGAM10SkimmingToolCfg (flags)
 EGAM10KernelCfg (flags, name="EGAM10Kernel", **kwargs)
 EGAM10Cfg (flags)

Variables

str electronRequirements
str photonRequirements

Function Documentation

◆ EGAM10Cfg()

python.EGAM10.EGAM10Cfg ( flags)

Definition at line 192 of file EGAM10.py.

192def EGAM10Cfg(flags):
193 acc = ComponentAccumulator()
194
195 # Get the lists of triggers needed for trigger matching.
196 # This is needed at this scope (for the slimming) and further down
197 # in the config chain for actually configuring the matching, so we create
198 # it here and pass it down
199 # TODO: this should ideally be called higher up to avoid it being run
200 # multiple times in a train.
201 # TODO: restrict it to relevant triggers
202 from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
203
204 EGAM10TriggerListsHelper = TriggerListsHelper(flags)
205
206 # configure skimming/thinning/augmentation tools
207 acc.merge(
208 EGAM10KernelCfg(
209 flags,
210 name="EGAM10Kernel",
211 StreamName="StreamDAOD_EGAM10",
212 TriggerListsHelper=EGAM10TriggerListsHelper,
213 )
214 )
215
216 # configure slimming
217 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
218 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
219 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
220
221 EGAM10SlimmingHelper = SlimmingHelper(
222 "EGAM10SlimmingHelper",
223 NamesAndTypes=flags.Input.TypedCollections,
224 flags=flags,
225 )
226
227 # ------------------------------------------
228 # containers for which we save all variables
229 # -------------------------------------------
230
231 # baseline
232 EGAM10SlimmingHelper.AllVariables = [
233 "CaloCalTopoClusters",
234 "egammaClusters"
235 ]
236
237 # and on MC we also add:
238 if flags.Input.isMC:
239 EGAM10SlimmingHelper.AppendToDictionary.update(
240 {
241 "TruthIsoCentralEventShape": "xAOD::EventShape",
242 "TruthIsoCentralEventShapeAux": "xAOD::EventShapeAuxInfo",
243 "TruthIsoForwardEventShape": "xAOD::EventShape",
244 "TruthIsoForwardEventShapeAux": "xAOD::EventShapeAuxInfo",
245 }
246 )
247 EGAM10SlimmingHelper.AllVariables += [
248 "TruthEvents",
249 "TruthParticles",
250 "TruthVertices",
251 "TruthMuons",
252 "TruthElectrons",
253 "TruthPhotons",
254 "TruthNeutrinos",
255 "TruthTaus",
256 "AntiKt4TruthJets",
257 "AntiKt4TruthDressedWZJets",
258 "egammaTruthParticles",
259 "TruthIsoCentralEventShape",
260 "TruthIsoForwardEventShape",
261 ]
262
263 # -------------------------------------------
264 # containers that we slim
265 # -------------------------------------------
266
267 # first add variables from smart-slimming
268 # adding only also those for which we add all variables since
269 # the XXXCPContent.py files also bring in some extra variables
270 # for other collections
271 # muons, tau, MET, b-tagging could be switched off if not needed
272 # and use too much space
273 EGAM10SlimmingHelper.SmartCollections = [
274 "Electrons",
275 "Photons",
276 "InDetTrackParticles",
277 "PrimaryVertices",
278 "AntiKt4EMPFlowJets",
279 ]
280
281 if flags.Input.isMC:
282 EGAM10SlimmingHelper.SmartCollections += [
283 "AntiKt4TruthJets",
284 "AntiKt4TruthDressedWZJets",
285 ]
286
287 # then add extra variables:
288
289 # egamma clusters
290 EGAM10SlimmingHelper.ExtraVariables += [
291 "egammaClusters.PHI2CALOFRAME.ETA2CALOFRAME.phi_sampl",
292 ]
293
294 # photons
295 EGAM10SlimmingHelper.ExtraVariables += [
296 "Photons.ptcone30.ptcone40.f3.f3core",
297 "Photons.maxEcell_time.maxEcell_energy.maxEcell_gain.maxEcell_onlId",
298 "Photons.maxEcell_x.maxEcell_y.maxEcell_z",
299 "Photons.ptcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
300 "Photons.ptcone40_Nonprompt_All_MaxWeightTTVA_pt500",
301 "Photons.ptcone20_Nonprompt_All_MaxWeightTTVA_pt500",
302 "Photons.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000",
303 "Photons.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500",
304 ]
305
306 # electrons
307 EGAM10SlimmingHelper.ExtraVariables += [
308 "Electrons.topoetcone30.topoetcone40.ptcone20.ptcone30",
309 "Electrons.ptcone40.maxEcell_time.maxEcell_energy.maxEcell_gain",
310 "Electrons.maxEcell_onlId.maxEcell_x.maxEcell_y.maxEcell_z",
311 ]
312
313 # primary vertices
314 EGAM10SlimmingHelper.ExtraVariables += [
315 "PrimaryVertices.covariance.trackWeights.sumPt2.sumPt",
316 "PrimaryVertices.pt.eta.phi",
317 ]
318
319 # tracks
320 EGAM10SlimmingHelper.ExtraVariables += [
321 "InDetTrackParticles.TTVA_AMVFVertices.TTVA_AMVFWeights"
322 ]
323
324 # photons and electrons: detailed shower shape variables and track variables
325 EGAM10SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent
326
327 # photons: gain and cluster energy per layer
328 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import (
329 getGainDecorations,
330 getClusterEnergyPerLayerDecorations,
331 )
332
333 gainDecorations = getGainDecorations(acc, flags, "EGAM10Kernel")
334 print("EGAM10 gain decorations: ", gainDecorations)
335 EGAM10SlimmingHelper.ExtraVariables.extend(gainDecorations)
336 clusterEnergyDecorations = getClusterEnergyPerLayerDecorations(acc, "EGAM10Kernel")
337 print("EGAM10 cluster energy decorations: ", clusterEnergyDecorations)
338 EGAM10SlimmingHelper.ExtraVariables.extend(clusterEnergyDecorations)
339
340 # energy density
341 EGAM10SlimmingHelper.ExtraVariables += [
342 "TopoClusterIsoCentralEventShape.Density",
343 "TopoClusterIsoForwardEventShape.Density",
344 ]
345
346 from DerivationFrameworkEGamma import EGammaIsoConfig
347
348 (
349 pflowIsoVar,
350 densityList,
351 densityDict,
352 acc1,
353 ) = EGammaIsoConfig.makeEGammaCommonIsoCfg(flags)
354 acc.merge(acc1)
355 EGAM10SlimmingHelper.AppendToDictionary.update(densityDict)
356 EGAM10SlimmingHelper.ExtraVariables += densityList + [f"Photons{pflowIsoVar}"]
357
358 # To have ptcone40, needed for efficiency measurement with MM
359 from IsolationAlgs.DerivationTrackIsoConfig import DerivationTrackIsoCfg
360
361 acc.merge(
362 DerivationTrackIsoCfg(
363 flags, object_types=("Photons",), ptCuts=(500, 1000), postfix="Extra"
364 )
365 )
366
367 # truth
368 if flags.Input.isMC:
369 EGAM10SlimmingHelper.ExtraVariables += [
370 "Electrons.truthClassification.truthOrigin.truthType.truthParticleLink.truthPdgId",
371 "Electrons.lastEgMotherTruthClassification.lastEgMotherTruthType.lastEgMotherTruthOrigin",
372 "Electrons.lastEgMotherTruthParticleLink.lastEgMotherPdgId",
373 "Electrons.firstEgMotherTruthClassification.firstEgMotherTruthType.firstEgMotherTruthOrigin",
374 "Electrons.firstEgMotherTruthParticleLink.firstEgMotherPdgId",
375 ]
376
377 EGAM10SlimmingHelper.ExtraVariables += [
378 "Photons.truthClassification.truthOrigin.truthType.truthParticleLink"
379 ]
380
381 EGAM10SlimmingHelper.ExtraVariables += [
382 "TruthIsoCentralEventShape.DensitySigma.Density.DensityArea",
383 "TruthIsoForwardEventShape.DensitySigma.Density.DensityArea",
384 ]
385
386 # Add event info
387 if flags.Derivation.Egamma.doEventInfoSlimming:
388 EGAM10SlimmingHelper.SmartCollections.append("EventInfo")
389 else:
390 EGAM10SlimmingHelper.AllVariables += ["EventInfo"]
391
392 # Add egamma trigger objects
393 EGAM10SlimmingHelper.IncludeEGammaTriggerContent = True
394
395 # Trigger matching
396 # Run 2
397 if flags.Trigger.EDMVersion == 2:
398 from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
399 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = EGAM10SlimmingHelper,
400 OutputContainerPrefix = "TrigMatch_",
401 TriggerList = EGAM10TriggerListsHelper.Run2TriggerNamesNoTau)
402 # Run 3, or Run 2 with navigation conversion
403 if flags.Trigger.EDMVersion == 3 or (flags.Trigger.EDMVersion == 2 and flags.Trigger.doEDMVersionConversion):
404 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
405 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(EGAM10SlimmingHelper)
406
407 # Add full CellContainer
408 EGAM10SlimmingHelper.StaticContent = [
409 "CaloCellContainer#AllCalo",
410 "CaloClusterCellLinkContainer#egammaClusters_links",
411 ]
412
413 EGAM10ItemList = EGAM10SlimmingHelper.GetItemList()
414 acc.merge(
415 OutputStreamCfg(
416 flags,
417 "DAOD_EGAM10",
418 ItemList=EGAM10ItemList,
419 AcceptAlgs=["EGAM10Kernel"],
420 )
421 )
422 acc.merge(
423 SetupMetaDataForStreamCfg(
424 flags,
425 "DAOD_EGAM10",
426 AcceptAlgs=["EGAM10Kernel"],
427 createMetadata=[
428 MetadataCategory.CutFlowMetaData,
429 MetadataCategory.TruthMetaData,
430 ],
431 )
432 )
433
434 return acc
void print(char *figname, TCanvas *c1)

◆ EGAM10KernelCfg()

python.EGAM10.EGAM10KernelCfg ( flags,
name = "EGAM10Kernel",
** kwargs )
Configure the derivation framework driving algorithm (kernel)
for EGAM10

Definition at line 83 of file EGAM10.py.

83def EGAM10KernelCfg(flags, name="EGAM10Kernel", **kwargs):
84 """Configure the derivation framework driving algorithm (kernel)
85 for EGAM10"""
86 acc = ComponentAccumulator()
87
88 # Common augmentations
89 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
90
91 acc.merge(
92 PhysCommonAugmentationsCfg(
93 flags, TriggerListsHelper=kwargs["TriggerListsHelper"]
94 )
95 )
96
97 # EGAM10 augmentations
98 augmentationTools = []
99
100 # ====================================================================
101 # PhotonVertexSelectionWrapper decoration tool - needs PhotonPointing tool
102 # ====================================================================
103 from DerivationFrameworkEGamma.EGammaToolsConfig import (
104 PhotonVertexSelectionWrapperKernelCfg)
105 acc.merge(PhotonVertexSelectionWrapperKernelCfg(flags))
106
107 # ====================================================================
108 # Common calo decoration tools
109 # ====================================================================
110 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import (
111 CaloDecoratorKernelCfg
112 )
113 acc.merge(CaloDecoratorKernelCfg(flags))
114
115 # thinning tools
116 thinningTools = []
117 streamName = kwargs["StreamName"]
118
119 # Track thinning
120 if flags.Derivation.Egamma.doTrackThinning:
121 TrackThinningKeepElectronTracks = True
122 TrackThinningKeepPhotonTracks = True
123 TrackThinningKeepAllElectronTracks = True
124
125 # Tracks associated with high-pT Electrons (deltaR=0.6)
126 if TrackThinningKeepElectronTracks:
127 EGAM10ElectronTPThinningTool = (
128 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
129 name="EGAM10ElectronTPThinningTool",
130 StreamName=streamName,
131 SGKey="Electrons",
132 GSFTrackParticlesKey="GSFTrackParticles",
133 InDetTrackParticlesKey="InDetTrackParticles",
134 SelectionString=electronRequirements,
135 BestMatchOnly=True,
136 ConeSize=0.6,
137 )
138 )
139 acc.addPublicTool(EGAM10ElectronTPThinningTool)
140 thinningTools.append(EGAM10ElectronTPThinningTool)
141
142 # Tracks associated with Photons
143 if TrackThinningKeepPhotonTracks:
144 EGAM10PhotonTPThinningTool = (
145 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
146 name="EGAM10PhotonTPThinningTool",
147 StreamName=streamName,
148 SGKey="Photons",
149 GSFTrackParticlesKey="GSFTrackParticles",
150 InDetTrackParticlesKey="InDetTrackParticles",
151 GSFConversionVerticesKey="GSFConversionVertices",
152 SelectionString=photonRequirements,
153 BestMatchOnly=False,
154 ConeSize=0.6,
155 )
156 )
157 acc.addPublicTool(EGAM10PhotonTPThinningTool)
158 thinningTools.append(EGAM10PhotonTPThinningTool)
159
160 # Tracks associated with all Electrons (for ambiguity resolver tool)
161 if TrackThinningKeepAllElectronTracks:
162 EGAM10ElectronTPThinningToolAR = (
163 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
164 name="EGAM10ElectronTPThinningToolAR",
165 StreamName=streamName,
166 SGKey="Electrons",
167 GSFTrackParticlesKey="GSFTrackParticles",
168 InDetTrackParticlesKey="InDetTrackParticles",
169 SelectionString=electronRequirements,
170 BestMatchOnly=True,
171 )
172 )
173 acc.addPublicTool(EGAM10ElectronTPThinningToolAR)
174 thinningTools.append(EGAM10ElectronTPThinningToolAR)
175
176 # skimming
177 skimmingTool = acc.getPrimaryAndMerge(EGAM10SkimmingToolCfg(flags))
178
179 # setup the kernel
180 acc.addEventAlgo(
181 CompFactory.DerivationFramework.DerivationKernel(
182 name,
183 SkimmingTools=[skimmingTool],
184 AugmentationTools=augmentationTools,
185 ThinningTools=thinningTools,
186 )
187 )
188
189 return acc
190
191

◆ EGAM10SkimmingToolCfg()

python.EGAM10.EGAM10SkimmingToolCfg ( flags)
Configure the EGAM10 skimming tool

Definition at line 36 of file EGAM10.py.

36def EGAM10SkimmingToolCfg(flags):
37 """Configure the EGAM10 skimming tool"""
38 acc = ComponentAccumulator()
39
40 # off-line based selection
41 photonSelection = "(count(" + photonRequirements + ") >= 1)"
42 print("EGAM10 offline skimming expression: ", photonSelection)
43 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
44 xAODStringSkimmingToolCfg)
45 EGAM10_OfflineSkimmingTool = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
46 flags, name="EGAM10_OfflineSkimmingTool", expression=photonSelection))
47 filterList = [EGAM10_OfflineSkimmingTool]
48
49 # trigger-based selection
50 MenuType = None
51 if flags.Trigger.EDMVersion == 2:
52 MenuType = "Run2"
53 elif flags.Trigger.EDMVersion == 3:
54 MenuType = "Run3"
55 if MenuType:
56 allTriggers = (
57 singlePhotonTriggers[MenuType]
58 + diPhotonTriggers[MenuType]
59 + triPhotonTriggers[MenuType]
60 + noalgTriggers[MenuType]
61 )
62 # remove duplicates
63 allTriggers = list(set(allTriggers))
64 print("EGAM10 trigger skimming list (OR): ", allTriggers)
65 EGAM10_TriggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(
66 name="EGAM10_TriggerSkimmingTool", TriggerListOR=allTriggers
67 )
68 acc.addPublicTool(EGAM10_TriggerSkimmingTool)
69 filterList += [EGAM10_TriggerSkimmingTool]
70 else:
71 print("Unknown Trigger.EDMVersion ", flags.Trigger.EDMVersion)
72 print("Will not apply trigger-based skimming")
73
74 # do the AND of trigger-based and offline-based selection
75 print("EGAM10 skimming is logical AND of previous selections")
76 EGAM10_SkimmingTool = CompFactory.DerivationFramework.FilterCombinationAND(
77 name="EGAM10_SkimmingTool", FilterList=filterList)
78
79 acc.addPublicTool(EGAM10_SkimmingTool, primary=True)
80 return acc
81
82
STL class.

Variable Documentation

◆ electronRequirements

str python.EGAM10.electronRequirements
Initial value:
1= " && ".join(
2 [
3 "(Electrons.pt > 15*GeV)",
4 "(abs(Electrons.eta) < 2.5)",
5 "(Electrons.DFCommonElectronsLHLoose)",
6 ]
7)

Definition at line 25 of file EGAM10.py.

◆ photonRequirements

str python.EGAM10.photonRequirements
Initial value:
1= " && ".join(
2 ["(DFCommonPhotons_et >= 15*GeV)", "(abs(DFCommonPhotons_eta) < 2.5)"]
3)

Definition at line 32 of file EGAM10.py.