20 """Configure the derivation framework driving algorithm (kernel) for TRIG8"""
21 acc = ComponentAccumulator()
26 from DerivationFrameworkInDet.InDetToolsConfig
import InDetLRTMergeCfg
27 acc.merge(InDetLRTMergeCfg(flags))
30 from DerivationFrameworkLLP.LLPToolsConfig
import LRTMuonMergerAlg
31 acc.merge(LRTMuonMergerAlg( flags,
32 PromptMuonLocation =
"Muons",
33 LRTMuonLocation =
"MuonsLRT",
34 OutputMuonLocation = TRIG8MergedMuonContainer,
35 CreateViewCollection =
True))
38 from DerivationFrameworkLLP.LLPToolsConfig
import LRTElectronMergerAlg
39 acc.merge(LRTElectronMergerAlg( flags,
40 PromptElectronLocation =
"Electrons",
41 LRTElectronLocation =
"LRTElectrons",
42 OutputCollectionName = TRIG8MergedElectronContainer,
44 CreateViewCollection =
True))
47 augmentationTools = [ ]
50 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
51 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs[
'TriggerListsHelper']))
54 from DerivationFrameworkEGamma.EGammaLRTConfig
import EGammaLRTCfg
55 acc.merge(EGammaLRTCfg(flags))
57 from DerivationFrameworkLLP.LLPToolsConfig
import LRTElectronLHSelectorsCfg
58 acc.merge(LRTElectronLHSelectorsCfg(flags))
61 from DerivationFrameworkMuons.MuonsCommonConfig
import MuonsCommonCfg
62 acc.merge(MuonsCommonCfg(flags,
65 from TriggerMenuMT.TriggerAPI.TriggerAPI
import TriggerAPI
66 from TriggerMenuMT.TriggerAPI.TriggerEnums
import TriggerPeriod
68 allperiods = TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future2e34
69 TriggerAPI.setConfigFlags(flags)
70 trig_all = list(TriggerAPI.getAllHLT(allperiods).keys())
73 TriggerListsHelper = kwargs[
'TriggerListsHelper']
74 trig_all += TriggerListsHelper.Run3TriggerNames
77 displaced_jet_triggers = [t
for t
in trig_all
if "dispjet" in t]
78 bjet_veto = [
"HLT_e26_lhtight_ivarloose_2j20_0eta290_020jvt_boffperf_pf_ftf_L1EM22VHI"]
79 bjet_triggers = [t
for t
in trig_all
if "boffperf" in t
and t
not in bjet_veto]
82 from DerivationFrameworkInDet.InDetToolsConfig
import TrackParticleThinningCfg
83 from DerivationFrameworkTools.DerivationFrameworkToolsConfig
import GenericObjectThinningCfg
84 from DerivationFrameworkTrigger.TriggerGenericObjectThinningConfig
import TriggerGenericThinningCfg
89 TRIG8PhotonsThinningTool = acc.getPrimaryAndMerge(GenericObjectThinningCfg(
91 name =
"TRIG8PhotonsThinningTool",
92 StreamName = kwargs[
'StreamName'],
93 ContainerName =
"Photons",
94 SelectionString =
"Photons.pt >= 1000000."))
96 TRIG8TrackParticleThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg(
98 name =
"TRIG8TrackParticleThinningTool",
99 StreamName = kwargs[
'StreamName'],
100 SelectionString =
"InDetTrackParticles.pt > 1*GeV",
101 InDetTrackParticlesKey =
"InDetTrackParticles"))
103 TRIG8LRTTrackParticleThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg(
105 name =
"TRIG8LRTTrackParticleThinningTool",
106 StreamName = kwargs[
'StreamName'],
107 SelectionString =
"InDetLargeD0TrackParticles.pt > 1*GeV",
108 InDetTrackParticlesKey =
"InDetLargeD0TrackParticles"))
111 thinningTools = [TRIG8PhotonsThinningTool,
112 TRIG8TrackParticleThinningTool,
113 TRIG8LRTTrackParticleThinningTool]
115 if((
not flags.Input.isMC)
or "HLT_AntiKt4EMTopoJets_subjesIS" in flags.Input.Collections):
116 TRIG8JETThinningTool = acc.getPrimaryAndMerge(TriggerGenericThinningCfg(
118 name =
"TRIG8JetThinningTool",
119 StreamName = kwargs[
'StreamName'],
120 ContainerName =
"HLT_AntiKt4EMTopoJets_subjesIS",
121 TriggerListOR = sorted(list(
set(displaced_jet_triggers + bjet_triggers)))
124 thinningTools.append(TRIG8JETThinningTool)
130 idtrig_keys = [
'idperf',
'boffperf',
'ivarperf',
'idtp']
132 idtrig_veto = [
'HLT_e26_lhtight_ivarloose_2j20_0eta290_020jvt_boffperf_pf_ftf_L1EM22VHI']
134 additional_triggers = [
136 "HLT_j45_pf_ftf_preselj20_L1J15",
137 "HLT_xe80_tcpufit_isotrk120_medium_iaggrmedium_L1XE55",
138 "HLT_xe80_tcpufit_isotrk140_medium_iaggrmedium_L1XE55",
139 "HLT_xe80_tcpufit_dedxtrk50_medium_L1XE50",
140 "HLT_xe80_tcpufit_distrk20_medium_L1XE50",
141 "HLT_xe80_tcpufit_distrk20_tight_L1XE50",
144 idtrig_keys += additional_triggers
145 idtrig_keys += displaced_jet_triggers
147 triggers = [t
for t
in trig_all
for k
in idtrig_keys
if k
in t]
148 for veto
in idtrig_veto:
150 triggers.remove(veto)
152 print(f
"Warning, {veto} already removed from trigger list.")
155 triggers = sorted(list(
set(triggers)))
156 print(
'TRIG8 list of triggers used for skimming:')
157 for trig
in triggers:
print(trig)
159 TriggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool
160 TRIG8TriggerSkimmingTool = TriggerSkimmingTool(name =
"TRIG8TriggerPreSkimmingTool",
162 TriggerListOR = triggers)
163 acc.addPublicTool(TRIG8TriggerSkimmingTool)
165 skimmingTools.append(TRIG8TriggerSkimmingTool)
167 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
168 acc.addEventAlgo(DerivationKernel(name,
169 SkimmingTools = skimmingTools,
170 ThinningTools = thinningTools,
171 AugmentationTools = augmentationTools))
178 acc = ComponentAccumulator()
184 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
185 TRIG8TriggerListsHelper = TriggerListsHelper(flags)
188 acc.merge(
TRIG8KernelCfg(flags, name=
"TRIG8Kernel", StreamName =
'StreamDAOD_TRIG8', TriggerListsHelper = TRIG8TriggerListsHelper))
194 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
195 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
196 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
198 TRIG8SlimmingHelper =
SlimmingHelper(
"TRIG8SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
200 TRIG8SlimmingHelper.SmartCollections = [
"EventInfo",
207 "InDetTrackParticles",
208 "InDetLargeD0TrackParticles",
210 "AntiKt4EMPFlowJets",
215 TRIG8SlimmingHelper.AllVariables = [
"HLT_IDTrack_Electron_FTF",
216 "HLT_IDTrack_ElecLRT_FTF",
217 "HLT_IDTrack_Electron_IDTrig",
218 "HLT_IDTrack_ElecLRT_IDTrig",
219 "HLT_IDTrack_Electron_GSF",
220 "HLT_IDTrack_Electron_LRTGSF",
221 "HLT_IDTrack_Muon_FTF",
222 "HLT_IDTrack_Muon_IDTrig",
223 "HLT_IDTrack_MuonLRT_IDTrig",
224 "HLT_IDTrack_MuonIso_FTF",
225 "HLT_IDTrack_MuonIso_IDTrig",
226 "HLT_IDTrack_MuonLRT_FTF",
227 "HLT_IDTrack_Bmumux_FTF",
228 "HLT_IDTrack_Bmumux_IDTrig",
229 "HLT_IDTrack_TauCore_FTF",
230 "HLT_IDTrack_TauLRT_FTF",
231 "HLT_IDTrack_TauIso_FTF",
232 "HLT_IDTrack_Tau_IDTrig",
233 "HLT_IDTrack_TauLRT_IDTrig",
234 "HLT_IDTrack_FS_FTF",
235 "HLT_IDTrack_FSLRT_FTF",
236 "HLT_IDTrack_FSLRT_IDTrig",
237 "HLT_IDTrack_DVLRT_FTF",
238 "HLT_IDTrack_BeamSpot_FTF",
239 "HLT_IDTrack_JetSuper_FTF",
240 "HLT_IDTrack_Bjet_FTF",
241 "HLT_IDTrack_Bjet_IDTrig",
242 "HLT_IDTrack_MinBias_IDTrig",
243 "HLT_IDTrack_Cosmic_FTF",
244 "HLT_IDTrack_Cosmic_IDTrig",
245 "HLT_IDTrack_DJLRT_FTF",
246 "HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf_BTaggingSecVtx",
248 "HLT_IDVertex_JetSuper",
252 "InDetDisappearingTrackParticles" ]
256 TRIG8SlimmingHelper.StaticContent = [
257 "TrigRoiDescriptorCollection#HLT_FSRoI",
258 "TrigRoiDescriptorCollection#HLT_MURoIs",
259 "TrigRoiDescriptorCollection#HLT_eEMRoIs",
260 "TrigRoiDescriptorCollection#HLT_eTAURoIs",
261 "TrigRoiDescriptorCollection#HLT_jTAURoIs",
262 "TrigRoiDescriptorCollection#HLT_cTAURoIs",
263 "TrigRoiDescriptorCollection#HLT_jEMRoIs",
264 "TrigRoiDescriptorCollection#HLT_jJRoIs",
265 "TrigRoiDescriptorCollection#HLT_jLJRoIs",
266 "TrigRoiDescriptorCollection#HLT_gJRoIs",
267 "TrigRoiDescriptorCollection#HLT_gLJRoIs",
268 "TrigRoiDescriptorCollection#HLT_EMRoIs",
269 "TrigRoiDescriptorCollection#HLT_METRoI",
270 "TrigRoiDescriptorCollection#HLT_JETRoI",
271 "TrigRoiDescriptorCollection#HLT_TAURoI",
272 "TrigRoiDescriptorCollection#HLT_Roi_LArPEBHLT",
273 "TrigRoiDescriptorCollection#HLT_Roi_IDCalibPEB",
274 "TrigRoiDescriptorCollection#HLT_Roi_FastElectron",
275 "TrigRoiDescriptorCollection#HLT_Roi_FastElectron_probe",
276 "TrigRoiDescriptorCollection#HLT_Roi_FastElectron_LRT",
277 "TrigRoiDescriptorCollection#HLT_Roi_FastElectron_LRT_probe",
278 "TrigRoiDescriptorCollection#HLT_Roi_FastPhoton",
279 "TrigRoiDescriptorCollection#HLT_Roi_FastPhoton_probe",
280 "TrigRoiDescriptorCollection#HLT_Roi_Bmumux",
281 "TrigRoiDescriptorCollection#MuonCandidates_FS_ROIs",
282 "TrigRoiDescriptorCollection#HLT_Roi_L2SAMuon",
283 "TrigRoiDescriptorCollection#HLT_Roi_L2SAMuon_probe",
284 "TrigRoiDescriptorCollection#HLT_Roi_L2SAMuon_LRT",
285 "TrigRoiDescriptorCollection#HLT_Roi_L2SAMuon_LRT_probe",
286 "TrigRoiDescriptorCollection#HLT_Roi_L2SAMuonForEF",
287 "TrigRoiDescriptorCollection#HLT_Roi_L2SAMuonForEF_probe",
288 "TrigRoiDescriptorCollection#HLT_Roi_MuonIso",
289 "TrigRoiDescriptorCollection#HLT_Roi_MuonIso_probe",
290 "TrigRoiDescriptorCollection#HLT_Roi_Tau",
291 "TrigRoiDescriptorCollection#HLT_Roi_Tau_probe",
292 "TrigRoiDescriptorCollection#HLT_Roi_TauCore",
293 "TrigRoiDescriptorCollection#HLT_Roi_TauCore_probe",
294 "TrigRoiDescriptorCollection#HLT_Roi_TauLRT",
295 "TrigRoiDescriptorCollection#HLT_Roi_TauLRT_probe",
296 "TrigRoiDescriptorCollection#HLT_Roi_TauIso",
297 "TrigRoiDescriptorCollection#HLT_Roi_TauIso_probe",
298 "TrigRoiDescriptorCollection#HLT_Roi_TauIsoBDT",
299 "TrigRoiDescriptorCollection#HLT_Roi_TauIsoBDT_probe",
300 "TrigRoiDescriptorCollection#HLT_Roi_JetPEBPhysicsTLA",
301 "TrigRoiDescriptorCollection#HLT_Roi_DV",
302 "TrigRoiDescriptorCollection#HLT_Roi_Bjet",
303 "TrigRoiDescriptorCollection#HLT_Roi_FS",
304 "TrigRoiDescriptorCollection#HLT_Roi_JetSuper",
305 "TrigRoiDescriptorCollection#HLT_Roi_DJ",
306 "TrigInDetTrackTruthMap#TrigInDetTrackTruthMap" ]
308 TRIG8SlimmingHelper.ExtraVariables += [
309 "Electrons.Tight.Medium.Loose.LHTight.LHMedium.LHLoose",
310 "LRTElectrons.Tight.Medium.Loose.LHTight.LHMedium.LHLoose",
311 "egammaClusters.phi_sampl.eta0.phi0",
312 "LRTegammaClusters.phi_sampl.eta0.phi0",
313 "TruthPrimaryVertices.t.x.y.z",
314 "PrimaryVertices.t.x.y.z.numberDoF.chiSquared.covariance.trackParticleLinks",
315 "InDetTrackParticles.d0.z0.vz.vx.vy.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.truthParticleLink.truthMatchProbability.radiusOfFirstHit.hitPattern.trackFitter.patternRecoInfo.numberDoF.numberOfTRTHits.numberOfTRTOutliers.numberOfBLayerHits.expectBLayerHit.numberOfPixelDeadSensors.numberOfSCTDeadSensors.numberOfTRTHighThresholdHits.expectInnermostPixelLayerHit",
316 "InDetLargeD0TrackParticles.d0.z0.vz.vx.vy.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.truthParticleLink.truthMatchProbability.radiusOfFirstHit.hitPattern.trackFitter.patternRecoInfo.numberDoF.numberOfTRTHits.numberOfTRTOutliers.numberOfBLayerHits.expectBLayerHit.numberOfPixelDeadSensors.numberOfSCTDeadSensors.numberOfTRTHighThresholdHits.expectInnermostPixelLayerHit",
317 "GSFTrackParticles.d0.z0.vz.vx.vy.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.truthParticleLink.truthMatchProbability.radiusOfFirstHit.numberOfPixelHoles.numberOfSCTHoles.numberDoF.chiSquared.trackFitter.patternRecoInfo.hitPattern.numberOfTRTHits.numberOfTRTOutliers.numberOfBLayerHits.expectBLayerHit.numberOfPixelDeadSensors.numberOfSCTDeadSensors.numberOfTRTHighThresholdHits.expectInnermostPixelLayerHit",
318 "LRTGSFTrackParticles.d0.z0.vz.vx.vy.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.truthParticleLink.truthMatchProbability.radiusOfFirstHit.numberOfPixelHoles.numberOfSCTHoles.numberDoF.chiSquared.trackFitter.patternRecoInfo.hitPattern.numberOfTRTHits.numberOfTRTOutliers.numberOfBLayerHits.expectBLayerHit.numberOfPixelDeadSensors.numberOfSCTDeadSensors.numberOfTRTHighThresholdHits.expectInnermostPixelLayerHit",
319 "EventInfo.hardScatterVertexLink.timeStampNSOffset",
320 "TauJets.dRmax.etOverPtLeadTrk",
321 "HLT_AntiKt4EMTopoJets_subjesIS.m.pt.eta.phi"]
326 from DerivationFrameworkMCTruth.MCTruthCommonConfig
import addTruth3ContentToSlimmerTool
327 addTruth3ContentToSlimmerTool(TRIG8SlimmingHelper)
328 TRIG8SlimmingHelper.AllVariables += [
'TruthHFWithDecayParticles',
'TruthHFWithDecayVertices',
'TruthCharm',
'TruthPileupParticles',
'InTimeAntiKt4TruthJets',
'OutOfTimeAntiKt4TruthJets']
329 TRIG8SlimmingHelper.ExtraVariables += [
"Electrons.TruthLink",
330 "LRTElectrons.TruthLink",
332 "MuonsLRT.TruthLink",
338 TRIG8SlimmingHelper.IncludeTriggerNavigation =
True
339 TRIG8SlimmingHelper.IncludeAdditionalTriggerContent =
True
340 TRIG8SlimmingHelper.IncludeJetTriggerContent =
False
341 TRIG8SlimmingHelper.IncludeMuonTriggerContent =
False
342 TRIG8SlimmingHelper.IncludeEGammaTriggerContent =
False
343 TRIG8SlimmingHelper.IncludeTauTriggerContent =
False
344 TRIG8SlimmingHelper.IncludeEtMissTriggerContent =
False
345 TRIG8SlimmingHelper.IncludeBJetTriggerContent =
False
346 TRIG8SlimmingHelper.IncludeBPhysTriggerContent =
False
347 TRIG8SlimmingHelper.IncludeMinBiasTriggerContent =
False
351 if flags.Trigger.EDMVersion == 2:
352 from DerivationFrameworkLLP.LLPToolsConfig
import LLP1TriggerMatchingToolRun2Cfg
353 from DerivationFrameworkPhys.TriggerMatchingCommonConfig
import AddRun2TriggerMatchingToSlimmingHelper
354 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = TRIG8SlimmingHelper,
355 OutputContainerPrefix =
"TrigMatch_",
356 TriggerList = TRIG8TriggerListsHelper.Run2TriggerNamesTau)
357 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = TRIG8SlimmingHelper,
358 OutputContainerPrefix =
"TrigMatch_",
359 TriggerList = TRIG8TriggerListsHelper.Run2TriggerNamesNoTau)
361 acc.merge(LLP1TriggerMatchingToolRun2Cfg(flags,
362 name =
"LRTTriggerMatchingTool",
363 OutputContainerPrefix =
"LRTTrigMatch_",
364 TriggerList = TRIG8TriggerListsHelper.Run2TriggerNamesNoTau,
365 InputElectrons=TRIG8MergedElectronContainer,
366 InputMuons=TRIG8MergedMuonContainer
369 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = TRIG8SlimmingHelper,
370 OutputContainerPrefix =
"LRTTrigMatch_",
371 TriggerList = TRIG8TriggerListsHelper.Run2TriggerNamesNoTau,
372 InputElectrons=TRIG8MergedElectronContainer,
373 InputMuons=TRIG8MergedMuonContainer
376 if flags.Trigger.EDMVersion == 3
or (flags.Trigger.EDMVersion == 2
and flags.Trigger.doEDMVersionConversion):
377 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
378 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(TRIG8SlimmingHelper)
381 TRIG8ItemList = TRIG8SlimmingHelper.GetItemList()
382 acc.merge(OutputStreamCfg(flags,
"DAOD_TRIG8", ItemList=TRIG8ItemList, AcceptAlgs=[
"TRIG8Kernel"]))
383 acc.merge(SetupMetaDataForStreamCfg(flags,
"DAOD_TRIG8", AcceptAlgs=[
"TRIG8Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))