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
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,
70 trackThresholdPt = 2400.,
71 invMassLower = 2600.0,
72 invMassUpper = 3500.0,
73 Chi2Cut = 20.,
74 oppChargesOnly = True,
75 atLeastOneComb = True,
76 useCombinedMeasurement = False,
77 muonCollectionKey = mainMuonInput,
78 TrackParticleCollection = mainIDInput,
79 V0VertexFitterTool = None,
80 useV0Fitter = False,
81 TrkVertexFitterTool = vkalvrt,
82 TrackSelectorTool = TrackSelector,
83 VertexPointEstimator = vpest,
84 useMCPCuts = False )
85 acc.addPublicTool(HIGG9D1JpsiFinder)
86
87 HIGG9D1UpsiFinder = CompFactory.Analysis.JpsiFinder(
88 name = "HIGG9D1UpsiFinder",
89 muAndMu = True,
90 muAndTrack = False,
91 TrackAndTrack = False,
92 assumeDiMuons = True,
93 trackThresholdPt = 2400.,
94 invMassLower = 8900.0,
95 invMassUpper = 9900.0,
96 Chi2Cut = 20.,
97 oppChargesOnly = True,
98 atLeastOneComb = True,
99 useCombinedMeasurement = False,
100 muonCollectionKey = mainMuonInput,
101 TrackParticleCollection = mainIDInput,
102 V0VertexFitterTool = None,
103 useV0Fitter = False,
104 TrkVertexFitterTool = vkalvrt,
105 TrackSelectorTool = TrackSelector,
106 VertexPointEstimator = vpest,
107 useMCPCuts = False )
108 acc.addPublicTool(HIGG9D1UpsiFinder)
109
110 HIGG9D1_Jpsi = CompFactory.DerivationFramework.Reco_Vertex(
111 name = "HIGG9D1_Jpsi",
112 VertexSearchTool = HIGG9D1JpsiFinder,
113 OutputVtxContainerName = "HIGG9D1_JpsiCandidates",
114 PVContainerName = "PrimaryVertices",
115 RefPVContainerName = "HIGG9D1_JpsiRefittedPrimaryVertices",
116 RefitPV = True,
117 MaxPVrefit = 100,
118 V0Tools = V0Tools,
119 RelinkTracks = TrkToRelink,
120 RelinkMuons = MuonToRelink,
121 PVRefitter = pvRefitter,
122 DoVertexType = 7)
123 acc.addPublicTool(HIGG9D1_Jpsi)
124
125 HIGG9D1_Upsi = CompFactory.DerivationFramework.Reco_Vertex(
126 name = "HIGG9D1_Upsi",
127 VertexSearchTool = HIGG9D1UpsiFinder,
128 OutputVtxContainerName = "HIGG9D1_UpsiCandidates",
129 PVContainerName = "PrimaryVertices",
130 RefPVContainerName = "HIGG9D1_UpsiRefittedPrimaryVertices",
131 RefitPV = True,
132 MaxPVrefit = 100,
133 V0Tools = V0Tools,
134 RelinkTracks = TrkToRelink,
135 RelinkMuons = MuonToRelink,
136 PVRefitter = pvRefitter,
137 DoVertexType = 7)
138 acc.addPublicTool(HIGG9D1_Upsi)
139
140 from InDetTrackSelectionTool.InDetTrackSelectionToolConfig import (
141 InDetTrackSelectionTool_Loose_Cfg)
142 HIGG9D1_isoTrackSelTool = acc.popToolsAndMerge(InDetTrackSelectionTool_Loose_Cfg(
143 flags,
144 name = "HIGG9D1_isoTrackSelTool",
145 maxZ0SinTheta = 3.0,
146 minPt = 500.))
147
148 from IsolationAlgs.IsoToolsConfig import TrackIsolationToolCfg
149 HIGG9D1_TrackIsoTool = acc.popToolsAndMerge(TrackIsolationToolCfg(
150 flags,
151 name = "HIGG9D1_TrackIsoTool",
152 TrackSelectionTool = HIGG9D1_isoTrackSelTool))
153 acc.addPublicTool(HIGG9D1_TrackIsoTool)
154
155 HIGG9D1_JpsiVtxTrkIsoDecor = CompFactory.DerivationFramework.VertexTrackIsolation(
156 name = "HIGG9D1_JpsiVtxTrkIsoDecor",
157 TrackIsoTool = HIGG9D1_TrackIsoTool,
158 TrackContainer = "InDetTrackParticles",
159 InputVertexContainer = "HIGG9D1_JpsiCandidates",
160 FixElecExclusion = False,
161 IncludeV0 = False)
162 acc.addPublicTool(HIGG9D1_JpsiVtxTrkIsoDecor)
163
164 HIGG9D1_UpsiVtxTrkIsoDecor = CompFactory.DerivationFramework.VertexTrackIsolation(
165 name = "HIGG9D1_UpsiVtxTrkIsoDecor",
166 TrackIsoTool = HIGG9D1_TrackIsoTool,
167 TrackContainer = "InDetTrackParticles",
168 InputVertexContainer = "HIGG9D1_UpsiCandidates",
169 FixElecExclusion = False,
170 IncludeV0 = False)
171 acc.addPublicTool(HIGG9D1_UpsiVtxTrkIsoDecor)
172
173
174 from AthenaCommon.CFElements import seqAND
175 acc.addSequence( seqAND("HIGG9D1Sequence") )
176
177
178 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
179 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']), sequenceName="HIGG9D1Sequence")
180
181
184 HIGG9D1_onia_skim = CompFactory.DerivationFramework.AnyVertexSkimmingTool(name = "HIGG9D1_onia_skim", VertexContainerNames = ["HIGG9D1_JpsiCandidates", "HIGG9D1_UpsiCandidates"])
185 acc.addPublicTool(HIGG9D1_onia_skim)
186
187 HIGG9D1_onia_skimKernel = CompFactory.DerivationFramework.DerivationKernel(
188 "HIGG9D1_onia_skimKernel",
189 AugmentationTools = [ HIGG9D1_AugOriginalCounts, HIGG9D1_Jpsi, HIGG9D1_Upsi, HIGG9D1_JpsiVtxTrkIsoDecor, HIGG9D1_UpsiVtxTrkIsoDecor ],
190 SkimmingTools = [ HIGG9D1_onia_skim ])
191
192 acc.addEventAlgo(HIGG9D1_onia_skimKernel, sequenceName="HIGG9D1Sequence")
193
194
195 from BTagging.FlavorTaggingConfig import FlavorTaggingCfg
196 acc.merge(FlavorTaggingCfg(flags, "AntiKt4EMPFlowJets"), sequenceName="HIGG9D1Sequence")
197
198
201
202 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
203 xAODStringSkimmingToolCfg)
204
205
207 HIGG9D1_smallR_EMPFlow_2j_sel = "count(AntiKt4EMPFlowJets.pt > 18*GeV && abs(AntiKt4EMPFlowJets.eta) < 2.8) >= 2"
208 HIGG9D1_smallR_EMPFlow_1j_sel = "count(AntiKt4EMPFlowJets.pt > 33*GeV && abs(AntiKt4EMPFlowJets.eta) < 2.8) >= 1"
209
210
211
212
213 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"
214
215
216 if flags.GeoModel.Run >= LHCPeriod.Run4:
217 HIGG9D1_smallR_EMPFlow_1b_sel = "count(AntiKt4EMPFlowJets.pt > 18*GeV && abs(AntiKt4EMPFlowJets.eta) < 2.8) >= 1"
218
219
220 HIGG9D1_bjet_sel = "%s && %s && %s" % (HIGG9D1_smallR_EMPFlow_2j_sel, HIGG9D1_smallR_EMPFlow_1j_sel, HIGG9D1_smallR_EMPFlow_1b_sel)
221 HIGG9D1_bb_skim = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
222 flags, name = "HIGG9D1_bb_skim", expression = HIGG9D1_bjet_sel))
223
224
225 HIGG9D1_tauTrks = '(TauJets.nTracks + TauJets.nTracksIsolation >= 1 && TauJets.nTracks + TauJets.nTracksIsolation <= 8)'
226 HIGG9D1_tauLead = '(TauJets.pt > 23.0*GeV || TauJets.ptFinalCalib > 23.0*GeV)'
227 HIGG9D1_tauSubl = '(TauJets.pt > 18.0*GeV || TauJets.ptFinalCalib > 18.0*GeV)'
228 HIGG9D1_tauId = 'TauJets.DFTauGNTauLoose'
229 HIGG9D1_tauReq0 = 'count( '+HIGG9D1_tauSubl+' && '+HIGG9D1_tauTrks+' ) >= 2'
230 HIGG9D1_tauReq1 = 'count( '+HIGG9D1_tauSubl+' && '+HIGG9D1_tauTrks+' && '+HIGG9D1_tauId+' ) >= 1'
231 HIGG9D1_tauReq2 = 'count( '+HIGG9D1_tauLead+' && '+HIGG9D1_tauTrks+' ) >= 1'
232 HIGG9D1_tau_sel = "%s && %s && %s" % (HIGG9D1_tauReq0, HIGG9D1_tauReq1, HIGG9D1_tauReq2)
233
234 HIGG9D1_tautau_skim = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
235 flags, name = "HIGG9D1_tautau_skim", expression = HIGG9D1_tau_sel))
236
237
238 from DerivationFrameworkHiggs.SkimmingToolHIGG1Config import SkimmingToolHIGG1Cfg
239 HIGG9D1_yy_skim = acc.popToolsAndMerge(SkimmingToolHIGG1Cfg(
240 flags,
241 name = "HIGG9D1_yy_skim",
242 RequireGRL = False,
243 ReqireLArError = True,
244 RequireTrigger = False,
245 RequirePreselection = True,
246 RequireKinematic = False,
247 RequireQuality = False,
248 RequireIsolation = False,
249 RequireInvariantMass = False,
250 IncludeSingleMergedElectronPreselection = False,
251 IncludeSingleElectronPreselection = False,
252 IncludeDoubleElectronPreselection = False,
253 IncludeSingleMuonPreselection = False,
254 IncludeDoubleMuonPreselection = False,
255 IncludePhotonDoubleElectronPreselection = False,
256 IncludePhotonMergedElectronPreselection = False,
257 IncludeHighPtPhotonElectronPreselection = False,
258 IncludeDoublePhotonPreselection = True,
259 MinimumPhotonPt = 4800.0,
260 RemoveCrack = True,
261 MaxEta = 2.47))
262 acc.addPublicTool(HIGG9D1_yy_skim)
263
264
265 HIGG9D1_bb_tautau_yy_skim = CompFactory.DerivationFramework.FilterCombinationOR(
266 name = "HIGG9D1_bb_tautau_yy_skim",
267 FilterList = [HIGG9D1_bb_skim, HIGG9D1_tautau_skim, HIGG9D1_yy_skim])
268 acc.addPublicTool(HIGG9D1_bb_tautau_yy_skim)
269
270
271 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import (CaloDecoratorKernelCfg, ClusterEnergyPerLayerDecoratorCfg)
272 acc.merge(CaloDecoratorKernelCfg(flags), sequenceName="HIGG9D1Sequence")
273
274
275 augmentationTools = []
276 cluster_sizes = (3,5), (5,7), (7,7)
277 for neta, nphi in cluster_sizes:
278 cename = "ClusterEnergyPerLayerDecorator_%sx%s" % (neta, nphi)
279 ClusterEnergyPerLayerDecorator = acc.popToolsAndMerge( ClusterEnergyPerLayerDecoratorCfg(flags, neta = neta, nphi=nphi, name=cename ))
280 acc.addPublicTool(ClusterEnergyPerLayerDecorator)
281 augmentationTools.append(ClusterEnergyPerLayerDecorator)
282
283 HIGG9D1_bb_tautau_yy_skimKernel = CompFactory.DerivationFramework.DerivationKernel(
284 "HIGG9D1_bb_tautau_yy_skimKernel",
285 AugmentationTools = augmentationTools,
286 SkimmingTools = [ HIGG9D1_bb_tautau_yy_skim ])
287
288 acc.addEventAlgo(HIGG9D1_bb_tautau_yy_skimKernel, sequenceName="HIGG9D1Sequence")
289
290 from IsolationAlgs.DerivationTrackIsoConfig import DerivationTrackIsoCfg
291 acc.merge(DerivationTrackIsoCfg(flags, object_types=("Electrons", "Photons", "Muons"), sequenceName="HIGG9D1Sequence"))
292
293
294 from LeptonTaggers.LeptonTaggersConfig import DecoratePLITAlgsCfg
295 acc.merge(DecoratePLITAlgsCfg(flags), sequenceName="HIGG9D1Sequence")
296
297 from IsolationSelection.IsolationSelectionConfig import IsoCloseByAlgsCfg
298 contNames = [ "Muons", "Electrons", "Photons" ]
299 acc.merge(IsoCloseByAlgsCfg(flags, isPhysLite = False, containerNames = contNames, useSelTools = True, stream_name = kwargs['StreamName']), sequenceName="HIGG9D1Sequence")
300
301
302 from DerivationFrameworkEGamma.EGammaToolsConfig import PhotonVertexSelectionWrapperKernelCfg
303 acc.merge(PhotonVertexSelectionWrapperKernelCfg(flags), sequenceName="HIGG9D1Sequence")
304 from DerivationFrameworkHiggs.HIGG1D1CustomVertexConfig import DiphotonVertexDecoratorCfg
305 DiphotonVertexDecorator = acc.popToolsAndMerge(DiphotonVertexDecoratorCfg(
306 flags,
307 MinimumPhotonPt = 4800.0,
308 DiphotonVertexName = "HIGG9D1_DiphotonPrimaryVertices"))
309 acc.addPublicTool(DiphotonVertexDecorator)
310 acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(name = "DiphotonVertexAugmentation", AugmentationTools = [DiphotonVertexDecorator]), sequenceName="HIGG9D1Sequence")
311
312
313
314
315
316 HIGG9D1MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(
317 name = "HIGG9D1MuonTPThinningTool",
318 StreamName = kwargs['StreamName'],
319 MuonKey = "Muons",
320 InDetTrackParticlesKey = "InDetTrackParticles")
321 acc.addPublicTool(HIGG9D1MuonTPThinningTool)
322
323
324 HIGG9D1ElectronTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
325 name = "HIGG9D1ElectronTPThinningTool",
326 SGKey = "Electrons",
327 StreamName = kwargs['StreamName'],
328 GSFTrackParticlesKey = "GSFTrackParticles",
329 InDetTrackParticlesKey = "InDetTrackParticles")
330 acc.addPublicTool(HIGG9D1ElectronTPThinningTool)
331
332
333 HIGG9D1PhotonTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
334 name = "HIGG9D1PhotonTPThinningTool",
335 SGKey = "Photons",
336 StreamName = kwargs['StreamName'],
337 GSFTrackParticlesKey = "GSFTrackParticles",
338 GSFConversionVerticesKey = "GSFConversionVertices",
339 InDetTrackParticlesKey = "InDetTrackParticles")
340 acc.addPublicTool(HIGG9D1PhotonTPThinningTool)
341
342
343 HIGG9D1TauTPThinningTool = CompFactory.DerivationFramework.TauTrackParticleThinning(
344 name = "HIGG9D1TauTPThinningTool",
345 StreamName = kwargs['StreamName'],
346 TauKey = "TauJets",
347 InDetTrackParticlesKey = "InDetTrackParticles",
348 DoTauTracksThinning = True,
349 TauTracksKey = "TauTracks")
350 acc.addPublicTool(HIGG9D1TauTPThinningTool)
351
352
353 HIGG9D1_ThinVtxTracks = CompFactory.DerivationFramework.Thin_vtxTrk(
354 name = "HIGG9D1_ThinVtxTracks",
355 StreamName = kwargs['StreamName'],
356 TrackParticleContainerName = "InDetTrackParticles",
357 VertexContainerNames = [ HIGG9D1_Jpsi.OutputVtxContainerName, HIGG9D1_Upsi.OutputVtxContainerName ],
358 IgnoreFlags = True )
359 acc.addPublicTool(HIGG9D1_ThinVtxTracks)
360
361 thinningTools = [HIGG9D1MuonTPThinningTool,
362 HIGG9D1ElectronTPThinningTool,
363 HIGG9D1PhotonTPThinningTool,
364 HIGG9D1TauTPThinningTool,
365 HIGG9D1_ThinVtxTracks]
366
367
368 if flags.Input.isMC:
369 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import MenuTruthThinningCfg
370 HIGG9D1TruthTool = acc.getPrimaryAndMerge(MenuTruthThinningCfg(
371 flags = flags,
372 name = "HIGG9D1TruthTool",
373 StreamName = kwargs['StreamName'],
374 ParticlesKey = "TruthParticles",
375 VerticesKey = "TruthVertices",
376 WritePartons = False,
377 WriteHadrons = True,
378 WriteBHadrons = True,
379 WriteCHadrons = True,
380 WriteGeant = False,
381 WriteTauHad = True,
382 WriteBSM = True,
383 WriteBosons = True,
384 WriteBSMProducts = True,
385 WriteBosonProducts = False,
386 WriteTopAndDecays = True,
387 WriteEverything = False,
388 WriteAllLeptons = True,
389 WriteNotPhysical = False,
390 PreserveDescendants = False,
391 PreserveGeneratorDescendants = True,
392 PreserveAncestors = True))
393 acc.addPublicTool(HIGG9D1TruthTool)
394 thinningTools.append(HIGG9D1TruthTool)
395
396
397
398
399 from DerivationFrameworkMCTruth.HFClassificationCommonConfig import HFClassificationCommonCfg
400 acc.merge(HFClassificationCommonCfg(flags), sequenceName="HIGG9D1Sequence")
401
402
403 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(name, ThinningTools = thinningTools), sequenceName="HIGG9D1Sequence")
404
405 return acc
406