Skip to content
Snippets Groups Projects
Commit d0c7ca66 authored by Ligang Xia's avatar Ligang Xia Committed by Frank Winklmeier
Browse files

(AFT-701) add FTAG4

(AFT-701) add FTAG4
parent 3ef09aad
No related branches found
No related tags found
No related merge requests found
......@@ -89,6 +89,7 @@ from DerivationFrameworkEGamma.EGAM12 import EGAM12Cfg
from DerivationFrameworkFlavourTag.FTAG1 import FTAG1Cfg
from DerivationFrameworkFlavourTag.FTAG2 import FTAG2Cfg
from DerivationFrameworkFlavourTag.FTAG3 import FTAG3Cfg
from DerivationFrameworkFlavourTag.FTAG4 import FTAG4Cfg
# Jet/Etmiss derivations
# JETM1: dijet for MC calibrations, JER, MJB, eta-intercalibration
......@@ -140,7 +141,7 @@ __all__ = ['TEST1Cfg','TEST2Cfg','TEST3Cfg','TEST4Cfg','TEST5Cfg','TEST6Cfg',
'TRUTH0Cfg','TRUTH1Cfg','TRUTH3Cfg',
'PHYSCfg','PHYSLITECfg',
'PHYSVALCfg',
'FTAG1Cfg', 'FTAG2Cfg', 'FTAG3Cfg',
'FTAG1Cfg', 'FTAG2Cfg', 'FTAG3Cfg', 'FTAG4Cfg',
'HIGG1D1Cfg',
'LLP1Cfg', 'LLJ1Cfg',
'IDTR2Cfg',
......
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
#!/usr/bin/env python
#====================================================================
# DAOD_FTAG4.py
# This defines DAOD_FTAG4, an unskimmed DAOD format for Run 3.
# It is designed to do free data derivations for calibrations.
# It requires the flag FTAG4 in Derivation_tf.py
#====================================================================
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
#from AthenaCommon.Logging import logging
#logFTAG4 = logging.getLogger('FTAG4')
# Main algorithm config
def FTAG4KernelCfg(flags, name='FTAG4Kernel', **kwargs):
"""Configure the derivation framework driving algorithm (kernel) for FTAG4"""
acc = ComponentAccumulator()
from DerivationFrameworkPhys.PHYS import PHYSKernelCfg
acc.merge(PHYSKernelCfg(flags, name, StreamName = kwargs['StreamName'], TriggerListsHelper = kwargs['TriggerListsHelper'], TauJets_EleRM_in_input=kwargs['TauJets_EleRM_in_input']))
# augmentation tools
augmentationTools = []
# skimming tools
skimmingTools = []
# filter leptons
lepton_skimming_expression = 'count( (Muons.pt > 25*GeV) && (0 == Muons.muonType || 1 == Muons.muonType || 4 == Muons.muonType) ) + count(( Electrons.pt > 25*GeV) && ((Electrons.Loose) || (Electrons.DFCommonElectronsLHLoose))) >= 1'
FTAG4LeptonSkimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(
name = "FTAG4LeptonSkimmingTool",
expression = lepton_skimming_expression )
acc.addPublicTool(FTAG4LeptonSkimmingTool)
# thinning tools
thinningTools = []
skimmingTools += [
FTAG4LeptonSkimmingTool,
]
thinningTools = [
]
# Finally the kernel itself
DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
acc.addEventAlgo(DerivationKernel(name, AugmentationTools = augmentationTools, ThinningTools = thinningTools, SkimmingTools = skimmingTools))
return acc
def FTAG4Cfg(flags):
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
# TODO: this should ideally be called higher up to avoid it being run multiple times in a train
#from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
#FTAG4TriggerListsHelper = TriggerListsHelper(flags)
# the name_tag has to consistent between KernelCfg and CoreCfg
FTAG4_name_tag = 'FTAG4'
# 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
# TODO: this should ideally be called higher up to avoid it being run multiple times in a train
from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
PHYSTriggerListsHelper = TriggerListsHelper(flags)
# for AOD produced before 24.0.17, the electron removal tau is not available
TauJets_EleRM_in_input = (flags.Input.TypedCollections.count('xAOD::TauJetContainer#TauJets_EleRM') > 0)
#if TauJets_EleRM_in_input:
# logFTAG4.info("TauJets_EleRM is in the input AOD. Relevant containers will be scheduled")
#else:
# logFTAG4.info("TauJets_EleRM is Not in the input AOD. No relevant containers will be written")
# Common augmentations
acc.merge(FTAG4KernelCfg(flags,
name= FTAG4_name_tag + "Kernel",
StreamName = 'StreamDAOD_'+FTAG4_name_tag,
TriggerListsHelper = PHYSTriggerListsHelper,
TauJets_EleRM_in_input=TauJets_EleRM_in_input
))
# PHYS content
from DerivationFrameworkPhys.PHYS import PHYSCoreCfg
acc.merge(PHYSCoreCfg(flags,
FTAG4_name_tag,
StreamName = 'StreamDAOD_'+FTAG4_name_tag,
TriggerListsHelper = PHYSTriggerListsHelper,
TauJets_EleRM_in_input=TauJets_EleRM_in_input
))
return acc
......@@ -55,36 +55,18 @@ def PHYSKernelCfg(ConfigFlags, name='PHYSKernel', **kwargs):
return acc
def PHYSCfg(ConfigFlags):
def PHYSCoreCfg(ConfigFlags, name_tag='PHYS', StreamName='StreamDAOD_PHYS', TriggerListsHelper=None, TauJets_EleRM_in_input=None):
if TriggerListsHelper is None:
from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
TriggerListsHelper = TriggerListsHelper(ConfigFlags)
if TauJets_EleRM_in_input is None:
# for AOD produced before 24.0.17, the electron removal tau is not available
TauJets_EleRM_in_input = (ConfigFlags.Input.TypedCollections.count('xAOD::TauJetContainer#TauJets_EleRM') > 0)
logPHYS.info('****************** STARTING PHYS *****************')
stream_name = 'StreamDAOD_PHYS'
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
# TODO: this should ideally be called higher up to avoid it being run multiple times in a train
from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
PHYSTriggerListsHelper = TriggerListsHelper(ConfigFlags)
# for AOD produced before 24.0.17, the electron removal tau is not available
TauJets_EleRM_in_input = (ConfigFlags.Input.TypedCollections.count('xAOD::TauJetContainer#TauJets_EleRM') > 0)
if TauJets_EleRM_in_input:
logPHYS.info("TauJets_EleRM is in the input AOD. Relevant containers will be scheduled")
else:
logPHYS.info("TauJets_EleRM is Not in the input AOD. No relevant containers will be written")
# Common augmentations
acc.merge(PHYSKernelCfg(
ConfigFlags,
name="PHYSKernel",
StreamName = stream_name,
TriggerListsHelper = PHYSTriggerListsHelper,
TauJets_EleRM_in_input=TauJets_EleRM_in_input
))
## Higgs augmentations - create 4l vertex
from DerivationFrameworkHiggs.HiggsPhysContent import HiggsAugmentationAlgsCfg
acc.merge(HiggsAugmentationAlgsCfg(ConfigFlags))
......@@ -92,7 +74,7 @@ def PHYSCfg(ConfigFlags):
## CloseByIsolation correction augmentation
## For the moment, run BOTH CloseByIsoCorrection on AOD AND add in augmentation variables to be able to also run on derivation (the latter part will eventually be suppressed)
from IsolationSelection.IsolationSelectionConfig import IsoCloseByAlgsCfg
acc.merge(IsoCloseByAlgsCfg(ConfigFlags, suff = "_PHYS", isPhysLite = False, stream_name = stream_name))
acc.merge(IsoCloseByAlgsCfg(ConfigFlags, suff = "_"+name_tag, isPhysLite = False, stream_name = StreamName))
#===================================================
......@@ -108,7 +90,7 @@ def PHYSCfg(ConfigFlags):
from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
PHYSSlimmingHelper = SlimmingHelper("PHYSSlimmingHelper", NamesAndTypes = ConfigFlags.Input.TypedCollections, ConfigFlags = ConfigFlags)
PHYSSlimmingHelper = SlimmingHelper(name_tag+"SlimmingHelper", NamesAndTypes = ConfigFlags.Input.TypedCollections, ConfigFlags = ConfigFlags)
PHYSSlimmingHelper.SmartCollections = ["EventInfo",
"Electrons",
"Photons",
......@@ -199,10 +181,10 @@ def PHYSCfg(ConfigFlags):
from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = PHYSSlimmingHelper,
OutputContainerPrefix = "TrigMatch_",
TriggerList = PHYSTriggerListsHelper.Run2TriggerNamesTau)
TriggerList = TriggerListsHelper.Run2TriggerNamesTau)
AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = PHYSSlimmingHelper,
OutputContainerPrefix = "TrigMatch_",
TriggerList = PHYSTriggerListsHelper.Run2TriggerNamesNoTau)
TriggerList = TriggerListsHelper.Run2TriggerNamesNoTau)
# Run 3, or Run 2 with navigation conversion
if ConfigFlags.Trigger.EDMVersion == 3 or (ConfigFlags.Trigger.EDMVersion == 2 and ConfigFlags.Trigger.doEDMVersionConversion):
from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
......@@ -222,8 +204,48 @@ def PHYSCfg(ConfigFlags):
# Output stream
PHYSItemList = PHYSSlimmingHelper.GetItemList()
acc.merge(OutputStreamCfg(ConfigFlags, "DAOD_PHYS", ItemList=PHYSItemList, AcceptAlgs=["PHYSKernel"]))
acc.merge(SetupMetaDataForStreamCfg(ConfigFlags, "DAOD_PHYS", AcceptAlgs=["PHYSKernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData]))
acc.merge(OutputStreamCfg(ConfigFlags, "DAOD_"+name_tag, ItemList=PHYSItemList, AcceptAlgs=[name_tag+"Kernel"]))
acc.merge(SetupMetaDataForStreamCfg(ConfigFlags, "DAOD_"+name_tag, AcceptAlgs=[name_tag+"Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData]))
return acc
def PHYSCfg(ConfigFlags):
logPHYS.info('****************** STARTING PHYS *****************')
stream_name = 'StreamDAOD_PHYS'
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
# TODO: this should ideally be called higher up to avoid it being run multiple times in a train
from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
PHYSTriggerListsHelper = TriggerListsHelper(ConfigFlags)
# for AOD produced before 24.0.17, the electron removal tau is not available
TauJets_EleRM_in_input = (ConfigFlags.Input.TypedCollections.count('xAOD::TauJetContainer#TauJets_EleRM') > 0)
if TauJets_EleRM_in_input:
logPHYS.info("TauJets_EleRM is in the input AOD. Relevant containers will be scheduled")
else:
logPHYS.info("TauJets_EleRM is Not in the input AOD. No relevant containers will be written")
# Common augmentations
acc.merge(PHYSKernelCfg(
ConfigFlags,
name="PHYSKernel",
StreamName = stream_name,
TriggerListsHelper = PHYSTriggerListsHelper,
TauJets_EleRM_in_input=TauJets_EleRM_in_input
))
# PHYS content
acc.merge(PHYSCoreCfg(
ConfigFlags,
"PHYS",
StreamName = stream_name,
TriggerListsHelper = PHYSTriggerListsHelper,
TauJets_EleRM_in_input=TauJets_EleRM_in_input
))
return acc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment