ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloRec
python
ToolConstantsCondAlgConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3
# File: CaloRec/python/ToolConstantsCondAlgConfig.py
4
# Created: Jun 2020, sss
5
# Purpose: Configure ToolConstantsCondAlg.
6
7
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
8
from
AthenaConfiguration.ComponentFactory
import
CompFactory
9
10
11
def
ToolConstantsCondAlgCfg
(flags, key, DetStoreKey='', COOLFolder=''):
12
"""Configure a conditions algorithm to convert inline COOL data or detector store data to ToolConstants.
13
KEY is also the key of the output conditions object.
14
For reading from COOL inline data, COOLFOLDER gives the name
15
of the COOL folder; the dta are given by KEY within the folder.
16
The caller should register the folder with IOVDbSvc.
17
For copying a ToolConstants object from the detector store,
18
set DETSTOREKEY to the key of the object to copy."""
19
20
if
((DetStoreKey ==
''
and
COOLFolder ==
''
)
or
21
(DetStoreKey !=
''
and
COOLFolder !=
''
)):
22
raise
RuntimeError (
"ToolConstantsCondAlgCfg: For key "
+ key +
", exactly one of DetStoreKey or COOLFolder must be specified"
)
23
24
result = ComponentAccumulator()
25
26
name =
'ToolConstantsCondAlg_'
+ key
27
28
ToolConstantsCondAlg = CompFactory.ToolConstantsCondAlg
# CaloRec
29
alg = ToolConstantsCondAlg (name,
30
COOLFolderKey = COOLFolder,
31
ToolConstantsKey = key,
32
DetStoreKey = DetStoreKey)
33
result.addCondAlgo (alg)
34
35
return
result
36
37
38
if
__name__ ==
"__main__"
:
39
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
40
flags = initConfigFlags()
41
flags.Input.Files = []
42
flags.lock()
43
44
print
(
'--- detstore'
)
45
acc1 = ToolConstantsCondAlgCfg (flags,
'key1'
, DetStoreKey=
'ds1'
)
46
acc1.printConfig(summariseProps=
True
)
47
acc1.wasMerged()
48
49
print
(
'--- cool'
)
50
acc2 = ToolConstantsCondAlgCfg (flags,
'key2'
, COOLFolder=
'folder2'
)
51
acc2.printConfig(summariseProps=
True
)
52
acc2.wasMerged()
53
54
print
(
'--- error'
)
55
try
:
56
acc3 = ToolConstantsCondAlgCfg (flags,
'key3'
, COOLFolder=
'folder3'
, DetStoreKey=
'ds3'
)
57
except
RuntimeError:
58
pass
59
else
:
60
assert
0,
'not caught'
python.ToolConstantsCondAlgConfig.ToolConstantsCondAlgCfg
ToolConstantsCondAlgCfg(flags, key, DetStoreKey='', COOLFolder='')
Definition
ToolConstantsCondAlgConfig.py:11
Generated on
for ATLAS Offline Software by
1.17.0