37 """Configure the EGAM10 skimming tool"""
38 acc = ComponentAccumulator()
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]
51 if flags.Trigger.EDMVersion == 2:
53 elif flags.Trigger.EDMVersion == 3:
57 singlePhotonTriggers[MenuType]
58 + diPhotonTriggers[MenuType]
59 + triPhotonTriggers[MenuType]
60 + noalgTriggers[MenuType]
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
68 acc.addPublicTool(EGAM10_TriggerSkimmingTool)
69 filterList += [EGAM10_TriggerSkimmingTool]
71 print(
"Unknown Trigger.EDMVersion ", flags.Trigger.EDMVersion)
72 print(
"Will not apply trigger-based skimming")
75 print(
"EGAM10 skimming is logical AND of previous selections")
76 EGAM10_SkimmingTool = CompFactory.DerivationFramework.FilterCombinationAND(
77 name=
"EGAM10_SkimmingTool", FilterList=filterList)
79 acc.addPublicTool(EGAM10_SkimmingTool, primary=
True)
84 """Configure the derivation framework driving algorithm (kernel)
86 acc = ComponentAccumulator()
89 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
92 PhysCommonAugmentationsCfg(
93 flags, TriggerListsHelper=kwargs[
"TriggerListsHelper"]
98 augmentationTools = []
103 from DerivationFrameworkEGamma.EGammaToolsConfig
import (
104 PhotonVertexSelectionWrapperKernelCfg)
105 acc.merge(PhotonVertexSelectionWrapperKernelCfg(flags))
110 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import (
111 CaloDecoratorKernelCfg
113 acc.merge(CaloDecoratorKernelCfg(flags))
117 streamName = kwargs[
"StreamName"]
120 if flags.Derivation.Egamma.doTrackThinning:
121 TrackThinningKeepElectronTracks =
True
122 TrackThinningKeepPhotonTracks =
True
123 TrackThinningKeepAllElectronTracks =
True
126 if TrackThinningKeepElectronTracks:
127 EGAM10ElectronTPThinningTool = (
128 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
129 name=
"EGAM10ElectronTPThinningTool",
130 StreamName=streamName,
132 GSFTrackParticlesKey=
"GSFTrackParticles",
133 InDetTrackParticlesKey=
"InDetTrackParticles",
134 SelectionString=electronRequirements,
139 acc.addPublicTool(EGAM10ElectronTPThinningTool)
140 thinningTools.append(EGAM10ElectronTPThinningTool)
143 if TrackThinningKeepPhotonTracks:
144 EGAM10PhotonTPThinningTool = (
145 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
146 name=
"EGAM10PhotonTPThinningTool",
147 StreamName=streamName,
149 GSFTrackParticlesKey=
"GSFTrackParticles",
150 InDetTrackParticlesKey=
"InDetTrackParticles",
151 GSFConversionVerticesKey=
"GSFConversionVertices",
152 SelectionString=photonRequirements,
157 acc.addPublicTool(EGAM10PhotonTPThinningTool)
158 thinningTools.append(EGAM10PhotonTPThinningTool)
161 if TrackThinningKeepAllElectronTracks:
162 EGAM10ElectronTPThinningToolAR = (
163 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
164 name=
"EGAM10ElectronTPThinningToolAR",
165 StreamName=streamName,
167 GSFTrackParticlesKey=
"GSFTrackParticles",
168 InDetTrackParticlesKey=
"InDetTrackParticles",
169 SelectionString=electronRequirements,
173 acc.addPublicTool(EGAM10ElectronTPThinningToolAR)
174 thinningTools.append(EGAM10ElectronTPThinningToolAR)
181 CompFactory.DerivationFramework.DerivationKernel(
183 SkimmingTools=[skimmingTool],
184 AugmentationTools=augmentationTools,
185 ThinningTools=thinningTools,
193 acc = ComponentAccumulator()
202 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
204 EGAM10TriggerListsHelper = TriggerListsHelper(flags)
211 StreamName=
"StreamDAOD_EGAM10",
212 TriggerListsHelper=EGAM10TriggerListsHelper,
217 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
218 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
219 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
222 "EGAM10SlimmingHelper",
223 NamesAndTypes=flags.Input.TypedCollections,
232 EGAM10SlimmingHelper.AllVariables = [
233 "CaloCalTopoClusters",
239 EGAM10SlimmingHelper.AppendToDictionary.update(
241 "TruthIsoCentralEventShape":
"xAOD::EventShape",
242 "TruthIsoCentralEventShapeAux":
"xAOD::EventShapeAuxInfo",
243 "TruthIsoForwardEventShape":
"xAOD::EventShape",
244 "TruthIsoForwardEventShapeAux":
"xAOD::EventShapeAuxInfo",
247 EGAM10SlimmingHelper.AllVariables += [
257 "AntiKt4TruthDressedWZJets",
258 "egammaTruthParticles",
259 "TruthIsoCentralEventShape",
260 "TruthIsoForwardEventShape",
273 EGAM10SlimmingHelper.SmartCollections = [
276 "InDetTrackParticles",
278 "AntiKt4EMPFlowJets",
282 EGAM10SlimmingHelper.SmartCollections += [
284 "AntiKt4TruthDressedWZJets",
290 EGAM10SlimmingHelper.ExtraVariables += [
291 "egammaClusters.PHI2CALOFRAME.ETA2CALOFRAME.phi_sampl",
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",
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",
314 EGAM10SlimmingHelper.ExtraVariables += [
315 "PrimaryVertices.covariance.trackWeights.sumPt2.sumPt",
316 "PrimaryVertices.pt.eta.phi",
320 EGAM10SlimmingHelper.ExtraVariables += [
321 "InDetTrackParticles.TTVA_AMVFVertices.TTVA_AMVFWeights"
325 EGAM10SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent
328 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import (
330 getClusterEnergyPerLayerDecorations,
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)
341 EGAM10SlimmingHelper.ExtraVariables += [
342 "TopoClusterIsoCentralEventShape.Density",
343 "TopoClusterIsoForwardEventShape.Density",
346 from DerivationFrameworkEGamma
import EGammaIsoConfig
353 ) = EGammaIsoConfig.makeEGammaCommonIsoCfg(flags)
355 EGAM10SlimmingHelper.AppendToDictionary.update(densityDict)
356 EGAM10SlimmingHelper.ExtraVariables += densityList + [f
"Photons{pflowIsoVar}"]
359 from IsolationAlgs.DerivationTrackIsoConfig
import DerivationTrackIsoCfg
362 DerivationTrackIsoCfg(
363 flags, object_types=(
"Photons",), ptCuts=(500, 1000), postfix=
"Extra"
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",
377 EGAM10SlimmingHelper.ExtraVariables += [
378 "Photons.truthClassification.truthOrigin.truthType.truthParticleLink"
381 EGAM10SlimmingHelper.ExtraVariables += [
382 "TruthIsoCentralEventShape.DensitySigma.Density.DensityArea",
383 "TruthIsoForwardEventShape.DensitySigma.Density.DensityArea",
387 if flags.Derivation.Egamma.doEventInfoSlimming:
388 EGAM10SlimmingHelper.SmartCollections.append(
"EventInfo")
390 EGAM10SlimmingHelper.AllVariables += [
"EventInfo"]
393 EGAM10SlimmingHelper.IncludeEGammaTriggerContent =
True
397 if flags.Trigger.EDMVersion == 2:
398 from DerivationFrameworkPhys.TriggerMatchingCommonConfig
import AddRun2TriggerMatchingToSlimmingHelper
399 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = EGAM10SlimmingHelper,
400 OutputContainerPrefix =
"TrigMatch_",
401 TriggerList = EGAM10TriggerListsHelper.Run2TriggerNamesNoTau)
403 if flags.Trigger.EDMVersion == 3
or (flags.Trigger.EDMVersion == 2
and flags.Trigger.doEDMVersionConversion):
404 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
405 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(EGAM10SlimmingHelper)
408 EGAM10SlimmingHelper.StaticContent = [
409 "CaloCellContainer#AllCalo",
410 "CaloClusterCellLinkContainer#egammaClusters_links",
413 EGAM10ItemList = EGAM10SlimmingHelper.GetItemList()
418 ItemList=EGAM10ItemList,
419 AcceptAlgs=[
"EGAM10Kernel"],
423 SetupMetaDataForStreamCfg(
426 AcceptAlgs=[
"EGAM10Kernel"],
428 MetadataCategory.CutFlowMetaData,
429 MetadataCategory.TruthMetaData,