ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
AthenaPOOL
AthenaPoolCnvSvc
python
PoolAttributeHelper.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2
3
""" A basic module that helps with setting various common Pool Attributes """
4
5
def
setPoolAttribute
( **kwargs ):
6
""" The low-level function that builds the requested Pool Attribure string. """
7
8
# Resolve the variables for convenience
9
fileName = kwargs.get(
'fileName'
)
10
contName = kwargs.get(
'contName'
)
11
attrName = kwargs.get(
'attrName'
)
12
attrValue = kwargs.get(
'attrValue'
)
13
14
# Now let's build the string
15
result =
""
16
17
# First set the domain attribute
18
if
not
attrName
or
not
attrValue:
19
return
result
20
result += f
"{attrName} = '{attrValue}';"
21
22
# Then set database and container level attributes
23
# These are optional: can set both, only one, or neither
24
if
contName:
25
result = f
"ContainerName = '{contName}'; {result}"
26
if
fileName:
27
result = f
"DatabaseName = '{fileName}'; {result}"
28
29
# Finally return the result
30
return
result
31
32
def
setFileCompAlg
( fileName = None, compAlg = None ):
33
""" Convenience method for setting the compression algorithm for a given file. """
34
35
return
setPoolAttribute
( fileName = fileName,
36
attrName =
"COMPRESSION_ALGORITHM"
,
37
attrValue = compAlg )
38
39
def
setFileCompLvl
( fileName = None, compLvl = None ):
40
""" Convenience method for setting the compression level for a given file. """
41
42
return
setPoolAttribute
( fileName = fileName,
43
attrName =
"COMPRESSION_LEVEL"
,
44
attrValue = compLvl )
45
46
def
setMaxBufferSize
( fileName = None, bufferSize = None ):
47
""" Convenience method for setting the maximum basket buffer size """
48
49
return
setPoolAttribute
( fileName = fileName,
50
attrName =
"MAXIMUM_BUFFERSIZE"
,
51
attrValue = bufferSize )
52
53
def
setMinBufferEntries
( fileName = None, nEntries = None ):
54
""" Convenience method for setting the minimum basket buffer entries """
55
56
return
setPoolAttribute
( fileName = fileName,
57
attrName =
"MINIMUM_BUFFERENTRIES"
,
58
attrValue = nEntries )
59
60
def
setTreeAutoFlush
( fileName = None, treeName = None, autoFlush = None ):
61
""" Convenience method for setting the AutoFlush for a tree in a given file. """
62
63
return
setPoolAttribute
( fileName = fileName,
64
contName = f
"TTree={treeName}"
,
65
attrName =
"TREE_AUTO_FLUSH"
,
66
attrValue = autoFlush )
67
68
def
setTreeMaxSize
( fileName = None, treeName = None, maxSize = None ):
69
""" Convenience method for setting the maximum size for a tree in a given file. """
70
71
return
setPoolAttribute
( fileName = fileName,
72
contName = f
"TTree={treeName}"
,
73
attrName =
"TREE_MAX_SIZE"
,
74
attrValue = maxSize )
75
76
def
setContainerSplitLevel
( fileName = None, treeName = None, splitLvl = None ):
77
""" Convenience method for setting the split level for a tree in a given file. """
78
79
return
setPoolAttribute
( fileName = fileName,
80
contName = f
"TTree={treeName}"
,
81
attrName =
"CONTAINER_SPLITLEVEL"
,
82
attrValue = splitLvl )
83
84
def
setBranchBasketSize
( fileName = None, treeName = None, basketSize = None ):
85
""" Convenience method for setting the branch basket size for a tree in a given file. """
86
87
return
setPoolAttribute
( fileName = fileName,
88
contName = f
"TTree={treeName}"
,
89
attrName =
"BRANCH_BASKET_SIZE"
,
90
attrValue = basketSize )
91
92
def
setUnsplitFieldList
( fileName = None, unsplitFieldList = None ):
93
""" Convenience method for setting the unsplit field list for RNTuples in a given file. """
94
95
return
setPoolAttribute
( fileName = fileName,
96
attrName =
"RNTUPLE_UNSPLIT_FIELD_LIST"
,
97
attrValue = unsplitFieldList )
98
99
# Main Function: Only to check the basic functionality
100
# Can be run via python PoolAttributeHelper.py
101
if
"__main__"
in
__name__:
102
103
# Test Basic Functionality
104
attrs = []
105
106
# High-level
107
attrs += [
setFileCompAlg
(
"AOD.pool.root"
, 2 ) ]
108
attrs += [
setFileCompLvl
(
"AOD.pool.root"
, 1 ) ]
109
attrs += [
setMaxBufferSize
(
"*"
, 131072 ) ]
110
attrs += [
setMinBufferEntries
(
"*"
, 10 ) ]
111
attrs += [
setTreeAutoFlush
(
"AOD.pool.root"
,
"CollectionTree"
, 10 ) ]
112
attrs += [
setContainerSplitLevel
(
None
,
"POOLContainerForm(DataHeaderForm)"
, 99 ) ]
113
114
# Low-level
115
attrs += [
setPoolAttribute
( attrName =
"DEFAULT_SPLITLEVEL"
, attrValue = 0) ]
116
117
# Print the configuration
118
for
attr
in
attrs:
119
print
( f
"{attr}"
)
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
python.PoolAttributeHelper.setFileCompAlg
setFileCompAlg(fileName=None, compAlg=None)
Definition
PoolAttributeHelper.py:32
python.PoolAttributeHelper.setTreeAutoFlush
setTreeAutoFlush(fileName=None, treeName=None, autoFlush=None)
Definition
PoolAttributeHelper.py:60
python.PoolAttributeHelper.setBranchBasketSize
setBranchBasketSize(fileName=None, treeName=None, basketSize=None)
Definition
PoolAttributeHelper.py:84
python.PoolAttributeHelper.setFileCompLvl
setFileCompLvl(fileName=None, compLvl=None)
Definition
PoolAttributeHelper.py:39
python.PoolAttributeHelper.setMaxBufferSize
setMaxBufferSize(fileName=None, bufferSize=None)
Definition
PoolAttributeHelper.py:46
python.PoolAttributeHelper.setMinBufferEntries
setMinBufferEntries(fileName=None, nEntries=None)
Definition
PoolAttributeHelper.py:53
python.PoolAttributeHelper.setPoolAttribute
setPoolAttribute(**kwargs)
Definition
PoolAttributeHelper.py:5
python.PoolAttributeHelper.setTreeMaxSize
setTreeMaxSize(fileName=None, treeName=None, maxSize=None)
Definition
PoolAttributeHelper.py:68
python.PoolAttributeHelper.setContainerSplitLevel
setContainerSplitLevel(fileName=None, treeName=None, splitLvl=None)
Definition
PoolAttributeHelper.py:76
python.PoolAttributeHelper.setUnsplitFieldList
setUnsplitFieldList(fileName=None, unsplitFieldList=None)
Definition
PoolAttributeHelper.py:92
Generated on
for ATLAS Offline Software by
1.17.0