ATLAS Offline Software
TileHitVecToNtupleConfig.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 from 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 
12 from AthenaConfiguration.ComponentFactory import CompFactory
13 
14 
15 def 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 
45 if __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)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TileHitToNtuple
Definition: TileHitToNtuple.h:36
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:312
Constants
some useful constants -------------------------------------------------—
TileHitVecToNtupleConfig.TileHitVecToNtupleCfg
def TileHitVecToNtupleCfg(flags, outputFile=None, **kwargs)
Definition: TileHitVecToNtupleConfig.py:15
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:71
python.TileCablingSvcConfig.TileCablingSvcCfg
def TileCablingSvcCfg(flags)
Definition: TileCablingSvcConfig.py:11
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7