ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileConditions
python
TileAutoCorrelationConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3
"""Define methods to construct configured Tile auto correlation tool and conditions algorithm"""
4
5
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
6
from
AthenaConfiguration.ComponentFactory
import
CompFactory
7
8
def
TileAutoCorrelationCondAlgCfg
(flags, **kwargs):
9
"""Return component accumulator with configured Tile auto correlation conditions algorithm
10
11
Arguments:
12
flags -- Athena configuration flags
13
Keyword arguments:
14
Source -- source of Tile auto correlation conditions (COOL, FILE). Defaults to COOL.
15
TileAutoCorrelation -- name of Tile auto correlation conditions object. Defaults to TileAutoCorrelaton.
16
"""
17
18
acc = ComponentAccumulator()
19
20
source = kwargs.get(
'Source'
,
'COOL'
)
21
autoCorrelation = kwargs.get(
'TileAutoCorrelation'
,
'TileAutoCorrelation'
)
22
23
name = autoCorrelation +
'CondAlg'
24
25
if
source ==
'COOL'
:
26
# Connect COOL Tile conditions proxies to the algorithm (default)
27
28
from
TileConditions.TileFolders
import
TileFolders
29
folders = TileFolders(isMC = flags.Input.isMC, isOnline = flags.Common.isOnline)
30
31
if
flags.IOVDb.DatabaseInstance ==
'CONDBR2'
:
32
if
not
flags.Common.isOnline:
33
autoCorrelationFolder = folders.add(
'/TILE/OFL02/NOISE/AUTOCR'
,
'TILE_OFL'
)
34
else
:
35
raise(Exception(
"No online auto correlation folder in CONDBR2 DB"
))
36
else
:
37
autoCorrelationFolder = folders.addSplitOnline(
'/TILE/OFL01/NOISE/AUTOCR'
,
'/TILE/OFL02/NOISE/AUTOCR'
)
38
39
TileCondProxyCoolFlt=CompFactory.getComp(
"TileCondProxyCool<TileCalibDrawerFlt>"
)
40
autoCorrelationProxy =
TileCondProxyCoolFlt
(
'TileCondProxyCool_NoiseAutoCr'
, Source = autoCorrelationFolder)
41
42
from
IOVDbSvc.IOVDbSvcConfig
import
addFolderList
43
acc.merge( addFolderList(flags, folders.get()) )
44
45
elif
source ==
'FILE'
:
46
# Connect FILE Tile conditions proxies to the algorithm
47
TileCondProxyFileFlt=CompFactory.getComp(
"TileCondProxyFile<TileCalibDrawerFlt>"
)
48
autoCorrelationProxy =
TileCondProxyFileFlt
(
'TileCondProxyFile_NoiseAutoCr'
, Source =
'TileDefault.acr'
)
49
50
else
:
51
raise(Exception(
"Invalid source: %s"
% source))
52
53
TileCalibFltCondAlg=CompFactory.getComp(
"TileCalibCondAlg<TileCalibDrawerFlt>"
)
54
autoCorrelationCondAlg =
TileCalibFltCondAlg
( name = name,
55
ConditionsProxy = autoCorrelationProxy,
56
TileCalibData = autoCorrelation)
57
58
acc.addCondAlgo(autoCorrelationCondAlg)
59
60
return
acc
61
62
63
def
TileCondToolAutoCrCfg
(flags, **kwargs):
64
"""Return component accumulator with configured private Tile auto correlation tool
65
Arguments:
66
flags -- Athena configuration flags
67
Keyword arguments:
68
Source -- source of Tile auto correlation conditions (COOL, FILE). Defaults to COOL.
69
TileAutoCorrelation -- name of Tile auto correlation conditions object. Defaults to TileAutoCorrelaton.
70
"""
71
72
acc = ComponentAccumulator()
73
74
kwargs.setdefault(
'Source'
,
'COOL'
)
75
kwargs.setdefault(
'TileAutoCorrelation'
,
'TileAutoCorrelation'
)
76
77
autoCorrelation = kwargs[
'TileAutoCorrelation'
]
78
name =
'TileCondToolAutoCr'
79
80
acc.merge(
TileAutoCorrelationCondAlgCfg
(flags, **kwargs) )
81
82
TileCondToolAutoCr=CompFactory.TileCondToolAutoCr
83
acc.setPrivateTools(
TileCondToolAutoCr
(name, TileAutoCorrelation = autoCorrelation) )
84
85
return
acc
86
87
88
if
__name__ ==
"__main__"
:
89
90
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
91
from
AthenaConfiguration.TestDefaults
import
defaultTestFiles
92
from
AthenaCommon.Logging
import
log
93
from
AthenaCommon.Constants
import
DEBUG
94
95
# Test setup
96
log.setLevel(DEBUG)
97
98
flags = initConfigFlags()
99
flags.Input.Files = defaultTestFiles.RAW_RUN2
100
flags.lock()
101
102
acc = ComponentAccumulator()
103
104
autoCorrelationTool = acc.popToolsAndMerge(
TileCondToolAutoCrCfg
(flags) )
105
print
(autoCorrelationTool)
106
107
acc.printConfig(withDetails =
True
, summariseProps =
True
)
108
print
(acc.getService(
'IOVDbSvc'
))
109
acc.store( open(
'TileAutoCorrelation.pkl'
,
'wb'
) )
110
111
print
(
'All OK'
)
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
TileCalibCondAlg< TileCalibDrawerFlt >
TileCondProxyCool< TileCalibDrawerFlt >
TileCondProxyFile< TileCalibDrawerFlt >
TileCondToolAutoCr
Definition
TileCondToolAutoCr.h:18
Constants
python.TileAutoCorrelationConfig.TileAutoCorrelationCondAlgCfg
TileAutoCorrelationCondAlgCfg(flags, **kwargs)
Definition
TileAutoCorrelationConfig.py:8
python.TileAutoCorrelationConfig.TileCondToolAutoCrCfg
TileCondToolAutoCrCfg(flags, **kwargs)
Definition
TileAutoCorrelationConfig.py:63
Generated on
for ATLAS Offline Software by
1.17.0