15def EGammaLRTCfg(flags):
16 """Main config method for LRT e-gamma decorations"""
17
18 acc = ComponentAccumulator()
19
20
21
22
23
24
25
26
27
28
29
30
31 if not hasattr(acc, "ElectronChargeIDSelectorLoose"):
32 if flags.Derivation.Egamma.addECIDS:
33 from ElectronPhotonSelectorTools.AsgElectronChargeIDSelectorToolConfig import (
34 AsgElectronChargeIDSelectorToolCfg,
35 )
36
37 ElectronChargeIDSelector = acc.popToolsAndMerge(
38 AsgElectronChargeIDSelectorToolCfg(
39 flags, name="ElectronChargeIDSelectorLoose"
40 )
41 )
42 ElectronChargeIDSelector.primaryVertexContainer = "PrimaryVertices"
43 ElectronChargeIDSelector.TrainingFile = (
44 "ElectronPhotonSelectorTools/ChargeID/"
45 + "ECIDS_20180731rel21Summer2018.root"
46 )
47 acc.addPublicTool(ElectronChargeIDSelector)
48
49
50
51
52 from DerivationFrameworkEGamma.EGammaToolsConfig import (
53 EGElectronLikelihoodToolWrapperCfg,
54 )
55
56
57
58
59
60 if flags.Derivation.Egamma.addECIDS:
61 LRTElectronPassECIDS = acc.addPublicTool(acc.popToolsAndMerge(
62 EGElectronLikelihoodToolWrapperCfg(
63 flags,
64 name="LRTElectronPassECIDS",
65 EGammaElectronLikelihoodTool=ElectronChargeIDSelector,
66 CutType="",
67 StoreGateEntryName="DFCommonElectronsECIDS",
68 ContainerName="LRTElectrons",
69 StoreTResult=True,
70 )
71 ))
72
73
74
75 from DerivationFrameworkEGamma.EGammaToolsConfig import EGElectronAmbiguityToolCfg
76
77 LRTElectronAmbiguity = acc.addPublicTool(acc.popToolsAndMerge(
78 EGElectronAmbiguityToolCfg(
79 flags,
80 name="LRTElectronAdditionnalAmbiguity",
81 idCut="DFCommonElectronsLHLooseNoPix",
82 ContainerName="LRTElectrons",
83 isMC=flags.Input.isMC,
84 )
85 ))
86
87
88 LRTEGAugmentationTools = [LRTElectronAmbiguity]
89 if flags.Derivation.Egamma.addECIDS:
90 LRTEGAugmentationTools.extend([LRTElectronPassECIDS])
91
92
93
94 if flags.Derivation.Egamma.addMissingCellInfo:
95 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import EgammaCoreCellRecoveryCfg
96
97 CoreCellRecoveryTool = acc.addPublicTool(acc.popToolsAndMerge(
98 EgammaCoreCellRecoveryCfg(flags,
99 name = "LRTCoreCellRecoveryTool",
100 SGKey_photons = "",
101 SGKey_electrons = "LRTElectrons")
102 ))
103 LRTEGAugmentationTools.append(CoreCellRecoveryTool)
104
105
106
107 if flags.Input.isMC:
108
109 from DerivationFrameworkEGamma.EGammaToolsConfig import (
110 BkgElectronClassificationCfg,
111 )
112
113 BkgLRTElectronClassificationTool = acc.addPublicTool(acc.popToolsAndMerge(
114 BkgElectronClassificationCfg(
115 flags,
116 name="BkgLRTElectronClassificationTool",
117 ElectronContainerName="LRTElectrons"
118 )
119 ))
120 LRTEGAugmentationTools.append(BkgLRTElectronClassificationTool)
121
122
123
124
125
126 acc.addEventAlgo(
127 CompFactory.DerivationFramework.CommonAugmentation(
128 "EGammaLRTKernel", AugmentationTools=LRTEGAugmentationTools
129 )
130 )
131
132
133
134
135 from IsolationAlgs.DerivationTrackIsoConfig import DerivationTrackIsoCfg
136
137 acc.merge(
138 DerivationTrackIsoCfg(
139 flags, object_types=("Electrons", "Muons"), postfix="LRT"
140 )
141 )
142
143 if not hasattr(acc, "LRTElectronCaloIsolationBuilder"):
144 from IsolationAlgs.IsolationSteeringDerivConfig import (
145 LRTElectronIsolationSteeringDerivCfg,
146 )
147
148 acc.merge(LRTElectronIsolationSteeringDerivCfg(flags))
149
150 from IsolationAlgs.IsolationBuilderConfig import egIsolationCfg
151
152 acc.merge(
153 egIsolationCfg(
154 flags,
155 name="electronIsolationLRT",
156
157 noCalo=True,
158 ElectronCollectionContainerName="LRTElectrons",
159 )
160 )
161
162 return acc