ATLAS Offline Software
Loading...
Searching...
No Matches
TileHitVecToNtupleConfig.py
Go to the documentation of this file.
2# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3#
4
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6
7'''
8@file TileHitVecToNtupleConfig.py
9@brief Python configuration of Tile hit vector to ntuple algorithm for the Run III
10'''
11
12from AthenaConfiguration.ComponentFactory import CompFactory
13
14
15def TileHitVecToNtupleCfg(flags, outputFile=None, **kwargs):
16 ''' Function to configure Tile hit vector to h32 ntuple algorithm.'''
17
18 acc = ComponentAccumulator()
19
20 from TileGeoModel.TileGMConfig import TileGMCfg
21 acc.merge(TileGMCfg(flags))
22
23 from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
24 acc.merge( TileCablingSvcCfg(flags) )
25
26 if not outputFile:
27 outputFile = 'tiletb.ntup.root'
28
29 ntupleSvc = CompFactory.NTupleSvc()
30 ntupleSvc.Output = ["NTUP DATAFILE='%s' OPT='NEW'" % outputFile]
31 acc.addService(ntupleSvc)
32
33 kwargs.setdefault('MaxLength', 99999)
34 kwargs.setdefault('TileHitVector', 'TileHitVec')
35 kwargs.setdefault('NTupleLoc', '/NTUP')
36
37 TileHitToNtuple = CompFactory.TileHitVecToNtuple
38 acc.addEventAlgo(TileHitToNtuple(**kwargs), primary=True)
39
40 acc.setAppProperty('HistogramPersistency', 'ROOT')
41
42 return acc
43
44
45if __name__ == '__main__':
46
47 # Set the Athena configuration flags
48 from AthenaConfiguration.AllConfigFlags import initConfigFlags
49 flags = initConfigFlags()
50
51 # Setup logs
52 from AthenaCommon.Logging import log
53 from AthenaCommon.Constants import INFO
54 log.setLevel(INFO)
55
56 from AthenaConfiguration.TestDefaults import defaultTestFiles
57 flags.Input.Files = defaultTestFiles.HITS_RUN3
58 flags.Exec.MaxEvents = 3
59 flags.fillFromArgs()
60
61 log.info('FINAL CONFIG FLAGS SETTINGS FOLLOW')
62 flags.dump()
63
64 flags.lock()
65
66 # Initialize configuration object, add accumulator, merge, and run.
67 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
68 cfg = MainServicesCfg(flags)
69
70 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
71 cfg.merge(PoolReadCfg(flags))
72
73 cfg.merge(TileHitVecToNtupleCfg(flags))
74
75 cfg.printConfig(withDetails=True, summariseProps=True)
76
77 cfg.store( open('TileHitVecToNtupleConfig.pkl', 'wb') )
78
79 sc = cfg.run()
80
81 import sys
82 # Success should be 0
83 sys.exit(0 if sc.isSuccess() else 1)
TileHitVecToNtupleCfg(flags, outputFile=None, **kwargs)