ATLAS Offline Software
Loading...
Searching...
No Matches
python.STDM17 Namespace Reference

Functions

 STDM17SkimmingToolCfg (flags)
 STDM17AugmentationToolsForSkimmingCfg (flags)
 STDM17AugmentationToolsCfg (flags)
 STDM17KernelCfg (flags, name='STDM17Kernel', **kwargs)
 STDM17Cfg (flags)

Function Documentation

◆ STDM17AugmentationToolsCfg()

python.STDM17.STDM17AugmentationToolsCfg ( flags)
Configure the augmentation tool

Definition at line 102 of file STDM17.py.

102def STDM17AugmentationToolsCfg(flags):
103 """Configure the augmentation tool"""
104 acc = ComponentAccumulator()
105
106 toolkwargs = {}
107 # Loose tracks with pT > 500 MeV
108 from InDetConfig.InDetTrackSelectionToolConfig import InDetTrackSelectionTool_Loose_Cfg
109 toolkwargs["TrackSelectionTool"] = acc.popToolsAndMerge(InDetTrackSelectionTool_Loose_Cfg(flags,
110 name = "TrackSelectionTool500_STDM17",
111 minPt = 500.))
112 #Nonprompt_All_MaxWeight TTVA
113 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import isoTTVAToolCfg
114 toolkwargs['TTVATool'] = acc.popToolsAndMerge(isoTTVAToolCfg(flags))
115
116 toolkwargs["name"] = "TrackIsolationToolPt500"
117 TrackIsoTool = CompFactory.xAOD.TrackIsolationTool(**toolkwargs)
118 acc.addPublicTool(TrackIsoTool)
119
120
121 from xAODPrimitives.xAODIso import xAODIso as isoPar
122 from DerivationFrameworkInDet.InDetToolsConfig import IsolationTrackDecoratorCfg
123 Pt500IsoTrackDecorator = acc.getPrimaryAndMerge(IsolationTrackDecoratorCfg(flags,
124 name = "Pt500IsoTrackDecorator",
125 TrackIsolationTool = TrackIsoTool,
126 TargetContainer = "InDetTrackParticles",
127 iso = [isoPar.ptcone40, isoPar.ptcone30, isoPar.ptcone20],
128 isoSuffix = ["ptcone40", "ptcone30", "ptcone20"],
129 Prefix = "TrkIsoPt500_"))
130 acc.addPublicTool(Pt500IsoTrackDecorator, primary=True)
131
132 return(acc)
133
134# Main algorithm config

◆ STDM17AugmentationToolsForSkimmingCfg()

python.STDM17.STDM17AugmentationToolsForSkimmingCfg ( flags)
Configure the augmentation tool for skimming

Definition at line 69 of file STDM17.py.

69def STDM17AugmentationToolsForSkimmingCfg(flags):
70 """Configure the augmentation tool for skimming"""
71 acc = ComponentAccumulator()
72
73 # Loose tracks with pT > 1000 MeV and Nonprompt_All_MaxWeight TTVA
74 toolkwargs = {}
75 from InDetConfig.InDetTrackSelectionToolConfig import InDetTrackSelectionTool_Loose_Cfg
76 toolkwargs["TrackSelectionTool"] = acc.popToolsAndMerge(InDetTrackSelectionTool_Loose_Cfg(flags,
77 name = "TrackSelectionTool1000_STDM17",
78 minPt = 1000.))
79
80 #Nonprompt_All_MaxWeight TTVA
81 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import isoTTVAToolCfg
82 toolkwargs['TTVATool'] = acc.popToolsAndMerge(isoTTVAToolCfg(flags))
83
84 toolkwargs["name"] = "TrackIsolationToolPt1000"
85 TrackIsoTool = CompFactory.xAOD.TrackIsolationTool(**toolkwargs)
86 acc.addPublicTool(TrackIsoTool)
87
88
89 from xAODPrimitives.xAODIso import xAODIso as isoPar
90 from DerivationFrameworkInDet.InDetToolsConfig import IsolationTrackDecoratorCfg
91 Pt1000IsoTrackDecorator = acc.getPrimaryAndMerge(IsolationTrackDecoratorCfg(flags,
92 name = "Pt1000IsoTrackDecorator",
93 TrackIsolationTool = TrackIsoTool,
94 TargetContainer = "InDetTrackParticles",
95 iso = [isoPar.ptcone40, isoPar.ptcone30, isoPar.ptcone20],
96 isoSuffix = ["ptcone40", "ptcone30", "ptcone20"],
97 Prefix = "TrkIsoPt1000_"))
98 acc.addPublicTool(Pt1000IsoTrackDecorator, primary=True)
99
100 return(acc)
101

◆ STDM17Cfg()

python.STDM17.STDM17Cfg ( flags)

Definition at line 244 of file STDM17.py.

244def STDM17Cfg(flags):
245
246 acc = ComponentAccumulator()
247
248 # Get the lists of triggers needed for trigger matching.
249 # This is needed at this scope (for the slimming) and further down in the config chain
250 # for actually configuring the matching, so we create it here and pass it down
251 # Note this should ideally be called higher up to avoid it being run multiple times in a train
252 from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
253 STDM17TriggerListsHelper = TriggerListsHelper(flags)
254
255 # Skimming, thinning, augmentation, extra content
256 acc.merge(STDM17KernelCfg(flags, name="STDM17Kernel", PreselectionName="STDM17PreselectionKernel", StreamName = 'StreamDAOD_STDM17', TriggerListsHelper = STDM17TriggerListsHelper))
257
258 # ============================
259 # Define contents of the format
260 # =============================
261 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
262 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
263 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
264
265 STDM17SlimmingHelper = SlimmingHelper("STDM17SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
266
267 STDM17SlimmingHelper.SmartCollections = ["EventInfo",
268 "Electrons", "Photons", "Muons", "TauJets", "TauJets_MuonRM",
269 "InDetTrackParticles", "PrimaryVertices",
270 "MET_Baseline_AntiKt4EMPFlow",
271 "AntiKt4EMPFlowJets"]
272
273
274 STDM17SlimmingHelper.AllVariables = ["MuonSegments","InDetTrackParticles",
275 "Kt4EMTopoOriginEventShape","Kt4EMPFlowEventShape","CaloCalTopoClusters"]
276
277 STDM17SlimmingHelper.ExtraVariables = ["InDetTrackParticles.TrkIsoPt1000_ptcone40.TrkIsoPt1000_ptcone30.TrkIsoPt1000_ptcone20.TrkIsoPt500_ptcone40.TrkIsoPt500_ptcone30.TrkIsoPt500_ptcone20"]
278
279 if flags.Input.isMC:
280 from DerivationFrameworkMCTruth.MCTruthCommonConfig import addTruth3ContentToSlimmerTool
281 addTruth3ContentToSlimmerTool(STDM17SlimmingHelper)
282
283 STDM17SlimmingHelper.AppendToDictionary.update({'TruthParticles': 'xAOD::TruthParticleContainer',
284 'TruthParticlesAux': 'xAOD::TruthParticleAuxContainer'})
285
286 STDM17SlimmingHelper.SmartCollections += ["AntiKt4TruthJets"]
287 STDM17SlimmingHelper.AllVariables += ["MuonTruthParticles", "TruthParticles", "TruthVertices"]
288
289 # Trigger content
290 STDM17SlimmingHelper.IncludeTriggerNavigation = False
291 STDM17SlimmingHelper.IncludeJetTriggerContent = False
292 STDM17SlimmingHelper.IncludeMuonTriggerContent = False
293 STDM17SlimmingHelper.IncludeEGammaTriggerContent = False
294 STDM17SlimmingHelper.IncludeTauTriggerContent = False
295 STDM17SlimmingHelper.IncludeEtMissTriggerContent = False
296 STDM17SlimmingHelper.IncludeBJetTriggerContent = False
297 STDM17SlimmingHelper.IncludeBPhysTriggerContent = False
298 STDM17SlimmingHelper.IncludeMinBiasTriggerContent = False
299
300
301 # Trigger matching
302 # Run 2
303 if flags.Trigger.EDMVersion == 2:
304 from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
305 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM17SlimmingHelper,
306 OutputContainerPrefix = "TrigMatch_",
307 TriggerList = STDM17TriggerListsHelper.Run2TriggerNamesTau)
308 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM17SlimmingHelper,
309 OutputContainerPrefix = "TrigMatch_",
310 TriggerList = STDM17TriggerListsHelper.Run2TriggerNamesNoTau)
311 # Run 3, or Run 2 with navigation conversion
312 if flags.Trigger.EDMVersion == 3 or (flags.Trigger.EDMVersion == 2 and flags.Trigger.doEDMVersionConversion):
313 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
314 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(STDM17SlimmingHelper)
315
316
317
318 # Output stream
319 STDM17ItemList = STDM17SlimmingHelper.GetItemList()
320 acc.merge(OutputStreamCfg(flags, "DAOD_STDM17", ItemList=STDM17ItemList, AcceptAlgs=["STDM17Kernel"]))
321 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_STDM17", AcceptAlgs=["STDM17Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
322
323 return acc
324

◆ STDM17KernelCfg()

python.STDM17.STDM17KernelCfg ( flags,
name = 'STDM17Kernel',
** kwargs )
Configure the derivation framework driving algorithm (kernel) for STDM17

Definition at line 135 of file STDM17.py.

135def STDM17KernelCfg(flags, name='STDM17Kernel', **kwargs):
136 """Configure the derivation framework driving algorithm (kernel) for STDM17"""
137 acc = ComponentAccumulator()
138
139 # Common augmentations
140 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
141 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']))
142
143 #Pre-selection kernel
144 from AthenaCommon.CFElements import seqAND
145 acc.addSequence( seqAND("STDM17Sequence") )
146 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
147 skimmingTool = acc.getPrimaryAndMerge(STDM17SkimmingToolCfg(flags))
148 augmentationToolSkim = acc.getPrimaryAndMerge(STDM17AugmentationToolsForSkimmingCfg(flags))
149 skimmingKernel = DerivationKernel(kwargs["PreselectionName"], SkimmingTools = [skimmingTool], AugmentationTools = [augmentationToolSkim])
150 acc.addEventAlgo( skimmingKernel, sequenceName="STDM17Sequence" )
151
152 # Thinning tools...
153 from DerivationFrameworkInDet.InDetToolsConfig import TrackParticleThinningCfg, MuonTrackParticleThinningCfg, EgammaTrackParticleThinningCfg, TauTrackParticleThinningCfg
154
155 # Increased cut (w.r.t. R21) on abs(z0) for new TTVA working points
156 STDM17_thinning_expression = "( InDetTrackParticles.pt > 6*GeV && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )"
157 STDM17TrackParticleThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg(
158 flags,
159 name = "STDM17TrackParticleThinningTool",
160 StreamName = kwargs['StreamName'],
161 SelectionString = STDM17_thinning_expression,
162 InDetTrackParticlesKey = "InDetTrackParticles"))
163
164 # Include inner detector tracks associated with muons
165 STDM17MuonTPThinningTool = acc.getPrimaryAndMerge(MuonTrackParticleThinningCfg(
166 flags,
167 name = "STDM17MuonTPThinningTool",
168 StreamName = kwargs['StreamName'],
169 MuonKey = "Muons",
170 InDetTrackParticlesKey = "InDetTrackParticles"))
171
172 # Include inner detector tracks associated with electonrs
173 STDM17ElectronTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg(
174 flags,
175 name = "STDM17ElectronTPThinningTool",
176 StreamName = kwargs['StreamName'],
177 SGKey = "Electrons",
178 InDetTrackParticlesKey = "InDetTrackParticles"))
179
180 # Include inner detector tracks associated with photons
181 STDM17PhotonTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg(
182 flags,
183 name = "STDM17PhotonTPThinningTool",
184 StreamName = kwargs['StreamName'],
185 SGKey = "Photons",
186 InDetTrackParticlesKey = "InDetTrackParticles",
187 GSFConversionVerticesKey = "GSFConversionVertices"))
188
189 # Include inner detector tracks associated with taus
190 STDM17TauTPThinningTool = acc.getPrimaryAndMerge(TauTrackParticleThinningCfg(
191 flags,
192 name = "STDM17TauTPThinningTool",
193 StreamName = kwargs['StreamName'],
194 TauKey = "TauJets",
195 InDetTrackParticlesKey = "InDetTrackParticles",
196 DoTauTracksThinning = True,
197 TauTracksKey = "TauTracks"))
198
199 thinningTools = [STDM17TrackParticleThinningTool,
200 STDM17MuonTPThinningTool,
201 STDM17ElectronTPThinningTool,
202 STDM17PhotonTPThinningTool,
203 STDM17TauTPThinningTool]
204
205 #CaloClusterThinning
206 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import CaloClusterThinningCfg
207 selectionString = "( InDetTrackParticles.pt > 6*GeV && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )"
208 STDM17CaloThinningTool = acc.getPrimaryAndMerge(CaloClusterThinningCfg(flags,
209 name = "STDM17CaloClusterThinning",
210 StreamName = kwargs['StreamName'],
211 SGKey = "InDetTrackParticles",
212 TopoClCollectionSGKey = "CaloCalTopoClusters",
213 SelectionString = selectionString,
214 ConeSize = 0.6))
215 acc.addPublicTool(STDM17CaloThinningTool)
216 thinningTools.append(STDM17CaloThinningTool)
217
218 if flags.Input.isMC:
219 truth_cond_status = "( (TruthParticles.pdgId == 24) || (TruthParticles.pdgId == -24) )" # decay products of W so we know which are signal
220 truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16) && (TruthParticles.barcode < 200000))" # Leptons
221 truth_expression = '('+truth_cond_status+' || '+truth_cond_Lepton +')'
222
223 STDM17TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(name = "STDM17TruthThinningTool",
224 StreamName = kwargs['StreamName'],
225 ParticleSelectionString = truth_expression,
226 PreserveDescendants = False,
227 PreserveGeneratorDescendants = True,
228 PreserveAncestors = False)
229
230 acc.addPublicTool(STDM17TruthThinningTool)
231 thinningTools.append(STDM17TruthThinningTool)
232
233 # augmentation tool
234 augmentationTool = acc.getPrimaryAndMerge(STDM17AugmentationToolsCfg(flags))
235
236 # Main kernel
237 acc.addEventAlgo(DerivationKernel(name,
238 ThinningTools = thinningTools,
239 AugmentationTools = [augmentationTool]),
240 sequenceName="STDM17Sequence")
241
242 return acc
243

◆ STDM17SkimmingToolCfg()

python.STDM17.STDM17SkimmingToolCfg ( flags)
Configure the skimming tool

Definition at line 12 of file STDM17.py.

12def STDM17SkimmingToolCfg(flags):
13 """Configure the skimming tool"""
14 acc = ComponentAccumulator()
15
16 filterList = []
17
18 from DerivationFrameworkJetEtMiss import TriggerLists
19 elTriggers = TriggerLists.single_el_Trig(flags)
20 muTriggers = TriggerLists.single_mu_Trig(flags)
21
22 addRun3ElectronTriggers = ["HLT_e17_lhvloose_L1EM15VHI","HLT_e20_lhvloose_L1EM15VH", "HLT_e250_etcut_L1EM22VHI",
23 "HLT_e26_lhtight_ivarloose_L1EM22VHI","HLT_e26_lhtight_ivarloose_L1eEM26M",
24 "HLT_e60_lhmedium_L1EM22VHI","HLT_e60_lhmedium_L1eEM26M",
25 "HLT_e140_lhloose_L1EM22VHI","HLT_e140_lhloose_L1eEM26M",
26 "HLT_e300_etcut_L1EM22VHI","HLT_e300_etcut_L1eEM26M",
27 "HLT_e140_lhloose_noringer_L1EM22VHI","HLT_e140_lhloose_noringer_L1eEM26M"]
28
29 addRund3MuonTriggers = ["HLT_mu24_ivarmedium_L1MU14FCH","HLT_mu50_L1MU14FCH","HLT_mu60_0eta105_msonly_L1MU14FCH","HLT_mu60_L1MU14FCH","HLT_mu80_msonly_3layersEC_L1MU14FCH"]
30
31 elTriggers = elTriggers+addRun3ElectronTriggers
32 muTriggers = muTriggers+addRund3MuonTriggers
33 lepTriggers = elTriggers+muTriggers
34
35 #xAODStringSkimmingTool cannot handle electron trigger names, therefore need to use TriggerSkimmingTool
36 tracks = 'InDetTrackParticles.TrkIsoPt1000_ptcone20 < 0.12*InDetTrackParticles.pt && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm'
37
38 trackRequirements = '(InDetTrackParticles.pt > 9.*GeV && '+tracks+' )'
39 #b-jet requirement FixedCutBEff_85 of GN2v01
40 jetRequirementsTtbar = '(AntiKt4EMPFlowJets.pt > 18*GeV && log(AntiKt4EMPFlowJets.GN2v01_pb/(0.2*AntiKt4EMPFlowJets.GN2v01_pc+0.01*AntiKt4EMPFlowJets.GN2v01_ptau+(1.0-0.2-0.01)*AntiKt4EMPFlowJets.GN2v01_pu)) > -0.378)'
41
42 muonsRequirements = '(Muons.pt >= 24.*GeV) && (abs(Muons.eta) < 2.6) && (Muons.DFCommonMuonPassPreselection)'
43 electronsRequirements = '(Electrons.pt > 24.*GeV) && (abs(Electrons.eta) < 2.6) && ((Electrons.Loose) || (Electrons.DFCommonElectronsLHLoose))'
44
45 #String skimming selections
46 expression = '( count('+trackRequirements+') >=2 && count('+jetRequirementsTtbar+') >=1 && ( count('+muonsRequirements+') >=1 || count('+electronsRequirements+') >=1 ) )'
47
48 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
49 xAODStringSkimmingToolCfg)
50 skimmingTool = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
51 flags, name = "skimmingTool", expression = expression))
52 acc.addPublicTool(skimmingTool)
53 filterList += [skimmingTool]
54
55 # Trigger skimming tools
56 if flags.Trigger.EDMVersion >= 0:
57 STDM17TriggerSkimmingTool_lep = CompFactory.DerivationFramework.TriggerSkimmingTool(name = "STDM17TriggerSkimmingTool_lep", TriggerListOR = lepTriggers)
58 acc.addPublicTool(STDM17TriggerSkimmingTool_lep)
59 filterList += [STDM17TriggerSkimmingTool_lep]
60
61 STDM17SkimmingTool_lep = CompFactory.DerivationFramework.FilterCombinationAND(name="STDM17SkimmingTool_lep", FilterList=filterList)
62 acc.addPublicTool(STDM17SkimmingTool_lep)
63
64 STDM17SkimmingTool = CompFactory.DerivationFramework.FilterCombinationOR(name="STDM17SkimmingTool", FilterList=[STDM17SkimmingTool_lep])
65 acc.addPublicTool(STDM17SkimmingTool, primary = True)
66
67 return(acc)
68