ATLAS Offline Software
Loading...
Searching...
No Matches
TileMuonFitterConfig.py
Go to the documentation of this file.
2# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3#
4'''
5@file TileMuonFitterConfig.py
6@brief Python configuration of Tile Muon Fitter algorithm for the Run III
7'''
8
9from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
10from AthenaConfiguration.ComponentFactory import CompFactory
11
12def TileMuonFitterCfg(flags, **kwargs):
13
14 acc = ComponentAccumulator()
15
16 kwargs.setdefault('DoHoughTransform', True)
17 kwargs.setdefault('EThreshold', 250.0)
18 kwargs.setdefault('BeamType', flags.Beam.Type.value)
19 kwargs.setdefault('CaloCellContainer', 'AllCalo')
20
21 if kwargs['DoHoughTransform']:
22 kwargs.setdefault('name', 'TileMuonFitter')
23 kwargs.setdefault('ComTimeKey', 'ComTimeTileMuon')
24 kwargs.setdefault('TileCosmicMuonKey', 'TileCosmicMuonHT')
25 else:
26 kwargs.setdefault('name', 'TileMuonFitterMF')
27 kwargs.setdefault('ComTimeKey', 'ComTimeTileMuonMF')
28 kwargs.setdefault('TileCosmicMuonKey', 'TileCosmicMuonMF')
29
30 from TileGeoModel.TileGMConfig import TileGMCfg
31 acc.merge(TileGMCfg(flags))
32
33 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
34 acc.merge(LArGMCfg(flags))
35
36 TileMuonFitter=CompFactory.TileMuonFitter
37 acc.addEventAlgo(TileMuonFitter(**kwargs), primary = True)
38
39 return acc
40
41
42def TileMuonFitterOutputCfg(flags, streamName = 'ESD', **kwargs):
43
44 acc = TileMuonFitterCfg(flags, **kwargs)
45 muonFitter = acc.getPrimary()
46
47 cosmiMuonContainer = muonFitter.TileCosmicMuonKey
48 cosmiMuonContainer = cosmiMuonContainer.split('+').pop()
49 outputItemList = ['TileCosmicMuonContainer#' + cosmiMuonContainer]
50
51 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
52 acc.merge( OutputStreamCfg(flags, streamName, ItemList = outputItemList) )
53
54 return acc
55
56
57if __name__=='__main__':
58
59 # Setup logs
60 from AthenaCommon.Logging import log
61 from AthenaCommon.Constants import INFO
62 log.setLevel(INFO)
63
64 # Set the Athena configuration flags
65 from AthenaConfiguration.AllConfigFlags import initConfigFlags
66 from AthenaConfiguration.TestDefaults import defaultTestFiles
67 flags = initConfigFlags()
68 flags.Input.Files = defaultTestFiles.ESD
69 flags.DQ.useTrigger = False
70 flags.DQ.enableLumiAccess = False
71 flags.lock()
72
73 # Initialize configuration object, add accumulator, merge, and run.
74 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
75 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
76 cfg = MainServicesCfg(flags)
77 cfg.merge(PoolReadCfg(flags))
78
79 cfg.merge( TileMuonFitterCfg(flags) )
80
81 cfg.printConfig(withDetails = True, summariseProps = True)
82 flags.dump()
83
84 cfg.store( open('TileMuonFitter.pkl','wb') )
85
86 sc = cfg.run(maxEvents=3)
87
88 import sys
89 # Success should be 0
90 sys.exit(not sc.isSuccess())
Fits straight cosmic muon track to TileCal event.
TileMuonFitterCfg(flags, **kwargs)
TileMuonFitterOutputCfg(flags, streamName='ESD', **kwargs)