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 EGammaFudgeMCTool="",
67 CutType="",
68 StoreGateEntryName="DFCommonElectronsECIDS",
69 ContainerName="LRTElectrons",
70 StoreTResult=True,
71 )
72 ))
73
74
75
76 from DerivationFrameworkEGamma.EGammaToolsConfig import EGElectronAmbiguityToolCfg
77
78 LRTElectronAmbiguity = acc.addPublicTool(acc.popToolsAndMerge(
79 EGElectronAmbiguityToolCfg(
80 flags,
81 name="LRTElectronAdditionnalAmbiguity",
82 idCut="DFCommonElectronsLHLooseNoPix",
83 ContainerName="LRTElectrons",
84 isMC=flags.Input.isMC,
85 )
86 ))
87
88
89 LRTEGAugmentationTools = [LRTElectronAmbiguity]
90 if flags.Derivation.Egamma.addECIDS:
91 LRTEGAugmentationTools.extend([LRTElectronPassECIDS])
92
93
94
95 if flags.Derivation.Egamma.addMissingCellInfo:
96 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import EgammaCoreCellRecoveryCfg
97
98 CoreCellRecoveryTool = acc.addPublicTool(acc.popToolsAndMerge(
99 EgammaCoreCellRecoveryCfg(flags,
100 name = "LRTCoreCellRecoveryTool",
101 SGKey_photons = "",
102 SGKey_electrons = "LRTElectrons")
103 ))
104 LRTEGAugmentationTools.append(CoreCellRecoveryTool)
105
106
107
108 if flags.Input.isMC:
109
110 from DerivationFrameworkEGamma.EGammaToolsConfig import (
111 BkgElectronClassificationCfg,
112 )
113
114 BkgLRTElectronClassificationTool = acc.addPublicTool(acc.popToolsAndMerge(
115 BkgElectronClassificationCfg(
116 flags,
117 name="BkgLRTElectronClassificationTool",
118 ElectronContainerName="LRTElectrons"
119 )
120 ))
121 LRTEGAugmentationTools.append(BkgLRTElectronClassificationTool)
122
123
124
125
126
127 acc.addEventAlgo(
128 CompFactory.DerivationFramework.CommonAugmentation(
129 "EGammaLRTKernel", AugmentationTools=LRTEGAugmentationTools
130 )
131 )
132
133
134
135
136 from IsolationAlgs.DerivationTrackIsoConfig import DerivationTrackIsoCfg
137
138 acc.merge(
139 DerivationTrackIsoCfg(
140 flags, object_types=("Electrons", "Muons"), postfix="LRT"
141 )
142 )
143
144 if not hasattr(acc, "LRTElectronCaloIsolationBuilder"):
145 from IsolationAlgs.IsolationSteeringDerivConfig import (
146 LRTElectronIsolationSteeringDerivCfg,
147 )
148
149 acc.merge(LRTElectronIsolationSteeringDerivCfg(flags))
150
151 from IsolationAlgs.IsolationBuilderConfig import egIsolationCfg
152
153 acc.merge(
154 egIsolationCfg(
155 flags,
156 name="electronIsolationLRT",
157
158 noCalo=True,
159 ElectronCollectionContainerName="LRTElectrons",
160 )
161 )
162
163 return acc