ATLAS Offline Software
AODFixConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from EventInfoMgt.TagInfoMgrConfig import TagInfoMgrCfg
5 from AthenaCommon.Logging import logging
6 
7 
8 _doneAODFixes=set()
9 
10 
11 def AODFixCfg(flags):
12 
13  nAODFixes=0
14  msg=logging.getLogger("AODFixCfg")
15  aodFixesDone=flags.Input.AODFixesDone
16 
17  if isinstance(aodFixesDone,str):
18  aodFixesDone=aodFixesDone.split()
19 
20  for doneFix in aodFixesDone:
21  _doneAODFixes.add(doneFix)
22 
23  result=ComponentAccumulator()
24 
25 
26  #Add list of known AOD Fixes here:
27  listOfFixes=[]
28 
29  #Example:
30  #from RecJobTransforms.AODFixDemoConfig import AODFixDemoCfg
31  #listOfFixes=[AODFixDemoCfg,]
32 
33 
34  for aodFix in listOfFixes:
35  aodFixName=aodFix.__name__
36  if aodFixName in _doneAODFixes:
37  msg.warning("AODFix %s already applied, not applying again",aodFixName)
38 
39  ca=aodFix(flags)
40  #The method is supposed to verify if the AOD-fix must be applied for the input data,
41  #typically based on flags.Input.Release. If yes, returns a ComponentAccumulator, otherwise None
42  if ca is not None:
43  msg.info("Applying AOD fix %s",aodFixName)
44  result.merge(ca)
45  _doneAODFixes.add(aodFixName)
46  nAODFixes+=1
47  else:
48  msg.info("AODFix \"%s\" not applicable for this input AOD",aodFixName)
49 
50 
51  if nAODFixes>0:
52  result.merge(TagInfoMgrCfg(flags,{"AODFixVersion":" ".join(_doneAODFixes)}))
53  else:
54  msg.info("No AOD fix scheduled")
55  return result
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.AODFixConfig.AODFixCfg
def AODFixCfg(flags)
Definition: AODFixConfig.py:11
python.TagInfoMgrConfig.TagInfoMgrCfg
def TagInfoMgrCfg(flags, tagValuePairs={})
Definition: TagInfoMgrConfig.py:6
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10