ATLAS Offline Software
CaloBadChanToolConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 """Define method to construct configured private Calo bad channels tool"""
4 
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 
8 def CaloBadChanToolCfg(flags, **kwargs):
9  """Return component accumulator with configured private Calo bad channels tool
10 
11  Arguments:
12  flags -- Athena configuration flags (ConfigFlags)
13  """
14 
15  kwargs.setdefault('name', 'CaloBadChanTool')
16  kwargs.setdefault('LArBadChanKey', 'LArBadChannel')
17 
18  from LArBadChannelTool.LArBadChannelConfig import LArBadChannelCfg
19  acc = LArBadChannelCfg(flags)
20 
21  if 'TileBadChanTool' not in kwargs:
22  from TileConditions.TileBadChannelsConfig import TileBadChanToolCfg
23  badChannelsTool = acc.popToolsAndMerge( TileBadChanToolCfg(flags) )
24  kwargs['TileBadChanTool'] = badChannelsTool
25 
26  CaloBadChanTool=CompFactory.CaloBadChanTool
27  acc.setPrivateTools(CaloBadChanTool(**kwargs))
28 
29  return acc
30 
31 
32 if __name__ == "__main__":
33 
34  from AthenaConfiguration.AllConfigFlags import initConfigFlags
35  from AthenaConfiguration.TestDefaults import defaultGeometryTags, defaultTestFiles
36  from AthenaCommon.Logging import log
37  from AthenaCommon.Constants import DEBUG
38 
39  # Test setup
40  log.setLevel(DEBUG)
41 
42  flags = initConfigFlags()
43  flags.Input.Files = defaultTestFiles.RAW_RUN2
44  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
45 
46  flags.fillFromArgs()
47  flags.lock()
48 
50 
51  print( acc.popToolsAndMerge( CaloBadChanToolCfg(flags) ) )
52  flags.dump()
53 
54  acc.printConfig(withDetails = True, summariseProps = True)
55  acc.store( open('CaloBadChanTool.pkl','wb') )
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.LArBadChannelConfig.LArBadChannelCfg
def LArBadChannelCfg(configFlags, tag=None, isSC=False)
Definition: LArBadChannelConfig.py:8
python.TileBadChannelsConfig.TileBadChanToolCfg
def TileBadChanToolCfg(flags, **kwargs)
Definition: TileBadChannelsConfig.py:83
CaloBadChanToolConfig.CaloBadChanToolCfg
def CaloBadChanToolCfg(flags, **kwargs)
Definition: CaloBadChanToolConfig.py:8
Constants
some useful constants -------------------------------------------------—
Trk::open
@ open
Definition: BinningType.h:40
CaloBadChanTool
Definition: CaloBadChanTool.h:19
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28