ATLAS Offline Software
DRAW_TAULH.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 #!/usr/bin/env python
3 # ====================================================================
4 # DRAW_TAULH.py
5 # This defines DRAW_TAULH, a skimmed DRAW format
6 # ====================================================================
7 
8 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 from AthenaCommon.CFElements import seqAND
11 from AthenaCommon.Logging import logging
12 from PrimaryDPDMaker.DRAWCommonByteStream import DRAWCommonByteStreamCfg
13 
14 
15 def DRAW_TAULHKernelCfg(flags, name='DRAW_TAULHKernel', **kwargs):
16  """Configure DRAW_TAULH kernel"""
17 
18  mlog = logging.getLogger(name)
19  mlog.info('Start configuration')
20 
21  acc = ComponentAccumulator()
22  acc.addSequence(seqAND('DRAW_TAULHSequence'))
23 
24  # trigger-based skimming
25  # unprescaled - single electron and muon triggers
26  triggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(
27  name = "TAULH_TriggerSkimmingTool",
28  TriggerListOR = ["HLT_e26_lhtight_ivarloose_L1eEM26M",
29  "HLT_e60_lhmedium_L1eEM26M",
30  "HLT_e140_lhloose_L1eEM26M",
31  "HLT_mu24_ivarmedium_L1MU14FCH",
32  "HLT_mu50_L1MU14FCH"] )
33 
34  acc.addPublicTool(triggerSkimmingTool)
35  skimTool1 = triggerSkimmingTool
36 
37  # tau selection tool
38  from TauAnalysisTools.TauAnalysisToolsConfig import TauSelectionToolCfg
39  TauSelectorMedium = acc.popToolsAndMerge(TauSelectionToolCfg(flags,
40  name = 'TauSelectorMedium_TAULH',
41  ConfigPath = 'TauAnalysisAlgorithms/tau_selection_medium_noeleid.conf'))
42  acc.addPublicTool(TauSelectorMedium)
43 
44  from DerivationFrameworkTools.DerivationFrameworkToolsConfig import AsgSelectionToolWrapperCfg
45  TauMediumWrapper = acc.getPrimaryAndMerge(AsgSelectionToolWrapperCfg(flags,
46  name = "TauMediumWrapper_TAULH",
47  ContainerName = "TauJets",
48  StoreGateEntryName = "TauMedium_TAULH",
49  AsgSelectionTool = TauSelectorMedium))
50  acc.addPublicTool(TauMediumWrapper)
51 
52  # muon selection tool
53  from MuonSelectorTools.MuonSelectorToolsConfig import MuonSelectionToolCfg
54  MuonSelectorMedium = acc.popToolsAndMerge(MuonSelectionToolCfg(flags, name="MuonSelectorMedium_TAULH",
55  MaxEta=3, MuQuality=2))
56 
57  acc.addPublicTool(MuonSelectorMedium)
58 
59  MuonMediumWrapper = acc.getPrimaryAndMerge(AsgSelectionToolWrapperCfg(flags,
60  name = "MuonMediumWrapper_TAULH",
61  ContainerName = "Muons",
62  StoreGateEntryName = "MuonMedium_TAULH",
63  AsgSelectionTool = MuonSelectorMedium))
64  acc.addPublicTool(MuonMediumWrapper)
65 
66  # The Ztautau Lep-Had skimming using AOD string skimming and delta-R tool
67  # split into selections and requirements
68  el_sel = "(Electrons.pt > 27.0*GeV) && (abs(Electrons.eta) < 2.5) && (Electrons.LHMedium)"
69  mu_sel = "(Muons.pt > 25.0*GeV) && (abs(Muons.eta) < 3.0) && (Muons.MuonMedium_TAULH==1)"
70  tau_sel = "(TauJets.pt > 20*GeV) && (abs(TauJets.charge)==1)" \
71  " && ((TauJets.nChargedTracks == 1) || (TauJets.nChargedTracks == 3)) && (TauJets.TauMedium_TAULH==1)"
72 
73  # Add the deltaR tool for electrons
74  tauLH_DeltaRTool = CompFactory.DerivationFramework.DeltaRTool(name = "TAUEH_DeltaRTool",
75  ContainerName = "Electrons",
76  ObjectRequirements = el_sel,
77  SecondContainerName = "TauJets",
78  SecondObjectRequirements= tau_sel,
79  StoreGateEntryName = "TAUEH_DeltaR")
80  acc.addPublicTool(tauLH_DeltaRTool)
81 
82  #
83  elRequirement = '( count( ' + el_sel + ' ) == 1 )'
84  muRequirement = '( count( ' + mu_sel + ' ) == 1 )'
85  tauRequirement = '( count( ' + tau_sel + ' ) >= 1 )'
86 
87  # additional delta-R requirement for electrons to avoid double counting object
88  expression = "( ("+ elRequirement + " && (count (TAUEH_DeltaR > 0.1) >=1) ) || " + muRequirement + ") && " + tauRequirement
89 
90  stringSkimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(
91  name='TAULH_stringSkimmingTool',
92  expression = expression)
93  acc.addPublicTool(stringSkimmingTool)
94  skimTool2 = stringSkimmingTool
95 
96  # require trigger AND rec. selection requirements
97  combTool = CompFactory.DerivationFramework.FilterCombinationAND(name="tauSkim", FilterList=[skimTool1,skimTool2])
98  acc.addPublicTool(combTool,primary = True)
99 
100  # The kernel for delta-R tool
101  DRAW_TAULHPreKernel = CompFactory.DerivationFramework.DerivationKernel(
102  name='DRAW_TAULHPreKernel',
103  AugmentationTools=[TauMediumWrapper, MuonMediumWrapper],
104  SkimmingTools=[])
105  acc.addEventAlgo(DRAW_TAULHPreKernel, sequenceName='DRAW_TAULHSequence')
106 
107  # The main kernel algo
108  DRAW_TAULHKernel = CompFactory.DerivationFramework.DerivationKernel(
109  name='DRAW_TAULHKernel',
110  doChronoStat=(flags.Concurrency.NumThreads <= 1),
111  AugmentationTools=[tauLH_DeltaRTool],
112  SkimmingTools=[combTool])
113 
114  acc.addEventAlgo(DRAW_TAULHKernel, sequenceName='DRAW_TAULHSequence')
115 
116 
117 
118  return acc
119 
120 
121 def DRAW_TAULHCfg(flags):
122  """Main config fragment for DRAW_TAULH"""
123  acc = ComponentAccumulator()
124 
125  # Main algorithm (kernel)
126  acc.merge(DRAW_TAULHKernelCfg(flags, name='DRAW_TAULHKernel'))
127  acc.merge(DRAWCommonByteStreamCfg(flags,
128  formatName='DRAW_TAULH',
129  filename=flags.Output.DRAW_TAULHFileName))
130 
131  return acc
132 
133 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TauAnalysisToolsConfig.TauSelectionToolCfg
def TauSelectionToolCfg(ConfigFlags, name, **kwargs)
Definition: TauAnalysisToolsConfig.py:6
python.DRAW_TAULH.DRAW_TAULHCfg
def DRAW_TAULHCfg(flags)
Definition: DRAW_TAULH.py:121
python.CFElements.seqAND
def seqAND(name, subs=[])
Definition: CFElements.py:25
python.DRAW_TAULH.DRAW_TAULHKernelCfg
def DRAW_TAULHKernelCfg(flags, name='DRAW_TAULHKernel', **kwargs)
Definition: DRAW_TAULH.py:15
python.DerivationFrameworkToolsConfig.AsgSelectionToolWrapperCfg
def AsgSelectionToolWrapperCfg(ConfigFlags, name, **kwargs)
Definition: DerivationFrameworkToolsConfig.py:11
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