8 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
9 from AthenaConfiguration.ComponentFactory
import CompFactory
10 from AthenaConfiguration.Enums
import MetadataCategory
14 MuonContainer="Muons",
15 IdTrackContainer="InDetTrackParticles",
16 applyTrigger = False):
19 from DerivationFrameworkMuons.MuonsToolsConfig
import DiMuonTaggingAlgCfg
22 name =
"DiMuonTaggingZmumuOC",
23 Mu1PtMin = 24*Units.GeV,
25 Mu1RequireQual =
True,
26 Mu2PtMin = 3.0*Units.GeV,
27 Mu2RequireQual =
True,
28 UseTrackProbe =
False,
29 MuonContainerKey = MuonContainer,
30 TrackContainerKey = IdTrackContainer,
31 InvariantMassLow = 60*Units.GeV,
32 IDTrackThinningConeSize = 0.4,
33 applyTrigger = applyTrigger,
34 BranchPrefix =
"Muon1ZmumuOC"))
38 name =
"DiMuonTaggingZmumuSC",
39 Mu1PtMin = 24*Units.GeV,
41 Mu1RequireQual =
True,
42 Mu2PtMin = 3.0*Units.GeV,
43 Mu2RequireQual =
True,
44 UseTrackProbe =
False,
45 MuonContainerKey = MuonContainer,
46 TrackContainerKey = IdTrackContainer,
47 OppositeCharge =
False,
48 applyTrigger = applyTrigger,
49 InvariantMassLow = 60*Units.GeV,
50 BranchPrefix =
"Muon1ZmumuSC"))
68 requirement_tag =
" && ".
join(
69 [
"(Electrons.DFCommonElectronsLHMedium)",
"(Electrons.pt > 24.5*GeV)"]
72 requirement_probe =
" && ".
join(
73 [
"(Electrons.DFCommonElectronsLHLoose)",
"(Electrons.pt > 3.0*GeV)"]
77 CompFactory.DerivationFramework.EGInvariantMassTool(
78 name=
"EGAM1_ZEEMassTool3",
79 Object1Requirements=requirement_tag,
80 Object2Requirements=requirement_probe,
81 StoreGateEntryName=
"EGAM1_DiElectronMass3",
82 Mass1Hypothesis=0.511 * Units.MeV,
83 Mass2Hypothesis=0.511 * Units.MeV,
84 Container1Name=
"Electrons",
85 Container2Name=
"Electrons",
87 DoTransverseMass=
False,
97 """Configure the derivation framework driving algorithm (kernel) for MUON5"""
100 kwargs.setdefault(
"MuonContainer",
"Muons")
101 kwargs.setdefault(
"IdTrkContainer",
"InDetTrackParticles")
102 kwargs.setdefault(
"MsTrkContainer",
"ExtrapolatedMuonTrackParticles")
103 kwargs.setdefault(
"scheduleThinning",
True)
108 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
113 MuonContainer= kwargs[
"MuonContainer"],
114 IdTrackContainer=kwargs[
"IdTrkContainer"])
119 dimuon_flags = [
"pass{flag}".
format(flag = algo.BranchPrefix)
for algo
in diMuonSelAcc.getEventAlgos()]
120 skimmingORs = [f
"DIMU_{flag} > 0" for flag
in dimuon_flags ]
121 acc.merge(diMuonSelAcc)
128 MUON5AugmentTools = []
133 acc.addPublicTool(Muon5ElElSelectionTool)
134 MUON5AugmentTools.append(Muon5ElElSelectionTool)
135 skimmingORs.append(
"(count( EGAM1_DiElectronMass3 > 60.0*GeV ) >= 1)")
139 from DerivationFrameworkMuons.TrackIsolationDecoratorConfig
import TrackIsolationCfg
140 acc.merge(
TrackIsolationCfg(flags,TrackCollection=
"InDetTrackParticles", TrackSelections = trkThinFlags))
141 acc.merge(
TrackIsolationCfg(flags,TrackCollection=
"ExtrapolatedMuonTrackParticles"))
143 from IsolationSelection.IsolationSelectionConfig
import IsoCloseByAlgsCfg
144 contNames = [
"Muons",
"Electrons",
"Photons" ]
145 acc.merge(
IsoCloseByAlgsCfg(flags, isPhysLite =
False, containerNames = contNames, useSelTools =
True, stream_name = kwargs[
'StreamName']))
148 from DerivationFrameworkMuons.MuonsToolsConfig
import MuonCaloDepositAlgCfg
150 ContainerKey=
"Muons"))
152 name =
"IdTrkCaloDepsitDecorator",
153 ContainerKey=
"InDetTrackParticles"))
155 from BTagging.BTagTrackAugmenterAlgConfig
import BTagTrackAugmenterAlgCfg
159 TrackCollection=
"InDetTrackParticles",
160 PrimaryVertexCollectionName=
"PrimaryVertices"
169 elReq1 =
'(Electrons.pt > 25*GeV && abs(Electrons.eta) < 2.5 && Electrons.DFCommonElectronsLHMedium)'
170 elReq2 =
'(Electrons.pt > 3*GeV && abs(Electrons.eta) < 2.8 && Electrons.DFCommonElectronsLHLoose)'
171 muReq1 =
'(Muons.DFCommonMuonPassPreselection && Muons.DFCommonMuonPassIDCuts && Muons.pt>25*GeV && abs(Muons.eta) <2.5)'
172 muReq2 =
'(Muons.DFCommonMuonPassPreselection && Muons.DFCommonMuonPassIDCuts && Muons.pt>3*GeV && abs(Muons.eta) <2.8)'
174 el1 =
'(count('+elReq1+
') >= 1)'
175 el2 =
'(count('+elReq2+
') >= 1)'
176 mu1 =
'(count('+muReq1+
') >= 1)'
177 mu2 =
'(count('+muReq2+
') >= 1)'
179 emuSel=
'(('+el1+
"&&"+mu2+
')'+
'||'+
'('+el2+
"&&"+mu1+
'))'
180 skimmingORs.append(emuSel)
182 lepSelection =
'||'.
join(skimmingORs)
184 MUON5SkimmingTools = []
185 from DerivationFrameworkTools.DerivationFrameworkToolsConfig
import xAODStringSkimmingToolCfg
189 if not (flags.Reco.EnableTrigger
or flags.Trigger.triggerConfig ==
'INFILE'):
190 SkimArgs[
"TrigDecisionTool"] =
""
192 name =
"MUON5SkimmingTool1",
193 expression = lepSelection,
195 MUON5SkimmingTools.append(MUON5SkimmingTool1)
201 MUON5ThinningTools = []
204 from DerivationFrameworkInDet.InDetToolsConfig
import TrackParticleThinningCfg
206 name =
"MUON5TrackThinningTool",
207 StreamName = kwargs[
'StreamName'],
208 SelectionString =
"abs(DFCommonInDetTrackZ0AtPV) < 35.0 && abs(InDetTrackParticles.eta) < 3.2",
209 InDetTrackParticlesKey =
"InDetTrackParticles")
212 MUON5ThinningTools.append(MUON5TrackThinningTool)
215 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import CaloClusterThinningCfg
216 from DerivationFrameworkCalo.CaloCellDFGetterConfig
import thinCaloCellsForDFCfg
217 from DerivationFrameworkMuons.MuonsToolsConfig
import AnalysisMuonThinningAlgCfg
220 fwdTracks =
"InDetForwardTrackParticles"
221 if fwdTracks
not in flags.Input.Collections:
224 MuonPassFlags = muonThinFlags,
225 TrkPassFlags = trkThinFlags,
226 StreamName = kwargs[
'StreamName'],
227 IdTrkFwdThinning=fwdTracks))
232 name =
"MUON5ThinningTool1",
233 StreamName = kwargs[
'StreamName'],
235 SelectionString =
"Muons.pt>4*GeV",
236 TopoClCollectionSGKey =
"CaloCalTopoClusters",
238 MUON5ThinningTools.append(MUON5ThinningTool1)
242 name =
"MUON5ThinningTool2",
243 StreamName = kwargs[
'StreamName'],
245 SelectionString =
"Electrons.pt>4*GeV",
246 CaloClCollectionSGKey =
"egammaClusters",
248 MUON5ThinningTools.append(MUON5ThinningTool2)
252 name =
"MUON5ThinningTool3",
253 StreamName = kwargs[
'StreamName'],
255 SelectionString =
"Photons.pt>4*GeV",
256 CaloClCollectionSGKey =
"egammaClusters",
258 MUON5ThinningTools.append(MUON5ThinningTool3)
262 inputClusterKeys = [
"MuonClusterCollection"],
263 streamName = kwargs[
'StreamName'],
264 outputCellKey =
"DFMUONCellContainer"))
268 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig
import MenuTruthThinningCfg
270 name =
"MUON5TruthThinningTool",
271 StreamName = kwargs[
'StreamName'],
272 WritePartons =
False,
273 WriteHadrons =
False,
274 WriteCHadrons =
True,
275 WriteBHadrons =
True,
278 PartonPtThresh = -1.0,
281 WriteBosonProducts =
True,
282 WriteBSMProducts =
True,
283 WriteTopAndDecays =
True,
284 WriteEverything =
False,
285 WriteAllLeptons =
True,
286 WriteLeptonsNotFromHadrons =
False,
287 WriteNotPhysical =
False,
289 PreserveAncestors =
False,
290 PreserveParentsSiblingsChildren =
True,
291 PreserveGeneratorDescendants =
False))
294 MUON5ThinningTools.append(MUON5TruthThinningTool)
299 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
301 AugmentationTools = MUON5AugmentTools,
302 SkimmingTools = MUON5SkimmingTools,
303 ThinningTools = MUON5ThinningTools))
308 stream_name =
'StreamDAOD_MUON5'
314 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
315 MUON5TriggerListsHelper = TriggerListsHelper(flags)
318 from DerivationFrameworkMuons.JPsiVertexFitSetupCfg
import AddMCPJPsiVertexFitCfg
322 acc.merge(
MUON5KernelCfg(flags, name=
"MUON5Kernel", StreamName = stream_name, TriggerListsHelper = MUON5TriggerListsHelper))
325 from LeptonTaggers.LeptonTaggersConfig
import DecorateImprovedPromptLeptonAlgsCfg, DecoratePLITAlgsCfg
332 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
333 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
334 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
336 MUON5SlimmingHelper =
SlimmingHelper(
"MUON5SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
340 MUON5SlimmingHelper.SmartCollections = [
"EventInfo",
342 "InDetTrackParticles",
346 "AntiKt4EMPFlowJets",
347 "AntiKtVR30Rmax4Rmin02PV0TrackJets",
348 "BTagging_AntiKt4EMPFlow",
349 "MET_Baseline_AntiKt4EMPFlow",
353 MUON5SlimmingHelper.AllVariables = [
355 "CaloCalTopoClusters",
356 "MuonClusterCollection",
357 "TopoClusterIsoCentralEventShape",
358 "TopoClusterIsoForwardEventShape",
359 "GSFConversionVertices",
362 "AntiKtVR30Rmax4Rmin02PV0TrackJets",
365 excludedVertexAuxData =
"-vxTrackAtVertex.-MvfFitInfo.-isInitialized.-VTAV"
367 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Tight_Vertices"]
368 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Tight_VerticesAux." + excludedVertexAuxData]
369 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Medium_Vertices"]
370 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Medium_VerticesAux." + excludedVertexAuxData]
371 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Loose_Vertices"]
372 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Loose_VerticesAux." + excludedVertexAuxData]
373 StaticContent += [
"CaloCellContainer#DFMUONCellContainer"]
374 StaticContent += [
"CaloClusterCellLinkContainer#MuonClusterCollection_links"]
376 MUON5SlimmingHelper.StaticContent = StaticContent
379 CommonEgammaContent= [
380 "ptcone20",
"ptcone30",
"ptcone40",
"ptvarcone20",
"ptvarcone30",
"ptvarcone40",
"topoetcone30",
381 "neflowisol20",
"neflowisol30",
"neflowisol40",
382 "ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt500" ,
"ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt1000",
383 "ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500",
"ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000",
384 "ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt500",
"ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
385 "ptcone20_Nonprompt_All_MaxWeightTTVA_pt500",
"ptcone20_Nonprompt_All_MaxWeightTTVA_pt1000",
386 "ptcone30_Nonprompt_All_MaxWeightTTVA_pt500",
"ptcone30_Nonprompt_All_MaxWeightTTVA_pt1000",
387 "ptcone40_Nonprompt_All_MaxWeightTTVA_pt500",
"ptcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
388 "topoetconecoreConeEnergyCorrection"
390 ElectronsExtraContent = [
394 "deltaPhiRescaled2",
"deltaPhiFromLastMeasurement",
395 "originalTrackParticle"
396 ] + CommonEgammaContent
400 PhotonsExtraContent = [
401 ".".
join([
"Photons"] + CommonEgammaContent )
404 MuonsExtraContent = [
408 "MeasEnergyLoss.MeasEnergyLossSigma.EnergyLossSigma.ParamEnergyLoss",
409 "ParamEnergyLossSigmaMinus.ParamEnergyLossSigmaPlus.clusterLink.scatteringCurvatureSignificance",
410 "deltaPhiRescaled2.deltaPhiFromLastMeasurement.scatteringNeighbourSignificance",
411 "ptcone20.ptcone30.ptcone40.ptvarcone20.ptvarcone30.ptvarcone40.topoetcone30",
412 "neflowisol20.neflowisol30.neflowisol40.ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt500",
413 "ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt1000.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500",
414 "ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000.ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt500",
415 "ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt1000.ptcone20_Nonprompt_All_MaxWeightTTVA_pt500",
416 "ptcone20_Nonprompt_All_MaxWeightTTVA_pt1000.ptcone30_Nonprompt_All_MaxWeightTTVA_pt500",
417 "ptcone30_Nonprompt_All_MaxWeightTTVA_pt1000.ptcone40_Nonprompt_All_MaxWeightTTVA_pt500",
418 "ptcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
424 InDetTrackParticlesExtraContent = [
427 "InDetTrackParticles",
"TTVA_AMVFVertices.TTVA_AMVFWeights",
428 "btagIp_d0.btagIp_z0SinTheta.btagIp_d0Uncertainty.btagIp_z0SinThetaUncertainty",
429 "numberOfNextToInnermostPixelLayerHits.numberOfInnermostPixelLayerSharedHits",
430 "numberOfInnermostPixelLayerSplitHits.numberOfPixelSplitHits.leptonID"
435 ExtraVariables = ElectronsExtraContent + PhotonsExtraContent + MuonsExtraContent + InDetTrackParticlesExtraContent
436 MUON5SlimmingHelper.ExtraVariables += ExtraVariables
437 MUON5SlimmingHelper.ExtraVariables += [
438 "CombinedMuonTrackParticles.definingParametersCovMatrix.definingParametersCovMatrix.vertexLink",
439 "ExtrapolatedMuonTrackParticles.definingParametersCovMatrix.vertexLink",
440 "MuonSpectrometerTrackParticles.definingParametersCovMatrix.vertexLink",
441 "CaloCalTopoClusters.calE.calEta.calM.calPhi.e_sampl.rawM.rawPhi.rawEta.rawE",
442 "EventInfo.GenFiltHT.GenFiltMET.GenFiltHTinclNu.GenFiltPTZ.GenFiltFatJ",
445 from LeptonTaggers.LeptonTaggersConfig
import GetExtraImprovedPromptVariablesForDxAOD, GetExtraPLITVariablesForDxAOD
449 from DerivationFrameworkEGamma.ElectronsCPDetailedContent
import ElectronsCPDetailedContent
450 MUON5SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent
451 from DerivationFrameworkEGamma.ElectronsCPDetailedContent
import GSFTracksCPDetailedContent
452 MUON5SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent
456 MUON5SlimmingHelper.SmartCollections += [
458 "AntiKt4TruthDressedWZJets",
460 MUON5SlimmingHelper.AllVariables += [
469 "TruthPrimaryVertices",
472 MUON5SlimmingHelper.ExtraVariables+= [
473 "TruthPrimaryVertices.t.x.y.z",
474 "InDetTrackParticles.ftagTruthTypeLabel.ftagTruthOriginLabel.ftagTruthVertexIndex"
479 MUON5SlimmingHelper.IncludeTriggerNavigation =
False
480 MUON5SlimmingHelper.IncludeJetTriggerContent =
False
481 MUON5SlimmingHelper.IncludeMuonTriggerContent =
False
482 MUON5SlimmingHelper.IncludeEGammaTriggerContent =
False
483 MUON5SlimmingHelper.IncludeTauTriggerContent =
False
484 MUON5SlimmingHelper.IncludeEtMissTriggerContent =
False
485 MUON5SlimmingHelper.IncludeBJetTriggerContent =
False
486 MUON5SlimmingHelper.IncludeBPhysTriggerContent =
False
487 MUON5SlimmingHelper.IncludeMinBiasTriggerContent =
False
491 if flags.Trigger.EDMVersion == 2:
492 from DerivationFrameworkPhys.TriggerMatchingCommonConfig
import AddRun2TriggerMatchingToSlimmingHelper
494 OutputContainerPrefix =
"TrigMatch_",
495 TriggerList = MUON5TriggerListsHelper.Run2TriggerNamesTau)
497 OutputContainerPrefix =
"TrigMatch_",
498 TriggerList = MUON5TriggerListsHelper.Run2TriggerNamesNoTau)
500 if flags.Trigger.EDMVersion == 3
or (flags.Trigger.EDMVersion == 2
and flags.Trigger.doEDMVersionConversion):
501 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
505 MUON5ItemList = MUON5SlimmingHelper.GetItemList()
506 acc.merge(
OutputStreamCfg(flags,
"DAOD_MUON5", ItemList=MUON5ItemList, AcceptAlgs=[
"MUON5Kernel"]))
507 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_MUON5", AcceptAlgs=[
"MUON5Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData]))