ATLAS Offline Software
DRAW_ZMUMU.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaCommon.CFElements import seqAND
6 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import InvariantMassToolCfg
7 from PrimaryDPDMaker.DRAWCommonByteStream import DRAWCommonByteStreamCfg
8 
9 
10 def DRAW_ZmumuKernelCfg(flags, name="DRAW_ZMUMUKernel", **kwargs):
11 
12  result = ComponentAccumulator()
13  result.addSequence(seqAND("DRAWZMUMU_Sequence"))
14 
15  massEntryName = "DRZmumuMass"
16  # Object selection strings
17  sel_muon1 = 'Muons.pt > 25*GeV && Muons.ptcone40/Muons.pt < 0.3'
18  sel_muon2 = 'Muons.pt > 20*GeV && Muons.ptcone40/Muons.pt < 0.3'
19  # Ensure that it's scheduled after the Isolation builder
20  kwargs.setdefault(
21  "ExtraInputs", [('xAOD::MuonContainer', 'StoreGateSvc+Muons.ptcone40')])
22 
23  mass_tool = result.getPrimaryAndMerge(InvariantMassToolCfg(flags,
24  name="DRZmumuMassTool",
25  ContainerName="Muons",
26  ObjectRequirements=sel_muon1,
27  SecondObjectRequirements=sel_muon2,
28  MassHypothesis=105.66,
29  SecondMassHypothesis=105.66,
30  StoreGateEntryName=massEntryName))
31 
32  from DerivationFrameworkTools.DerivationFrameworkToolsConfig import AsgSelectionToolWrapperCfg
33  from MuonSelectorTools.MuonSelectorToolsConfig import MuonSelectionToolCfg
34  muon_sel_tool = result.popToolsAndMerge(MuonSelectionToolCfg(flags, name="DRAW_ZMUMU_MuonsSelector",
35  MaxEta=3, MuQuality=2 # Use Medium muons
36  ))
37  result.addPublicTool(muon_sel_tool)
38  muonSkimmingTool = result.getPrimaryAndMerge(AsgSelectionToolWrapperCfg(flags,
39  name="DRAW_ZMUMU_GoodMuon_SkimmingTool",
40  ContainerName="Muons",
41  StoreGateEntryName="isMedium_DRAWZmumu",
42  AsgSelectionTool=muon_sel_tool))
43 
44  dimuonMassString = "( count ( {mass} > 70*GeV && {mass} < 110*GeV ) >= 1 )".format(
45  mass=massEntryName)
46 
47  muonSkimmingString = "( count (Muons.pt > 20*GeV && Muons.isMedium_DRAWZmumu == 1) >= 1)"
48  from DerivationFrameworkTools.DerivationFrameworkToolsConfig import xAODStringSkimmingToolCfg
49  dimuonMassSkimmingTool = result.getPrimaryAndMerge(xAODStringSkimmingToolCfg(flags,
50  name="DRAW_ZMUMU_DiMuonMass_SkimmingTool",
51  expression="{mass} && {muon} ".format(mass=dimuonMassString,
52  muon=muonSkimmingString)))
53 
54  # needed for dynamic determination of lowest-unprescaled single-muon and dimuon triggers
55  from TriggerMenuMT.TriggerAPI.TriggerAPI import TriggerAPI
56  from TriggerMenuMT.TriggerAPI.TriggerEnums import TriggerPeriod, TriggerType
57  periods = TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future
58  TriggerAPI.setConfigFlags(flags)
59  allUnprescaledTriggers = TriggerAPI.getLowestUnprescaledAnyPeriod(
60  periods, TriggerType.mu) + ["HLT_noalg_L1MU14FCH", "L1_MU14FCH"]
61  print("DRAW_ZMUMU: will skim on an OR of the following muon triggers (list provided at run-time by the TriggerAPI):")
62  for trig in allUnprescaledTriggers:
63  print(" **** {trig}".format(trig=trig))
64 
65  from DerivationFrameworkTools.DerivationFrameworkToolsConfig import TriggerSkimmingToolCfg
66  triggerSkimmingTool = result.getPrimaryAndMerge(TriggerSkimmingToolCfg(flags,
67  name="DRAWZMUMUTriggerSkimmingTool",
68  TriggerListOR=allUnprescaledTriggers))
69 
70  # Event selection tool
71  from DerivationFrameworkTools.DerivationFrameworkToolsConfig import FilterCombinationANDCfg
72  DRAW_ZMUMU_SkimmingTool = result.getPrimaryAndMerge(FilterCombinationANDCfg(flags,
73  name="DRAW_ZMUMU_FinalFilter",
74  FilterList=[dimuonMassSkimmingTool,
75  triggerSkimmingTool]))
76 
77  kwargs.setdefault("AugmentationTools", [muonSkimmingTool, mass_tool])
78  kwargs.setdefault("SkimmingTools", [DRAW_ZMUMU_SkimmingTool])
79  kwargs.setdefault("doChronoStat", flags.Concurrency.NumThreads <= 1)
80  the_alg = CompFactory.DerivationFramework.DerivationKernel(name, **kwargs)
81  result.addEventAlgo(the_alg, primary=True)
82  return result
83 
84 
85 def DRAW_ZmumuCfg(flags):
86  acc = ComponentAccumulator()
87 
88  # Main algorithm (kernel)
89  acc.merge(DRAW_ZmumuKernelCfg(flags), sequenceName="DRAWZMUMU_Sequence")
90  acc.merge(DRAWCommonByteStreamCfg(flags,
91  formatName='DRAW_ZMUMU',
92  filename=flags.Output.DRAW_ZmumuFileName))
93 
94  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
vtune_athena.format
format
Definition: vtune_athena.py:14
python.DerivationFrameworkToolsConfig.FilterCombinationANDCfg
def FilterCombinationANDCfg(ConfigFlags, name, **kwargs)
Definition: DerivationFrameworkToolsConfig.py:59
python.DerivationFrameworkToolsConfig.InvariantMassToolCfg
def InvariantMassToolCfg(ConfigFlags, name, **kwargs)
Invariant mass tool config.
Definition: DerivationFrameworkToolsConfig.py:44
python.CFElements.seqAND
def seqAND(name, subs=[])
Definition: CFElements.py:25
python.DerivationFrameworkToolsConfig.AsgSelectionToolWrapperCfg
def AsgSelectionToolWrapperCfg(ConfigFlags, name, **kwargs)
Definition: DerivationFrameworkToolsConfig.py:11
python.DerivationFrameworkToolsConfig.xAODStringSkimmingToolCfg
def xAODStringSkimmingToolCfg(ConfigFlags, name, **kwargs)
Definition: DerivationFrameworkToolsConfig.py:29
python.DRAW_ZMUMU.DRAW_ZmumuKernelCfg
def DRAW_ZmumuKernelCfg(flags, name="DRAW_ZMUMUKernel", **kwargs)
Definition: DRAW_ZMUMU.py:10
python.DerivationFrameworkToolsConfig.TriggerSkimmingToolCfg
def TriggerSkimmingToolCfg(ConfigFlags, name, **kwargs)
Trigger skimming list.
Definition: DerivationFrameworkToolsConfig.py:38
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.MuonSelectorToolsConfig.MuonSelectionToolCfg
def MuonSelectionToolCfg(flags, name="MuonSelectionTool", **kwargs)
Standard configuration of the MuonSelectionTool used in reconstruction & validation jobs The snippet ...
Definition: MuonSelectorToolsConfig.py:16
python.DRAWCommonByteStream.DRAWCommonByteStreamCfg
def DRAWCommonByteStreamCfg(flags, formatName, filename)
Definition: DRAWCommonByteStream.py:9
python.DRAW_ZMUMU.DRAW_ZmumuCfg
def DRAW_ZmumuCfg(flags)
Definition: DRAW_ZMUMU.py:85