diff --git a/Control/AthenaConfiguration/python/ComponentAccumulator.py b/Control/AthenaConfiguration/python/ComponentAccumulator.py index 0edc332c146119e61607ff7f3b9066280cffb52e..78371985c189e2ec886118cbadb1b21a1e8a5901 100644 --- a/Control/AthenaConfiguration/python/ComponentAccumulator.py +++ b/Control/AthenaConfiguration/python/ComponentAccumulator.py @@ -1177,7 +1177,7 @@ def conf2toConfigurable( comp, indent="", parent="", suppressDupes=False ): setattr(clone, pname, alreadySetProperties[pname]) try: updatedPropValue = __listHelperToList(newConf2Instance._descriptors[pname].semantics.merge( getattr(newConf2Instance, pname), getattr(clone, pname))) - except TypeError: + except (TypeError, ValueError): err_message = f"Failed merging new config value ({getattr(newConf2Instance, pname)}) and old config value ({getattr(clone, pname)}) for the ({pname}) property of {existingConfigurableInstance.getFullJobOptName() } ({newConf2Instance.getFullJobOptName()}) old (new)." _log.fatal( err_message ) raise ConfigurationError(err_message) diff --git a/Control/AthenaConfiguration/python/OldFlags2NewFlags.py b/Control/AthenaConfiguration/python/OldFlags2NewFlags.py index 73818c5cd794e91e7a8b04ed97328d40341f03a9..c80d3365c4e7adb9cd91fd50f90f4bec17db1a90 100644 --- a/Control/AthenaConfiguration/python/OldFlags2NewFlags.py +++ b/Control/AthenaConfiguration/python/OldFlags2NewFlags.py @@ -20,6 +20,12 @@ def getNewConfigFlags(): ConfigFlags.GeoModel.AtlasVersion = jobproperties.Global.DetDescrVersion() ConfigFlags.GeoModel.Align.Dynamic = InDetGeometryFlags.useDynamicAlignFolders() + # Concurrency + from AthenaCommon.ConcurrencyFlags import jobproperties as jp + ConfigFlags.Concurrency.NumProcs = jp.ConcurrencyFlags.NumProcs() + ConfigFlags.Concurrency.NumThreads = jp.ConcurrencyFlags.NumThreads() + + # Let's build a map whose key is new flagname, and whose value is old flagname. geom_flag_map = {} # Geometry - InnerDetector diff --git a/InnerDetector/InDetConditions/InDetCondFolders/python/InDetAlignFolders.py b/InnerDetector/InDetConditions/InDetCondFolders/python/InDetAlignFolders.py index bb6952bc86337bf4915984f825416477edfe7bd8..254a8b2e3f09537286d9427c56dc334ffd0a476a 100644 --- a/InnerDetector/InDetConditions/InDetCondFolders/python/InDetAlignFolders.py +++ b/InnerDetector/InDetConditions/InDetCondFolders/python/InDetAlignFolders.py @@ -101,4 +101,3 @@ if DetFlags.pixel_on() and ((not DetFlags.simulate.pixel_on()) or DetFlags.overl if not hasattr(condSeq, "PixelDetectorElementCondAlg"): from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDetectorElementCondAlg condSeq += PixelDetectorElementCondAlg(name = "PixelDetectorElementCondAlg") - diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt index 7ae63b0372682c10764dab18dc7241daa73d4d35..51953eae3431f4f79bce31fdcf40f8f0ec3bf27a 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt @@ -11,7 +11,7 @@ find_package( CORAL COMPONENTS CoralBase ) atlas_add_component( PixelConditionsAlgorithms src/*.h src/*.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities CommissionEvent DetDescrConditions GaudiKernel GeoModelUtilities GeoPrimitives Identifier InDetCondTools InDetIdentifier InDetReadoutGeometry PathResolver PixelConditionsData PixelReadoutGeometry StoreGateLib TrkGeometry TrkSurfaces ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities CommissionEvent DetDescrConditions GaudiKernel GeoModelUtilities GeoPrimitives Identifier InDetCondTools InDetIdentifier InDetReadoutGeometry PathResolver PixelConditionsData PixelReadoutGeometry StoreGateLib TrkGeometry TrkSurfaces MuonReadoutGeometry TRT_ReadoutGeometry) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py index 18b985f8cbe110aa9bfc42e0dd907980a03d9ecf..696e596daa05eb750f804a1c9fb826e79f2e304a 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py @@ -444,9 +444,19 @@ def PixelDetectorElementCondAlgCfg(flags, name="PixelDetectorElementCondAlg", ** """Return a ComponentAccumulator with configured PixelDetectorElementCondAlg""" acc = ComponentAccumulator() acc.merge(PixelAlignCondAlgCfg(flags)) + kwargs.setdefault("PixelAlignmentStore", "PixelAlignmentStore") kwargs.setdefault("WriteKey", "PixelDetectorElementCollection") - acc.addCondAlgo(CompFactory.PixelDetectorElementCondAlg(name, **kwargs)) + def merge_lists(a, b): + a.extend([item for item in b if item not in a]) + return a + + alg=CompFactory.PixelDetectorElementCondAlg(name, **kwargs) + alg._descriptors['MuonManagerKey'].semantics.merge = merge_lists + alg._descriptors['TRT_DetEltContKey'].semantics.merge = merge_lists + alg._descriptors['SCTAlignmentStore'].semantics.merge = merge_lists + acc.addCondAlgo(alg) + return acc def PixelDistortionAlgCfg(flags, name="PixelDistortionAlg", **kwargs): diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.cxx index f1a04420a540761739fa04b08a92fc8e56f77903..8399889e406932b47931f9d3fe9704859de08ac9 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.cxx @@ -36,6 +36,11 @@ StatusCode PixelDetectorElementCondAlg::initialize() // We need the detector manager ATH_CHECK(detStore()->retrieve(m_detManager, m_detManagerName)); + // used only if they exist + ATH_CHECK(m_trtDetElContKey.initialize()); + ATH_CHECK(m_muonManagerKey.initialize()); + ATH_CHECK(m_SCT_readKey.initialize()); + return StatusCode::SUCCESS; } @@ -62,7 +67,6 @@ StatusCode PixelDetectorElementCondAlg::execute(const EventContext& ctx) const // ____________ Construct new Write Cond Object ____________ std::unique_ptr<InDetDD::SiDetectorElementCollection> writeCdo{std::make_unique<InDetDD::SiDetectorElementCollection>()}; - EventIDRange rangeW; // ____________ Get Read Cond Object ____________ SG::ReadCondHandle<GeoAlignmentStore> readHandle{m_readKey, ctx}; @@ -72,10 +76,32 @@ StatusCode PixelDetectorElementCondAlg::execute(const EventContext& ctx) const return StatusCode::FAILURE; } - // Define validity of the output cond object and record it - if (not readHandle.range(rangeW)) { - ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandle.key()); - return StatusCode::FAILURE; + // Add dependency for IOV range + writeHandle.addDependency(readHandle); + // Additional dependencies for IOV range to limit lifetime to TrackingGeometry lifetime + for (const SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> &key :m_muonManagerKey ) { + SG::ReadCondHandle<MuonGM::MuonDetectorManager> muonDependency{key, ctx}; + if (*muonDependency != nullptr){ + writeHandle.addDependency(muonDependency); + } else { + ATH_MSG_WARNING("MuonManager not found, ignoring Muons for PixelDetElement lifetime"); + } + } + for (const SG::ReadCondHandleKey<InDetDD::TRT_DetElementContainer> &key :m_trtDetElContKey ) { + SG::ReadCondHandle<InDetDD::TRT_DetElementContainer> trtDependency{key, ctx}; + if (*trtDependency != nullptr){ + writeHandle.addDependency(trtDependency); + } else { + ATH_MSG_WARNING("TRT DetEls not found, ignoring TRT for PixelDetElement lifetime"); + } + } + for (const SG::ReadCondHandleKey<GeoAlignmentStore> &key :m_SCT_readKey ) { + SG::ReadCondHandle<GeoAlignmentStore> sctDependency{key, ctx}; + if (*sctDependency != nullptr){ + writeHandle.addDependency(sctDependency); + } else { + ATH_MSG_WARNING("SCT AlignmentStore not found, ignoring SCT for PixelDetElement lifetime"); + } } // ____________ Update writeCdo using readCdo ____________ @@ -120,15 +146,14 @@ StatusCode PixelDetectorElementCondAlg::execute(const EventContext& ctx) const // Record WriteCondHandle const std::size_t size{writeCdo->size()}; - if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) { + if (writeHandle.record(std::move(writeCdo)).isFailure()) { ATH_MSG_FATAL("Could not record " << writeHandle.key() - << " with EventRange " << rangeW + << " with EventRange " << writeHandle.getRange() << " into Conditions Store"); return StatusCode::FAILURE; } - ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << rangeW + ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << writeHandle.getRange() << " with size of " << size << " into Conditions Store"); return StatusCode::SUCCESS; } - diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.h index 9267d4bf01a5626bde543fffbcc13c057bd80ddb..6c8561bcdc3e85104f15283c859530db5ddd55eb 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.h +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.h @@ -14,9 +14,14 @@ #include "InDetReadoutGeometry/SiDetectorElementCollection.h" #include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/WriteCondHandleKey.h" +#include "StoreGate/CondHandleKeyArray.h" #include "GaudiKernel/ICondSvc.h" +//dependencies to limit lifetime of SiDetElColl for TrackingGeometry +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "TRT_ReadoutGeometry/TRT_DetElementContainer.h" + namespace InDetDD { class PixelDetectorManager; } @@ -39,6 +44,15 @@ class PixelDetectorElementCondAlg : public AthReentrantAlgorithm SG::WriteCondHandleKey<InDetDD::SiDetectorElementCollection> m_writeKey {this, "WriteKey", "PixelDetectorElementCollection", "Key of output SiDetectorElementCollection for Pixel"}; + // The DetElement Collection must have a life time <= the Tracking Geometry due to DetElt-> Surface -> Layer connection, + // which is why we intersect with the IOV Ranges from the TG's dependencies. + SG::ReadCondHandleKeyArray<MuonGM::MuonDetectorManager> m_muonManagerKey + {this, "MuonManagerKey", {}, "MuonManager ReadKey for IOV Range intersection"}; + SG::ReadCondHandleKeyArray<InDetDD::TRT_DetElementContainer> m_trtDetElContKey + {this, "TRT_DetEltContKey", {}, "TRT ReadKey for IOV Range intersection"}; + SG::ReadCondHandleKeyArray<GeoAlignmentStore> m_SCT_readKey + {this, "SCTAlignmentStore", {}, "SCTAlignmentStore ReadKey for IOV Range intersection "}; + ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"}; StringProperty m_detManagerName{this, "DetManagerName", "Pixel", "Name of the DeterctorManager to retrieve"}; diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt index dc82c6166717846434209ec31f0ea492c0df3624..5631d38e399a80459f3708a50230a3e92f87d59a 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt @@ -11,7 +11,7 @@ atlas_add_component( SCT_ConditionsAlgorithms src/*.cxx src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps StoreGateLib Identifier DetDescrConditions GeoModelUtilities GeoPrimitives GaudiKernel SCT_ConditionsData SCT_CablingLib AthenaPoolUtilities InDetConditionsSummaryService InDetIdentifier InDetReadoutGeometry SCT_ReadoutGeometry TrkGeometry TrkSurfaces SCT_ConditionsToolsLib ) + LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps StoreGateLib Identifier DetDescrConditions GeoModelUtilities GeoPrimitives GaudiKernel SCT_ConditionsData SCT_CablingLib AthenaPoolUtilities InDetConditionsSummaryService InDetIdentifier InDetReadoutGeometry SCT_ReadoutGeometry TrkGeometry TrkSurfaces SCT_ConditionsToolsLib MuonReadoutGeometry TRT_ReadoutGeometry) atlas_add_test( TestCalibChipRead SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testCalibChipRead.py diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DetectorElementCondAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DetectorElementCondAlg.cxx index 0b82033e137834572248ecf4867fd940da6e27ff..fd644343f1b14afd49a3f8fbb8478906ca05b5af 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DetectorElementCondAlg.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DetectorElementCondAlg.cxx @@ -35,6 +35,11 @@ StatusCode SCT_DetectorElementCondAlg::initialize() ATH_CHECK(m_condSvc->regHandle(this, m_writeKey)); ATH_CHECK(detStore()->retrieve(m_detManager, m_detManagerName)); + // used only if they exist + ATH_CHECK(m_trtDetElContKey.initialize()); + ATH_CHECK(m_muonManagerKey.initialize()); + ATH_CHECK(m_pixelReadKey.initialize()); + return StatusCode::SUCCESS; } @@ -72,6 +77,31 @@ StatusCode SCT_DetectorElementCondAlg::execute(const EventContext& ctx) const // Add dependency writeHandle.addDependency(readHandle); + // Additional dependencies for IOV range to limit lifetime to TrackingGeometry lifetime + for (const SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> &key :m_muonManagerKey ) { + SG::ReadCondHandle<MuonGM::MuonDetectorManager> muonDependency{key, ctx}; + if (*muonDependency != nullptr){ + writeHandle.addDependency(muonDependency); + } else { + ATH_MSG_WARNING("MuonManager not found, ignoring Muons for PixelDetElement lifetime"); + } + } + for (const SG::ReadCondHandleKey<InDetDD::TRT_DetElementContainer> &key :m_trtDetElContKey ) { + SG::ReadCondHandle<InDetDD::TRT_DetElementContainer> trtDependency{key, ctx}; + if (*trtDependency != nullptr){ + writeHandle.addDependency(trtDependency); + } else { + ATH_MSG_WARNING("TRT DetEls not found, ignoring TRT for PixelDetElement lifetime"); + } + } + for (const SG::ReadCondHandleKey<GeoAlignmentStore> &key :m_pixelReadKey ) { + SG::ReadCondHandle<GeoAlignmentStore> pixelDependency{key, ctx}; + if (*pixelDependency != nullptr){ + writeHandle.addDependency(pixelDependency); + } else { + ATH_MSG_WARNING("Pixel AlignmentStore not found, ignoring Pixels for SCT_DetElement lifetime"); + } + } // ____________ Update writeCdo using readCdo ____________ std::map<const InDetDD::SiDetectorElement*, const InDetDD::SiDetectorElement*> oldToNewMap; diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DetectorElementCondAlg.h b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DetectorElementCondAlg.h index d01dfb47521dec5e9f398c142efcdb3981400e3a..5ce3183f86a452f2799555661915067c08203ca9 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DetectorElementCondAlg.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DetectorElementCondAlg.h @@ -14,9 +14,14 @@ #include "InDetReadoutGeometry/SiDetectorElementCollection.h" #include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/WriteCondHandleKey.h" +#include "StoreGate/CondHandleKeyArray.h" #include "GaudiKernel/ICondSvc.h" +//dependencies to limit lifetime of SiDetElColl for TrackingGeometry +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "TRT_ReadoutGeometry/TRT_DetElementContainer.h" + namespace InDetDD { class SCT_DetectorManager; } @@ -37,6 +42,15 @@ class SCT_DetectorElementCondAlg : public AthReentrantAlgorithm SG::ReadCondHandleKey<GeoAlignmentStore> m_readKey; SG::WriteCondHandleKey<InDetDD::SiDetectorElementCollection> m_writeKey{this, "WriteKey", "SCT_DetectorElementCollection", "Key of output SiDetectorElementCollection for SCT"}; + // The DetElement Collection must have a life time <= the Tracking Geometry due to DetElt-> Surface -> Layer connection, + // which is why we intersect with the IOV Ranges from the TG's dependencies. + SG::ReadCondHandleKeyArray<MuonGM::MuonDetectorManager> m_muonManagerKey + {this, "MuonManagerKey", {}, "MuonManager ReadKey for IOV Range intersection"}; + SG::ReadCondHandleKeyArray<InDetDD::TRT_DetElementContainer> m_trtDetElContKey + {this, "TRT_DetEltContKey", {}, "TRT ReadKey for IOV Range intersection"}; + SG::ReadCondHandleKeyArray<GeoAlignmentStore> m_pixelReadKey + {this, "PixelAlignmentStore", {}, "PixelAlignmentStore ReadKey for IOV Range intersection"}; + ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"}; std::string m_detManagerName; const InDetDD::SCT_DetectorManager* m_detManager{nullptr}; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/python/PixelGeoModelConfig.py b/InnerDetector/InDetDetDescr/PixelGeoModel/python/PixelGeoModelConfig.py index 7d184d5fe7c5f6b4445717a07659d2d61ed1c702..5d057be17949d9cc4f1b1edd2489168eeea599a9 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/python/PixelGeoModelConfig.py +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/python/PixelGeoModelConfig.py @@ -36,11 +36,6 @@ def PixelGeometryCfg( flags ): acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Align","/Indet/Align")) if flags.Common.Project != "AthSimulation": # Protection for AthSimulation builds if flags.Common.ProductionStep != ProductionStep.Simulation or flags.Overlay.DataOverlay: - PixelAlignCondAlg=CompFactory.PixelAlignCondAlg - pixelAlignCondAlg = PixelAlignCondAlg(name = "PixelAlignCondAlg", - UseDynamicAlignFolders = flags.GeoModel.Align.Dynamic) - acc.addCondAlgo(pixelAlignCondAlg) - PixelDetectorElementCondAlg=CompFactory.PixelDetectorElementCondAlg - pixelDetectorElementCondAlg = PixelDetectorElementCondAlg(name = "PixelDetectorElementCondAlg") - acc.addCondAlgo(pixelDetectorElementCondAlg) + from PixelConditionsAlgorithms.PixelConditionsConfig import PixelDetectorElementCondAlgCfg + acc.merge(PixelDetectorElementCondAlgCfg(flags)) return acc diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py b/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py index 317891acc6c77ccb92225f19db0058d881d95bd4..b387483dd5c746aa111ec7e1481af828ae575410 100644 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py @@ -3,6 +3,7 @@ from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.Enums import ProductionStep from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator def SCT_GeometryCfg( flags ): from AtlasGeoModel.GeoModelConfig import GeoModelCfg @@ -31,7 +32,20 @@ def SCT_GeometryCfg( flags ): sctAlignCondAlg = SCT_AlignCondAlg(name = "SCT_AlignCondAlg", UseDynamicAlignFolders = flags.GeoModel.Align.Dynamic) acc.addCondAlgo(sctAlignCondAlg) - SCT_DetectorElementCondAlg=CompFactory.SCT_DetectorElementCondAlg - sctDetectorElementCondAlg = SCT_DetectorElementCondAlg(name = "SCT_DetectorElementCondAlg") - acc.addCondAlgo(sctDetectorElementCondAlg) + + acc.merge(SCT_DetectorElementCondAlgCfg(flags)) + return acc + +def SCT_DetectorElementCondAlgCfg(flags, name = "SCT_DetectorElementCondAlg", **kwargs): + + def merge_lists(a, b): + a.extend([item for item in b if item not in a]) + return a + SCT_DetectorElementCondAlg=CompFactory.SCT_DetectorElementCondAlg + sctDetectorElementCondAlg = SCT_DetectorElementCondAlg(name, **kwargs) + acc = ComponentAccumulator() + sctDetectorElementCondAlg._descriptors['MuonManagerKey'].semantics.merge = merge_lists + sctDetectorElementCondAlg._descriptors['TRT_DetEltContKey'].semantics.merge = merge_lists + sctDetectorElementCondAlg._descriptors['PixelAlignmentStore'].semantics.merge = merge_lists + acc.addCondAlgo(sctDetectorElementCondAlg) return acc diff --git a/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py b/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py index b3109196b6c8311023728d9d93cd4c8771df204c..448554d6e328f0c4198bacaecf685f99c5294986 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py +++ b/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py @@ -2,6 +2,7 @@ from AthenaConfiguration.AthConfigFlags import AthConfigFlags from AthenaConfiguration.AutoConfigFlags import DetDescrInfo +from AthenaConfiguration.Enums import ProductionStep import re # Some comments from Ed about existing flags @@ -126,6 +127,9 @@ def createMuonConfigFlags(): mcf.addFlag("Muon.MuonTrigger", False) mcf.addFlag("Muon.SAMuonTrigger", False) + mcf.addFlag("Muon.enableAlignment",lambda flags: (flags.Common.Project != 'AthSimulation' \ + and (flags.Common.ProductionStep != ProductionStep.Simulation or flags.Overlay.DataOverlay))) + # TODO - add configuration for above return mcf diff --git a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py index 1d69c3296e08fc584d879a4d2dd567e07de86196..0f314dda5e4b574d7561e96cbaa0854548aa55ff 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py @@ -33,9 +33,7 @@ def MuonDetectorToolCfg(flags): from MuonGeoModel.MMPassivationFlag import MMPassivationFlag detTool.passivationWidthMM = MMPassivationFlag.correction - enableAlignment = flags.Common.Project != 'AthSimulation' \ - and (flags.Common.ProductionStep != ProductionStep.Simulation or flags.Overlay.DataOverlay) - if enableAlignment: + if flags.Muon.enableAlignment: # Condition DB is needed only if A-lines or B-lines are requested if not (not flags.Muon.Align.UseALines and flags.Muon.Align.UseBLines=='none'): detTool.UseConditionDb = 1 @@ -182,9 +180,7 @@ def MuonGeoModelCfg(flags, forceDisableAlignment=False): detTool.FillCacheInitTime = 0 # We do not need to fill cache for the MuonGeoModel MuonDetectorTool, just for the condAlg gms.DetectorTools += [ detTool ] - enableAlignment = flags.Common.Project != 'AthSimulation' \ - and (flags.Common.ProductionStep != ProductionStep.Simulation or flags.Overlay.DataOverlay) - if enableAlignment and not forceDisableAlignment: + if flags.Muon.enableAlignment and not forceDisableAlignment: acc.merge(MuonDetectorCondAlgCfg(flags)) acc.merge(MuonIdHelperSvcCfg(flags)) # This line can be removed once the configuration methods for all 258 components which directly use this service are updated!! diff --git a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py index ef5325e40717a5bc4d6a1f35dae7aebd6e40a15c..b8f7dc7a3dcd61563afa2372487b318c663b31ad 100644 --- a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py +++ b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py @@ -49,16 +49,17 @@ def tmpSetupTrackServices(inputFlags): PixelAlignCondAlg=CompFactory.PixelAlignCondAlg result.addCondAlgo(PixelAlignCondAlg(name = "PixelAlignCondAlg",UseDynamicAlignFolders = inputFlags.GeoModel.Align.Dynamic)) - PixelDetectorElementCondAlg=CompFactory.PixelDetectorElementCondAlg - result.addCondAlgo(PixelDetectorElementCondAlg(name = "PixelDetectorElementCondAlg")) + from PixelConditionsAlgorithms.PixelConditionsConfig import PixelDetectorElementCondAlgCfg + result.merge(PixelDetectorElementCondAlgCfg(inputFlags)) #Setup SCT conditions SCT_AlignCondAlg=CompFactory.SCT_AlignCondAlg result.addCondAlgo(SCT_AlignCondAlg(name = "SCT_AlignCondAlg",UseDynamicAlignFolders = inputFlags.GeoModel.Align.Dynamic)) - SCT_DetectorElementCondAlg=CompFactory.SCT_DetectorElementCondAlg - result.addCondAlgo(SCT_DetectorElementCondAlg(name = "SCT_DetectorElementCondAlg")) - + + from SCT_GeoModel.SCT_GeoModelConfig import SCT_DetectorElementCondAlgCfg + result.merge(SCT_DetectorElementCondAlgCfg(inputFlags)) + GeometryDBSvc=CompFactory.GeometryDBSvc result.addService(GeometryDBSvc("InDetGeometryDBSvc")) diff --git a/Reconstruction/eflowRec/python/PFRun3Config.py b/Reconstruction/eflowRec/python/PFRun3Config.py index 50f1bcd7ccc6e5cc22cf7f2a9e240b1827c3e9eb..4d216548dfab9ab4201e728b80634176db3129e6 100644 --- a/Reconstruction/eflowRec/python/PFRun3Config.py +++ b/Reconstruction/eflowRec/python/PFRun3Config.py @@ -59,16 +59,16 @@ def PFCfg(inputFlags,**kwargs): #Setup Pixel conditions PixelAlignCondAlg=CompFactory.PixelAlignCondAlg result.addCondAlgo(PixelAlignCondAlg(name = "PixelAlignCondAlg",UseDynamicAlignFolders = inputFlags.GeoModel.Align.Dynamic)) - - PixelDetectorElementCondAlg=CompFactory.PixelDetectorElementCondAlg - result.addCondAlgo(PixelDetectorElementCondAlg(name = "PixelDetectorElementCondAlg")) + + from PixelConditionsAlgorithms.PixelConditionsConfig import PixelDetectorElementCondAlgCfg + result.merge(PixelDetectorElementCondAlgCfg(inputFlags)) #Setup SCT conditions SCT_AlignCondAlg=CompFactory.SCT_AlignCondAlg result.addCondAlgo(SCT_AlignCondAlg(name = "SCT_AlignCondAlg",UseDynamicAlignFolders = inputFlags.GeoModel.Align.Dynamic)) - SCT_DetectorElementCondAlg=CompFactory.SCT_DetectorElementCondAlg - result.addCondAlgo(SCT_DetectorElementCondAlg(name = "SCT_DetectorElementCondAlg")) + from SCT_GeoModel.SCT_GeoModelConfig import SCT_DetectorElementCondAlgCfg + result.merge(SCT_DetectorElementCondAlgCfg(inputFlags)) GeometryDBSvc=CompFactory.GeometryDBSvc result.addService(GeometryDBSvc("InDetGeometryDBSvc")) diff --git a/Tracking/TrkConditions/TrackingGeometryCondAlg/python/AtlasTrackingGeometryCondAlg.py b/Tracking/TrkConditions/TrackingGeometryCondAlg/python/AtlasTrackingGeometryCondAlg.py index 73f6976cfce3500281e072fbf51aeb7a10a551ce..ce9666700bc7e78ffb021213ded65204df12de4e 100644 --- a/Tracking/TrkConditions/TrackingGeometryCondAlg/python/AtlasTrackingGeometryCondAlg.py +++ b/Tracking/TrkConditions/TrackingGeometryCondAlg/python/AtlasTrackingGeometryCondAlg.py @@ -20,6 +20,18 @@ from AthenaCommon.DetFlags import DetFlags ################################################################################# # Material for the Geometry comes from COOL or local database ################################################################################# +def modifyCondAlg(the_name, **props) : + from AthenaCommon.AlgSequence import AlgSequence + from AthenaCommon.AlgSequence import AthSequencer + cond_seq=AthSequencer("AthCondSeq") + for seq in [AlgSequence(),cond_seq] : + if hasattr(seq,the_name) : + alg = getattr(seq,the_name) + print('Modified %s' % the_name) + for k,v in props.items() : + setattr(alg,k,v) + print (alg) + return from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags @@ -73,7 +85,25 @@ class ConfiguredTrackingGeometryCondAlg( Trk__TrackingGeometryCondAlg ) : InDetTrackingGeometryBuilder.OutputLevel = TrkDetFlags.InDetBuildingOutputLevel() # and give it to the Geometry Builder AtlasGeometryBuilder.InDetTrackingGeometryBuilder = InDetTrackingGeometryBuilder - # + + # artifical dependencies to Si-DetectorElement conditions algs to ensure that + # the IOV is identical to the IOV of the tracking geoemtry + from AthenaCommon.ConcurrencyFlags import jobproperties as jp + if jp.ConcurrencyFlags.NumThreads() > 0: + + MuonManagerKey = ['MuonDetectorManager'] if (DetFlags.Muon_on() and not DetFlags.writeRDOPool.Muon_on()) else [] + TRT_DetEltKey = ["TRT_DetElementContainer"] if DetFlags.TRT_on() else [] + SCTAlignStore = ["SCTAlignmentStore"] if DetFlags.SCT_on() else [] + PixelAlignStore = ["PixelAlignmentStore"] if DetFlags.pixel_on() else [] + + modifyCondAlg('SCT_DetectorElementCondAlg', MuonManagerKey = MuonManagerKey, + TRT_DetEltContKey = TRT_DetEltKey, + PixelAlignmentStore = PixelAlignStore) + + modifyCondAlg('PixelDetectorElementCondAlg', MuonManagerKey = MuonManagerKey, + TRT_DetEltContKey = TRT_DetEltKey, + SCTAlignmentStore = SCTAlignStore) + # (Calo) if DetFlags.Calo_on() : from TrkDetDescrTools.TrkDetDescrToolsConf import Trk__CylinderVolumeCreator @@ -96,7 +126,7 @@ class ConfiguredTrackingGeometryCondAlg( Trk__TrackingGeometryCondAlg ) : MuonTrackingGeometryBuilderCond.EnvelopeDefinitionSvc = AtlasEnvelopeSvc # and give it to the Geometry Builder AtlasGeometryBuilder.MuonTrackingGeometryBuilder = MuonTrackingGeometryBuilderCond - + # processors AtlasGeometryProcessors = [] diff --git a/Tracking/TrkConditions/TrackingGeometryCondAlg/python/AtlasTrackingGeometryCondAlgConfig.py b/Tracking/TrkConditions/TrackingGeometryCondAlg/python/AtlasTrackingGeometryCondAlgConfig.py index 6658ce3b65b1b224deb4c37efeebb6f3b8a7d9d7..f779c1a39be78f96fe38a68ebc29247b05cd2eee 100644 --- a/Tracking/TrkConditions/TrackingGeometryCondAlg/python/AtlasTrackingGeometryCondAlgConfig.py +++ b/Tracking/TrkConditions/TrackingGeometryCondAlg/python/AtlasTrackingGeometryCondAlgConfig.py @@ -78,6 +78,14 @@ def _getInDetTrackingGeometryBuilder(name, flags,result, envelopeDefinitionSvc, binnings += [ PixelLayerBinning ] colors += [ 3 ] + # add artifical dependencies to Pixel DetectorElement conditions algs to ensure that the IOV + # is identical to the IOV of the tracking geoemtry cond alg + from PixelConditionsAlgorithms.PixelConditionsConfig import PixelDetectorElementCondAlgCfg + result.merge(PixelDetectorElementCondAlgCfg(flags, + MuonManagerKey = ["MuonDetectorManager"] if flags.Muon.enableAlignment and flags.Concurrency.NumThreads > 0 else [], + TRT_DetEltContKey = ["TRT_DetElementContainer"] if flags.Detector.GeometryTRT and flags.Concurrency.NumThreads > 0 else [], + SCTAlignmentStore = ["SCTAlignmentStore"] if flags.Detector.GeometrySCT and flags.Concurrency.NumThreads > 0 else [])) + if flags.Detector.GeometrySCT: # for SCT DetectorElement conditions data : from SCT_GeoModel.SCT_GeoModelConfig import SCT_GeometryCfg @@ -113,6 +121,13 @@ def _getInDetTrackingGeometryBuilder(name, flags,result, envelopeDefinitionSvc, binnings += [ SCT_LayerBinning ] colors += [ 4 ] + from SCT_GeoModel.SCT_GeoModelConfig import SCT_DetectorElementCondAlgCfg + result.merge(SCT_DetectorElementCondAlgCfg(flags, + MuonManagerKey = ["MuonDetectorManager"] if flags.Muon.enableAlignment and flags.Concurrency.NumThreads > 0 else [], + + TRT_DetEltContKey = ["TRT_DetElementContainer"] if flags.Detector.GeometryTRT and flags.Concurrency.NumThreads > 0 else [], + PixelAlignmentStore = ["PixelAlignmentStore"] if flags.Detector.GeometryPixel and flags.Concurrency.NumThreads > 0 else [])) + if flags.Detector.GeometryTRT: # for TRT DetectorElement conditions data : from TRT_GeoModel.TRT_GeoModelConfig import TRT_GeometryCfg