18def 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
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
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
78 skimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(
79 name='DRAW_EGZSkimmingTool',
80 expression=draw_egz)
81 acc.addPublicTool(skimmingTool)
82
83
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