diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkConfiguration/python/DerivationConfigList.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkConfiguration/python/DerivationConfigList.py index 6944c6a7b7ed953bea406453c7530ad32dcd9669..92ed19727f61ef24d3258cb5008d85b6869bf47b 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkConfiguration/python/DerivationConfigList.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkConfiguration/python/DerivationConfigList.py @@ -115,12 +115,9 @@ from DerivationFrameworkJetEtMiss.JETM14 import JETM14Cfg # TRIG8: ID trigger performance (extra trigger info eg online tracks and RoIs [idperf chain skimming]) from DerivationFrameworkTrigger.TRIG8 import TRIG8Cfg -# L1CALO1 derivation - runs primarily on RAWD -from DerivationFrameworkL1Calo.L1CALO1 import L1CALO1Cfg - -# Muon combined performance DAODs -# MUON1: baseline format for T&P -from DerivationFrameworkMuons.MUON1 import MUON1Cfg +# TLA derivations +from DerivationFrameworkTLA.TLA0 import TLA0Cfg +from DerivationFrameworkTLA.TLA1 import TLA1Cfg # Avoids compilation warnings from Flake8 __all__ = ['TEST1Cfg','TEST2Cfg','TEST3Cfg','TEST4Cfg','TEST5Cfg','TEST6Cfg', @@ -142,6 +139,6 @@ __all__ = ['TEST1Cfg','TEST2Cfg','TEST3Cfg','TEST4Cfg','TEST5Cfg','TEST6Cfg', 'EGAM7Cfg', 'EGAM8Cfg', 'EGAM9Cfg', 'EGAM10Cfg', 'EGAM11Cfg', 'EGAM12Cfg', 'JETM1Cfg','JETM2Cfg','JETM3Cfg','JETM4Cfg','JETM5Cfg','JETM6Cfg','JETM7Cfg', 'JETM10Cfg','JETM11Cfg','JETM12Cfg','JETM14Cfg', - 'TRIG8Cfg','L1CALO1Cfg', - 'MUON1Cfg' + 'TRIG8Cfg', + 'TLA0Cfg', 'TLA1Cfg', ] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py index 3a2a2957e887b77e98a41d496aaa0a71daca848c..8902ddb4d6691ea2ddf40e928283dd9a14059c2f 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py @@ -58,7 +58,9 @@ def FullListOfSmartContainers(flags=None): "HLT_xAOD__BTaggingContainer_HLTBjetFex", "HLT_xAOD__TrigBphysContainer_EFBMuMuFex", "HLT_xAOD__TrigVertexCountsContainer_vertexcounts", - "HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf" + "HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf", + "HLT_IDVertex_FS", + "HLT_IDTrack_FS_FTF" ] if flags is not None and flags.Tracking.doPseudoTracking: diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/JetTriggerContentRun3TLA.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/JetTriggerContentRun3TLA.py new file mode 100644 index 0000000000000000000000000000000000000000..c90af4c019a3e783b7542ec0b66685876045406c --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/JetTriggerContentRun3TLA.py @@ -0,0 +1,59 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from DerivationFrameworkCore.JetTriggerContentRun3 import JetTriggerContentRun3 + + +excludedTriggerContentForTLA = [ + # substrings listing excluded content + "AntiKt10", # ALL large-R jets +] + +additionalTriggerContentForTLA = [] + + +def triggerContentIsExcludedForTLA(content:str, exclusionList:list)->bool: + excluded = False + for excludedStr in exclusionList: + if excludedStr in content: + excluded = True + break + return excluded + +# create list for TLA jet trigger content +# excluding content configured for removal +# in excludedTriggerContentForTLA +JetTriggerContentRun3TLA = [ + element for element in JetTriggerContentRun3 + if not triggerContentIsExcludedForTLA(element, excludedTriggerContentForTLA) +] + +for additionalContent in additionalTriggerContentForTLA: + # determine whether processing an Aux container or not + if "Aux" not in additionalContent: + JetTriggerContentRun3TLA.append(additionalContent) + else: + # processing an Aux container so different handling is needed + # check if the Aux container exists and then compare Aux attributes + # and use all unique elements + matchedAuxElementIdx = -1 + for idx, element in enumerate(JetTriggerContentRun3TLA): + if additionalContent.split(".")[0] == element.split(".")[0]: + matchedAuxElementIdx = idx + + if matchedAuxElementIdx < 0: + # Aux container doesn't already exist in TLA jet trigger content + JetTriggerContentRun3TLA.append(additionalContent) + else: + # check whether we are taking the whole Aux container or just selected attributes + if additionalContent.split(".")[-1] == "" and len(additionalContent.split(".")) == 2: + # overwrite the existing entry with the updated content for TLA + JetTriggerContentRun3TLA[matchedAuxElementIdx] = additionalContent + else: + # Aux container already exists, keep unique Aux attributes + JetTriggerContentRun3TLA[matchedAuxElementIdx] = ".".join([additionalContent.split(".")[0]] + list(set(additionalContent.split(".")[1:] + JetTriggerContentRun3TLA[matchedAuxElementIdx].split(".")[1:]))) + +# remove any duplicates introduced by +# adding non-Aux containers in additionalTriggerContentForTLA +JetTriggerContentRun3TLA = list(set(JetTriggerContentRun3TLA)) + + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py index 4ba4cc1cbbb04f694b47faec60d5ffd0664b385e..e1914fceb06acd1a71f074f8c81a0de96bca05c8 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py @@ -100,11 +100,13 @@ class SlimmingHelper: self.IncludeEGammaTriggerContent = False self.IncludeJetTauEtMissTriggerContent = False self.IncludeJetTriggerContent = False + self.IncludeTrackingTriggerContent = False self.IncludeTauTriggerContent = False self.IncludeEtMissTriggerContent = False self.IncludeBJetTriggerContent = False self.IncludeBPhysTriggerContent = False self.IncludeMinBiasTriggerContent = False + self.OverrideJetTriggerContentWithTLAContent = False # Choice of whether user provided a typed container list or not (CA vs non-CA) if "NamesAndTypes" in kwargs.keys(): self.NamesAndTypes = buildNamesAndTypes(kwargs["NamesAndTypes"]) else: self.NamesAndTypes = buildNamesAndTypes() @@ -191,6 +193,11 @@ class SlimmingHelper: for item in JetTriggerFixContent: self.FinalItemList.append(item) + if (self.IncludeTrackingTriggerContent is True): + triggerContent = True + self.SmartCollections.append("HLT_IDVertex_FS") + self.SmartCollections.append("HLT_IDTrack_FS_FTF") + if (self.IncludeEtMissTriggerContent is True): triggerContent = True self.SmartCollections.append("HLT_xAOD__TrigMissingETContainer_TrigEFMissingET") @@ -573,6 +580,12 @@ class SlimmingHelper: elif collectionName=="HLT_xAOD__JetContainer_a4tcemsubjesFS": from DerivationFrameworkCore.JetTriggerContent import JetTriggerContent items.extend(JetTriggerContent) + elif collectionName=="HLT_IDVertex_FS": + from DerivationFrameworkCore.TrackingTriggerContent import TrackingTriggerContent + items.extend(TrackingTriggerContent) + elif collectionName=="HLT_IDTrack_FS_FTF": + from DerivationFrameworkCore.TrackingTriggerContent import TrackingTriggerContent + items.extend(TrackingTriggerContent) elif collectionName=="HLT_xAOD__TrigMissingETContainer_TrigEFMissingET": from DerivationFrameworkCore.EtMissTriggerContent import EtMissTriggerContent items.extend(EtMissTriggerContent) @@ -590,7 +603,12 @@ class SlimmingHelper: items.extend(MinBiasTriggerContent) elif collectionName=="HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf": from DerivationFrameworkCore.JetTriggerContentRun3 import JetTriggerContentRun3 - items.extend(JetTriggerContentRun3) + from DerivationFrameworkCore.JetTriggerContentRun3TLA import JetTriggerContentRun3TLA + if not self.OverrideJetTriggerContentWithTLAContent: + items.extend(JetTriggerContentRun3) + else: + items.extend(JetTriggerContentRun3TLA) + else: raise RuntimeError("Smart slimming container "+collectionName+" does not exist or does not have a smart slimming list") return items diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/TrackingTriggerContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/TrackingTriggerContent.py new file mode 100644 index 0000000000000000000000000000000000000000..6f3ddb838900b9270eba177eebedbe2c5d893279 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/TrackingTriggerContent.py @@ -0,0 +1,10 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +TrackingTriggerContent = [ + "HLT_IDVertex_FS", + "HLT_IDVertex_FSAux.", + "HLT_IDTrack_FS_FTF", + "HLT_IDTrack_FS_FTFAux.", +] + + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..09b52cee104c9fad630df43fdbfc7fbd2a040952 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( DerivationFrameworkTLA ) + +# Install files from the package: +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLA0.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLA0.py new file mode 100644 index 0000000000000000000000000000000000000000..61318fa27b05acf0d3228492ae0827f7b28c51db --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLA0.py @@ -0,0 +1,245 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +#!/usr/bin/env python +#==================================================================== +# Slimmed DAOD_PHYS.py for Run 3 trigger-object level analyses (TLAs) +# It contains the variables and objects needed for Run 3 TLA searches. +#==================================================================== + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory +from AthenaConfiguration.Enums import MetadataCategory + +# Skimming config +def TLA0SkimmingCfg(ConfigFlags): + """Configure the skimming tool""" + acc = ComponentAccumulator() + + + from DerivationFrameworkTLA.TLATriggerList import SupportSingleJetTriggers, SupportMultiJetTriggers, SupportPhotonTriggers, PrimaryISRTLATriggers, SupportTLATriggers, PrimarySingleJetTLATriggers, PrimaryMultiJetTLATriggers + + tlaFullTriggerList = SupportSingleJetTriggers + SupportMultiJetTriggers + SupportPhotonTriggers + PrimaryISRTLATriggers + SupportTLATriggers + PrimarySingleJetTLATriggers + PrimaryMultiJetTLATriggers + + if not ConfigFlags.Input.isMC: + TLA0TriggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool( + name = "TLA0TriggerSkimmingTool1", + TriggerListOR = tlaFullTriggerList + ) + acc.addPublicTool(TLA0TriggerSkimmingTool, primary=True) + + return acc + + +# Main thinning config and common augmentations +def TLA0KernelCfg(ConfigFlags, name='TLA0Kernel', **kwargs): + """Configure the derivation framework driving algorithm (kernel) for TLA0""" + acc = ComponentAccumulator() + + # Skimming + skimmingTool = None + if not ConfigFlags.Input.isMC: + skimmingTool = acc.getPrimaryAndMerge(TLA0SkimmingCfg(ConfigFlags)) + + # Common augmentations + from DerivationFrameworkTLA.TLACommonConfig import TLACommonAugmentationsCfg + acc.merge(TLACommonAugmentationsCfg(ConfigFlags, prefix="TLA0_", TriggerListsHelper = kwargs['TriggerListsHelper'])) + + from DerivationFrameworkInDet.InDetToolsConfig import InDetTrackSelectionToolWrapperCfg + DFCommonTrackSelection = acc.getPrimaryAndMerge(InDetTrackSelectionToolWrapperCfg( + ConfigFlags, + name = "DFCommonTrackSelectionLoose", + ContainerName = "InDetTrackParticles", + DecorationName = "DFTLA0Loose")) + DFCommonTrackSelection.TrackSelectionTool.CutLevel = "Loose" + + acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation("TLA0CommonKernel", AugmentationTools = [DFCommonTrackSelection])) + + # Thinning tools... + from DerivationFrameworkInDet.InDetToolsConfig import MuonTrackParticleThinningCfg, EgammaTrackParticleThinningCfg, JetTrackParticleThinningCfg + + # Include inner detector tracks associated with muons + TLA0MuonTPThinningTool = acc.getPrimaryAndMerge(MuonTrackParticleThinningCfg( + ConfigFlags, + name = "TLA0MuonTPThinningTool", + StreamName = kwargs['StreamName'], + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles")) + + # Include inner detector tracks associated with electonrs + TLA0ElectronTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg( + ConfigFlags, + name = "TLA0ElectronTPThinningTool", + StreamName = kwargs['StreamName'], + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles")) + + TLA0_thinning_expression = "InDetTrackParticles.DFTLA0Loose && ( abs(InDetTrackParticles.d0) < 5.0*mm ) && ( abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )" + + TLA0Akt4JetTPThinningTool = acc.getPrimaryAndMerge(JetTrackParticleThinningCfg( + ConfigFlags, + name = "TLA0Akt4JetTPThinningTool", + StreamName = kwargs['StreamName'], + JetKey = "AntiKt4EMTopoJets", + SelectionString = "AntiKt4EMTopoJets.pt > 18*GeV", + TrackSelectionString = TLA0_thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles")) + + TLA0Akt4PFlowJetTPThinningTool = acc.getPrimaryAndMerge(JetTrackParticleThinningCfg( + ConfigFlags, + name = "TLA0Akt4PFlowJetTPThinningTool", + StreamName = kwargs['StreamName'], + JetKey = "AntiKt4EMPFlowJets", + SelectionString = "AntiKt4EMPFlowJets.pt > 18*GeV", + TrackSelectionString = TLA0_thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles")) + + # Finally the kernel itself + thinningTools = [TLA0MuonTPThinningTool, + TLA0ElectronTPThinningTool, + TLA0Akt4JetTPThinningTool, + TLA0Akt4PFlowJetTPThinningTool] + + # create the derivation kernel + DerivationKernel = CompFactory.DerivationFramework.DerivationKernel + acc.addEventAlgo(DerivationKernel( + name, + ThinningTools = thinningTools, + SkimmingTools = [skimmingTool] if skimmingTool is not None else [] + )) + + + return acc + +# Main setup of the config & format +def TLA0Cfg(ConfigFlags): + stream_name = 'StreamDAOD_TLA0' + acc = ComponentAccumulator() + + # Get the lists of triggers needed for trigger matching. + # This is needed at this scope (for the slimming) and further down in the config chain + # for actually configuring the matching, so we create it here and pass it down + + from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper + TLA0TriggerListsHelper = TriggerListsHelper(ConfigFlags) + + + # Common augmentations and TLA0 thinning & skimming + acc.merge(TLA0KernelCfg(ConfigFlags, name="TLA0Kernel", StreamName = stream_name, TriggerListsHelper = TLA0TriggerListsHelper)) + + # ============================ + # Define contents of the format + # ============================= + from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg + from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg + from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper + + TLA0SlimmingHelper = SlimmingHelper("TLA0SlimmingHelper", NamesAndTypes = ConfigFlags.Input.TypedCollections, ConfigFlags = ConfigFlags) + + TLA0SlimmingHelper.SmartCollections = [ + "EventInfo", + "Electrons", + "Photons", + "PrimaryVertices", + "Muons", + "AntiKt4EMTopoJets", + "AntiKt4EMPFlowJets", + "BTagging_AntiKt4EMPFlow", + ] + + # Extra content + if ConfigFlags.Input.isMC: + TLA0SlimmingHelper.ExtraVariables += [ + "AntiKt4EMTopoJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt", + + "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt", + + "TruthPrimaryVertices.t.x.y.z", + + "EventInfo.hardScatterVertexLink.timeStampNSOffset", + ] + else: + TLA0SlimmingHelper.ExtraVariables += [ + "AntiKt4EMTopoJets.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1", + + "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1", + + "EventInfo.hardScatterVertexLink.timeStampNSOffset", + ] + + TLA0SlimmingHelper.AllVariables = [ + # store event shape variables to get full objects (also included by jet CP content) + "Kt4EMTopoOriginEventShape","Kt4EMPFlowEventShape", # EMTopo and EMPFlow event shapes + "Kt4EMPFlowPUSBEventShape","Kt4EMPFlowNeutEventShape", # newer event shapes for testing (e.g. if offline jet calibration changes) + # store muon segments in case they are needed for offline jet calibrations + "MuonSegments", + ] + + # add eEM RoIs + # based on L1CALOCore.py implementation + L1Calo_eEM_postfix = "" # empty unless otherwise set + # append to slimming helper dictionaties so that the code knows the container type + TLA0SlimmingHelper.AppendToDictionary.update( + {"L1_eEMRoI"+L1Calo_eEM_postfix : "xAOD::eFexEMRoIContainer", + "L1_eEMRoI"+L1Calo_eEM_postfix+"Aux" : "xAOD::eFexEMRoIAuxContainer"}) + # add the RoIs to the derivation + TLA0SlimmingHelper.AllVariables += ["L1_eEMRoI"+L1Calo_eEM_postfix] + + + # Truth extra content + if ConfigFlags.Input.isMC: + # from DerivationFrameworkMCTruth.MCTruthCommonConfig import addTruth3ContentToSlimmerTool + from DerivationFrameworkTLA.TLACommonConfig import addTLATruth3ContentToSlimmerTool + addTLATruth3ContentToSlimmerTool(TLA0SlimmingHelper) + TLA0SlimmingHelper.AllVariables += [ + 'TruthHFWithDecayParticles', + 'TruthHFWithDecayVertices', + 'TruthCharm', + 'TruthPileupParticles', + 'InTimeAntiKt4TruthJets', + 'OutOfTimeAntiKt4TruthJets', + ] + TLA0SlimmingHelper.ExtraVariables += [ + "Electrons.TruthLink", + "Photons.TruthLink" + ] + # truth jet collections for calibrations and performance studies + # replicates jet collection configuration in JETM1 (with the exception of AntiKt4TruthDressedWZJets which doesn't exist there) + TLA0SlimmingHelper.SmartCollections += ["AntiKt4TruthWZJets"] + TLA0SlimmingHelper.AllVariables += ["AntiKt4TruthJets", "AntiKt4TruthDressedWZJets"] + + # Trigger content + # only save B-jet trigger content and trigger navigation when running on MC + TLA0SlimmingHelper.IncludeTriggerNavigation = True + TLA0SlimmingHelper.IncludeJetTriggerContent = True + TLA0SlimmingHelper.IncludeMuonTriggerContent = False + TLA0SlimmingHelper.IncludeTrackingTriggerContent = True + TLA0SlimmingHelper.IncludeEGammaTriggerContent = True + TLA0SlimmingHelper.IncludeJetTauEtMissTriggerContent = False + TLA0SlimmingHelper.IncludeTauTriggerContent = False + TLA0SlimmingHelper.IncludeEtMissTriggerContent = False + TLA0SlimmingHelper.IncludeBJetTriggerContent = True + TLA0SlimmingHelper.IncludeBPhysTriggerContent = False + TLA0SlimmingHelper.IncludeMinBiasTriggerContent = False + TLA0SlimmingHelper.OverrideJetTriggerContentWithTLAContent = True + + # Trigger matching + # Run 2 + if ConfigFlags.Trigger.EDMVersion == 2: + from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper + AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = TLA0SlimmingHelper, + OutputContainerPrefix = "TrigMatch_", + TriggerList = TLA0TriggerListsHelper.Run2TriggerNamesTau) + AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = TLA0SlimmingHelper, + OutputContainerPrefix = "TrigMatch_", + TriggerList = TLA0TriggerListsHelper.Run2TriggerNamesNoTau) + # Run 3 + if ConfigFlags.Trigger.EDMVersion == 3: + from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper + AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(TLA0SlimmingHelper) + + # Output stream + TLA0ItemList = TLA0SlimmingHelper.GetItemList() + acc.merge(OutputStreamCfg(ConfigFlags, "DAOD_TLA0", ItemList=TLA0ItemList, AcceptAlgs=["TLA0Kernel"])) + acc.merge(SetupMetaDataForStreamCfg(ConfigFlags, "DAOD_TLA0", AcceptAlgs=["TLA0Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData])) + + return acc + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLA1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLA1.py new file mode 100644 index 0000000000000000000000000000000000000000..9d8dca06672bc460949913b7d7c8498b3a249877 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLA1.py @@ -0,0 +1,244 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +#!/usr/bin/env python +#==================================================================== +# Slimmed DAOD_PHYSLITE.py for Run 3 trigger-object level analyses (TLAs) +# It contains minimal variables needed for the Run 3 ISR+DiJet TLA searches +#==================================================================== + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory +from AthenaConfiguration.Enums import MetadataCategory + +# Skimming config +def TLA1SkimmingCfg(ConfigFlags): + """Configure the skimming tool""" + acc = ComponentAccumulator() + + from DerivationFrameworkTLA.TLATriggerList import SupportPhotonTriggers, PrimaryISRTLATriggers, SupportTLATriggers + + tlaLiteTriggerList = PrimaryISRTLATriggers + SupportTLATriggers + SupportPhotonTriggers + + + if not ConfigFlags.Input.isMC: + TLA1TriggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool( + name = "TLA1TriggerSkimmingTool1", + TriggerListOR = tlaLiteTriggerList + ) + acc.addPublicTool(TLA1TriggerSkimmingTool, primary=True) + + return acc + + +# Main thinning config and common augmentations +def TLA1KernelCfg(ConfigFlags, name='TLA1Kernel', **kwargs): + """Configure the derivation framework driving algorithm (kernel) for TLA1""" + acc = ComponentAccumulator() + + # Skimming + skimmingTool = None + if not ConfigFlags.Input.isMC: + skimmingTool = acc.getPrimaryAndMerge(TLA1SkimmingCfg(ConfigFlags)) + + # Common augmentations + from DerivationFrameworkTLA.TLACommonConfig import TLACommonAugmentationsCfg + acc.merge(TLACommonAugmentationsCfg(ConfigFlags, prefix="TLA1_", TriggerListsHelper = kwargs['TriggerListsHelper'])) + + from DerivationFrameworkInDet.InDetToolsConfig import InDetTrackSelectionToolWrapperCfg + DFCommonTrackSelection = acc.getPrimaryAndMerge(InDetTrackSelectionToolWrapperCfg( + ConfigFlags, + name = "DFCommonTrackSelectionLoose", + ContainerName = "InDetTrackParticles", + DecorationName = "DFTLA1Loose")) + DFCommonTrackSelection.TrackSelectionTool.CutLevel = "Loose" + + acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation("TLA1CommonKernel", AugmentationTools = [DFCommonTrackSelection])) + + # Thinning tools... + from DerivationFrameworkInDet.InDetToolsConfig import MuonTrackParticleThinningCfg, EgammaTrackParticleThinningCfg, JetTrackParticleThinningCfg + + # Include inner detector tracks associated with muons + TLA1MuonTPThinningTool = acc.getPrimaryAndMerge(MuonTrackParticleThinningCfg( + ConfigFlags, + name = "TLA1MuonTPThinningTool", + StreamName = kwargs['StreamName'], + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles")) + + # Include inner detector tracks associated with electonrs + TLA1ElectronTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg( + ConfigFlags, + name = "TLA1ElectronTPThinningTool", + StreamName = kwargs['StreamName'], + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles")) + + TLA1_thinning_expression = "InDetTrackParticles.DFTLA1Loose && ( abs(InDetTrackParticles.d0) < 5.0*mm ) && ( abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )" + + TLA1Akt4JetTPThinningTool = acc.getPrimaryAndMerge(JetTrackParticleThinningCfg( + ConfigFlags, + name = "TLA1Akt4JetTPThinningTool", + StreamName = kwargs['StreamName'], + JetKey = "AntiKt4EMTopoJets", + SelectionString = "AntiKt4EMTopoJets.pt > 18*GeV", + TrackSelectionString = TLA1_thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles")) + + TLA1Akt4PFlowJetTPThinningTool = acc.getPrimaryAndMerge(JetTrackParticleThinningCfg( + ConfigFlags, + name = "TLA1Akt4PFlowJetTPThinningTool", + StreamName = kwargs['StreamName'], + JetKey = "AntiKt4EMPFlowJets", + SelectionString = "AntiKt4EMPFlowJets.pt > 18*GeV", + TrackSelectionString = TLA1_thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles")) + + # Finally the kernel itself + thinningTools = [TLA1MuonTPThinningTool, + TLA1ElectronTPThinningTool, + TLA1Akt4JetTPThinningTool, + TLA1Akt4PFlowJetTPThinningTool] + + # create the derivation kernel + DerivationKernel = CompFactory.DerivationFramework.DerivationKernel + acc.addEventAlgo(DerivationKernel( + name, + ThinningTools = thinningTools, + SkimmingTools = [skimmingTool] if skimmingTool is not None else [] + )) + + + return acc + +# Main setup of the config & format +def TLA1Cfg(ConfigFlags): + stream_name = 'StreamDAOD_TLA1' + acc = ComponentAccumulator() + + # Get the lists of triggers needed for trigger matching. + # This is needed at this scope (for the slimming) and further down in the config chain + # for actually configuring the matching, so we create it here and pass it down + from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper + TLA1TriggerListsHelper = TriggerListsHelper(ConfigFlags) + + + # Common augmentations and TLA1 thinning & skimming + acc.merge(TLA1KernelCfg(ConfigFlags, name="TLA1Kernel", StreamName = stream_name, TriggerListsHelper = TLA1TriggerListsHelper)) + + # ============================ + # Define contents of the format + # ============================= + from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg + from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg + from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper + + TLA1SlimmingHelper = SlimmingHelper("TLA1SlimmingHelper", NamesAndTypes = ConfigFlags.Input.TypedCollections, ConfigFlags = ConfigFlags) + + TLA1SlimmingHelper.SmartCollections = [ + "EventInfo", + "Electrons", + "Photons", + "PrimaryVertices", + "Muons", + "AntiKt4EMTopoJets", + "AntiKt4EMPFlowJets", + "BTagging_AntiKt4EMPFlow", + ] + + # Extra content + if ConfigFlags.Input.isMC: + TLA1SlimmingHelper.ExtraVariables += [ + "AntiKt4EMTopoJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt", + + "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt", + + "TruthPrimaryVertices.t.x.y.z", + + "EventInfo.hardScatterVertexLink.timeStampNSOffset", + ] + else: + TLA1SlimmingHelper.ExtraVariables += [ + "AntiKt4EMTopoJets.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1", + + "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1", + + "EventInfo.hardScatterVertexLink.timeStampNSOffset", + ] + + TLA1SlimmingHelper.AllVariables = [ + # store event shape variables to get full objects (also included by jet CP content) + "Kt4EMTopoOriginEventShape","Kt4EMPFlowEventShape", # EMTopo and EMPFlow event shapes + "Kt4EMPFlowPUSBEventShape","Kt4EMPFlowNeutEventShape", # newer event shapes for testing (e.g. if offline jet calibration changes) + # store muon segments in case they are needed for offline jet calibrations + "MuonSegments", + ] + + # add eEM RoIs + # based on L1CALOCore.py implementation + L1Calo_eEM_postfix = "" # empty unless otherwise set + # append to slimming helper dictionaties so that the code knows the container type + TLA1SlimmingHelper.AppendToDictionary.update( + {"L1_eEMRoI"+L1Calo_eEM_postfix : "xAOD::eFexEMRoIContainer", + "L1_eEMRoI"+L1Calo_eEM_postfix+"Aux" : "xAOD::eFexEMRoIAuxContainer"}) + # add the RoIs to the derivation + TLA1SlimmingHelper.AllVariables += ["L1_eEMRoI"+L1Calo_eEM_postfix] + + + # Truth extra content + if ConfigFlags.Input.isMC: + # from DerivationFrameworkMCTruth.MCTruthCommonConfig import addTruth3ContentToSlimmerTool + from DerivationFrameworkTLA.TLACommonConfig import addTLATruth3ContentToSlimmerTool + addTLATruth3ContentToSlimmerTool(TLA1SlimmingHelper) + TLA1SlimmingHelper.AllVariables += [ + 'TruthHFWithDecayParticles', + 'TruthHFWithDecayVertices', + 'TruthCharm', + 'TruthPileupParticles', + 'InTimeAntiKt4TruthJets', + 'OutOfTimeAntiKt4TruthJets', + ] + TLA1SlimmingHelper.ExtraVariables += [ + "Electrons.TruthLink", + "Photons.TruthLink" + ] + # truth jet collections for calibrations and performance studies + # replicates jet collection configuration in JETM1 (with the exception of AntiKt4TruthDressedWZJets which doesn't exist there) + TLA1SlimmingHelper.SmartCollections += ["AntiKt4TruthWZJets"] + TLA1SlimmingHelper.AllVariables += ["AntiKt4TruthJets", "AntiKt4TruthDressedWZJets"] + + # Trigger content + # only save B-jet trigger content and trigger navigation when running on MC + TLA1SlimmingHelper.IncludeTriggerNavigation = True + TLA1SlimmingHelper.IncludeJetTriggerContent = True + TLA1SlimmingHelper.IncludeMuonTriggerContent = False + TLA1SlimmingHelper.IncludeTrackingTriggerContent = True + TLA1SlimmingHelper.IncludeEGammaTriggerContent = True + TLA1SlimmingHelper.IncludeJetTauEtMissTriggerContent = False + TLA1SlimmingHelper.IncludeTauTriggerContent = False + TLA1SlimmingHelper.IncludeEtMissTriggerContent = False + TLA1SlimmingHelper.IncludeBJetTriggerContent = True + TLA1SlimmingHelper.IncludeBPhysTriggerContent = False + TLA1SlimmingHelper.IncludeMinBiasTriggerContent = False + TLA1SlimmingHelper.OverrideJetTriggerContentWithTLAContent = True + + # Trigger matching + # Run 2 + if ConfigFlags.Trigger.EDMVersion == 2: + from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper + AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = TLA1SlimmingHelper, + OutputContainerPrefix = "TrigMatch_", + TriggerList = TLA1TriggerListsHelper.Run2TriggerNamesTau) + AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = TLA1SlimmingHelper, + OutputContainerPrefix = "TrigMatch_", + TriggerList = TLA1TriggerListsHelper.Run2TriggerNamesNoTau) + # Run 3 + if ConfigFlags.Trigger.EDMVersion == 3: + from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper + AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(TLA1SlimmingHelper) + + # Output stream + TLA1ItemList = TLA1SlimmingHelper.GetItemList() + acc.merge(OutputStreamCfg(ConfigFlags, "DAOD_TLA1", ItemList=TLA1ItemList, AcceptAlgs=["TLA1Kernel"])) + acc.merge(SetupMetaDataForStreamCfg(ConfigFlags, "DAOD_TLA1", AcceptAlgs=["TLA1Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData])) + + return acc + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLACommonConfig.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLACommonConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..210602ad9fde2e6d44bdff612cfbe6e541ced7c9 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLACommonConfig.py @@ -0,0 +1,130 @@ +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + +# TLACommonConfig +# Contains the configuration for the common physics containers/decorations used in analysis DAODs + +# Actual configuration is subcontracted to other config files since some of them are very long + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory +from AthenaConfiguration.Enums import LHCPeriod + +def TLACommonAugmentationsCfg(ConfigFlags,**kwargs): + """Configure the common augmentation""" + acc = ComponentAccumulator() + + # MC truth + if ConfigFlags.Input.isMC: + from DerivationFrameworkMCTruth.MCTruthCommonConfig import ( + # AddStandardTruthContentsCfg, + AddHFAndDownstreamParticlesCfg, + AddMiniTruthCollectionLinksCfg, + AddPVCollectionCfg, + AddTruthCollectionNavigationDecorationsCfg) + from DerivationFrameworkTLA.TLACommonConfigFunctions import AddStandardTLATruthContentsCfg + from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthCollectionMakerCfg + TLACommonTruthCharmTool = acc.getPrimaryAndMerge(TruthCollectionMakerCfg( + ConfigFlags, + name = "TLACommonTruthCharmTool", + NewCollectionName = "TruthCharm", + KeepNavigationInfo = False, + ParticleSelectionString = "(abs(TruthParticles.pdgId) == 4)", + Do_Compress = True)) + CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation + acc.addEventAlgo(CommonAugmentation("TLACommonTruthCharmKernel",AugmentationTools=[TLACommonTruthCharmTool])) + acc.merge(AddHFAndDownstreamParticlesCfg(ConfigFlags)) + acc.merge(AddStandardTLATruthContentsCfg(ConfigFlags, useTLAPostJetAugmentations=True)) + acc.merge(AddTruthCollectionNavigationDecorationsCfg( + ConfigFlags, + TruthCollections=["TruthElectrons", + "TruthMuons", + "TruthPhotons", + "TruthTaus", + "TruthNeutrinos", + "TruthBSM", + "TruthBottom", + "TruthTop", + "TruthBoson", + "TruthCharm", + "TruthHFWithDecayParticles"], + prefix = 'PHYS_')) + # Re-point links on reco objects + acc.merge(AddMiniTruthCollectionLinksCfg(ConfigFlags)) + acc.merge(AddPVCollectionCfg(ConfigFlags)) + + # Muon common augmentations + from DerivationFrameworkMuons.MuonsCommonConfig import MuonsCommonCfg + acc.merge(MuonsCommonCfg(ConfigFlags)) + + # InDet common augmentations + from DerivationFrameworkInDet.InDetCommonConfig import InDetCommonCfg + + acc.merge(InDetCommonCfg(ConfigFlags, + DoVertexFinding = ConfigFlags.Tracking.doVertexFinding, + AddPseudoTracks = ConfigFlags.Tracking.doPseudoTracking and ConfigFlags.GeoModel.Run<=LHCPeriod.Run3, + DecoLRTTTVA = False, + DoR3LargeD0 = ConfigFlags.Tracking.doLargeD0, + StoreSeparateLargeD0Container = ConfigFlags.Tracking.storeSeparateLargeD0Container, + MergeLRT = False)) + + # Egamma common augmentations + from DerivationFrameworkEGamma.EGammaCommonConfig import EGammaCommonCfg + acc.merge(EGammaCommonCfg(ConfigFlags)) + # Jets, flavour tagging + from DerivationFrameworkTLA.TLACommonConfigFunctions import TLAJetCommonCfg + from DerivationFrameworkFlavourTag.FtagDerivationConfig import FtagJetCollectionsCfg + acc.merge(TLAJetCommonCfg(ConfigFlags)) + + + + FTagJetColl = ['AntiKt4EMPFlowJets'] + if ConfigFlags.GeoModel.Run >= LHCPeriod.Run4: + FTagJetColl.append('AntiKt4EMTopoJets') + acc.merge(FtagJetCollectionsCfg(ConfigFlags,FTagJetColl)) + + # Trigger matching (from PhysCommonConfig.py) + if ConfigFlags.Reco.EnableTrigger or ConfigFlags.Trigger.triggerConfig == 'INFILE': + from DerivationFrameworkPhys.TriggerMatchingCommonConfig import TriggerMatchingCommonRun2Cfg + from DerivationFrameworkPhys.TriggerMatchingCommonConfig import TriggerMatchingCommonRun3Cfg + # requires some wrangling due to the difference between run 2 and 3 + triggerListsHelper = kwargs['TriggerListsHelper'] + if ConfigFlags.Trigger.EDMVersion == 2: + acc.merge(TriggerMatchingCommonRun2Cfg(ConfigFlags, + name = "TLACommonTrigMatchNoTau", + OutputContainerPrefix = "TrigMatch_", + ChainNames = triggerListsHelper.Run2TriggerNamesNoTau)) + acc.merge(TriggerMatchingCommonRun2Cfg(ConfigFlags, + name = "TLACommonTrigMatchTau", + OutputContainerPrefix = "TrigMatch_", + ChainNames = triggerListsHelper.Run2TriggerNamesTau, + DRThreshold = 0.2)) + if ConfigFlags.Trigger.EDMVersion == 3: + acc.merge(TriggerMatchingCommonRun3Cfg(ConfigFlags, TriggerList = triggerListsHelper.Run3TriggerNames)) + + return acc + + +def addTLATruth3ContentToSlimmerTool(slimmer): + slimmer.AllVariables += [ + # "MET_Truth", + "TruthElectrons", + "TruthMuons", + "TruthPhotons", + "TruthTaus", + "TruthNeutrinos", + "TruthBSM", + "TruthBottom", + "TruthTop", + "TruthBoson", + # "TruthForwardProtons", + # "BornLeptons", + "TruthBosonsWithDecayParticles", + "TruthBosonsWithDecayVertices", + "TruthBSMWithDecayParticles", + "TruthBSMWithDecayVertices", + "HardScatterParticles", + "HardScatterVertices", + ] + slimmer.ExtraVariables += [ + "AntiKt4TruthDressedWZJets.GhostCHadronsFinalCount.GhostBHadronsFinalCount.pt.HadronConeExclTruthLabelID.ConeTruthLabelID.PartonTruthLabelID.TrueFlavor", + "TruthEvents.Q.XF1.XF2.PDGID1.PDGID2.PDFID1.PDFID2.X1.X2.crossSection"] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLACommonConfigFunctions.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLACommonConfigFunctions.py new file mode 100644 index 0000000000000000000000000000000000000000..592c3741b95b2c3b7b155547df92ad3b032b6aca --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLACommonConfigFunctions.py @@ -0,0 +1,157 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#============================================================================== +# Contains the configuration for TLA jet reconstruction + decorations +# used in analysis DAODs +#============================================================================== + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory + +# Jet related +from DerivationFrameworkJetEtMiss.JetCommonConfig import AddBadBatmanCfg, AddDistanceInTrainCfg, AddSidebandEventShapeCfg, AddEventCleanFlagsCfg + +## These jet related functions are a copy of the ones in the JetCommonConfig file +## but we remove the jet collections we don't need +def TLAJetCommonCfg(ConfigFlags): + """TLA config for jet reconstruction and decorations""" + + acc = ComponentAccumulator() + + acc.merge(StandardTLAJetsCfg(ConfigFlags)) + + + + if "McEventCollection#GEN_EVENT" not in ConfigFlags.Input.TypedCollections: + acc.merge(AddBadBatmanCfg(ConfigFlags)) + acc.merge(AddDistanceInTrainCfg(ConfigFlags)) + acc.merge(AddSidebandEventShapeCfg(ConfigFlags)) + acc.merge(AddEventCleanFlagsCfg(ConfigFlags)) + + return acc + +def StandardTLAJetsCfg(ConfigFlags): + """Standard (offline) jets needed for TLA derivations""" + + from JetRecConfig.StandardSmallRJets import AntiKt4EMTopo,AntiKt4EMPFlow + from JetRecConfig.JetRecConfig import JetRecCfg + from JetRecConfig.JetConfigFlags import jetInternalFlags + + acc = ComponentAccumulator() + + AntiKt4EMTopo_deriv = AntiKt4EMTopo.clone( + modifiers = AntiKt4EMTopo.modifiers+("JetPtAssociation","QGTagging") + ) + + AntiKt4EMPFlow_deriv = AntiKt4EMPFlow.clone( + modifiers = AntiKt4EMPFlow.modifiers+("JetPtAssociation","QGTagging","fJVT","NNJVT","CaloEnergiesClus") + ) + + jetList = [AntiKt4EMTopo_deriv, AntiKt4EMPFlow_deriv] + + jetInternalFlags.isRecoJob = True + + for jd in jetList: + acc.merge(JetRecCfg(ConfigFlags,jd)) + + return acc + +## Custom functions for handling TLA truth jets (and related truth content) for MC +## designed to remove large-R jets that are un-needed at the moment +from DerivationFrameworkMCTruth.MCTruthCommonConfig import (HepMCtoXAODTruthCfg, PreJetMCTruthAugmentationsCfg, PostJetMCTruthAugmentationsCfg, AddTruthCollectionNavigationDecorationsCfg, AddBosonsAndDownstreamParticlesCfg, AddBSMAndDownstreamParticlesCfg, AddTruthEnergyDensityCfg, AddHardScatterCollectionCfg) + +def AddTLATruthJetsCfg(flags): + acc = ComponentAccumulator() + + from JetRecConfig.StandardSmallRJets import AntiKt4Truth,AntiKt4TruthWZ,AntiKt4TruthDressedWZ + from JetRecConfig.JetRecConfig import JetRecCfg + from JetRecConfig.JetConfigFlags import jetInternalFlags + + jetInternalFlags.isRecoJob = True + + jetList = [AntiKt4Truth,AntiKt4TruthWZ,AntiKt4TruthDressedWZ] + + for jd in jetList: + acc.merge(JetRecCfg(flags,jd)) + + return acc + +def PostTLAJetMCTruthAugmentationsCfg(flags, **kwargs): + + acc = ComponentAccumulator() + + # Tau collections are built separately + # truth tau matching needs truth jets, truth electrons and truth muons + from DerivationFrameworkTau.TauTruthCommonConfig import TauTruthToolsCfg + acc.merge(TauTruthToolsCfg(flags)) + from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import DFCommonTruthTauDressingToolCfg + augmentationToolsList = [ acc.getPrimaryAndMerge(DFCommonTruthTauDressingToolCfg(flags)) ] + + + from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import DFCommonTruthDressedWZQGLabelToolCfg + augmentationToolsList += [ acc.getPrimaryAndMerge(DFCommonTruthDressedWZQGLabelToolCfg(flags))] + + # SUSY signal decorations + from DerivationFrameworkSUSY.DecorateSUSYProcessConfig import IsSUSYSignalRun3 + if IsSUSYSignalRun3(flags): + from DerivationFrameworkSUSY.DecorateSUSYProcessConfig import DecorateSUSYProcessCfg + augmentationToolsList += DecorateSUSYProcessCfg(flags, 'MCTruthCommon') + + CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation + acc.addEventAlgo(CommonAugmentation(name = "MCTruthCommonPostJetKernel", + AugmentationTools = augmentationToolsList)) + + # add SoW of individual SUSY final states, relies on augmentation from DecorateSUSYProcess() + if IsSUSYSignalRun3(flags): + from DerivationFrameworkSUSY.SUSYWeightMetadataConfig import AddSUSYWeightsCfg + acc.merge(AddSUSYWeightsCfg(flags)) + + return(acc) + +# This adds the entirety of TRUTH3 +def AddStandardTLATruthContentsCfg(flags, + decorationDressing='dressedPhoton', + includeTausInDressingPhotonRemoval=False, + prefix='', + # default is true to prevent crashes when AntiKt10TruthJets is not built + useTLAPostJetAugmentations=True): + + acc = ComponentAccumulator() + + # Schedule HepMC->xAOD truth conversion + acc.merge(HepMCtoXAODTruthCfg(flags)) + + # Local flag + isEVNT = False + if "McEventCollection#GEN_EVENT" in flags.Input.TypedCollections: isEVNT = True + # Tools that must come before jets + acc.merge(PreJetMCTruthAugmentationsCfg(flags,decorationDressing = decorationDressing)) + # Should photons that are dressed onto taus also be removed from truth jets? + if includeTausInDressingPhotonRemoval: + acc.getPublicTool("DFCommonTruthTauDressingTool").decorationName=decorationDressing + # Jets and MET + acc.merge(AddTLATruthJetsCfg(flags)) + # Tools that must come after jets + # configured for compatibility in case we want to + # revert to common MCTruth version + if not useTLAPostJetAugmentations: + acc.merge(PostJetMCTruthAugmentationsCfg(flags, decorationDressing = decorationDressing)) + else: + acc.merge(PostTLAJetMCTruthAugmentationsCfg(flags, decorationDressing = decorationDressing)) + + # Add back the navigation contect for the collections we want + acc.merge(AddTruthCollectionNavigationDecorationsCfg(flags, ["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson"], prefix=prefix)) + # Some more additions for standard TRUTH3 + acc.merge(AddBosonsAndDownstreamParticlesCfg(flags)) + + # Special collection for BSM particles + acc.merge(AddBSMAndDownstreamParticlesCfg(flags)) + + # Special collection for hard scatter (matrix element) - save TWO extra generations of particles + acc.merge(AddHardScatterCollectionCfg(flags, 2)) + + # Energy density for isolation corrections + if isEVNT: acc.merge(AddTruthEnergyDensityCfg(flags)) + + return acc + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLATriggerList.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLATriggerList.py new file mode 100644 index 0000000000000000000000000000000000000000..cb2f07a62e2b722f0dccaa320bf02e5777ebab90 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTLA/python/TLATriggerList.py @@ -0,0 +1,144 @@ +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + +#Â TODO: add all small-R jet, single-photon triggers used for Run 3!! + +SupportSingleJetTriggers = [ + # additional triggers required for MC + # j0 is used to have a chain that allows us to manually calculate EventShape.Density values + "HLT_j0_perf_pf_subjesgscIS_ftf_L1RD0_FILLED", + + # single-jet support + "HLT_j0_pf_ftf_L1RD0_FILLED", + "HLT_j15_pf_ftf_L1RD0_FILLED", + "HLT_j25_pf_ftf_L1RD0_FILLED", + "HLT_j35_pf_ftf_L1RD0_FILLED", + "HLT_j45_pf_ftf_preselj20_L1RD0_FILLED", + "HLT_j45_pf_ftf_preselj20_L1J15", + "HLT_j60_pf_ftf_preselj50_L1J20", + "HLT_j85_pf_ftf_preselj50_L1J20", + "HLT_j110_pf_ftf_preselj80_L1J30", + "HLT_j175_pf_ftf_preselj140_L1J50", + "HLT_j260_pf_ftf_preselj200_L1J75", + "HLT_j360_pf_ftf_preselj225_L1J100", + "HLT_j420_pf_ftf_preselj225_L1J100", + "HLT_j0_L1RD0_FILLED", + "HLT_j15_L1RD0_FILLED", + "HLT_j25_L1RD0_FILLED", + "HLT_j35_L1RD0_FILLED", + "HLT_j45_preselj20_L1RD0_FILLED", + "HLT_j45_preselj20_L1J15", + "HLT_j60_preselj50_L1J20", + "HLT_j85_preselj50_L1J20", + "HLT_j110_preselj80_L1J30", + "HLT_j175_preselj140_L1J50", + "HLT_j260_preselj200_L1J75", + "HLT_j360_preselj225_L1J100", + "HLT_j420_L1J100", + "HLT_j420_pf_ftf_L1J100", + +] + +SupportMultiJetTriggers = [ + # multi-jet + "HLT_2j250c_j120c_pf_ftf_presel2j180XXj80_L1J100", + "HLT_3j200_pf_ftf_presel3j150_L1J100", + "HLT_4j115_pf_ftf_presel4j85_L13J50", + "HLT_5j70c_pf_ftf_presel5c50_L14J15", + "HLT_5j85_pf_ftf_presel5j50_L14J15", + "HLT_6j55c_pf_ftf_presel6j40_L14J15", + "HLT_6j70_pf_ftf_presel6j40_L14J15", + "HLT_7j45_pf_ftf_presel7j30_L14J15", + "HLT_10j40_pf_ftf_presel7j30_L14J15", + "HLT_3j200_L1J100", + "HLT_4j120_L13J50", + "HLT_5j70c_L14J15", + "HLT_5j85_L14J15", + "HLT_6j55c_L14J15", + "HLT_6j70_L14J15", + "HLT_7j45_L14J15", + "HLT_10j40_L14J15", + "HLT_6j35c_020jvt_pf_ftf_presel6c25_L14J15", + "HLT_3j200_pf_ftf_L1J100", + "HLT_6j35c_pf_ftf_presel6c25_L14J15", +] + +SupportPhotonTriggers = [ + # support photon triggers + "HLT_g25_loose_L1EM20VH", + "HLT_g25_medium_L1EM20VH", + "HLT_g20_tight_L1EM15VHI", + "HLT_g25_loose_L1eEM24L", + "HLT_g25_medium_L1eEM24L", + "HLT_g20_tight_L1eEM18M", +] + +PrimaryISRTLATriggers = [ + # Legacy Block (2022) + "HLT_g35_loose_3j25_pf_ftf_PhysicsTLA_L1EM22VHI", + "HLT_g35_tight_3j25_PhysicsTLA_L1EM22VHI", + "HLT_g35_tight_3j25_pf_ftf_PhysicsTLA_L1EM22VHI", + "HLT_g35_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1EM22VHI", + "HLT_g40_tight_3j25_pf_ftf_PhysicsTLA_L1EM22VHI", + "HLT_g45_tight_3j25_pf_ftf_PhysicsTLA_L1EM22VHI", + "HLT_g45_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1EM22VHI", + "HLT_g50_tight_3j25_pf_ftf_PhysicsTLA_L1EM22VHI", + "HLT_g50_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1EM22VHI", + "HLT_g60_tight_3j25_pf_ftf_PhysicsTLA_L1EM22VHI", + "HLT_g60_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1EM22VHI", + + # Phase1 Block (2023-) + "HLT_g35_loose_3j25_pf_ftf_PhysicsTLA_L1eEM26M", + "HLT_g35_tight_3j25_PhysicsTLA_L1eEM26M", + "HLT_g35_tight_3j25_pf_ftf_PhysicsTLA_L1eEM26M", + "HLT_g35_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1eEM26M", + "HLT_g40_tight_3j25_pf_ftf_PhysicsTLA_L1eEM26M", + "HLT_g45_tight_3j25_pf_ftf_PhysicsTLA_L1eEM26M", + "HLT_g45_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1eEM26M", + "HLT_g50_tight_3j25_pf_ftf_PhysicsTLA_L1eEM26M", + "HLT_g50_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1eEM26M", + "HLT_g60_tight_3j25_pf_ftf_PhysicsTLA_L1eEM26M", + "HLT_g60_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1eEM26M", + + + + "HLT_g35_loose_3j25_pf_ftf_PhysicsTLA_L1eEM28M", + "HLT_g35_tight_3j25_PhysicsTLA_L1eEM28M", + "HLT_g35_tight_3j25_pf_ftf_PhysicsTLA_L1eEM28M", + "HLT_g35_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1eEM28M", + "HLT_g40_tight_3j25_pf_ftf_PhysicsTLA_L1eEM28M", + "HLT_g45_tight_3j25_pf_ftf_PhysicsTLA_L1eEM28M", + "HLT_g45_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1eEM28M", + "HLT_g50_tight_3j25_pf_ftf_PhysicsTLA_L1eEM28M", + "HLT_g50_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1eEM28M", + "HLT_g60_tight_3j25_pf_ftf_PhysicsTLA_L1eEM28M", + "HLT_g60_tight_noiso_3j25_pf_ftf_PhysicsTLA_L1eEM28M", + +] + +SupportTLATriggers = [ + "HLT_g35_tight_3j25_pf_ftf_L1EM22VHI", +] + +PrimarySingleJetTLATriggers = [ + "HLT_j20_PhysicsTLA_L1J100", + "HLT_j20_PhysicsTLA_L1jJ160", + "HLT_j20_pf_ftf_preselj140_PhysicsTLA_L1J50", + "HLT_j20_pf_ftf_preselj180_PhysicsTLA_L1J100", + "HLT_j20_pf_ftf_preselj180_PhysicsTLA_L1jJ160", + "HLT_j20_pf_ftf_preselj190_PhysicsTLA_L1J100", + "HLT_j20_pf_ftf_preselj190_PhysicsTLA_L1jJ160", + "HLT_j20_pf_ftf_preselj200_PhysicsTLA_L1J100", + "HLT_j20_pf_ftf_preselj200_PhysicsTLA_L1jJ160", +] + +PrimaryMultiJetTLATriggers = [ + + "HLT_2j20_2j20_pf_ftf_presel2c20XX2c20b85_PhysicsTLA_L1J45p0ETA21_3J15p0ETA25", + "HLT_j20_PhysicsTLA_L1HT190-J15s5pETA21", + "HLT_j20_PhysicsTLA_L1HT190-jJ40s5pETA21", + "HLT_j20_PhysicsTLA_L1J50_DETA20-J50J", + "HLT_j20_PhysicsTLA_L1jJ90_DETA20-jJ90J", + "HLT_j20_pf_ftf_preselcHT450_PhysicsTLA_L1HT190-J15s5pETA21", + "HLT_j60_j45_j25_j20_pf_ftf_preselc60XXc45XXc25XXc20_PhysicsTLA_L1J45p0ETA21_3J15p0ETA25", +] +