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