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 107 of file STDM17.py.

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

◆ STDM17AugmentationToolsForSkimmingCfg()

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

Definition at line 73 of file STDM17.py.

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

◆ STDM17Cfg()

python.STDM17.STDM17Cfg ( flags)

Definition at line 250 of file STDM17.py.

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

◆ STDM17KernelCfg()

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

Definition at line 141 of file STDM17.py.

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

◆ 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 # Drop FTAG requirement for Run 4 as WPs are not available
42 # Should ultimately be reworked into a precomputed flag with an FTAG tool rather than hardcoding the FTAG discriminant cut
43 if flags.GeoModel.Run >= LHCPeriod.Run4:
44 jetRequirementsTtbar = '(AntiKt4EMPFlowJets.pt > 18*GeV)'
45
46 muonsRequirements = '(Muons.pt >= 24.*GeV) && (abs(Muons.eta) < 2.6) && (Muons.DFCommonMuonPassPreselection)'
47 electronsRequirements = '(Electrons.pt > 24.*GeV) && (abs(Electrons.eta) < 2.6) && ((Electrons.Loose) || (Electrons.DFCommonElectronsLHLoose))'
48
49 #String skimming selections
50 expression = '( count('+trackRequirements+') >=2 && count('+jetRequirementsTtbar+') >=1 && ( count('+muonsRequirements+') >=1 || count('+electronsRequirements+') >=1 ) )'
51
52 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
53 xAODStringSkimmingToolCfg)
54 skimmingTool = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
55 flags, name = "skimmingTool", expression = expression))
56 acc.addPublicTool(skimmingTool)
57 filterList += [skimmingTool]
58
59 # Trigger skimming tools
60 if flags.Trigger.EDMVersion >= 0:
61 STDM17TriggerSkimmingTool_lep = CompFactory.DerivationFramework.TriggerSkimmingTool(name = "STDM17TriggerSkimmingTool_lep", TriggerListOR = lepTriggers)
62 acc.addPublicTool(STDM17TriggerSkimmingTool_lep)
63 filterList += [STDM17TriggerSkimmingTool_lep]
64
65 STDM17SkimmingTool_lep = CompFactory.DerivationFramework.FilterCombinationAND(name="STDM17SkimmingTool_lep", FilterList=filterList)
66 acc.addPublicTool(STDM17SkimmingTool_lep)
67
68 STDM17SkimmingTool = CompFactory.DerivationFramework.FilterCombinationOR(name="STDM17SkimmingTool", FilterList=[STDM17SkimmingTool_lep])
69 acc.addPublicTool(STDM17SkimmingTool, primary = True)
70
71 return(acc)
72