9 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
10 from AthenaConfiguration.ComponentFactory
import CompFactory
11 from AthenaConfiguration.Enums
import MetadataCategory
15 MuonContainer="Muons",
16 IdTrackContainer="InDetTrackParticles",
17 applyTrigger = False):
20 from DerivationFrameworkMuons.MuonsToolsConfig
import DiMuonTaggingAlgCfg
23 name =
"DiMuonTaggingZmumuOC",
24 Mu1PtMin = 24*Units.GeV,
26 Mu1RequireQual =
True,
27 Mu2PtMin = 3.0*Units.GeV,
28 Mu2RequireQual =
True,
29 UseTrackProbe =
False,
30 MuonContainerKey = MuonContainer,
31 TrackContainerKey = IdTrackContainer,
32 InvariantMassLow = 60*Units.GeV,
33 IDTrackThinningConeSize = 0.4,
34 applyTrigger = applyTrigger,
35 BranchPrefix =
"Muon1ZmumuOC"))
39 name =
"DiMuonTaggingZmumuSC",
40 Mu1PtMin = 24*Units.GeV,
42 Mu1RequireQual =
True,
43 Mu2PtMin = 3.0*Units.GeV,
44 Mu2RequireQual =
True,
45 UseTrackProbe =
False,
46 MuonContainerKey = MuonContainer,
47 TrackContainerKey = IdTrackContainer,
48 OppositeCharge =
False,
49 applyTrigger = applyTrigger,
50 InvariantMassLow = 60*Units.GeV,
51 BranchPrefix =
"Muon1ZmumuSC"))
69 requirement_tag =
" && ".
join(
70 [
"(Electrons.DFCommonElectronsLHMedium)",
"(Electrons.pt > 24.5*GeV)"]
73 requirement_probe =
" && ".
join(
74 [
"(Electrons.DFCommonElectronsLHLoose)",
"(Electrons.pt > 3.0*GeV)"]
78 CompFactory.DerivationFramework.EGInvariantMassTool(
79 name=
"EGAM1_ZEEMassTool3",
80 Object1Requirements=requirement_tag,
81 Object2Requirements=requirement_probe,
82 StoreGateEntryName=
"EGAM1_DiElectronMass3",
83 Mass1Hypothesis=0.511 * Units.MeV,
84 Mass2Hypothesis=0.511 * Units.MeV,
85 Container1Name=
"Electrons",
86 Container2Name=
"Electrons",
88 DoTransverseMass=
False,
98 """Configure the derivation framework driving algorithm (kernel) for MUON5"""
101 kwargs.setdefault(
"MuonContainer",
"Muons")
102 kwargs.setdefault(
"IdTrkContainer",
"InDetTrackParticles")
103 kwargs.setdefault(
"MsTrkContainer",
"ExtrapolatedMuonTrackParticles")
104 kwargs.setdefault(
"scheduleThinning",
True)
109 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
114 MuonContainer= kwargs[
"MuonContainer"],
115 IdTrackContainer=kwargs[
"IdTrkContainer"])
120 dimuon_flags = [
"pass{flag}".
format(flag = algo.BranchPrefix)
for algo
in diMuonSelAcc.getEventAlgos()]
121 skimmingORs = [f
"DIMU_{flag} > 0" for flag
in dimuon_flags ]
122 acc.merge(diMuonSelAcc)
129 MUON5AugmentTools = []
134 acc.addPublicTool(Muon5ElElSelectionTool)
135 MUON5AugmentTools.append(Muon5ElElSelectionTool)
136 skimmingORs.append(
"(count( EGAM1_DiElectronMass3 > 60.0*GeV ) >= 1)")
140 from DerivationFrameworkMuons.TrackIsolationDecoratorConfig
import TrackIsolationCfg
141 acc.merge(
TrackIsolationCfg(flags,TrackCollection=
"InDetTrackParticles", TrackSelections = trkThinFlags))
142 acc.merge(
TrackIsolationCfg(flags,TrackCollection=
"ExtrapolatedMuonTrackParticles"))
144 from IsolationSelection.IsolationSelectionConfig
import IsoCloseByAlgsCfg
145 contNames = [
"Muons",
"Electrons",
"Photons" ]
146 acc.merge(
IsoCloseByAlgsCfg(flags, isPhysLite =
False, containerNames = contNames, useSelTools =
True, stream_name = kwargs[
'StreamName']))
149 from DerivationFrameworkMuons.MuonsToolsConfig
import MuonCaloDepositAlgCfg
151 ContainerKey=
"Muons"))
153 name =
"IdTrkCaloDepsitDecorator",
154 ContainerKey=
"InDetTrackParticles"))
156 from BTagging.BTagTrackAugmenterAlgConfig
import BTagTrackAugmenterAlgCfg
160 TrackCollection=
"InDetTrackParticles",
161 PrimaryVertexCollectionName=
"PrimaryVertices"
170 elReq1 =
'(Electrons.pt > 25*GeV && abs(Electrons.eta) < 2.5 && Electrons.DFCommonElectronsLHMedium)'
171 elReq2 =
'(Electrons.pt > 3*GeV && abs(Electrons.eta) < 2.8 && Electrons.DFCommonElectronsLHLoose)'
172 muReq1 =
'(Muons.DFCommonMuonPassPreselection && Muons.DFCommonMuonPassIDCuts && Muons.pt>25*GeV && abs(Muons.eta) <2.5)'
173 muReq2 =
'(Muons.DFCommonMuonPassPreselection && Muons.DFCommonMuonPassIDCuts && Muons.pt>3*GeV && abs(Muons.eta) <2.8)'
175 el1 =
'(count('+elReq1+
') >= 1)'
176 el2 =
'(count('+elReq2+
') >= 1)'
177 mu1 =
'(count('+muReq1+
') >= 1)'
178 mu2 =
'(count('+muReq2+
') >= 1)'
180 emuSel=
'(('+el1+
"&&"+mu2+
')'+
'||'+
'('+el2+
"&&"+mu1+
'))'
181 skimmingORs.append(emuSel)
183 lepSelection =
'||'.
join(skimmingORs)
185 MUON5SkimmingTools = []
186 from DerivationFrameworkTools.DerivationFrameworkToolsConfig
import xAODStringSkimmingToolCfg
190 if not (flags.Reco.EnableTrigger
or flags.Trigger.triggerConfig ==
'INFILE'):
191 SkimArgs[
"TrigDecisionTool"] =
""
193 name =
"MUON5SkimmingTool1",
194 expression = lepSelection,
196 MUON5SkimmingTools.append(MUON5SkimmingTool1)
202 MUON5ThinningTools = []
205 from DerivationFrameworkInDet.InDetToolsConfig
import TrackParticleThinningCfg
207 name =
"MUON5TrackThinningTool",
208 StreamName = kwargs[
'StreamName'],
209 SelectionString =
"abs(DFCommonInDetTrackZ0AtPV) < 35.0 && abs(InDetTrackParticles.eta) < 3.2",
210 InDetTrackParticlesKey =
"InDetTrackParticles")
213 MUON5ThinningTools.append(MUON5TrackThinningTool)
216 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import CaloClusterThinningCfg
217 from DerivationFrameworkCalo.CaloCellDFGetterConfig
import thinCaloCellsForDFCfg
218 from DerivationFrameworkMuons.MuonsToolsConfig
import AnalysisMuonThinningAlgCfg
221 fwdTracks =
"InDetForwardTrackParticles"
222 if fwdTracks
not in flags.Input.Collections:
225 MuonPassFlags = muonThinFlags,
226 TrkPassFlags = trkThinFlags,
227 StreamName = kwargs[
'StreamName'],
228 IdTrkFwdThinning=fwdTracks))
233 name =
"MUON5ThinningTool1",
234 StreamName = kwargs[
'StreamName'],
236 SelectionString =
"Muons.pt>4*GeV",
237 TopoClCollectionSGKey =
"CaloCalTopoClusters",
239 MUON5ThinningTools.append(MUON5ThinningTool1)
243 name =
"MUON5ThinningTool2",
244 StreamName = kwargs[
'StreamName'],
246 SelectionString =
"Electrons.pt>4*GeV",
247 CaloClCollectionSGKey =
"egammaClusters",
249 MUON5ThinningTools.append(MUON5ThinningTool2)
253 name =
"MUON5ThinningTool3",
254 StreamName = kwargs[
'StreamName'],
256 SelectionString =
"Photons.pt>4*GeV",
257 CaloClCollectionSGKey =
"egammaClusters",
259 MUON5ThinningTools.append(MUON5ThinningTool3)
263 inputClusterKeys = [
"MuonClusterCollection"],
264 streamName = kwargs[
'StreamName'],
265 outputCellKey =
"DFMUONCellContainer"))
269 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig
import MenuTruthThinningCfg
271 name =
"MUON5TruthThinningTool",
272 StreamName = kwargs[
'StreamName'],
273 WritePartons =
False,
274 WriteHadrons =
False,
275 WriteCHadrons =
True,
276 WriteBHadrons =
True,
279 PartonPtThresh = -1.0,
282 WriteBosonProducts =
True,
283 WriteBSMProducts =
True,
284 WriteTopAndDecays =
True,
285 WriteEverything =
False,
286 WriteAllLeptons =
True,
287 WriteLeptonsNotFromHadrons =
False,
288 WriteNotPhysical =
False,
290 PreserveAncestors =
False,
291 PreserveParentsSiblingsChildren =
True,
292 PreserveGeneratorDescendants =
False))
295 MUON5ThinningTools.append(MUON5TruthThinningTool)
300 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
302 AugmentationTools = MUON5AugmentTools,
303 SkimmingTools = MUON5SkimmingTools,
304 ThinningTools = MUON5ThinningTools))
309 stream_name =
'StreamDAOD_MUON5'
315 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
316 MUON5TriggerListsHelper = TriggerListsHelper(flags)
319 from DerivationFrameworkMuons.JPsiVertexFitSetupCfg
import AddMCPJPsiVertexFitCfg
323 acc.merge(
MUON5KernelCfg(flags, name=
"MUON5Kernel", StreamName = stream_name, TriggerListsHelper = MUON5TriggerListsHelper))
326 from LeptonTaggers.LeptonTaggersConfig
import DecorateImprovedPromptLeptonAlgsCfg, DecoratePLITAlgsCfg
333 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
334 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
335 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
337 MUON5SlimmingHelper =
SlimmingHelper(
"MUON5SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
341 MUON5SlimmingHelper.SmartCollections = [
"EventInfo",
343 "InDetTrackParticles",
347 "AntiKt4EMPFlowJets",
348 "AntiKtVR30Rmax4Rmin02PV0TrackJets",
349 "BTagging_AntiKt4EMPFlow",
350 "MET_Baseline_AntiKt4EMPFlow",
354 MUON5SlimmingHelper.AllVariables = [
356 "CaloCalTopoClusters",
357 "MuonClusterCollection",
358 "TopoClusterIsoCentralEventShape",
359 "TopoClusterIsoForwardEventShape",
360 "GSFConversionVertices",
363 "AntiKtVR30Rmax4Rmin02PV0TrackJets",
366 excludedVertexAuxData =
"-vxTrackAtVertex.-MvfFitInfo.-isInitialized.-VTAV"
368 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Tight_Vertices"]
369 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Tight_VerticesAux." + excludedVertexAuxData]
370 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Medium_Vertices"]
371 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Medium_VerticesAux." + excludedVertexAuxData]
372 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Loose_Vertices"]
373 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Loose_VerticesAux." + excludedVertexAuxData]
374 StaticContent += [
"CaloCellContainer#DFMUONCellContainer"]
375 StaticContent += [
"CaloClusterCellLinkContainer#MuonClusterCollection_links"]
377 MUON5SlimmingHelper.StaticContent = StaticContent
380 CommonEgammaContent= [
381 "ptcone20",
"ptcone30",
"ptcone40",
"ptvarcone20",
"ptvarcone30",
"ptvarcone40",
"topoetcone30",
382 "neflowisol20",
"neflowisol30",
"neflowisol40",
383 "ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt500" ,
"ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt1000",
384 "ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500",
"ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000",
385 "ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt500",
"ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
386 "ptcone20_Nonprompt_All_MaxWeightTTVA_pt500",
"ptcone20_Nonprompt_All_MaxWeightTTVA_pt1000",
387 "ptcone30_Nonprompt_All_MaxWeightTTVA_pt500",
"ptcone30_Nonprompt_All_MaxWeightTTVA_pt1000",
388 "ptcone40_Nonprompt_All_MaxWeightTTVA_pt500",
"ptcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
389 "topoetconecoreConeEnergyCorrection"
391 ElectronsExtraContent = [
395 "deltaPhiRescaled2",
"deltaPhiFromLastMeasurement",
396 "originalTrackParticle"
397 ] + CommonEgammaContent
401 PhotonsExtraContent = [
402 ".".
join([
"Photons"] + CommonEgammaContent )
405 MuonsExtraContent = [
409 "MeasEnergyLoss.MeasEnergyLossSigma.EnergyLossSigma.ParamEnergyLoss",
410 "ParamEnergyLossSigmaMinus.ParamEnergyLossSigmaPlus.clusterLink.scatteringCurvatureSignificance",
411 "deltaPhiRescaled2.deltaPhiFromLastMeasurement.scatteringNeighbourSignificance",
412 "ptcone20.ptcone30.ptcone40.ptvarcone20.ptvarcone30.ptvarcone40.topoetcone30",
413 "neflowisol20.neflowisol30.neflowisol40.ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt500",
414 "ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt1000.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500",
415 "ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000.ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt500",
416 "ptvarcone40_Nonprompt_All_MaxWeightTTVA_pt1000.ptcone20_Nonprompt_All_MaxWeightTTVA_pt500",
417 "ptcone20_Nonprompt_All_MaxWeightTTVA_pt1000.ptcone30_Nonprompt_All_MaxWeightTTVA_pt500",
418 "ptcone30_Nonprompt_All_MaxWeightTTVA_pt1000.ptcone40_Nonprompt_All_MaxWeightTTVA_pt500",
419 "ptcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
425 InDetTrackParticlesExtraContent = [
428 "InDetTrackParticles",
"TTVA_AMVFVertices.TTVA_AMVFWeights",
429 "btagIp_d0.btagIp_z0SinTheta.btagIp_d0Uncertainty.btagIp_z0SinThetaUncertainty",
430 "numberOfNextToInnermostPixelLayerHits.numberOfInnermostPixelLayerSharedHits",
431 "numberOfInnermostPixelLayerSplitHits.numberOfPixelSplitHits.leptonID"
436 ExtraVariables = ElectronsExtraContent + PhotonsExtraContent + MuonsExtraContent + InDetTrackParticlesExtraContent
437 MUON5SlimmingHelper.ExtraVariables += ExtraVariables
438 MUON5SlimmingHelper.ExtraVariables += [
439 "CombinedMuonTrackParticles.definingParametersCovMatrix.definingParametersCovMatrix.vertexLink",
440 "ExtrapolatedMuonTrackParticles.definingParametersCovMatrix.vertexLink",
441 "MuonSpectrometerTrackParticles.definingParametersCovMatrix.vertexLink",
442 "CaloCalTopoClusters.calE.calEta.calM.calPhi.e_sampl.rawM.rawPhi.rawEta.rawE",
443 "EventInfo.GenFiltHT.GenFiltMET.GenFiltHTinclNu.GenFiltPTZ.GenFiltFatJ",
446 from LeptonTaggers.LeptonTaggersConfig
import GetExtraImprovedPromptVariablesForDxAOD, GetExtraPLITVariablesForDxAOD
450 from DerivationFrameworkEGamma.ElectronsCPDetailedContent
import ElectronsCPDetailedContent
451 MUON5SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent
452 from DerivationFrameworkEGamma.ElectronsCPDetailedContent
import GSFTracksCPDetailedContent
453 MUON5SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent
457 MUON5SlimmingHelper.SmartCollections += [
459 "AntiKt4TruthDressedWZJets",
461 MUON5SlimmingHelper.AllVariables += [
470 "TruthPrimaryVertices",
473 MUON5SlimmingHelper.ExtraVariables+= [
474 "TruthPrimaryVertices.t.x.y.z",
475 "InDetTrackParticles.ftagTruthTypeLabel.ftagTruthOriginLabel.ftagTruthVertexIndex"
480 MUON5SlimmingHelper.IncludeTriggerNavigation =
False
481 MUON5SlimmingHelper.IncludeJetTriggerContent =
False
482 MUON5SlimmingHelper.IncludeMuonTriggerContent =
False
483 MUON5SlimmingHelper.IncludeEGammaTriggerContent =
False
484 MUON5SlimmingHelper.IncludeTauTriggerContent =
False
485 MUON5SlimmingHelper.IncludeEtMissTriggerContent =
False
486 MUON5SlimmingHelper.IncludeBJetTriggerContent =
False
487 MUON5SlimmingHelper.IncludeBPhysTriggerContent =
False
488 MUON5SlimmingHelper.IncludeMinBiasTriggerContent =
False
492 if flags.Trigger.EDMVersion == 2:
493 from DerivationFrameworkPhys.TriggerMatchingCommonConfig
import AddRun2TriggerMatchingToSlimmingHelper
495 OutputContainerPrefix =
"TrigMatch_",
496 TriggerList = MUON5TriggerListsHelper.Run2TriggerNamesTau)
498 OutputContainerPrefix =
"TrigMatch_",
499 TriggerList = MUON5TriggerListsHelper.Run2TriggerNamesNoTau)
501 if flags.Trigger.EDMVersion == 3
or (flags.Trigger.EDMVersion == 2
and flags.Trigger.doEDMVersionConversion):
502 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
506 MUON5ItemList = MUON5SlimmingHelper.GetItemList()
507 acc.merge(
OutputStreamCfg(flags,
"DAOD_MUON5", ItemList=MUON5ItemList, AcceptAlgs=[
"MUON5Kernel"]))
508 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_MUON5", AcceptAlgs=[
"MUON5Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData]))