ATLAS Offline Software
PhysCommonConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2 
3 # PhysCommonConfig
4 # Contains the configuration for the common physics containers/decorations used in analysis DAODs
5 # including PHYS(LITE)
6 # Actual configuration is subcontracted to other config files since some of them are very long
7 
8 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 from AthenaCommon.Logging import logging
11 msg = logging.getLogger('PHYSCommonConfig')
12 
13 def PhysCommonAugmentationsCfg(flags,**kwargs):
14  """Configure the common augmentation"""
15  acc = ComponentAccumulator()
16 
17  # MC truth
18  if flags.Input.isMC:
19  from DerivationFrameworkMCTruth.MCTruthCommonConfig import (
20  AddStandardTruthContentsCfg,
21  AddHFAndDownstreamParticlesCfg,
22  AddMiniTruthCollectionLinksCfg,
23  AddPVCollectionCfg)
24  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import DFCommonTruthCharmToolCfg
25  PhysCommonTruthCharmTool = acc.getPrimaryAndMerge(DFCommonTruthCharmToolCfg(
26  flags,
27  name = "PhysCommonTruthCharmTool"))
28  CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
29  acc.addEventAlgo(CommonAugmentation("PhysCommonTruthCharmKernel",AugmentationTools=[PhysCommonTruthCharmTool]))
30  acc.merge(AddHFAndDownstreamParticlesCfg(flags))
31  acc.merge(AddStandardTruthContentsCfg
32  (flags,
33  navInputCollections = ["TruthElectrons",
34  "TruthMuons",
35  "TruthPhotons",
36  "TruthTaus",
37  "TruthNeutrinos",
38  "TruthBSM",
39  "TruthBottom",
40  "TruthTop",
41  "TruthBoson",
42  "TruthCharm",
43  "TruthHFWithDecayParticles"]))
44  # Re-point links on reco objects
45  acc.merge(AddMiniTruthCollectionLinksCfg(flags))
46  acc.merge(AddPVCollectionCfg(flags))
47 
48  # InDet, Muon, Egamma common augmentations
49  from DerivationFrameworkInDet.InDetCommonConfig import InDetCommonCfg
50  from DerivationFrameworkMuons.MuonsCommonConfig import MuonsCommonCfg
51  from DerivationFrameworkEGamma.EGammaCommonConfig import EGammaCommonCfg
52  # TODO: need to find the new flags equivalent for the missing settings below, then we can
53  # drop these kwargs and do everything via the flags
54  acc.merge(InDetCommonCfg(flags,
55  DoVertexFinding = flags.Tracking.doVertexFinding,
56  AddPseudoTracks = flags.Tracking.doPseudoTracking,
57  DecoLRTTTVA = False,
58  DoR3LargeD0 = flags.Tracking.doLargeD0,
59  StoreSeparateLargeD0Container = flags.Tracking.storeSeparateLargeD0Container,
60  MergeLRT = False))
61  acc.merge(MuonsCommonCfg(flags))
62  acc.merge(EGammaCommonCfg(flags))
63  # Jets, di-taus, tau decorations, flavour tagging, MET association
64  from DerivationFrameworkJetEtMiss.JetCommonConfig import JetCommonCfg
65  from DerivationFrameworkTau.TauCommonConfig import (AddDiTauLowPtCfg, AddMuonRemovalTauAODReRecoAlgCfg, AddTauIDDecorationCfg, AddDiTauChargeDecoratorCfg, AddDiTauIDDecorationCfg)
66  from DerivationFrameworkJetEtMiss.METCommonConfig import METCommonCfg
67  acc.merge(JetCommonCfg(flags))
68  #We also need to build links between the newly created jet constituents (GlobalFE)
69  #and electrons,photons,muons and taus
70  from eflowRec.PFCfg import PFGlobalFlowElementLinkingCfg
71  acc.merge(PFGlobalFlowElementLinkingCfg(flags))
72  acc.merge(AddDiTauLowPtCfg(flags))
73  acc.merge(AddMuonRemovalTauAODReRecoAlgCfg(flags))
74  # eVeto WP and DeepSet ID for taus and muon-subtracted taus
75  acc.merge(AddTauIDDecorationCfg(flags, TauContainerName="TauJets"))
76  acc.merge(AddTauIDDecorationCfg(flags, TauContainerName="TauJets_MuonRM"))
77  # add ID score for ditau
78  acc.merge(AddDiTauIDDecorationCfg(flags, DiTauContainerName="DiTauJets"))
79  # for AOD produced before 24.0.17, the electron removal tau is not available
80  if flags.Tau.TauEleRM_isAvailable:
81  acc.merge(AddTauIDDecorationCfg(flags, TauContainerName="TauJets_EleRM"))
82  # ditau Charge
83  acc.merge(AddDiTauChargeDecoratorCfg(flags, DiTauContainerName="DiTauJets"))
84  acc.merge(AddDiTauChargeDecoratorCfg(flags, DiTauContainerName="DiTauJetsLowPt"))
85  if flags.Reco.EnableBTagging:
86  from BTagging.FlavorTaggingConfig import FlavorTaggingCfg
87  from DerivationFrameworkFlavourTag.FtagDerivationConfig import (
88  BTagLargeRDecoration, LegacyBTaggingCfg
89  )
90  acc.merge(FlavorTaggingCfg(flags, "AntiKt4EMPFlowJets"))
91  acc.merge(BTagLargeRDecoration(flags, "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"))
92  if flags.BTagging.EnableLegacyBTagging:
93  acc.merge(LegacyBTaggingCfg(flags, "AntiKt4EMPFlowJets"))
94 
95  acc.merge(METCommonCfg(flags))
96 
97  # Trigger matching
98  if flags.Reco.EnableTrigger or flags.Trigger.triggerConfig == 'INFILE':
99  from DerivationFrameworkPhys.TriggerMatchingCommonConfig import TriggerMatchingCommonRun2Cfg
100  from DerivationFrameworkPhys.TriggerMatchingCommonConfig import TriggerMatchingCommonRun2ToRun3Cfg
101  from DerivationFrameworkPhys.TriggerMatchingCommonConfig import TriggerMatchingCommonRun3Cfg
102  # requires some wrangling due to the difference between run 2 and 3
103  triggerListsHelper = kwargs['TriggerListsHelper']
104  if flags.Trigger.EDMVersion == 2:
105  # NOTE: Once Run-2 -> Run-3 trigger navigation is validated and doEDMVersionConversion is on by default, we will only want to do ONE of
106  # TriggerMatchingCommonRun2Cfg(s) OR TriggerMatchingCommonRun2ToRun3Cfg
107  # Otherwise we are doubling up on the analysis trigger data in both the Run-2 and Run-3 formats.
108 
109  # This sets up the Run-2 style matching during the derivation process
111  flags,
112  name = "PhysCommonTrigMatchNoTau",
113  OutputContainerPrefix = "TrigMatch_",
114  ChainNames = triggerListsHelper.Run2TriggerNamesNoTau))
116  flags,
117  name = "PhysCommonTrigMatchTau",
118  OutputContainerPrefix = "TrigMatch_",
119  ChainNames = triggerListsHelper.Run2TriggerNamesTau,
120  DRThreshold = 0.2))
121  # This sets up a conversion of the Run-2 trigger navigation to the Run-3 style,
122  # followed by Run-3 style navigation slimming for trigger-matching from DAOD.
123  # This function is a noop if doEDMVersionConversion=False
125  flags,
126  TriggerList = triggerListsHelper.Run2TriggerNamesNoTau +
127  triggerListsHelper.Run2TriggerNamesTau))
128  if flags.Trigger.EDMVersion == 3:
129  # This sets up the Run-3 style navigation slimming for trigger-matching from DAOD
131  flags, TriggerList = triggerListsHelper.Run3TriggerNames))
132 
133  return acc
134 
python.TriggerMatchingCommonConfig.TriggerMatchingCommonRun2Cfg
def TriggerMatchingCommonRun2Cfg(flags, name, **kwargs)
Definition: TriggerMatchingCommonConfig.py:91
python.JetCommonConfig.JetCommonCfg
def JetCommonCfg(ConfigFlags)
Definition: JetCommonConfig.py:11
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.FlavorTaggingConfig.FlavorTaggingCfg
def FlavorTaggingCfg(cfgFlags, JetCollection, pv_col='PrimaryVertices', trackAugmenterPrefix=None, fast=False, JetTrackAssociator='TracksForBTagging', trackCollection='InDetTrackParticles')
Definition: FlavorTaggingConfig.py:72
python.TauCommonConfig.AddDiTauChargeDecoratorCfg
def AddDiTauChargeDecoratorCfg(flags, **kwargs)
Definition: TauCommonConfig.py:230
python.FtagDerivationConfig.LegacyBTaggingCfg
def LegacyBTaggingCfg(cfgFlags, jet_col, pv_col='PrimaryVertices', trackAugmenterPrefix=None)
Definition: FtagDerivationConfig.py:104
python.MCTruthCommonConfig.AddMiniTruthCollectionLinksCfg
def AddMiniTruthCollectionLinksCfg(flags, **kwargs)
Definition: MCTruthCommonConfig.py:434
python.MCTruthCommonConfig.AddPVCollectionCfg
def AddPVCollectionCfg(flags)
Definition: MCTruthCommonConfig.py:321
python.TauCommonConfig.AddMuonRemovalTauAODReRecoAlgCfg
def AddMuonRemovalTauAODReRecoAlgCfg(flags, **kwargs)
Definition: TauCommonConfig.py:251
python.TriggerMatchingCommonConfig.TriggerMatchingCommonRun2ToRun3Cfg
def TriggerMatchingCommonRun2ToRun3Cfg(flags, **kwargs)
Definition: TriggerMatchingCommonConfig.py:106
python.EGammaCommonConfig.EGammaCommonCfg
def EGammaCommonCfg(ConfigFlags)
Definition: EGammaCommonConfig.py:15
python.TauCommonConfig.AddDiTauIDDecorationCfg
def AddDiTauIDDecorationCfg(flags, **kwargs)
Definition: TauCommonConfig.py:159
python.MuonsCommonConfig.MuonsCommonCfg
def MuonsCommonCfg(flags, suff="")
Definition: MuonsCommonConfig.py:13
python.TauCommonConfig.AddTauIDDecorationCfg
def AddTauIDDecorationCfg(flags, **kwargs)
Definition: TauCommonConfig.py:186
python.TruthDerivationToolsConfig.DFCommonTruthCharmToolCfg
def DFCommonTruthCharmToolCfg(flags, name)
Definition: TruthDerivationToolsConfig.py:37
python.MCTruthCommonConfig.AddHFAndDownstreamParticlesCfg
def AddHFAndDownstreamParticlesCfg(flags, **kwargs)
Add electrons, photons, and their downstream particles in a special collection def addEgammaAndDownst...
Definition: MCTruthCommonConfig.py:297
python.TriggerMatchingCommonConfig.TriggerMatchingCommonRun3Cfg
def TriggerMatchingCommonRun3Cfg(flags, **kwargs)
Definition: TriggerMatchingCommonConfig.py:129
python.InDetCommonConfig.InDetCommonCfg
def InDetCommonCfg(flags, **kwargs)
Definition: InDetCommonConfig.py:16
python.TauCommonConfig.AddDiTauLowPtCfg
def AddDiTauLowPtCfg(flags, **kwargs)
Definition: TauCommonConfig.py:145
python.FtagDerivationConfig.BTagLargeRDecoration
def BTagLargeRDecoration(cfgFlags, jet_col)
Definition: FtagDerivationConfig.py:53
python.PhysCommonConfig.PhysCommonAugmentationsCfg
def PhysCommonAugmentationsCfg(flags, **kwargs)
Definition: PhysCommonConfig.py:13
PFCfg.PFGlobalFlowElementLinkingCfg
def PFGlobalFlowElementLinkingCfg(inputFlags, **kwargs)
Definition: PFCfg.py:472
python.METCommonConfig.METCommonCfg
def METCommonCfg(ConfigFlags)
Definition: METCommonConfig.py:11