ATLAS Offline Software
SCT_ConditionsAlgorithmsConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.AccumulatorCache import AccumulatorCache
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline
6 
7 
8 @AccumulatorCache
9 def 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 
36 def 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
66 def 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
91 def 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 
102 def 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
120 def 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 
133 if __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)
python.SCT_ConditionsAlgorithmsConfig.SCT_AlignCondAlgCfg
def SCT_AlignCondAlgCfg(flags, name="SCT_AlignCondAlg", **kwargs)
Definition: SCT_ConditionsAlgorithmsConfig.py:9
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TRT_GeoModelConfig.TRT_ReadoutGeometryCfg
def TRT_ReadoutGeometryCfg(flags)
Definition: TRT_GeoModelConfig.py:59
python.SCT_ConditionsAlgorithmsConfig.SCT_DetectorElementStatusAlgCfg
def SCT_DetectorElementStatusAlgCfg(flags, name="SCTDetectorElementStatusAlg", **kwargs)
Definition: SCT_ConditionsAlgorithmsConfig.py:120
PixelGeoModelConfig.PixelAlignmentCfg
def PixelAlignmentCfg(flags)
Definition: PixelGeoModelConfig.py:24
python.SCT_ConditionsToolsConfig.SCT_DetectorElementStatusAddFlaggedToolCfg
def SCT_DetectorElementStatusAddFlaggedToolCfg(flags, name="InDetSCT_DetectorElementStatusAddFlaggedTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:61
python.SCT_ConditionsAlgorithmsConfig.SCT_ConfigurationCondAlgCfg
def SCT_ConfigurationCondAlgCfg(flags, name="SCT_ConfigurationCondAlg", **kwargs)
Definition: SCT_ConditionsAlgorithmsConfig.py:36
python.SCT_ConditionsToolsConfig.SCT_DetectorElementStatusAddByteStreamErrorsToolCfg
def SCT_DetectorElementStatusAddByteStreamErrorsToolCfg(flags, name="InDetSCT_DetectorElementStatusAddByteStreamErrorsTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:69
python.SCT_ConditionsToolsConfig.SCT_ConditionsSummaryToolCfg
def SCT_ConditionsSummaryToolCfg(flags, name="InDetSCT_ConditionsSummaryTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:80
python.SCT_CablingConfig.SCT_CablingToolCfg
def SCT_CablingToolCfg(flags, name="SCT_CablingTool")
Definition: SCT_CablingConfig.py:35
python.SCT_ConditionsAlgorithmsConfig.SCT_DetectorElementStatusAlgWithoutFlaggedCfg
def SCT_DetectorElementStatusAlgWithoutFlaggedCfg(flags, name="SCTDetectorElementStatusAlgWithoutFlagged", **kwargs)
Definition: SCT_ConditionsAlgorithmsConfig.py:102
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
Constants
some useful constants -------------------------------------------------—
python.IOVDbSvcConfig.addFoldersSplitOnline
def addFoldersSplitOnline(flags, detDb, onlineFolders, offlineFolders, className=None, extensible=False, addMCString='_OFL', splitMC=False, tag=None, forceDb=None, modifiers='')
Definition: IOVDbSvcConfig.py:153
python.SCT_ConditionsAlgorithmsConfig.SCT_DetectorElementStatusCondAlgCfg
def SCT_DetectorElementStatusCondAlgCfg(flags, name="SCTDetectorElementStatusCondAlg", **kwargs)
Definition: SCT_ConditionsAlgorithmsConfig.py:91
SCT_GeoModelConfig.SCT_GeoModelCfg
def SCT_GeoModelCfg(flags)
Definition: SCT_GeoModelConfig.py:5
python.MuonGeometryConfig.MuonGeoModelCfg
def MuonGeoModelCfg(flags)
Definition: MuonGeometryConfig.py:28
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.SCT_ConditionsAlgorithmsConfig.getSCTDAQConfigFolder
def getSCTDAQConfigFolder(flags)
Definition: SCT_ConditionsAlgorithmsConfig.py:28
python.SCT_ConditionsAlgorithmsConfig.SCT_DetectorElementCondAlgCfg
def SCT_DetectorElementCondAlgCfg(flags, name="SCT_DetectorElementCondAlg", **kwargs)
Definition: SCT_ConditionsAlgorithmsConfig.py:66
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
python.SCT_ConditionsToolsConfig.SCT_ReadoutToolCfg
def SCT_ReadoutToolCfg(flags, name="SCT_ReadoutTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:399