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