ATLAS Offline Software
Loading...
Searching...
No Matches
STDM13.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 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 STDM13StringSkimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(
37 name = "STDM13StringSkimmingTool",
38 expression = lepton_skimming_expression )
39 acc.addPublicTool(STDM13StringSkimmingTool)
40 STDM13SkimmingTool = CompFactory.DerivationFramework.FilterCombinationAND("STDM13SkimmingTool", FilterList = [STDM13StringSkimmingTool])
41
42 acc.addPublicTool(STDM13SkimmingTool, primary = True)
43 tp_thinning_expression = "abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 6.0*mm"
44 STDM13TPThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg(
45 flags,
46 name = "STDM13TPThinningTool",
47 StreamName = kwargs['StreamName'],
48 SelectionString = tp_thinning_expression,
49 InDetTrackParticlesKey = "InDetTrackParticles"))
50
51 thinningTools = [ STDM13TPThinningTool ]
52 skimmingTools = [ STDM13SkimmingTool ]
53
54 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
55 acc.addEventAlgo(DerivationKernel(name, SkimmingTools = skimmingTools, ThinningTools = thinningTools))
56 return acc
57
58
59def STDM13Cfg(flags):
60 acc = ComponentAccumulator()
61
62 # Get the lists of triggers needed for trigger matching.
63 # This is needed at this scope (for the slimming) and further down in the config chain
64 # for actually configuring the matching, so we create it here and pass it down
65 # TODO: this should ideally be called higher up to avoid it being run multiple times in a train
66 from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
67 STDM13TriggerListsHelper = TriggerListsHelper(flags)
68
69 # Common augmentations
70 acc.merge(STDM13KernelCfg(flags, name="STDM13Kernel", StreamName = 'StreamDAOD_STDM13', TriggerListsHelper = STDM13TriggerListsHelper))
71
72 # ============================
73 # Define contents of the format
74 # =============================
75 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
76 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
77 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
78
79 STDM13SlimmingHelper = SlimmingHelper("STDM13SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
80
81 from DerivationFrameworkFlavourTag import FtagBaseContent
82 FtagBaseContent.addCommonAugmentation(flags, acc, STDM13SlimmingHelper)
83
84 STDM13SlimmingHelper.SmartCollections = [
85 "Electrons",
86 "Muons",
87 "AntiKt4EMPFlowJets",
88 "MET_Baseline_AntiKt4EMPFlow",
89 "PrimaryVertices",
90 "InDetTrackParticles",
91 ]
92
93 STDM13SlimmingHelper.AllVariables = [
94 "EventInfo",
95 "PrimaryVertices",
96 "InDetTrackParticles",
97
98 "AntiKt4TruthDressedWZJets",
99 "TruthEvents","TruthHFWithDecayParticles","TruthBoson","TruthBottom", "TruthCharm","TruthElectrons","TruthMuons","TruthTop","TruthTaus","MET_Truth",
100 "TruthPrimaryVertices","TruthHFWithDecayVertices",
101
102 ]
103
104 STDM13SlimmingHelper.IncludeTriggerNavigation = False
105 STDM13SlimmingHelper.IncludeJetTriggerContent = False
106 STDM13SlimmingHelper.IncludeMuonTriggerContent = False
107 STDM13SlimmingHelper.IncludeEGammaTriggerContent = False
108 STDM13SlimmingHelper.IncludeJetTauEtMissTriggerContent = False
109 STDM13SlimmingHelper.IncludeTauTriggerContent = False
110 STDM13SlimmingHelper.IncludeEtMissTriggerContent = False
111 STDM13SlimmingHelper.IncludeBJetTriggerContent = False
112 STDM13SlimmingHelper.IncludeBPhysTriggerContent = False
113 STDM13SlimmingHelper.IncludeMinBiasTriggerContent = False
114
115 # Truth extra content
116 if flags.Input.isMC:
117
118 from DerivationFrameworkMCTruth.MCTruthCommonConfig import addTruth3ContentToSlimmerTool
119 addTruth3ContentToSlimmerTool(STDM13SlimmingHelper)
120 STDM13SlimmingHelper.AllVariables += ['TruthLHEParticles', 'TruthHFWithDecayParticles','TruthHFWithDecayVertices','TruthCharm','TruthPileupParticles','InTimeAntiKt4TruthJets','OutOfTimeAntiKt4TruthJets']
121 STDM13SlimmingHelper.ExtraVariables += ["Electrons.TruthLink",
122 "Muons.TruthLink",
123 "Photons.TruthLink",
124 "AntiKt4TruthDressedWZJets.IsoFixedCone5Pt"]
125
126 from DerivationFrameworkMCTruth.MCTruthCommonConfig import AddTauAndDownstreamParticlesCfg
127 acc.merge(AddTauAndDownstreamParticlesCfg(flags))
128 STDM13SlimmingHelper.AllVariables += ['TruthTausWithDecayParticles','TruthTausWithDecayVertices']
129
130 # Extra content
131 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" ]
132
133
134 # Trigger matching
135 # Run 2
136 if flags.Trigger.EDMVersion == 2:
137 from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
138 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM13SlimmingHelper,
139 OutputContainerPrefix = "TrigMatch_",
140 TriggerList = STDM13TriggerListsHelper.Run2TriggerNamesTau)
141 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM13SlimmingHelper,
142 OutputContainerPrefix = "TrigMatch_",
143 TriggerList = STDM13TriggerListsHelper.Run2TriggerNamesNoTau)
144 # Run 3, or Run 2 with navigation conversion
145 if flags.Trigger.EDMVersion == 3 or (flags.Trigger.EDMVersion == 2 and flags.Trigger.doEDMVersionConversion):
146 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
147 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(STDM13SlimmingHelper)
148
149 # Output stream
150 STDM13ItemList = STDM13SlimmingHelper.GetItemList()
151 acc.merge(OutputStreamCfg(flags, "DAOD_STDM13", ItemList=STDM13ItemList, AcceptAlgs=["STDM13Kernel"]))
152 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_STDM13", AcceptAlgs=["STDM13Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData]))
153
154 return acc
155
STDM13KernelCfg(flags, name='STDM13Kernel', **kwargs)
Definition STDM13.py:12
STDM13Cfg(flags)
Definition STDM13.py:59