ATLAS Offline Software
Loading...
Searching...
No Matches
AODFixConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaCommon.Logging import logging
4from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5from EventInfoMgt.TagInfoMgrConfig import TagInfoMgrCfg
6
7_doneAODFixes = set()
8
9
10def AODFixCfg(flags):
11 msg = logging.getLogger("AODFixCfg")
12
13 if not isinstance(flags.Input.AODFixesDone, set):
14 raise TypeError("flags.Input.AODFixesDone must be a set, but is %s" % type(flags.Input.AODFixesDone))
15
16 if flags.Input.AODFixesDone:
17 msg.info("Already done AOD fixes = %s", flags.Input.AODFixesDone)
18
19 for doneFix in flags.Input.AODFixesDone:
20 _doneAODFixes.add(doneFix)
21
22 result = ComponentAccumulator()
23
24 # #Add list of known AOD Fixes here:
25 from egammaAlgs.egammaAODFixesConfig import egammaAODFixesCfg
26 from LArCellRec.EventInfoClearAlgConfig import EventVetoCearAlgCfg
27 listOfFixes = [
28 egammaAODFixesCfg,
29 EventVetoCearAlgCfg,
30 ]
31
32 fixApplied = False
33 for aodFix in listOfFixes:
34 # Basic string check to avoid applying the same AODFix twice, even if it is called from different places
35 if aodFix.__name__ in _doneAODFixes:
36 msg.warning("AODFix %s already applied, not applying again", aodFix.__name__)
37 continue
38
39 # The method is supposed to verify if the AOD-fix must be applied for the input data,
40 # typically based on flags.Input.Release. If yes, returns a ComponentAccumulator, otherwise None
41 ca = aodFix(flags)
42 if ca is not None:
43 msg.info("Applying AOD fix %s", aodFix.__name__)
44 result.merge(ca)
45 if " " in aodFix.__name__:
46 for fix in aodFix.__name__.split(" "):
47 _doneAODFixes.add(fix)
48 else:
49 _doneAODFixes.add(aodFix.__name__)
50 fixApplied = True
51 else:
52 msg.info("AODFix \"%s\" not applicable for this input AOD", aodFix.__name__)
53
54 if fixApplied:
55 result.merge(TagInfoMgrCfg(flags,{"AODFixVersion":" ".join(sorted(_doneAODFixes))}))
56 else:
57 msg.info("No AOD fix scheduled")
58 return result
STL class.