ATLAS Offline Software
Loading...
Searching...
No Matches
HIGG9D1.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2#========================================================================
3# HIGG9D1.py for J/psi+bbbar, J/psi+tautau and J/psi+diphoton
4# This requires the flag "HIGG9D1" in Derivation_tf.py
5#========================================================================
6
7from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8from AthenaConfiguration.ComponentFactory import CompFactory
9from AthenaConfiguration.Enums import MetadataCategory, LHCPeriod
10from AthenaCommon.Logging import logging
11log_HIGG9D1 = logging.getLogger('HIGG9D1')
12
13streamName = "StreamDAOD_HIGG9D1"
14
15def HIGG9D1KernelCfg(flags, name='HIGG9D1Kernel', **kwargs):
16 """Configure the derivation framework driving algorithm (kernel) for HIGG9D1"""
17 acc = ComponentAccumulator()
18
19 doLRT = flags.Tracking.doLargeD0
20 if doLRT:
21 log_HIGG9D1.info("flags.Tracking.doLargeD0 is True")
22 else:
23 log_HIGG9D1.info("flags.Tracking.doLargeD0 is False")
24
25 mainMuonInput = "StdWithLRTMuons" if doLRT else "Muons"
26 mainIDInput = "InDetWithLRTTrackParticles" if doLRT else "InDetTrackParticles"
27 if doLRT:
28 from DerivationFrameworkLLP.LLPToolsConfig import LRTMuonMergerAlg
29 acc.merge(LRTMuonMergerAlg( flags,
30 PromptMuonLocation = "Muons",
31 LRTMuonLocation = "MuonsLRT",
32 OutputMuonLocation = mainMuonInput,
33 CreateViewCollection = True,
34 UseRun3WP = flags.GeoModel.Run is LHCPeriod.Run3 ))
35 from DerivationFrameworkInDet.InDetToolsConfig import InDetLRTMergeCfg
36 acc.merge(InDetLRTMergeCfg( flags, OutputTrackParticleLocation = mainIDInput ))
37
38 MuonToRelink = [ "Muons", "MuonsLRT" ] if doLRT else []
39 TrkToRelink = ["InDetTrackParticles", "InDetLargeD0TrackParticles"] if doLRT else []
40
41 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import (
42 BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg,
43 BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg,
44 AugOriginalCountsCfg)
45
46 # Adds primary vertex counts and track counts to EventInfo before they are thinned
47 HIGG9D1_AugOriginalCounts = acc.popToolsAndMerge(
48 AugOriginalCountsCfg(flags, name = "HIGG9D1_AugOriginalCounts"))
49 acc.addPublicTool(HIGG9D1_AugOriginalCounts)
50
51 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, "HIGG9D1"))
52 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, "HIGG9D1"))
53 acc.addPublicTool(vkalvrt)
54 acc.addPublicTool(V0Tools)
55 TrackSelector = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, "HIGG9D1"))
56 acc.addPublicTool(TrackSelector)
57 vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, "HIGG9D1"))
58 acc.addPublicTool(vpest)
59
60 from JpsiUpsilonTools.JpsiUpsilonToolsConfig import PrimaryVertexRefittingToolCfg
61 pvRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags))
62 acc.addPublicTool(pvRefitter)
63
64 HIGG9D1JpsiFinder = CompFactory.Analysis.JpsiFinder(
65 name = "HIGG9D1JpsiFinder",
66 muAndMu = True,
67 muAndTrack = False,
68 TrackAndTrack = False,
69 assumeDiMuons = True, # If true, will assume dimu hypothesis and use PDG value for mu mass
70 trackThresholdPt = 2400.,
71 invMassLower = 2600.0,
72 invMassUpper = 3500.0,
73 Chi2Cut = 20.,
74 oppChargesOnly = True,
75 atLeastOneComb = True,
76 useCombinedMeasurement = False, # Only takes effect if combOnly=True
77 muonCollectionKey = mainMuonInput,
78 TrackParticleCollection = mainIDInput,
79 TrkVertexFitterTool = vkalvrt, # VKalVrt vertex fitter
80 TrackSelectorTool = TrackSelector,
81 VertexPointEstimator = vpest,
82 useMCPCuts = False )
83 acc.addPublicTool(HIGG9D1JpsiFinder)
84
85 HIGG9D1UpsiFinder = CompFactory.Analysis.JpsiFinder(
86 name = "HIGG9D1UpsiFinder",
87 muAndMu = True,
88 muAndTrack = False,
89 TrackAndTrack = False,
90 assumeDiMuons = True, # If true, will assume dimu hypothesis and use PDG value for mu mass
91 trackThresholdPt = 2400.,
92 invMassLower = 8900.0,
93 invMassUpper = 9900.0,
94 Chi2Cut = 20.,
95 oppChargesOnly = True,
96 atLeastOneComb = True,
97 useCombinedMeasurement = False, # Only takes effect if combOnly=True
98 muonCollectionKey = mainMuonInput,
99 TrackParticleCollection = mainIDInput,
100 TrkVertexFitterTool = vkalvrt, # VKalVrt vertex fitter
101 TrackSelectorTool = TrackSelector,
102 VertexPointEstimator = vpest,
103 useMCPCuts = False )
104 acc.addPublicTool(HIGG9D1UpsiFinder)
105
106 HIGG9D1_Jpsi = CompFactory.DerivationFramework.Reco_Vertex(
107 name = "HIGG9D1_Jpsi",
108 VertexSearchTool = HIGG9D1JpsiFinder,
109 OutputVtxContainerName = "HIGG9D1_JpsiCandidates",
110 PVContainerName = "PrimaryVertices",
111 RefPVContainerName = "HIGG9D1_JpsiRefittedPrimaryVertices",
112 RefitPV = True,
113 MaxPVrefit = 100,
114 V0Tools = V0Tools,
115 RelinkTracks = TrkToRelink,
116 RelinkMuons = MuonToRelink,
117 PVRefitter = pvRefitter,
118 DoVertexType = 7)
119 acc.addPublicTool(HIGG9D1_Jpsi)
120
121 HIGG9D1_Upsi = CompFactory.DerivationFramework.Reco_Vertex(
122 name = "HIGG9D1_Upsi",
123 VertexSearchTool = HIGG9D1UpsiFinder,
124 OutputVtxContainerName = "HIGG9D1_UpsiCandidates",
125 PVContainerName = "PrimaryVertices",
126 RefPVContainerName = "HIGG9D1_UpsiRefittedPrimaryVertices",
127 RefitPV = True,
128 MaxPVrefit = 100,
129 V0Tools = V0Tools,
130 RelinkTracks = TrkToRelink,
131 RelinkMuons = MuonToRelink,
132 PVRefitter = pvRefitter,
133 DoVertexType = 7)
134 acc.addPublicTool(HIGG9D1_Upsi)
135
136 from InDetTrackSelectionTool.InDetTrackSelectionToolConfig import (
137 InDetTrackSelectionTool_Loose_Cfg)
138 HIGG9D1_isoTrackSelTool = acc.popToolsAndMerge(InDetTrackSelectionTool_Loose_Cfg(
139 flags,
140 name = "HIGG9D1_isoTrackSelTool",
141 maxZ0SinTheta = 3.0,
142 minPt = 500.))
143
144 from IsolationAlgs.IsoToolsConfig import TrackIsolationToolCfg
145 HIGG9D1_TrackIsoTool = acc.popToolsAndMerge(TrackIsolationToolCfg(
146 flags,
147 name = "HIGG9D1_TrackIsoTool",
148 TrackSelectionTool = HIGG9D1_isoTrackSelTool))
149 acc.addPublicTool(HIGG9D1_TrackIsoTool)
150
151 HIGG9D1_JpsiVtxTrkIsoDecor = CompFactory.DerivationFramework.VertexTrackIsolation(
152 name = "HIGG9D1_JpsiVtxTrkIsoDecor",
153 TrackIsoTool = HIGG9D1_TrackIsoTool,
154 TrackContainer = "InDetTrackParticles",
155 InputVertexContainer = "HIGG9D1_JpsiCandidates",
156 FixElecExclusion = False,
157 IncludeV0 = False)
158 acc.addPublicTool(HIGG9D1_JpsiVtxTrkIsoDecor)
159
160 HIGG9D1_UpsiVtxTrkIsoDecor = CompFactory.DerivationFramework.VertexTrackIsolation(
161 name = "HIGG9D1_UpsiVtxTrkIsoDecor",
162 TrackIsoTool = HIGG9D1_TrackIsoTool,
163 TrackContainer = "InDetTrackParticles",
164 InputVertexContainer = "HIGG9D1_UpsiCandidates",
165 FixElecExclusion = False,
166 IncludeV0 = False)
167 acc.addPublicTool(HIGG9D1_UpsiVtxTrkIsoDecor)
168
169 # New subsequence
170 from AthenaCommon.CFElements import seqAND
171 acc.addSequence( seqAND("HIGG9D1Sequence") )
172
173 # Common augmentations
174 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
175 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']), sequenceName="HIGG9D1Sequence")
176
177
180 HIGG9D1_onia_skim = CompFactory.DerivationFramework.AnyVertexSkimmingTool(name = "HIGG9D1_onia_skim", VertexContainerNames = ["HIGG9D1_JpsiCandidates", "HIGG9D1_UpsiCandidates"])
181 acc.addPublicTool(HIGG9D1_onia_skim)
182
183 HIGG9D1_onia_skimKernel = CompFactory.DerivationFramework.DerivationKernel(
184 "HIGG9D1_onia_skimKernel",
185 AugmentationTools = [ HIGG9D1_AugOriginalCounts, HIGG9D1_Jpsi, HIGG9D1_Upsi, HIGG9D1_JpsiVtxTrkIsoDecor, HIGG9D1_UpsiVtxTrkIsoDecor ],
186 SkimmingTools = [ HIGG9D1_onia_skim ])
187 # Add skimming tool to subsequence
188 acc.addEventAlgo(HIGG9D1_onia_skimKernel, sequenceName="HIGG9D1Sequence")
189
190
191 from BTagging.FlavorTaggingConfig import FlavorTaggingCfg
192 acc.merge(FlavorTaggingCfg(flags, "AntiKt4EMPFlowJets"), sequenceName="HIGG9D1Sequence")
193
194
197
198 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
199 xAODStringSkimmingToolCfg)
200
201
203 HIGG9D1_smallR_EMPFlow_2j_sel = "count(AntiKt4EMPFlowJets.pt > 18*GeV && abs(AntiKt4EMPFlowJets.eta) < 2.8) >= 2"
204 HIGG9D1_smallR_EMPFlow_1j_sel = "count(AntiKt4EMPFlowJets.pt > 33*GeV && abs(AntiKt4EMPFlowJets.eta) < 2.8) >= 1"
205 # https://gitlab.cern.ch/atlas/athena/-/blob/main/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/Root/BTaggingSelectionTool.cxx
206 # fraction_c (0.2), fraction_tau (0.01) and cutvalue (0.844) from TDirectory "GN2v01/AntiKt4EMPFlowJets/FixedCutBEff_77" of
207 # /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/xAODBTaggingEfficiency/13TeV/MC20_2024-10-17_GN2v01_v1.root (run-2) and
208 # /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/xAODBTaggingEfficiency/13p6TeV/MC23_2024-10-17_GN2v01_v1.root (run-3)
209 HIGG9D1_smallR_EMPFlow_1b_sel = "count(AntiKt4EMPFlowJets.pt > 18*GeV && abs(AntiKt4EMPFlowJets.eta) < 2.8 && log(AntiKt4EMPFlowJets.GN2v01_pb/(0.2*AntiKt4EMPFlowJets.GN2v01_pc + (1.-0.2-0.01)*AntiKt4EMPFlowJets.GN2v01_pu + 0.01*AntiKt4EMPFlowJets.GN2v01_ptau))>=0.844) >= 1"
210 # Drop FTAG requirement for Run 4 as WPs are not available
211 # Should ultimately be reworked into a precomputed flag with an FTAG tool rather than hardcoding the FTAG discriminant cut
212 if flags.GeoModel.Run >= LHCPeriod.Run4:
213 HIGG9D1_smallR_EMPFlow_1b_sel = "count(AntiKt4EMPFlowJets.pt > 18*GeV && abs(AntiKt4EMPFlowJets.eta) < 2.8) >= 1"
214
215
216 HIGG9D1_bjet_sel = "%s && %s && %s" % (HIGG9D1_smallR_EMPFlow_2j_sel, HIGG9D1_smallR_EMPFlow_1j_sel, HIGG9D1_smallR_EMPFlow_1b_sel)
217 HIGG9D1_bb_skim = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
218 flags, name = "HIGG9D1_bb_skim", expression = HIGG9D1_bjet_sel))
219
220
221 HIGG9D1_tauTrks = '(TauJets.nTracks + TauJets.nTracksIsolation >= 1 && TauJets.nTracks + TauJets.nTracksIsolation <= 8)'
222 HIGG9D1_tauLead = '(TauJets.pt > 23.0*GeV || TauJets.ptFinalCalib > 23.0*GeV)'
223 HIGG9D1_tauSubl = '(TauJets.pt > 18.0*GeV || TauJets.ptFinalCalib > 18.0*GeV)'
224 HIGG9D1_tauId = 'TauJets.DFTauGNTauLoose'
225 HIGG9D1_tauReq0 = 'count( '+HIGG9D1_tauSubl+' && '+HIGG9D1_tauTrks+' ) >= 2'
226 HIGG9D1_tauReq1 = 'count( '+HIGG9D1_tauSubl+' && '+HIGG9D1_tauTrks+' && '+HIGG9D1_tauId+' ) >= 1'
227 HIGG9D1_tauReq2 = 'count( '+HIGG9D1_tauLead+' && '+HIGG9D1_tauTrks+' ) >= 1'
228 HIGG9D1_tau_sel = "%s && %s && %s" % (HIGG9D1_tauReq0, HIGG9D1_tauReq1, HIGG9D1_tauReq2)
229
230 HIGG9D1_tautau_skim = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
231 flags, name = "HIGG9D1_tautau_skim", expression = HIGG9D1_tau_sel))
232
233
234 from DerivationFrameworkHiggs.SkimmingToolHIGG1Config import SkimmingToolHIGG1Cfg
235 HIGG9D1_yy_skim = acc.popToolsAndMerge(SkimmingToolHIGG1Cfg(
236 flags,
237 name = "HIGG9D1_yy_skim",
238 RequireGRL = False,
239 ReqireLArError = True,
240 RequireTrigger = False,
241 RequirePreselection = True,
242 RequireKinematic = False,
243 RequireQuality = False, # True: "Tight" ID; False: DFCommonPhotonsIsEMLoose
244 RequireIsolation = False, # dummy
245 RequireInvariantMass = False,
246 IncludeSingleMergedElectronPreselection = False,
247 IncludeSingleElectronPreselection = False,
248 IncludeDoubleElectronPreselection = False,
249 IncludeSingleMuonPreselection = False,
250 IncludeDoubleMuonPreselection = False,
251 IncludePhotonDoubleElectronPreselection = False,
252 IncludePhotonMergedElectronPreselection = False,
253 IncludeHighPtPhotonElectronPreselection = False,
254 IncludeDoublePhotonPreselection = True, # di-photon requirement
255 MinimumPhotonPt = 4800.0,
256 RemoveCrack = True,
257 MaxEta = 2.47))
258 acc.addPublicTool(HIGG9D1_yy_skim)
259
260 # Combine skims with OR
261 HIGG9D1_bb_tautau_yy_skim = CompFactory.DerivationFramework.FilterCombinationOR(
262 name = "HIGG9D1_bb_tautau_yy_skim",
263 FilterList = [HIGG9D1_bb_skim, HIGG9D1_tautau_skim, HIGG9D1_yy_skim])
264 acc.addPublicTool(HIGG9D1_bb_tautau_yy_skim)
265
266 # Common calo decoration tools
267 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import (CaloDecoratorKernelCfg, ClusterEnergyPerLayerDecoratorCfg)
268 acc.merge(CaloDecoratorKernelCfg(flags), sequenceName="HIGG9D1Sequence")
269
270 # Adding missing cluster energy decorators
271 augmentationTools = []
272 cluster_sizes = (3,5), (5,7), (7,7)
273 for neta, nphi in cluster_sizes:
274 cename = "ClusterEnergyPerLayerDecorator_%sx%s" % (neta, nphi)
275 ClusterEnergyPerLayerDecorator = acc.popToolsAndMerge( ClusterEnergyPerLayerDecoratorCfg(flags, neta = neta, nphi=nphi, name=cename ))
276 acc.addPublicTool(ClusterEnergyPerLayerDecorator)
277 augmentationTools.append(ClusterEnergyPerLayerDecorator)
278
279 HIGG9D1_bb_tautau_yy_skimKernel = CompFactory.DerivationFramework.DerivationKernel(
280 "HIGG9D1_bb_tautau_yy_skimKernel",
281 AugmentationTools = augmentationTools,
282 SkimmingTools = [ HIGG9D1_bb_tautau_yy_skim ])
283 # Add skimming tool to subsequence
284 acc.addEventAlgo(HIGG9D1_bb_tautau_yy_skimKernel, sequenceName="HIGG9D1Sequence")
285
286 from IsolationAlgs.DerivationTrackIsoConfig import DerivationTrackIsoCfg
287 acc.merge(DerivationTrackIsoCfg(flags, object_types=("Electrons", "Photons", "Muons"), sequenceName="HIGG9D1Sequence"))
288
289 # IFF augmentation - Adding Lepton Taggers
290 from LeptonTaggers.LeptonTaggersConfig import DecoratePLITAlgsCfg
291 acc.merge(DecoratePLITAlgsCfg(flags), sequenceName="HIGG9D1Sequence")
292
293 from IsolationSelection.IsolationSelectionConfig import IsoCloseByAlgsCfg
294 contNames = [ "Muons", "Electrons", "Photons" ]
295 acc.merge(IsoCloseByAlgsCfg(flags, isPhysLite = False, containerNames = contNames, useSelTools = True, stream_name = kwargs['StreamName']), sequenceName="HIGG9D1Sequence")
296
297 # diphoton vertex augmentation
298 from DerivationFrameworkEGamma.EGammaToolsConfig import PhotonVertexSelectionWrapperKernelCfg
299 acc.merge(PhotonVertexSelectionWrapperKernelCfg(flags), sequenceName="HIGG9D1Sequence")
300 from DerivationFrameworkHiggs.HIGG1D1CustomVertexConfig import DiphotonVertexDecoratorCfg
301 DiphotonVertexDecorator = acc.popToolsAndMerge(DiphotonVertexDecoratorCfg(
302 flags,
303 MinimumPhotonPt = 4800.0,
304 DiphotonVertexName = "HIGG9D1_DiphotonPrimaryVertices"))
305 acc.addPublicTool(DiphotonVertexDecorator)
306 acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(name = "DiphotonVertexAugmentation", AugmentationTools = [DiphotonVertexDecorator]), sequenceName="HIGG9D1Sequence")
307
308 #================
309 # Thinning tools
310 #================
311 # Include inner detector tracks associated with muons
312 HIGG9D1MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(
313 name = "HIGG9D1MuonTPThinningTool",
314 StreamName = kwargs['StreamName'],
315 MuonKey = "Muons",
316 InDetTrackParticlesKey = "InDetTrackParticles")
317 acc.addPublicTool(HIGG9D1MuonTPThinningTool)
318
319 # Include inner detector tracks associated with electonrs
320 HIGG9D1ElectronTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
321 name = "HIGG9D1ElectronTPThinningTool",
322 SGKey = "Electrons",
323 StreamName = kwargs['StreamName'],
324 GSFTrackParticlesKey = "GSFTrackParticles",
325 InDetTrackParticlesKey = "InDetTrackParticles")
326 acc.addPublicTool(HIGG9D1ElectronTPThinningTool)
327
328 # Include inner detector tracks associated with photons
329 HIGG9D1PhotonTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
330 name = "HIGG9D1PhotonTPThinningTool",
331 SGKey = "Photons",
332 StreamName = kwargs['StreamName'],
333 GSFTrackParticlesKey = "GSFTrackParticles",
334 GSFConversionVerticesKey = "GSFConversionVertices",
335 InDetTrackParticlesKey = "InDetTrackParticles")
336 acc.addPublicTool(HIGG9D1PhotonTPThinningTool)
337
338 # Include inner detector tracks associated with taus
339 HIGG9D1TauTPThinningTool = CompFactory.DerivationFramework.TauTrackParticleThinning(
340 name = "HIGG9D1TauTPThinningTool",
341 StreamName = kwargs['StreamName'],
342 TauKey = "TauJets",
343 InDetTrackParticlesKey = "InDetTrackParticles",
344 DoTauTracksThinning = True,
345 TauTracksKey = "TauTracks")
346 acc.addPublicTool(HIGG9D1TauTPThinningTool)
347
348 # ID tracks associated to vertices
349 HIGG9D1_ThinVtxTracks = CompFactory.DerivationFramework.Thin_vtxTrk(
350 name = "HIGG9D1_ThinVtxTracks",
351 StreamName = kwargs['StreamName'],
352 TrackParticleContainerName = "InDetTrackParticles",
353 VertexContainerNames = [ HIGG9D1_Jpsi.OutputVtxContainerName, HIGG9D1_Upsi.OutputVtxContainerName ],
354 IgnoreFlags = True )
355 acc.addPublicTool(HIGG9D1_ThinVtxTracks)
356
357 thinningTools = [HIGG9D1MuonTPThinningTool,
358 HIGG9D1ElectronTPThinningTool,
359 HIGG9D1PhotonTPThinningTool,
360 HIGG9D1TauTPThinningTool,
361 HIGG9D1_ThinVtxTracks]
362
363
364 if flags.Input.isMC:
365 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import MenuTruthThinningCfg
366 HIGG9D1TruthTool = acc.getPrimaryAndMerge(MenuTruthThinningCfg(
367 flags = flags,
368 name = "HIGG9D1TruthTool",
369 StreamName = kwargs['StreamName'],
370 ParticlesKey = "TruthParticles",
371 VerticesKey = "TruthVertices",
372 WritePartons = False,
373 WriteHadrons = True,
374 WriteBHadrons = True,
375 WriteCHadrons = True,
376 WriteGeant = False,
377 WriteTauHad = True,
378 WriteBSM = True,
379 WriteBosons = True,
380 WriteBSMProducts = True,
381 WriteBosonProducts = False,
382 WriteTopAndDecays = True,
383 WriteEverything = False,
384 WriteAllLeptons = True,
385 WriteNotPhysical = False,
386 PreserveDescendants = False,
387 PreserveGeneratorDescendants = True,
388 PreserveAncestors = True))
389 acc.addPublicTool(HIGG9D1TruthTool)
390 thinningTools.append(HIGG9D1TruthTool)
391
392 #===================================================
393 # HEAVY FLAVOR CLASSIFICATION FOR ttbar+jets EVENTS
394 #===================================================
395 from DerivationFrameworkMCTruth.HFClassificationCommonConfig import HFClassificationCommonCfg
396 acc.merge(HFClassificationCommonCfg(flags), sequenceName="HIGG9D1Sequence")
397
398 # Apply thinning
399 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(name, ThinningTools = thinningTools), sequenceName="HIGG9D1Sequence")
400
401 return acc
402
403def HIGG9D1Cfg(flags):
404 log_HIGG9D1.info('****************** STARTING HIGG9D1 ******************')
405
406 acc = ComponentAccumulator()
407
408 # Get the lists of triggers needed for trigger matching.
409 # This is needed at this scope (for the slimming) and further down in the config chain
410 # for actually configuring the matching, so we create it here and pass it down
411 # TODO: this should ideally be called higher up to avoid it being run multiple times in a train
412 from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
413 HIGG9D1TriggerListsHelper = TriggerListsHelper(flags)
414
415 # dedicated augmentations
416 acc.merge(HIGG9D1KernelCfg(flags, name="HIGG9D1Kernel", StreamName = streamName, TriggerListsHelper = HIGG9D1TriggerListsHelper))
417
418 # =============================
419 # Define contents of the format
420 # =============================
421 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
422 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
423 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
424
425 HIGG9D1SlimmingHelper = SlimmingHelper("HIGG9D1SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
426 HIGG9D1SlimmingHelper.SmartCollections = [
427 "EventInfo",
428 "Electrons",
429 "Photons",
430 "Muons",
431 "PrimaryVertices",
432 "InDetTrackParticles",
433 "AntiKt4EMTopoJets",
434 "AntiKt4EMPFlowJets",
435
436 "MET_Baseline_AntiKt4EMTopo",
437 "MET_Baseline_AntiKt4EMPFlow",
438 "TauJets",
439 "TauJets_MuonRM",
440 "DiTauJets",
441 "DiTauJetsLowPt",
442 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"]
443
444 if flags.Tau.TauEleRM_isAvailable:
445 HIGG9D1SlimmingHelper.SmartCollections.append("TauJets_EleRM")
446
447 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
448 AllVariables = getDefaultAllVariables()
449 AllVariables += ["PrimaryVertices"]
450 AllVariables += ["CombinedMuonTrackParticles"]
451
452 doLRT = flags.Tracking.doLargeD0
453 AllVariables += ["InDetTrackParticles", "InDetLargeD0TrackParticles"] if doLRT else ["InDetTrackParticles"]
454 AllVariables += ["Muons", "MuonsLRT"] if doLRT else ["Muons"]
455 AllVariables += ["MuonSegments"]
456
457 # Additional content (shallow copy of PrimaryVertices)
458 HIGG9D1SlimmingHelper.AppendToDictionary.update({
459 "HIGG9D1_DiphotonPrimaryVertices" : "xAOD::VertexContainer",
460 "HIGG9D1_DiphotonPrimaryVerticesAux" : "xAOD::ShallowAuxContainer"
461 })
462 AllVariables += ["HIGG9D1_DiphotonPrimaryVertices"]
463
464 HIGG9D1_Jpsi = acc.getPublicTool("HIGG9D1_Jpsi")
465 HIGG9D1_Upsi = acc.getPublicTool("HIGG9D1_Upsi")
466
467 StaticContent = []
468 if HIGG9D1_Jpsi.RefitPV:
469 StaticContent += [ "xAOD::VertexContainer#%s" % HIGG9D1_Jpsi.RefPVContainerName ]
470 StaticContent += [ "xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % HIGG9D1_Jpsi.RefPVContainerName ]
471 if HIGG9D1_Upsi.RefitPV:
472 StaticContent += [ "xAOD::VertexContainer#%s" % HIGG9D1_Upsi.RefPVContainerName ]
473 StaticContent += [ "xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % HIGG9D1_Upsi.RefPVContainerName ]
474 StaticContent += [ "xAOD::VertexContainer#%s" % HIGG9D1_Jpsi.OutputVtxContainerName ]
475 StaticContent += [ "xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % HIGG9D1_Jpsi.OutputVtxContainerName ]
476 StaticContent += [ "xAOD::VertexContainer#%s" % HIGG9D1_Upsi.OutputVtxContainerName ]
477 StaticContent += [ "xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % HIGG9D1_Upsi.OutputVtxContainerName ]
478
479 excludedVertexAuxData = "-vxTrackAtVertex.-MvfFitInfo.-isInitialized.-VTAV"
480 StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Tight_Vertices"]
481 StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Tight_VerticesAux." + excludedVertexAuxData]
482 StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Medium_Vertices"]
483 StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Medium_VerticesAux." + excludedVertexAuxData]
484 StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Loose_Vertices"]
485 StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Loose_VerticesAux." + excludedVertexAuxData]
486
487 # Extra CP content
488 from DerivationFrameworkEGamma.PhotonsCPDetailedContent import PhotonsCPDetailedContent
489 HIGG9D1SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent
490
491 from DerivationFrameworkEGamma.ElectronsCPDetailedContent import (ElectronsCPDetailedContent, GSFTracksCPDetailedContent, ElectronsAddAmbiguityContent)
492 HIGG9D1SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent
493 HIGG9D1SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent
494 HIGG9D1SlimmingHelper.ExtraVariables += ElectronsAddAmbiguityContent
495
496 from DerivationFrameworkTau.TauJetsCPContent import TauJetsCPContent
497 HIGG9D1SlimmingHelper.ExtraVariables += TauJetsCPContent
498
499 from DerivationFrameworkTau.TauJets_LepRMCPContent import (TauJets_EleRMCPContent, TauJets_MuonRMCPContent)
500 HIGG9D1SlimmingHelper.ExtraVariables += TauJets_EleRMCPContent
501 HIGG9D1SlimmingHelper.ExtraVariables += TauJets_MuonRMCPContent
502
503 StaticContent += ["xAOD::TauJetContainer#TauJets_MuonRM"]
504 StaticContent += ["xAOD::TauJetAuxContainer#TauJets_MuonRMAux.-VertexedClusters"]
505 StaticContent += ["xAOD::VertexContainer#TauSecondaryVertices_MuonRM"]
506 StaticContent += ["xAOD::VertexAuxContainer#TauSecondaryVertices_MuonRMAux.-vxTrackAtVertex"]
507
508 HIGG9D1SlimmingHelper.StaticContent = StaticContent
509
510 HIGG9D1SlimmingHelper.ExtraVariables += [
511 "AntiKt4EMTopoJets.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt.IsoFixedCone5PtPUsub",
512 "AntiKt4EMPFlowJets.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt.GhostPartons.isJvtHS.isJvtPU.IsoFixedCone5PtPUsub",
513 "InDetTrackParticles.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.numberOfTRTHits.numberOfTRTOutliers",
514 "EventInfo.GenFiltHT.GenFiltMET.GenFiltHTinclNu.GenFiltPTZ.GenFiltFatJ.HF_Classification.HF_SimpleClassification",
515 "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET.ex.ey",
516 "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht.ex.ey"]
517
518 # FTAG Xbb extra content
519 extraList = []
520 for tagger in ["GN2Xv01", "GN2Xv02"]:
521 for score in ["phbb", "phcc", "ptop", "pqcd"]:
522 extraList.append(f"{tagger}_{score}")
523 HIGG9D1SlimmingHelper.ExtraVariables += ["AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets." + ".".join(extraList)]
524
525 # Large-Radius jet regression extra content
526 extraListReg = []
527 modelName = "bJR10v00"
528 for score in ["mass", "pt"]:
529 extraListReg.append(f"{modelName}_{score}")
530 HIGG9D1SlimmingHelper.ExtraVariables += ["AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets." + ".".join(extraListReg)]
531
532 # Truth content
533 if flags.Input.isMC:
534 from DerivationFrameworkMCTruth.MCTruthCommonConfig import addTruth3ContentToSlimmerTool
535 addTruth3ContentToSlimmerTool(HIGG9D1SlimmingHelper)
536 HIGG9D1SlimmingHelper.ExtraVariables += ["Electrons.TruthLink","Muons.TruthLink","Photons.TruthLink","AntiKt4TruthDressedWZJets.IsoFixedCone5Pt"]
537
538 AllVariables += ["TruthLHEParticles","TruthHFWithDecayParticles","TruthHFWithDecayVertices","TruthCharm","TruthPileupParticles","InTimeAntiKt4TruthJets","OutOfTimeAntiKt4TruthJets",
539 "TruthPrimaryVertices","TruthEvents","TruthParticles","TruthVertices","TruthElectrons","TruthMuons","TruthTaus"]
540
541 from DerivationFrameworkMCTruth.MCTruthCommonConfig import AddTauAndDownstreamParticlesCfg
542 acc.merge(AddTauAndDownstreamParticlesCfg(flags))
543 AllVariables += ["TruthTausWithDecayParticles","TruthTausWithDecayVertices"]
544
545 HIGG9D1SlimmingHelper.SmartCollections += [
546 "AntiKt4TruthDressedWZJets",
547 "AntiKt4TruthWZJets",
548 "AntiKt4TruthJets"
549 ]
550
551 # Extra isolation content
552 EgammaExtraContent= [
553 "ptcone20","ptcone30","ptcone40", "ptvarcone20", "ptvarcone30", "ptvarcone40", "topoetcone20", "topoetcone30",
554 "neflowisol20", "neflowisol30", "neflowisol40",
555 "ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt500" ,"ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt1000",
556 "ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500","ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000",
557 "ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt500","ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
558 "ptcone20_Nonprompt_All_MaxWeightTTVA_pt500", "ptcone20_Nonprompt_All_MaxWeightTTVA_pt1000",
559 "ptcone30_Nonprompt_All_MaxWeightTTVA_pt500", "ptcone30_Nonprompt_All_MaxWeightTTVA_pt1000",
560 "ptcone40_Nonprompt_All_MaxWeightTTVA_pt500", "ptcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
561 "topoetconecoreConeEnergyCorrection", "isoSelIsOK", "topoetcone20_CloseByCorr"
562 ]
563
564 ElectronsExtraContent = [ ".".join( ["Electrons", "deltaPhiRescaled2", "deltaPhiFromLastMeasurement", "originalTrackParticle", "ptvarcone30_Nonprompt_All_MaxWeightTTVALooseCone_pt1000", "ptcone20_Nonprompt_All_MaxWeightTTVALooseCone_pt1000", "ptvarcone30_Nonprompt_All_MaxWeightTTVALooseCone_pt1000_CloseByCorr", "ptcone20_Nonprompt_All_MaxWeightTTVALooseCone_pt1000_CloseByCorr"] + EgammaExtraContent ) ]
565
566 PhotonsExtraContent = [ ".".join(["Photons", "topoetcone40", "topoetcone40_CloseByCorr", "ptcone20_CloseByCorr"] + EgammaExtraContent ) ]
567
568 MuonsExtraContent = [ ".".join( [
569 "Muons",
570 "MeasEnergyLoss.MeasEnergyLossSigma.EnergyLossSigma.ParamEnergyLoss",
571 "ParamEnergyLossSigmaMinus.ParamEnergyLossSigmaPlus.clusterLink.scatteringCurvatureSignificance",
572 "deltaPhiRescaled2.deltaPhiFromLastMeasurement.scatteringNeighbourSignificance",
573 "ptcone20.ptcone30.ptcone40.ptvarcone20.ptvarcone30.ptvarcone40.topoetcone30",
574 "neflowisol20.neflowisol30.neflowisol40.ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt500",
575 "ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt1000.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500",
576 "ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000.ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt500",
577 "ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt1000.ptcone20_Nonprompt_All_MaxWeightTTVA_pt500",
578 "ptcone20_Nonprompt_All_MaxWeightTTVA_pt1000.ptcone30_Nonprompt_All_MaxWeightTTVA_pt500",
579 "ptcone30_Nonprompt_All_MaxWeightTTVA_pt1000.ptcone40_Nonprompt_All_MaxWeightTTVA_pt500",
580 "ptcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
581 "msInnerMatchChi2", "isoSelIsOK", "ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500_CloseByCorr",
582 "ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000_CloseByCorr", "neflowisol20_CloseByCorr", "topoetcone20_CloseByCorr"
583 ] ) ]
584
585 HIGG9D1SlimmingHelper.ExtraVariables += ElectronsExtraContent
586 HIGG9D1SlimmingHelper.ExtraVariables += PhotonsExtraContent
587 HIGG9D1SlimmingHelper.ExtraVariables += MuonsExtraContent
588
589 from IsolationSelection.IsolationSelectionConfig import setupIsoCloseBySlimmingVariables
590 setupIsoCloseBySlimmingVariables(HIGG9D1SlimmingHelper)
591
592 from LeptonTaggers.LeptonTaggersConfig import GetExtraPLITVariablesForDxAOD
593 HIGG9D1SlimmingHelper.ExtraVariables += GetExtraPLITVariablesForDxAOD()
594
595 HIGG9D1SlimmingHelper.AllVariables = AllVariables
596
597 # Trigger content
598 HIGG9D1SlimmingHelper.IncludeTriggerNavigation = False
599 HIGG9D1SlimmingHelper.IncludeJetTriggerContent = False
600 HIGG9D1SlimmingHelper.IncludeMuonTriggerContent = False
601 HIGG9D1SlimmingHelper.IncludeEGammaTriggerContent = False
602 HIGG9D1SlimmingHelper.IncludeTauTriggerContent = False
603 HIGG9D1SlimmingHelper.IncludeEtMissTriggerContent = False
604 HIGG9D1SlimmingHelper.IncludeBJetTriggerContent = False
605 HIGG9D1SlimmingHelper.IncludeBPhysTriggerContent = False
606 HIGG9D1SlimmingHelper.IncludeMinBiasTriggerContent = False
607 # Compact b-jet trigger matching info
608 HIGG9D1SlimmingHelper.IncludeBJetTriggerByYearContent = True
609
610 # Trigger matching
611 # Run 2
612 if flags.Trigger.EDMVersion == 2:
613 from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
614 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = HIGG9D1SlimmingHelper,
615 OutputContainerPrefix = "TrigMatch_",
616 TriggerList = HIGG9D1TriggerListsHelper.Run2TriggerNamesTau)
617 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = HIGG9D1SlimmingHelper,
618 OutputContainerPrefix = "TrigMatch_",
619 TriggerList = HIGG9D1TriggerListsHelper.Run2TriggerNamesNoTau)
620 # Run 3, or Run 2 with navigation conversion
621 if flags.Trigger.EDMVersion == 3 or (flags.Trigger.EDMVersion == 2 and flags.Trigger.doEDMVersionConversion):
622 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
623 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(HIGG9D1SlimmingHelper)
624
625 # L1 trigger objects
626 from Campaigns.Utils import getDataYear
627 if getDataYear(flags) >= 2024:
628 # Run 3 with Phase I jet RoIs.
629 from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddjFexRoIsToSlimmingHelper
630 AddjFexRoIsToSlimmingHelper(SlimmingHelper = HIGG9D1SlimmingHelper)
631 elif getDataYear(flags) >= 2015:
632 # Run 2 and early Run 3, legacy L1 RoIs
633 from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddLegacyL1JetRoIsToSlimmingHelper
634 AddLegacyL1JetRoIsToSlimmingHelper(SlimmingHelper = HIGG9D1SlimmingHelper)
635
636 # Output stream
637 HIGG9D1ItemList = HIGG9D1SlimmingHelper.GetItemList()
638 acc.merge(OutputStreamCfg(flags, "DAOD_HIGG9D1", ItemList=HIGG9D1ItemList, AcceptAlgs=["HIGG9D1Kernel"]))
639 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_HIGG9D1", AcceptAlgs=["HIGG9D1Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData]))
640 acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True)
641 return acc
HIGG9D1KernelCfg(flags, name='HIGG9D1Kernel', **kwargs)
Definition HIGG9D1.py:15
HIGG9D1Cfg(flags)
Definition HIGG9D1.py:403