ATLAS Offline Software
AtlasTest
ControlTest
python
test_cfgItemList.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
2
3
from
AthenaCommon.Constants
import
VERBOSE,INFO
4
from
AthenaCommon.KeyStore
import
CfgItemList
5
6
from
AthenaCommon.Logging
import
logging
7
msg = logging.getLogger(
'ItemList'
)
8
msg.setLevel( VERBOSE )
9
10
msg = logging.getLogger(
'Athena'
)
11
msg.setLevel( INFO )
12
13
msg.info(
"[CfgItemList] test running..."
)
14
esdList = CfgItemList(
"esd"
)
15
16
inDetEsdList = CfgItemList(
"InDetEsd"
)
17
inDetEsdList.add(
"VxContainer#Conversions"
)
18
19
esdList += inDetEsdList
20
21
esdList += CfgItemList(
22
"CaloEsd"
,
23
items = [
"CaloCellContainer#Boo"
,
24
"CaloClusterContainer#BooBoo"
]
25
)
26
assert( esdList.CaloEsd() == [
"CaloCellContainer#Boo"
,
27
"CaloClusterContainer#BooBoo"
] )
28
29
esdList += CfgItemList(
30
"TrigEsd"
,
31
items = [
"JetCollection#HLT_AutoKey*"
],
32
allowWildCard =
True
33
)
34
assert( esdList.TrigEsd() == [
"JetCollection#HLT_AutoKey*"
] )
35
36
msg.info(
"Should see a warning about attempt at adding invalid element..."
)
37
foo = CfgItemList(
38
"Foo"
,
39
items = [
"Bla#Blah*"
]
40
)
41
assert(
foo
() == [] )
42
del foo
43
44
45
msg.info(
"Creating an AthenaPoolOutputStream..."
)
46
from
AthenaPoolCnvSvc.WriteAthenaPool
import
AthenaPoolOutputStream
47
StreamESD =
AthenaPoolOutputStream
(
"StreamESD"
)
48
StreamESD.ItemList =
esdList
()
49
50
msg.info(
"ESD item list: %r"
,
esdList
() )
51
52
msg.info(
"removing TrigEsd item list"
)
53
del esdList.TrigEsd
54
StreamESD.ItemList =
esdList
()
55
msg.info(
"ESD item list: %r"
,StreamESD.ItemList )
56
57
caught =
False
58
try
:
59
esdList +=
AthenaPoolOutputStream
(
"FooFoo"
)
60
except
TypeError
as
err:
61
caught =
True
62
msg.info( err )
63
msg.info(
"Error has been caught, good"
)
64
assert(caught)
65
66
msg.info(
"ESD item list: %r"
,
esdList
() )
67
68
inDetEsdList.add(
"AnotherVxContainer#Conversions"
)
69
70
msg.info(
"InDet list: %r"
,
inDetEsdList
() )
71
msg.info(
"ESD item list: %r"
,
esdList
() )
72
assert(
set
(
esdList
()) ==
set
([
73
'CaloCellContainer#Boo'
,
74
'CaloClusterContainer#BooBoo'
,
'VxContainer#Conversions'
,
75
'AnotherVxContainer#Conversions'
])
76
)
77
78
msg.info(
"[CfgItemList] test SUCCESSFULL"
)
Logging
python.test_cfgItemList.inDetEsdList
inDetEsdList
Definition:
test_cfgItemList.py:16
Constants
some useful constants -------------------------------------------------—
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition:
bitmask.h:224
python.test_cfgItemList.foo
foo
Definition:
test_cfgItemList.py:37
python.CreateOutputStreams.AthenaPoolOutputStream
def AthenaPoolOutputStream
backward compat
Definition:
CreateOutputStreams.py:144
python.test_cfgItemList.esdList
esdList
Definition:
test_cfgItemList.py:14
Generated on Sun May 19 2024 21:27:55 for ATLAS Offline Software by
1.8.18