ATLAS Offline Software
DRAW_EGZ.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 
4 #!/usr/bin/env python
5 # ====================================================================
6 # DRAW_EGZ.py
7 # This defines DRAW_EGZ, a skimmed DRAW format
8 # Z->ee, eey and mmy reduction for electron and photon ID and calibration
9 # ====================================================================
10 
11 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
12 from AthenaConfiguration.ComponentFactory import CompFactory
13 from AthenaCommon.CFElements import seqAND
14 from AthenaCommon.Logging import logging
15 from PrimaryDPDMaker.DRAWCommonByteStream import DRAWCommonByteStreamCfg
16 
17 
18 def DRAW_EGZKernelCfg(configFlags, name='DRAW_EGZKernel', **kwargs):
19  """Configure DRAW_EGZ kerne"""
20 
21  mlog = logging.getLogger(name)
22  mlog.info('Start configuration')
23 
24  acc = ComponentAccumulator()
25  acc.addSequence(seqAND('DRAW_EGZSequence'))
26 
27  # The selections
28  DRAWEGZSel = {}
29  DRAWEGZSel['Zee'] = [
30  'Electrons.pt > 20*GeV && Electrons.LHMedium',
31  'eeMass1',
32  '(count(eeMass1 > 55*GeV) >= 1)']
33  DRAWEGZSel['Zeey'] = [
34  'Electrons.pt > 15*GeV && Electrons.LHMedium',
35  'eeMass2',
36  '(count(eeMass2 > 20*GeV && eeMass2 < 90*GeV) >= 1 && count(Photons.pt > 7*GeV && Photons.Tight) >= 1)']
37  DRAWEGZSel['Zmmy'] = [
38  'Muons.pt > 15*GeV',
39  'mmMass',
40  '(count(mmMass > 20*GeV && mmMass < 90*GeV) >= 1 && count(Photons.pt > 7*GeV && Photons.Tight) >= 1)']
41  DRAWEGZSel['Zefe'] = [
42  'Electrons.pt > 20*GeV && Electrons.LHMedium',
43  'eeMass3',
44  '(count(eeMass3 > 55*GeV) >=1'
45  ' && count(Electrons.pt > 20*GeV && Electrons.LHMedium)'
46  ' && count(ForwardElectrons.pt > 20*GeV && ForwardElectrons.Loose))',
47  'ForwardElectrons.pt > 20*GeV && ForwardElectrons.Loose']
48  # Augmentation tools for the di-lepton mass computations
49  EventSels = []
50  augmentationTools = []
51  for key, sel in DRAWEGZSel.items():
52  if key == 'Zefe':
53  tool = CompFactory.DerivationFramework.EGInvariantMassTool(
54  name=f'llmassToolFor{key}',
55  Container1Name='Electrons',
56  Container2Name='ForwardElectrons',
57  Object1Requirements=sel[0],
58  Object2Requirements=sel[3],
59  Mass1Hypothesis=0.511,
60  Mass2Hypothesis=0.511,
61  CheckCharge=False,
62  StoreGateEntryName=sel[1])
63  else:
64  tool = CompFactory.DerivationFramework.InvariantMassTool(
65  name=f'llmassToolFor{key}',
66  ContainerName='Electrons' if key.find('Zee') >= 0 else 'Muons',
67  ObjectRequirements=sel[0],
68  MassHypothesis=0.511 if key.find('Zee') >= 0 else 105.66,
69  StoreGateEntryName=sel[1])
70 
71  augmentationTools.append(tool)
72  acc.addPublicTool(tool)
73  EventSels.append(sel[2])
74  draw_egz = " || ".join(EventSels)
75  mlog.info('DRAW_EGZ selection '+draw_egz)
76 
77  # The skimming tool
78  skimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(
79  name='DRAW_EGZSkimmingTool',
80  expression=draw_egz)
81  acc.addPublicTool(skimmingTool)
82 
83  # The main kernel algo
84  DRAW_EGZKernel = CompFactory.DerivationFramework.DerivationKernel(
85  name='DRAW_EGZKernel',
86  doChronoStat=(configFlags.Concurrency.NumThreads <= 1),
87  AugmentationTools=augmentationTools,
88  SkimmingTools=[skimmingTool])
89 
90  acc.addEventAlgo(DRAW_EGZKernel, sequenceName='DRAW_EGZSequence')
91  return acc
92 
93 
94 def DRAW_EGZCfg(flags):
95  """Main config fragment for DRAW_EGZ"""
96  acc = ComponentAccumulator()
97 
98  # Main algorithm (kernel)
99  acc.merge(DRAW_EGZKernelCfg(flags, name='DRAW_EGZKernel'))
100  acc.merge(DRAWCommonByteStreamCfg(flags,
101  formatName='DRAW_EGZ',
102  filename=flags.Output.DRAW_EGZFileName))
103 
104  return acc
python.DRAW_EGZ.DRAW_EGZKernelCfg
def DRAW_EGZKernelCfg(configFlags, name='DRAW_EGZKernel', **kwargs)
Definition: DRAW_EGZ.py:18
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.CFElements.seqAND
def seqAND(name, subs=[])
Definition: CFElements.py:25
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.DRAW_EGZ.DRAW_EGZCfg
def DRAW_EGZCfg(flags)
Definition: DRAW_EGZ.py:94
python.DRAWCommonByteStream.DRAWCommonByteStreamCfg
def DRAWCommonByteStreamCfg(flags, formatName, filename)
Definition: DRAWCommonByteStream.py:9