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
bool decorateCells = True

Function Documentation

◆ EGAM10Cfg()

python.EGAM10.EGAM10Cfg ( flags)

Definition at line 196 of file EGAM10.py.

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

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

◆ EGAM10SkimmingToolCfg()

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

Definition at line 38 of file EGAM10.py.

38def EGAM10SkimmingToolCfg(flags):
39 """Configure the EGAM10 skimming tool"""
40 acc = ComponentAccumulator()
41
42 # off-line based selection
43 photonSelection = "(count(" + photonRequirements + ") >= 1)"
44 print("EGAM10 offline skimming expression: ", photonSelection)
45 EGAM10_OfflineSkimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(
46 name="EGAM10_OfflineSkimmingTool", expression=photonSelection, TrigDecisionTool="",
47 )
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
69 # do the AND of trigger-based and offline-based selection
70 print("EGAM10 skimming is logical AND of previous selections")
71 EGAM10_SkimmingTool = CompFactory.DerivationFramework.FilterCombinationAND(
72 name="EGAM10_SkimmingTool",
73 FilterList=[EGAM10_OfflineSkimmingTool, EGAM10_TriggerSkimmingTool],
74 )
75
76 acc.addPublicTool(EGAM10_OfflineSkimmingTool)
77 acc.addPublicTool(EGAM10_TriggerSkimmingTool)
78 acc.addPublicTool(EGAM10_SkimmingTool, primary=True)
79 else:
80 print("Unknown Trigger.EDMVersion ", flags.Trigger.EDMVersion)
81 print("Will not apply trigger-based skimming")
82 acc.addPublicTool(EGAM10_OfflineSkimmingTool, primary=True)
83
84 return acc
85
86
STL class.

Variable Documentation

◆ decorateCells

bool python.EGAM10.decorateCells = True

Definition at line 36 of file EGAM10.py.

◆ 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.