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
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
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
77 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
78 xAODStringSkimmingToolCfg)
79 skimmingTool = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
80 flags, name='DRAW_EGZSkimmingTool', expression=draw_egz))
81
82
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