155def egammaAODFixesCfg(flags, correctCluster = True):
156
157 msg=logging.getLogger("egammaAODFixes")
158
159 doFix, fixes = runAODFix(flags, correctCluster)
160 msg.info('Decision for egamma AOD fix = %s',doFix)
161 if not doFix:
162 return None
163 else:
164 if fixes:
165 msg.info('Will apply fixes = %s', ', '.join(fixes))
166 else:
167 msg.info('Range is ok but there are no fix to apply')
168 return None
169
170
171
172
173 getfunc().__name__ = " ".join(fixes)
174
175 result=ComponentAccumulator()
176
177
178 hasElectrons = "Electrons" in flags.Input.Collections
179 hasPhotons = "Photons" in flags.Input.Collections
180 if not hasElectrons and not hasPhotons:
181 return None
182
183
184
185
186
187 from SGComps.AddressRemappingConfig import InputRenameCfg
188 if hasElectrons:
189 result.merge(InputRenameCfg("xAOD::ElectronContainer", "Electrons", "old_Electrons"))
190 result.merge(InputRenameCfg("xAOD::ElectronAuxContainer", "ElectronsAux.", "old_ElectronsAux."))
191 if hasPhotons:
192 result.merge(InputRenameCfg("xAOD::PhotonContainer", "Photons", "old_Photons"))
193 result.merge(InputRenameCfg("xAOD::PhotonAuxContainer", "PhotonsAux.", "old_PhotonsAux."))
194
195 kwargs = dict()
196 kwargs['CorrectCluster'] = 'egClusterL2_3Fix' in fixes
197 kwargs['FixAmbiguityLinks'] = 'egammaAmbiguityLinksFix' in fixes
198 kwargs['FixEGTopoetcone']= 'egammatopoIsoFix' in fixes
199 if 'egClusterL2_3Fix' in fixes:
200
201
202 from LArBadChannelTool.LArBadChannelConfig import LArBadChannelCfg
203 result.merge(LArBadChannelCfg(flags))
204
205
206 from CaloBadChannelTool.CaloBadChanToolConfig import CaloBadChanToolCfg
207 result.popToolsAndMerge( CaloBadChanToolCfg(flags) )
208 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
209 result.merge(LArGMCfg(flags))
210
211 result.merge(InputRenameCfg("xAOD::CaloClusterContainer", "egammaClusters", "old_egammaClusters"))
212 result.merge(InputRenameCfg("xAOD::CaloClusterAuxContainer", "egammaClustersAux.", "old_egammaClustersAux."))
213 result.merge(InputRenameCfg("CaloClusterCellLinkContainer", "egammaClusters_links", "old_egammaClusters_links"))
214 kwargs['CaloDetDescrManager'] = 'CaloDetDescrManager'
215 from egammaTools.egammaSwToolConfig import egammaSwToolCfg
216 kwargs['ClusterCorrectionTool'] = result.popToolsAndMerge(egammaSwToolCfg(flags))
217 from egammaMVACalib.egammaMVACalibConfig import egammaMVASvcCfg
218 kwargs['MVACalibSvc'] = result.getPrimaryAndMerge(egammaMVASvcCfg(flags))
219 kwargs['EGammaClustersOutputName'] = flags.Egamma.Keys.Output.CaloClusters
220 kwargs['EGammaClustersInputName'] = f'old_{flags.Egamma.Keys.Output.CaloClusters}'
221
222 kwargs['IsoLeakCorrectionTool'] = CompFactory.CP.IsolationCorrectionTool(
223 LogLogFitForLeakage = True)
224
225
226 result.addEventAlgo(CompFactory.egammaAODFixes(**kwargs))
227
228 return result
229
230
231