ATLAS Offline Software
PhysCommonConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 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  AddTruthCollectionNavigationDecorationsCfg)
25  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthCollectionMakerCfg
26  PhysCommonTruthCharmTool = acc.getPrimaryAndMerge(TruthCollectionMakerCfg(
27  flags,
28  name = "PhysCommonTruthCharmTool",
29  NewCollectionName = "TruthCharm",
30  KeepNavigationInfo = False,
31  ParticleSelectionString = "(abs(TruthParticles.pdgId) == 4)",
32  Do_Compress = True))
33  CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
34  acc.addEventAlgo(CommonAugmentation("PhysCommonTruthCharmKernel",AugmentationTools=[PhysCommonTruthCharmTool]))
35  acc.merge(AddHFAndDownstreamParticlesCfg(flags))
36  acc.merge(AddStandardTruthContentsCfg(flags))
38  flags,
39  TruthCollections=["TruthElectrons",
40  "TruthMuons",
41  "TruthPhotons",
42  "TruthTaus",
43  "TruthNeutrinos",
44  "TruthBSM",
45  "TruthBottom",
46  "TruthTop",
47  "TruthBoson",
48  "TruthCharm",
49  "TruthHFWithDecayParticles"],
50  prefix = 'PHYS_'))
51  # Re-point links on reco objects
52  acc.merge(AddMiniTruthCollectionLinksCfg(flags))
53  acc.merge(AddPVCollectionCfg(flags))
54 
55  # InDet, Muon, Egamma common augmentations
56  from DerivationFrameworkInDet.InDetCommonConfig import InDetCommonCfg
57  from DerivationFrameworkMuons.MuonsCommonConfig import MuonsCommonCfg
58  from DerivationFrameworkEGamma.EGammaCommonConfig import EGammaCommonCfg
59  # TODO: need to find the new flags equivalent for the missing settings below, then we can
60  # drop these kwargs and do everything via the flags
61  acc.merge(InDetCommonCfg(flags,
62  DoVertexFinding = flags.Tracking.doVertexFinding,
63  AddPseudoTracks = flags.Tracking.doPseudoTracking,
64  DecoLRTTTVA = False,
65  DoR3LargeD0 = flags.Tracking.doLargeD0,
66  StoreSeparateLargeD0Container = flags.Tracking.storeSeparateLargeD0Container,
67  MergeLRT = False))
68  acc.merge(MuonsCommonCfg(flags))
69  acc.merge(EGammaCommonCfg(flags))
70  # Jets, di-taus, tau decorations, flavour tagging, MET association
71  from DerivationFrameworkJetEtMiss.JetCommonConfig import JetCommonCfg
72  from DerivationFrameworkTau.TauCommonConfig import (AddDiTauLowPtCfg, AddMuonRemovalTauAODReRecoAlgCfg, AddTauIDDecorationCfg)
73  from DerivationFrameworkJetEtMiss.METCommonConfig import METCommonCfg
74  acc.merge(JetCommonCfg(flags))
75  #We also need to build links between the newly created jet constituents (GlobalFE)
76  #and electrons,photons,muons and taus
77  from eflowRec.PFCfg import PFGlobalFlowElementLinkingCfg
78  acc.merge(PFGlobalFlowElementLinkingCfg(flags))
79  acc.merge(AddDiTauLowPtCfg(flags))
80  acc.merge(AddMuonRemovalTauAODReRecoAlgCfg(flags))
81  # eVeto WP and DeepSet ID for taus and muon-subtracted taus
82  acc.merge(AddTauIDDecorationCfg(flags, TauContainerName="TauJets"))
83  acc.merge(AddTauIDDecorationCfg(flags, TauContainerName="TauJets_MuonRM"))
84  # for AOD produced before 24.0.17, the electron removal tau is not available
85  if flags.Tau.TauEleRM_isAvailable:
86  acc.merge(AddTauIDDecorationCfg(flags, TauContainerName="TauJets_EleRM"))
87  if flags.Reco.EnableBTagging:
88  from BTagging.FlavorTaggingConfig import FlavorTaggingCfg
89  from DerivationFrameworkFlavourTag.FtagDerivationConfig import (
90  BTagLargeRDecoration, LegacyBTaggingCfg
91  )
92  acc.merge(FlavorTaggingCfg(flags, "AntiKt4EMPFlowJets"))
93  acc.merge(BTagLargeRDecoration(flags, "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"))
94  if flags.BTagging.EnableLegacyBTagging:
95  acc.merge(LegacyBTaggingCfg(flags, "AntiKt4EMPFlowJets"))
96 
97  acc.merge(METCommonCfg(flags))
98 
99  # Trigger matching
100  if flags.Reco.EnableTrigger or flags.Trigger.triggerConfig == 'INFILE':
101  from DerivationFrameworkPhys.TriggerMatchingCommonConfig import TriggerMatchingCommonRun2Cfg
102  from DerivationFrameworkPhys.TriggerMatchingCommonConfig import TriggerMatchingCommonRun2ToRun3Cfg
103  from DerivationFrameworkPhys.TriggerMatchingCommonConfig import TriggerMatchingCommonRun3Cfg
104  # requires some wrangling due to the difference between run 2 and 3
105  triggerListsHelper = kwargs['TriggerListsHelper']
106  if flags.Trigger.EDMVersion == 2:
107  # NOTE: Once Run-2 -> Run-3 trigger navigation is validated and doEDMVersionConversion is on by default, we will only want to do ONE of
108  # TriggerMatchingCommonRun2Cfg(s) OR TriggerMatchingCommonRun2ToRun3Cfg
109  # Otherwise we are doubling up on the analysis trigger data in both the Run-2 and Run-3 formats.
110 
111  # This sets up the Run-2 style matching during the derivation process
113  flags,
114  name = "PhysCommonTrigMatchNoTau",
115  OutputContainerPrefix = "TrigMatch_",
116  ChainNames = triggerListsHelper.Run2TriggerNamesNoTau))
118  flags,
119  name = "PhysCommonTrigMatchTau",
120  OutputContainerPrefix = "TrigMatch_",
121  ChainNames = triggerListsHelper.Run2TriggerNamesTau,
122  DRThreshold = 0.2))
123  # This sets up a conversion of the Run-2 trigger navigation to the Run-3 style,
124  # followed by Run-3 style navigation slimming for trigger-matching from DAOD.
125  # This function is a noop if doEDMVersionConversion=False
127  flags,
128  TriggerList = triggerListsHelper.Run2TriggerNamesNoTau +
129  triggerListsHelper.Run2TriggerNamesTau))
130  if flags.Trigger.EDMVersion == 3:
131  # This sets up the Run-3 style navigation slimming for trigger-matching from DAOD
133  flags, TriggerList = triggerListsHelper.Run3TriggerNames))
134 
135  return acc
136 
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.MCTruthCommonConfig.AddStandardTruthContentsCfg
def AddStandardTruthContentsCfg(flags, decorationDressing='dressedPhoton', includeTausInDressingPhotonRemoval=False, prefix='')
Definition: MCTruthCommonConfig.py:168
python.FtagDerivationConfig.LegacyBTaggingCfg
def LegacyBTaggingCfg(cfgFlags, jet_col, pv_col='PrimaryVertices', trackAugmenterPrefix=None)
Definition: FtagDerivationConfig.py:96
python.MCTruthCommonConfig.AddMiniTruthCollectionLinksCfg
def AddMiniTruthCollectionLinksCfg(flags, **kwargs)
Definition: MCTruthCommonConfig.py:430
python.MCTruthCommonConfig.AddPVCollectionCfg
def AddPVCollectionCfg(flags)
Definition: MCTruthCommonConfig.py:318
python.TauCommonConfig.AddMuonRemovalTauAODReRecoAlgCfg
def AddMuonRemovalTauAODReRecoAlgCfg(flags, **kwargs)
Definition: TauCommonConfig.py:205
python.TruthDerivationToolsConfig.TruthCollectionMakerCfg
def TruthCollectionMakerCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:19
python.TriggerMatchingCommonConfig.TriggerMatchingCommonRun2ToRun3Cfg
def TriggerMatchingCommonRun2ToRun3Cfg(flags, **kwargs)
Definition: TriggerMatchingCommonConfig.py:106
python.EGammaCommonConfig.EGammaCommonCfg
def EGammaCommonCfg(ConfigFlags)
Definition: EGammaCommonConfig.py:15
python.MuonsCommonConfig.MuonsCommonCfg
def MuonsCommonCfg(flags, suff="")
Definition: MuonsCommonConfig.py:13
python.TauCommonConfig.AddTauIDDecorationCfg
def AddTauIDDecorationCfg(flags, **kwargs)
Definition: TauCommonConfig.py:160
python.MCTruthCommonConfig.AddHFAndDownstreamParticlesCfg
def AddHFAndDownstreamParticlesCfg(flags, **kwargs)
Add electrons, photons, and their downstream particles in a special collection def addEgammaAndDownst...
Definition: MCTruthCommonConfig.py:295
python.MCTruthCommonConfig.AddTruthCollectionNavigationDecorationsCfg
def AddTruthCollectionNavigationDecorationsCfg(flags, TruthCollections=[], prefix='')
Definition: MCTruthCommonConfig.py:334
python.TriggerMatchingCommonConfig.TriggerMatchingCommonRun3Cfg
def TriggerMatchingCommonRun3Cfg(flags, **kwargs)
Definition: TriggerMatchingCommonConfig.py:129
python.InDetCommonConfig.InDetCommonCfg
def InDetCommonCfg(flags, **kwargs)
Definition: InDetCommonConfig.py:16
python.FlavorTaggingConfig.FlavorTaggingCfg
def FlavorTaggingCfg(cfgFlags, JetCollection, pv_col='PrimaryVertices', trackAugmenterPrefix=None, fast=False)
Definition: FlavorTaggingConfig.py:72
python.TauCommonConfig.AddDiTauLowPtCfg
def AddDiTauLowPtCfg(flags, **kwargs)
Definition: TauCommonConfig.py:145
python.FtagDerivationConfig.BTagLargeRDecoration
def BTagLargeRDecoration(cfgFlags, jet_col)
Definition: FtagDerivationConfig.py:52
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