ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
AthenaPOOL
AthenaPoolExample
AthenaPoolExampleAlgorithms
python
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
16
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
17
from
AthenaConfiguration.ComponentFactory
import
CompFactory
18
from
AthenaCommon.Constants
import
DEBUG
19
20
# Setup flags
21
flags = initConfigFlags()
22
flags.Input.Files = [
"EmptyPoolFile.root"
,
"SimplePoolReplica1.root"
,
23
"EmptyPoolFile.root"
,
"SimplePoolFile2.root"
,
"SimplePoolFile4.root"
]
24
flags.Exec.MaxEvents = -1
25
flags.Common.MsgSuppression =
False
26
flags.Exec.DebugMessageComponents = [
"ReadData"
,
"PoolSvc"
,
27
"AthenaPoolAddressProviderSvc"
,
"MetaDataSvc"
,
"EventSelector"
]
28
29
#Run3 for now
30
from
AthenaConfiguration.TestDefaults
import
defaultGeometryTags
31
flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
32
33
flags.lock()
34
35
# Main services
36
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
37
acc = MainServicesCfg( flags )
38
39
# Configure AthenaPool reading
40
from
AthenaPoolExampleAlgorithms.AthenaPoolExampleConfig
import
AthenaPoolExampleReadCfg
41
acc.merge( AthenaPoolExampleReadCfg(flags, readCatalogs = [
"file:Catalog1.xml"
]) )
42
43
# Creata and attach the reading algorithm
44
acc.addEventAlgo( CompFactory.AthPoolEx.ReadData(
"ReadData"
, OutputLevel = DEBUG) )
45
46
evSelector = acc.getService(
"EventSelector"
)
47
evSelector.SkipEvents = 8
# // skip the first 8 events
48
evSelector.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
54
poolAttribs = 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)
57
poolAttribs += [
"DatabaseName = '*'; ContainerName = 'CollectionTree'; TREE_CACHE = '100000'"
]
58
59
# Print out values - must have PoolSvc in info mode
60
poolAttribs += [
"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.
68
printOpts = acc.getService(
"AthenaPoolCnvSvc"
).PrintInputAttrPerEvt
69
printOpts += [
"DatabaseName = '*'; BYTES_READ = 'double'"
]
70
printOpts += [
"DatabaseName = '*'; READ_CALLS = 'int'"
]
71
#Switch Off for TAG - end
72
73
# Run
74
import
sys
75
sc = acc.run(flags.Exec.MaxEvents)
76
sys.exit(sc.isFailure())
Constants
Generated on
for ATLAS Offline Software by
1.17.0