ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaPoolExample_ReadAgain.py
Go to the documentation of this file.
1#!/env/python
2
3# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4
5
15
16from AthenaConfiguration.AllConfigFlags import initConfigFlags
17from AthenaConfiguration.ComponentFactory import CompFactory
18from AthenaCommon.Constants import DEBUG
19
20# Setup flags
21flags = initConfigFlags()
22flags.Input.Files = ["EmptyPoolFile.root", "SimplePoolReplica1.root",
23 "EmptyPoolFile.root", "SimplePoolFile2.root", "SimplePoolFile4.root"]
24flags.Exec.MaxEvents = -1
25flags.Common.MsgSuppression = False
26flags.Exec.DebugMessageComponents = ["ReadData", "PoolSvc",
27 "AthenaPoolAddressProviderSvc", "MetaDataSvc", "EventSelector"]
28
29#Run3 for now
30from AthenaConfiguration.TestDefaults import defaultGeometryTags
31flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
32
33flags.lock()
34
35# Main services
36from AthenaConfiguration.MainServicesConfig import MainServicesCfg
37acc = MainServicesCfg( flags )
38
39# Configure AthenaPool reading
40from AthenaPoolExampleAlgorithms.AthenaPoolExampleConfig import AthenaPoolExampleReadCfg
41acc.merge( AthenaPoolExampleReadCfg(flags, readCatalogs = ["file:Catalog1.xml"]) )
42
43# Creata and attach the reading algorithm
44acc.addEventAlgo( CompFactory.AthPoolEx.ReadData("ReadData", OutputLevel = DEBUG) )
45
46evSelector = acc.getService("EventSelector")
47evSelector.SkipEvents = 8 # // skip the first 8 events
48evSelector.SkipEventSequence = [ 9, 10 ] # // skip two more events
49#evSelector.SkipEventSequence = " 4-6,7 , 8 , 9 - 10 "; # // skip seven more events
50#evSelector.ProcessEventSequence = "11, 12, 13,14,15, 16-20, 21 - 25 , 26- 100"; # // skip two more events
51#svcMgr.EventSelector.CounterTool = "EventSelectorCounterTool/Counter"
52
53#Switch Off for TAG - start
54poolAttribs = acc.getService("AthenaPoolCnvSvc").InputPoolAttributes
55# Turn on the tree cache for the CollectionTree - tree cache only works for one tree.
56# And set tree cache size - default is 10 MB (10 000 000)
57poolAttribs += [ "DatabaseName = '*'; ContainerName = 'CollectionTree'; TREE_CACHE = '100000'" ]
58
59# Print out values - must have PoolSvc in info mode
60poolAttribs += [ "DatabaseName = '*'; TREE_CACHE_SIZE = 'int'" ]
61
62# Print out for each event the number of bytes read and the number of
63# read calls. With the tree cache, one should see jumps in the bytes
64# read by the cache size, i.e. the bytes read should not change each
65# event. However, the cache only works on one tree - the main event
66# tree (CollectionTree) - and we read some things from other trees, so
67# one does see a small increase event-by-event.
68printOpts = acc.getService("AthenaPoolCnvSvc").PrintInputAttrPerEvt
69printOpts += [ "DatabaseName = '*'; BYTES_READ = 'double'" ]
70printOpts += [ "DatabaseName = '*'; READ_CALLS = 'int'" ]
71#Switch Off for TAG - end
72
73# Run
74import sys
75sc = acc.run(flags.Exec.MaxEvents)
76sys.exit(sc.isFailure())