ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_ConditionsAlgorithmsConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2from AthenaConfiguration.AccumulatorCache import AccumulatorCache
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline
6
7
8@AccumulatorCache
9def SCT_AlignCondAlgCfg(flags, name="SCT_AlignCondAlg", **kwargs):
10 """Return a configured SCT_AlignCondAlg"""
11 from SCT_GeoModel.SCT_GeoModelConfig import SCT_GeoModelCfg
12 acc = SCT_GeoModelCfg(flags)
13 if flags.GeoModel.Align.Dynamic:
14 acc.merge(addFoldersSplitOnline(flags, "INDET",
15 ["/Indet/Onl/AlignL1/ID", "/Indet/Onl/AlignL2/SCT"],
16 ["/Indet/AlignL1/ID", "/Indet/AlignL2/SCT"],
17 className="CondAttrListCollection"))
18 acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/AlignL3", "/Indet/AlignL3", className="AlignableTransformContainer"))
19 else:
20 acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", "/Indet/Align", className="AlignableTransformContainer"))
21
22 kwargs.setdefault("UseDynamicAlignFolders", flags.GeoModel.Align.Dynamic)
23
24 acc.addCondAlgo(CompFactory.SCT_AlignCondAlg(name, **kwargs))
25 return acc
26
27
29 if flags.InDet.ForceCoolVectorPayload and flags.InDet.ForceCoraCool:
30 raise Exception("SCT DB CONFIGURATION FLAG CONFLICT: Both CVP and CoraCool selected")
31 return "/SCT/DAQ/Config/" if (flags.InDet.ForceCoolVectorPayload
32 or (flags.IOVDb.DatabaseInstance != "COMP200"
33 and not flags.InDet.ForceCoraCool)) else "/SCT/DAQ/Configuration/"
34
35
36def SCT_ConfigurationCondAlgCfg(flags, name="SCT_ConfigurationCondAlg", **kwargs):
37 acc = ComponentAccumulator()
38 config_folder_prefix = getSCTDAQConfigFolder(flags)
39 channelFolder = config_folder_prefix + ("Chip" if flags.IOVDb.DatabaseInstance == "COMP200" else "ChipSlim")
40 kwargs.setdefault("ReadKeyChannel", channelFolder)
41 kwargs.setdefault("ReadKeyModule", f"{config_folder_prefix}Module")
42 kwargs.setdefault("ReadKeyMur", f"{config_folder_prefix}MUR")
43
44 acc.merge(addFoldersSplitOnline(flags,
45 detDb="SCT",
46 onlineFolders=[channelFolder,
47 f"{config_folder_prefix}Module",
48 f"{config_folder_prefix}MUR"],
49 offlineFolders=[channelFolder,
50 f"{config_folder_prefix}Module",
51 f"{config_folder_prefix}MUR"],
52 className="CondAttrListVec",
53 splitMC=True))
54
55 from SCT_Cabling.SCT_CablingConfig import SCT_CablingToolCfg
56 kwargs.setdefault("SCT_CablingTool", acc.popToolsAndMerge(SCT_CablingToolCfg(flags)))
57
58 from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_ReadoutToolCfg
59 kwargs.setdefault("SCT_ReadoutTool", acc.popToolsAndMerge(SCT_ReadoutToolCfg(flags)))
60
61 acc.addCondAlgo(CompFactory.SCT_ConfigurationCondAlg(name, **kwargs))
62 return acc
63
64
65@AccumulatorCache
66def SCT_DetectorElementCondAlgCfg(flags, name="SCT_DetectorElementCondAlg", **kwargs):
67 acc = SCT_AlignCondAlgCfg(flags)
68
69 # FIXME
70 # add artifical dependencies to SCT, TRT and Muon
71 # conditions algs to ensure that the IOV
72 # is identical to the IOV of the tracking geometry
73 if flags.Detector.GeometryMuon and flags.Muon.enableAlignment:
74 from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
75 acc.merge(MuonGeoModelCfg(flags))
76 kwargs.setdefault("MuonManagerKey", "MuonDetectorManager")
77 if flags.Detector.GeometryTRT:
78 from TRT_GeoModel.TRT_GeoModelConfig import TRT_ReadoutGeometryCfg
79 acc.merge(TRT_ReadoutGeometryCfg(flags))
80 kwargs.setdefault("TRT_DetEltContKey", "TRT_DetElementContainer")
81 if not flags.GeoModel.Align.LegacyConditionsAccess and flags.Detector.GeometryPixel:
82 from PixelGeoModel.PixelGeoModelConfig import PixelAlignmentCfg
83 acc.merge(PixelAlignmentCfg(flags))
84 kwargs.setdefault("PixelAlignmentStore", "PixelAlignmentStore")
85 # end of hack
86
87 acc.addCondAlgo(CompFactory.SCT_DetectorElementCondAlg(name, **kwargs))
88 return acc
89
90# SCTDetectorElementStatusAlg which creates the status data to be used in the SCT_Clusterization
91def SCT_DetectorElementStatusCondAlgCfg(flags, name="SCTDetectorElementStatusCondAlg",**kwargs) :
92 acc = ComponentAccumulator()
93 if 'ConditionsSummaryTool' not in kwargs :
94 from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_ConditionsSummaryToolCfg
95 kwargs.setdefault("ConditionsSummaryTool", acc.popToolsAndMerge(SCT_ConditionsSummaryToolCfg(flags, withFlaggedCondTool=False, withByteStreamErrorsTool=False)) )
96 kwargs.setdefault("WriteKey", "SCTDetectorElementStatusCondData")
97
98 # not a conditions algorithm since it combines conditions data and data from the bytestream
99 acc.addCondAlgo( CompFactory.InDet.SiDetectorElementStatusCondAlg(name, **kwargs) )
100 return acc
101
102def SCT_DetectorElementStatusAlgWithoutFlaggedCfg(flags, name="SCTDetectorElementStatusAlgWithoutFlagged",**kwargs) :
103 '''
104 Algorithm which just creates event data from conditions data.
105 '''
107 if 'ConditionsSummaryTool' not in kwargs :
108 from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_DetectorElementStatusAddByteStreamErrorsToolCfg
109 kwargs.setdefault("ConditionsSummaryTool", acc.popToolsAndMerge(SCT_DetectorElementStatusAddByteStreamErrorsToolCfg(
110 flags,
111 SCTDetElStatusCondDataBaseKey = "SCTDetectorElementStatusCondData",
112 SCTDetElStatusEventDataBaseKey = "")) )
113 kwargs.setdefault("WriteKey", "SCTDetectorElementStatusWithoutFlagged")
114
115 # not a conditions algorithm since it combines conditions data and data from the bytestream
116 acc.addEventAlgo( CompFactory.InDet.SiDetectorElementStatusAlg(name, **kwargs) )
117 return acc
118
119# SCTDetectorElementStatusAlg which creates the status data to be used everywhere but the SCT_Clusterization
120def SCT_DetectorElementStatusAlgCfg(flags, name = "SCTDetectorElementStatusAlg", **kwargs) :
122 if 'ConditionsSummaryTool' not in kwargs :
123 from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_DetectorElementStatusAddFlaggedToolCfg
124 kwargs.setdefault("ConditionsSummaryTool", acc.popToolsAndMerge(SCT_DetectorElementStatusAddFlaggedToolCfg(
125 flags,
126 SCTDetElStatusCondDataBaseKey = "",
127 SCTDetElStatusEventDataBaseKey = "SCTDetectorElementStatusWithoutFlagged")) )
128
129 kwargs.setdefault("WriteKey", "SCTDetectorElementStatus")
130 acc.merge( SCT_DetectorElementStatusAlgWithoutFlaggedCfg(flags, name, **kwargs) )
131 return acc
132
133if __name__=="__main__":
134 from AthenaCommon.Logging import log
135 from AthenaCommon.Constants import INFO
136 log.setLevel(INFO)
137
138 algorithm = ""
139
140 from AthenaConfiguration.AllConfigFlags import initConfigFlags
141 flags = initConfigFlags()
142 flags.Input.isMC = False
143 flags.Input.Files = ["./myESD.pool.root"]
144 flags.Input.ProjectName = "data17_13TeV" # q431 input
145 flags.Input.RunNumbers = [330470] # q431 input
146 flags.IOVDb.GlobalTag = "CONDBR2-BLKPA-2018-03" # q431 setup
147 from AthenaConfiguration.TestDefaults import defaultGeometryTags
148 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
149 flags.lock()
150
151 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
152 cfg = MainServicesCfg(flags)
153
154 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
155 cfg.merge(PoolReadCfg(flags))
156
157 algkwargs = {}
158 algkwargs["OutputLevel"] = INFO
159 if algorithm == "AlignCondAlg":
160 cfg.merge(SCT_AlignCondAlgCfg(flags, **algkwargs))
161 elif algorithm == "ConfigurationCondAlg":
162 cfg.merge(SCT_ConfigurationCondAlgCfg(flags, **algkwargs))
163 elif algorithm == "DetectorElementCondAlg":
164 cfg.merge(SCT_DetectorElementCondAlgCfg(flags, **algkwargs))
165
166 cfg.run(maxEvents=25)
SCT_DetectorElementStatusAlgCfg(flags, name="SCTDetectorElementStatusAlg", **kwargs)
SCT_ConfigurationCondAlgCfg(flags, name="SCT_ConfigurationCondAlg", **kwargs)
SCT_DetectorElementStatusCondAlgCfg(flags, name="SCTDetectorElementStatusCondAlg", **kwargs)
SCT_DetectorElementCondAlgCfg(flags, name="SCT_DetectorElementCondAlg", **kwargs)
SCT_DetectorElementStatusAlgWithoutFlaggedCfg(flags, name="SCTDetectorElementStatusAlgWithoutFlagged", **kwargs)
SCT_AlignCondAlgCfg(flags, name="SCT_AlignCondAlg", **kwargs)