ATLAS Offline Software
Loading...
Searching...
No Matches
STDM13.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2#====================================================================
3# DAOD_STDM13.py for W+D analysises
4# * 1L skimming
5# * InDetTrackParticles with |z0|*sinTheta < 6.0
6#====================================================================
7from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8from AthenaConfiguration.ComponentFactory import CompFactory
9from AthenaConfiguration.Enums import MetadataCategory
10
11# Main algorithm config
12def STDM13KernelCfg(flags, name='STDM13Kernel', **kwargs):
13 """Configure the derivation framework driving algorithm (kernel) for STDM13"""
14 acc = ComponentAccumulator()
15
16 # Common augmentations
17 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
18 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']))
19
20
21
22 from BTagging.FlavorTaggingConfig import FlavorTaggingCfg
23 acc.merge(FlavorTaggingCfg(flags, "AntiKt4EMPFlowJets"))
24
25 #===================================================
26 # HEAVY FLAVOR CLASSIFICATION FOR ttbar+jets EVENTS
27 #===================================================
28 from DerivationFrameworkMCTruth.HFClassificationCommonConfig import HFClassificationCommonCfg
29 acc.merge(HFClassificationCommonCfg(flags))
30
31 from DerivationFrameworkInDet.InDetToolsConfig import TrackParticleThinningCfg
32
33 # filter leptons
34 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'
35
36 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
37 xAODStringSkimmingToolCfg)
38 STDM13StringSkimmingTool = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
39 flags, name = "STDM13StringSkimmingTool", expression = lepton_skimming_expression))
40
41 tp_thinning_expression = "abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 6.0*mm"
42 STDM13TPThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg(
43 flags,
44 name = "STDM13TPThinningTool",
45 StreamName = kwargs['StreamName'],
46 SelectionString = tp_thinning_expression,
47 InDetTrackParticlesKey = "InDetTrackParticles"))
48
49 thinningTools = [ STDM13TPThinningTool ]
50 skimmingTools = [ STDM13StringSkimmingTool ]
51
52 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
53 acc.addEventAlgo(DerivationKernel(name, SkimmingTools = skimmingTools, ThinningTools = thinningTools))
54 return acc
55
56
57def STDM13Cfg(flags):
58 acc = ComponentAccumulator()
59
60 # Get the lists of triggers needed for trigger matching.
61 # This is needed at this scope (for the slimming) and further down in the config chain
62 # for actually configuring the matching, so we create it here and pass it down
63 # TODO: this should ideally be called higher up to avoid it being run multiple times in a train
64 from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
65 STDM13TriggerListsHelper = TriggerListsHelper(flags)
66
67 # Common augmentations
68 acc.merge(STDM13KernelCfg(flags, name="STDM13Kernel", StreamName = 'StreamDAOD_STDM13', TriggerListsHelper = STDM13TriggerListsHelper))
69
70 # ============================
71 # Define contents of the format
72 # =============================
73 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
74 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
75 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
76
77 STDM13SlimmingHelper = SlimmingHelper("STDM13SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
78
79 from DerivationFrameworkFlavourTag import FtagBaseContent
80 FtagBaseContent.addCommonAugmentation(flags, acc, STDM13SlimmingHelper)
81
82 STDM13SlimmingHelper.SmartCollections = [
83 "Electrons",
84 "Muons",
85 "AntiKt4EMPFlowJets",
86 "MET_Baseline_AntiKt4EMPFlow",
87 "PrimaryVertices",
88 "InDetTrackParticles",
89 ]
90
91 STDM13SlimmingHelper.AllVariables = [
92 "EventInfo",
93 "PrimaryVertices",
94 "InDetTrackParticles",
95
96 "AntiKt4TruthDressedWZJets",
97 "TruthEvents","TruthHFWithDecayParticles","TruthBoson","TruthBottom", "TruthCharm","TruthElectrons","TruthMuons","TruthTop","TruthTaus","MET_Truth",
98 "TruthPrimaryVertices","TruthHFWithDecayVertices",
99
100 ]
101
102 STDM13SlimmingHelper.IncludeTriggerNavigation = False
103 STDM13SlimmingHelper.IncludeJetTriggerContent = False
104 STDM13SlimmingHelper.IncludeMuonTriggerContent = False
105 STDM13SlimmingHelper.IncludeEGammaTriggerContent = False
106 STDM13SlimmingHelper.IncludeJetTauEtMissTriggerContent = False
107 STDM13SlimmingHelper.IncludeTauTriggerContent = False
108 STDM13SlimmingHelper.IncludeEtMissTriggerContent = False
109 STDM13SlimmingHelper.IncludeBJetTriggerContent = False
110 STDM13SlimmingHelper.IncludeBPhysTriggerContent = False
111 STDM13SlimmingHelper.IncludeMinBiasTriggerContent = False
112
113 # Truth extra content
114 if flags.Input.isMC:
115
116 from DerivationFrameworkMCTruth.MCTruthCommonConfig import addTruth3ContentToSlimmerTool
117 addTruth3ContentToSlimmerTool(STDM13SlimmingHelper)
118 STDM13SlimmingHelper.AllVariables += ['TruthLHEParticles', 'TruthHFWithDecayParticles','TruthHFWithDecayVertices','TruthCharm','TruthPileupParticles','InTimeAntiKt4TruthJets','OutOfTimeAntiKt4TruthJets']
119 STDM13SlimmingHelper.ExtraVariables += ["Electrons.TruthLink",
120 "Muons.TruthLink",
121 "Photons.TruthLink",
122 "AntiKt4TruthDressedWZJets.IsoFixedCone5Pt"]
123
124 from DerivationFrameworkMCTruth.MCTruthCommonConfig import AddTauAndDownstreamParticlesCfg
125 acc.merge(AddTauAndDownstreamParticlesCfg(flags))
126 STDM13SlimmingHelper.AllVariables += ['TruthTausWithDecayParticles','TruthTausWithDecayVertices']
127
128 # Extra content
129 STDM13SlimmingHelper.ExtraVariables += ["AntiKt4EMPFlowJets.QGTransformer_ConstScore.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.GhostPartons.isJvtHS.isJvtPU.IsoFixedCone5PtPUsub" ]
130
131
132 # Trigger matching
133 # Run 2
134 if flags.Trigger.EDMVersion == 2:
135 from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
136 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM13SlimmingHelper,
137 OutputContainerPrefix = "TrigMatch_",
138 TriggerList = STDM13TriggerListsHelper.Run2TriggerNamesTau)
139 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM13SlimmingHelper,
140 OutputContainerPrefix = "TrigMatch_",
141 TriggerList = STDM13TriggerListsHelper.Run2TriggerNamesNoTau)
142 # Run 3, or Run 2 with navigation conversion
143 if flags.Trigger.EDMVersion == 3 or (flags.Trigger.EDMVersion == 2 and flags.Trigger.doEDMVersionConversion):
144 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
145 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(STDM13SlimmingHelper)
146
147 # Output stream
148 STDM13ItemList = STDM13SlimmingHelper.GetItemList()
149 acc.merge(OutputStreamCfg(flags, "DAOD_STDM13", ItemList=STDM13ItemList, AcceptAlgs=["STDM13Kernel"]))
150 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_STDM13", AcceptAlgs=["STDM13Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData]))
151
152 return acc
153
STDM13KernelCfg(flags, name='STDM13Kernel', **kwargs)
Definition STDM13.py:12
STDM13Cfg(flags)
Definition STDM13.py:57