39 """Configure the EGAM10 skimming tool"""
40 acc = ComponentAccumulator()
43 photonSelection =
"(count(" + photonRequirements +
") >= 1)"
44 print(
"EGAM10 offline skimming expression: ", photonSelection)
45 from DerivationFrameworkTools.DerivationFrameworkToolsConfig
import (
46 xAODStringSkimmingToolCfg)
47 EGAM10_OfflineSkimmingTool = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
48 flags, name=
"EGAM10_OfflineSkimmingTool", expression=photonSelection))
49 filterList = [EGAM10_OfflineSkimmingTool]
53 if flags.Trigger.EDMVersion == 2:
55 elif flags.Trigger.EDMVersion == 3:
59 singlePhotonTriggers[MenuType]
60 + diPhotonTriggers[MenuType]
61 + triPhotonTriggers[MenuType]
62 + noalgTriggers[MenuType]
65 allTriggers = list(
set(allTriggers))
66 print(
"EGAM10 trigger skimming list (OR): ", allTriggers)
67 EGAM10_TriggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(
68 name=
"EGAM10_TriggerSkimmingTool", TriggerListOR=allTriggers
70 acc.addPublicTool(EGAM10_TriggerSkimmingTool)
71 filterList += [EGAM10_TriggerSkimmingTool]
73 print(
"Unknown Trigger.EDMVersion ", flags.Trigger.EDMVersion)
74 print(
"Will not apply trigger-based skimming")
77 print(
"EGAM10 skimming is logical AND of previous selections")
78 EGAM10_SkimmingTool = CompFactory.DerivationFramework.FilterCombinationAND(
79 name=
"EGAM10_SkimmingTool", FilterList=filterList)
81 acc.addPublicTool(EGAM10_SkimmingTool, primary=
True)
86 """Configure the derivation framework driving algorithm (kernel)
88 acc = ComponentAccumulator()
91 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
94 PhysCommonAugmentationsCfg(
95 flags, TriggerListsHelper=kwargs[
"TriggerListsHelper"]
100 augmentationTools = []
105 from DerivationFrameworkEGamma.EGammaToolsConfig
import (
106 PhotonVertexSelectionWrapperKernelCfg)
107 acc.merge(PhotonVertexSelectionWrapperKernelCfg(flags))
112 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import (
113 CaloDecoratorKernelCfg, CaloCellDecoratorCfg)
114 acc.merge(CaloDecoratorKernelCfg(flags))
118 EGAM10CaloCellDecoratorTool = (
119 acc.popToolsAndMerge(
120 CaloCellDecoratorCfg(
122 name=
"EGAM10CaloCellDecoratorTool",
123 SGKey_photons=
"Photons",
125 SGKey_CaloCells=
"AllCalo",
129 acc.addPublicTool(EGAM10CaloCellDecoratorTool)
130 augmentationTools.append(EGAM10CaloCellDecoratorTool)
134 streamName = kwargs[
"StreamName"]
137 if flags.Derivation.Egamma.doTrackThinning:
138 TrackThinningKeepElectronTracks =
True
139 TrackThinningKeepPhotonTracks =
True
140 TrackThinningKeepAllElectronTracks =
True
143 if TrackThinningKeepElectronTracks:
144 EGAM10ElectronTPThinningTool = (
145 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
146 name=
"EGAM10ElectronTPThinningTool",
147 StreamName=streamName,
149 GSFTrackParticlesKey=
"GSFTrackParticles",
150 InDetTrackParticlesKey=
"InDetTrackParticles",
151 SelectionString=electronRequirements,
156 acc.addPublicTool(EGAM10ElectronTPThinningTool)
157 thinningTools.append(EGAM10ElectronTPThinningTool)
160 if TrackThinningKeepPhotonTracks:
161 EGAM10PhotonTPThinningTool = (
162 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
163 name=
"EGAM10PhotonTPThinningTool",
164 StreamName=streamName,
166 GSFTrackParticlesKey=
"GSFTrackParticles",
167 InDetTrackParticlesKey=
"InDetTrackParticles",
168 GSFConversionVerticesKey=
"GSFConversionVertices",
169 SelectionString=photonRequirements,
174 acc.addPublicTool(EGAM10PhotonTPThinningTool)
175 thinningTools.append(EGAM10PhotonTPThinningTool)
178 if TrackThinningKeepAllElectronTracks:
179 EGAM10ElectronTPThinningToolAR = (
180 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
181 name=
"EGAM10ElectronTPThinningToolAR",
182 StreamName=streamName,
184 GSFTrackParticlesKey=
"GSFTrackParticles",
185 InDetTrackParticlesKey=
"InDetTrackParticles",
186 SelectionString=electronRequirements,
190 acc.addPublicTool(EGAM10ElectronTPThinningToolAR)
191 thinningTools.append(EGAM10ElectronTPThinningToolAR)
198 CompFactory.DerivationFramework.DerivationKernel(
200 SkimmingTools=[skimmingTool],
201 AugmentationTools=augmentationTools,
202 ThinningTools=thinningTools,
210 acc = ComponentAccumulator()
219 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
221 EGAM10TriggerListsHelper = TriggerListsHelper(flags)
228 StreamName=
"StreamDAOD_EGAM10",
229 TriggerListsHelper=EGAM10TriggerListsHelper,
234 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
235 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
236 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
239 "EGAM10SlimmingHelper",
240 NamesAndTypes=flags.Input.TypedCollections,
249 EGAM10SlimmingHelper.AllVariables = [
250 "CaloCalTopoClusters"
255 EGAM10SlimmingHelper.AppendToDictionary.update(
257 "TruthIsoCentralEventShape":
"xAOD::EventShape",
258 "TruthIsoCentralEventShapeAux":
"xAOD::EventShapeAuxInfo",
259 "TruthIsoForwardEventShape":
"xAOD::EventShape",
260 "TruthIsoForwardEventShapeAux":
"xAOD::EventShapeAuxInfo",
263 EGAM10SlimmingHelper.AllVariables += [
273 "AntiKt4TruthDressedWZJets",
274 "egammaTruthParticles",
275 "TruthIsoCentralEventShape",
276 "TruthIsoForwardEventShape",
289 EGAM10SlimmingHelper.SmartCollections = [
292 "InDetTrackParticles",
294 "AntiKt4EMPFlowJets",
298 EGAM10SlimmingHelper.SmartCollections += [
300 "AntiKt4TruthDressedWZJets",
306 EGAM10SlimmingHelper.ExtraVariables += [
307 "egammaClusters.PHI2CALOFRAME.ETA2CALOFRAME.phi_sampl",
311 EGAM10SlimmingHelper.ExtraVariables += [
312 "Photons.ptcone30.ptcone40.f3.f3core",
313 "Photons.maxEcell_time.maxEcell_energy.maxEcell_gain.maxEcell_onlId",
314 "Photons.maxEcell_x.maxEcell_y.maxEcell_z",
315 "Photons.ptcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
316 "Photons.ptcone40_Nonprompt_All_MaxWeightTTVA_pt500",
317 "Photons.ptcone20_Nonprompt_All_MaxWeightTTVA_pt500",
318 "Photons.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000",
319 "Photons.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500",
323 EGAM10SlimmingHelper.ExtraVariables += [
324 "Electrons.topoetcone30.topoetcone40.ptcone20.ptcone30",
325 "Electrons.ptcone40.maxEcell_time.maxEcell_energy.maxEcell_gain",
326 "Electrons.maxEcell_onlId.maxEcell_x.maxEcell_y.maxEcell_z",
330 EGAM10SlimmingHelper.ExtraVariables += [
331 "PrimaryVertices.covariance.trackWeights.sumPt2.sumPt",
332 "PrimaryVertices.pt.eta.phi",
336 EGAM10SlimmingHelper.ExtraVariables += [
337 "InDetTrackParticles.TTVA_AMVFVertices.TTVA_AMVFWeights"
341 EGAM10SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent
344 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import (
346 getClusterEnergyPerLayerDecorations,
349 gainDecorations = getGainDecorations(acc, flags,
"EGAM10Kernel")
350 print(
"EGAM10 gain decorations: ", gainDecorations)
351 EGAM10SlimmingHelper.ExtraVariables.extend(gainDecorations)
352 clusterEnergyDecorations = getClusterEnergyPerLayerDecorations(acc,
"EGAM10Kernel")
353 print(
"EGAM10 cluster energy decorations: ", clusterEnergyDecorations)
354 EGAM10SlimmingHelper.ExtraVariables.extend(clusterEnergyDecorations)
358 EGAM10SlimmingHelper.ExtraVariables += [
359 "Photons.cells_E.cells_time.cells_onlId",
360 "Photons.cells_eta.cells_phi.cells_layer",
361 "Photons.cells_x.cells_y.cells_z",
362 "Photons.cells_gain",
363 "Photons.cells_quality",
364 "Photons.cells_clusterOriginInfo",
368 EGAM10SlimmingHelper.ExtraVariables += [
369 "TopoClusterIsoCentralEventShape.Density",
370 "TopoClusterIsoForwardEventShape.Density",
373 from DerivationFrameworkEGamma
import EGammaIsoConfig
380 ) = EGammaIsoConfig.makeEGammaCommonIsoCfg(flags)
382 EGAM10SlimmingHelper.AppendToDictionary.update(densityDict)
383 EGAM10SlimmingHelper.ExtraVariables += densityList + [f
"Photons{pflowIsoVar}"]
386 from IsolationAlgs.DerivationTrackIsoConfig
import DerivationTrackIsoCfg
389 DerivationTrackIsoCfg(
390 flags, object_types=(
"Photons",), ptCuts=(500, 1000), postfix=
"Extra"
396 EGAM10SlimmingHelper.ExtraVariables += [
397 "Electrons.truthClassification.truthOrigin.truthType.truthParticleLink.truthPdgId",
398 "Electrons.lastEgMotherTruthClassification.lastEgMotherTruthType.lastEgMotherTruthOrigin",
399 "Electrons.lastEgMotherTruthParticleLink.lastEgMotherPdgId",
400 "Electrons.firstEgMotherTruthClassification.firstEgMotherTruthType.firstEgMotherTruthOrigin",
401 "Electrons.firstEgMotherTruthParticleLink.firstEgMotherPdgId",
404 EGAM10SlimmingHelper.ExtraVariables += [
405 "Photons.truthClassification.truthOrigin.truthType.truthParticleLink"
408 EGAM10SlimmingHelper.ExtraVariables += [
409 "TruthIsoCentralEventShape.DensitySigma.Density.DensityArea",
410 "TruthIsoForwardEventShape.DensitySigma.Density.DensityArea",
414 if flags.Derivation.Egamma.doEventInfoSlimming:
415 EGAM10SlimmingHelper.SmartCollections.append(
"EventInfo")
417 EGAM10SlimmingHelper.AllVariables += [
"EventInfo"]
420 EGAM10SlimmingHelper.IncludeEGammaTriggerContent =
True
424 if flags.Trigger.EDMVersion == 2:
425 from DerivationFrameworkPhys.TriggerMatchingCommonConfig
import AddRun2TriggerMatchingToSlimmingHelper
426 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = EGAM10SlimmingHelper,
427 OutputContainerPrefix =
"TrigMatch_",
428 TriggerList = EGAM10TriggerListsHelper.Run2TriggerNamesNoTau)
430 if flags.Trigger.EDMVersion == 3
or (flags.Trigger.EDMVersion == 2
and flags.Trigger.doEDMVersionConversion):
431 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
432 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(EGAM10SlimmingHelper)
434 EGAM10ItemList = EGAM10SlimmingHelper.GetItemList()
439 ItemList=EGAM10ItemList,
440 AcceptAlgs=[
"EGAM10Kernel"],
444 SetupMetaDataForStreamCfg(
447 AcceptAlgs=[
"EGAM10Kernel"],
449 MetadataCategory.CutFlowMetaData,
450 MetadataCategory.TruthMetaData,