8 addFwd = False):
9
10 acc = ComponentAccumulator()
11
12
13 from ROOT import LikeEnum
14 from ElectronPhotonSelectorTools.EgammaPIDdefs import egammaPID
15
16 eidWP = { 'Loose' : LikeEnum.Loose, 'Medium' : LikeEnum.Medium, 'Tight' : LikeEnum.Tight }
17 gidWP = { 'Loose' : egammaPID.PhotonIDLoose, 'Tight' : egammaPID.PhotonIDTight }
18 gisoWP = [ 'FixedCutTight', 'FixedCutLoose', 'TightCaloOnly' ]
19
20 kwarg = {}
21
22 if particleType == 'electron' or particleType == 'dataZ':
23 kwarg['ElectronsKey'] = 'Electrons'
24 kwarg['GSFTrackParticlesKey'] = 'GSFTrackParticles'
25
26 if particleType == 'electron':
27 from ElectronPhotonSelectorTools.AsgElectronLikelihoodToolsConfig import (
28 AsgElectronLikelihoodToolCfg)
29 for k,w in eidWP.items():
30 t = AsgElectronLikelihoodToolCfg(flags, k+'LHSelector', w)
31 kwarg[k+'_Ele'] = t.popPrivateTools()
32 acc.merge(t)
33 if addFwd:
34 kwarg['FwdElectronsKey'] = 'ForwardElectrons'
35 from ElectronPhotonSelectorTools.AsgForwardElectronLikelihoodToolConfig import (
36 AsgForwardElectronLikelihoodToolCfg)
37 for k in eidWP.keys():
38
39
40 configFile = f'dev/ElectronPhotonSelectorTools/offline/mc16_20190729/FwdLH{k}Conf.conf'
41 t = AsgForwardElectronLikelihoodToolCfg(flags,k+'FwdSelector',
42 ConfigFile = configFile)
43 kwarg[k+'_FwdEle'] = t.popPrivateTools()
44 acc.merge(t)
45
46 if particleType == 'gamma':
47 from ElectronPhotonSelectorTools.AsgPhotonIsEMSelectorsConfig import (
48 AsgPhotonIsEMSelectorCfg)
49 for k,w in gidWP.items():
50 t = AsgPhotonIsEMSelectorCfg(flags, k+'_Photon', w)
51 kwarg[k+'_Photon'] = t.popPrivateTools()
52 acc.merge(t)
53
54 from IsolationSelection.IsolationSelectionConfig import IsolationSelectionToolCfg
55 for k in gisoWP:
56 t = IsolationSelectionToolCfg(flags, 'PhIso'+k, PhotonWP=k)
57 name = f'Iso{k}'
58 kwarg[name] = t.popPrivateTools()
59 acc.merge(t)
60 kwarg['PhotonsKey'] = 'Photons'
61
62
63 if particleType != 'dataZ':
64 from MCTruthClassifier.MCTruthClassifierConfig import MCTruthClassifierCfg
65 MCClassifier = acc.popToolsAndMerge(MCTruthClassifierCfg(flags))
66 kwarg['egammaTruthParticlesKey'] = 'egammaTruthParticles'
67 kwarg['truthParticlesKey'] = 'TruthParticles'
68 else:
69 MCClassifier = None
70
71 from AthenaConfiguration.Enums import LHCPeriod
72 if flags.GeoModel.Run > LHCPeriod.Run3:
73 kwarg['hasTRT'] = False
74
75
76 egMon = CompFactory.EgammaMonitoring(
77 name = 'egammaMonitoringAlg',
78 sampleType = particleType,
79 MCTruthClassifier = MCClassifier,
80 **kwarg)
81 acc.addEventAlgo(egMon)
82
83
84 svc = CompFactory.THistSvc(name="THistSvc")
85 svc.Output = [f"MONITORING DATAFILE='{outputFileName}.root' OPT='RECREATE'"]
86 acc.addService(svc)
87
88 return acc