From 562b9f45056946a672fc60205c4839baffb6ebee Mon Sep 17 00:00:00 2001 From: Susumu Oda <susumu.oda@cern.ch> Date: Wed, 23 May 2018 14:44:30 +0000 Subject: [PATCH] Use SiLorentzAngleTool instead of SiLorentzAngleCHSvc in SCT (ATLASRECTS-4048, ATLASRECTS-4370) Former-commit-id: fdc7018fee9f841d568c1cdcc5bb58cd2231311c --- .../GeoModel/AtlasGeoModel/python/InDetGM.py | 9 +- .../InDetCondServices/ISiLorentzAngleTool.h | 24 +- .../share/testCalibChipRead.py | 2 +- .../share/testCalibRead.py | 2 +- .../share/testConfig.py | 2 +- .../share/testDCSConditions.py | 2 +- .../share/testMajority.py | 2 +- .../share/testModuleVeto.py | 2 +- .../share/testMonRead.py | 2 +- .../share/testParameters.py | 2 +- .../share/testReadout.py | 2 +- .../share/testRodVeto.py | 2 +- .../share/testSensors.py | 2 +- .../share/testSilicon.py | 2 +- .../share/testStripVeto.py | 2 +- .../share/testSummary.py | 2 +- .../share/testTdaqEnabled.py | 2 +- .../python/LorentzAngleSvcSetup.py | 18 +- .../python/SCTLorentzAngleSvcSetup.py | 106 --------- .../python/SCTLorentzAngleToolSetup.py | 13 ++ .../src/SCTSiLorentzAngleCondAlg.cxx | 3 +- .../src/SiLorentzAngleTool.cxx | 42 ++-- .../src/SiLorentzAngleTool.h | 29 +-- .../InDetReadoutGeometry/SiCommonItems.h | 6 +- .../src/SiCommonItems.cxx | 14 +- .../src/SiDetectorElement.cxx | 13 +- .../SCT_GeoModel/SCT_DetectorTool.h | 6 +- .../SCT_GeoModel/SCT_GeoModelAthenaComps.h | 11 +- .../SCT_GeoModel/python/SCT_GeoModelConfig.py | 19 +- .../SCT_GeoModel/src/SCT_DetectorFactory.cxx | 2 +- .../SCT_GeoModel/src/SCT_DetectorTool.cxx | 206 +++++++----------- .../src/SCT_GeoModelAthenaComps.cxx | 12 +- .../SCT_GeoModelAthenaComps.h | 10 +- .../SCT_SLHC_GeoModel/SCT_SLHC_DetectorTool.h | 5 +- .../src/SCT_DetectorFactory.cxx | 2 +- .../src/SCT_GeoModelAthenaComps.cxx | 14 +- .../src/SCT_SLHC_DetectorTool.cxx | 160 ++++++-------- .../ReadSiDetectorElements.h | 5 +- .../ReadSiDetectorElements_jobOptions.py | 4 +- .../src/ReadSiDetectorElements.cxx | 11 +- .../share/InDetRecConditionsAccess.py | 9 +- .../InDetSLHC_Example/share/geometry.py | 16 +- .../python/InDetTrigConfigConditions.py | 20 +- .../ReadSiDetectorElements_jobOptions.py | 4 +- 44 files changed, 347 insertions(+), 476 deletions(-) delete mode 100644 InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleSvcSetup.py diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGM.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGM.py index 91154278a7f..3faea603f1f 100755 --- a/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGM.py +++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGM.py @@ -59,12 +59,9 @@ elif ( DetFlags.detdescr.ID_on() ): sctSLHCTool = SCT_SLHC_DetectorTool() sctSLHCTool.ServiceBuilderTool = InDetServMatBuilderToolSLHC GeoModelSvc.DetectorTools += [ sctSLHCTool ] - if not hasattr(svcMgr,'SCTLorentzAngleSvc'): - from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleCHSvc - SCTLorentzAngleSvc = SiLorentzAngleCHSvc(name = "SCTLorentzAngleSvc", - UseMagFieldSvc = False, - DetectorName = "SCT") - svcMgr+=SCTLorentzAngleSvc + if not hasattr(ToolSvc, "SCTLorentzAngleTool"): + from SiLorentzAngleSvc.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup + sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() else: # Current atlas specific code from AthenaCommon import CfgGetter diff --git a/InnerDetector/InDetConditions/InDetCondServices/InDetCondServices/ISiLorentzAngleTool.h b/InnerDetector/InDetConditions/InDetCondServices/InDetCondServices/ISiLorentzAngleTool.h index 5845fbceb72..54ff794c01f 100644 --- a/InnerDetector/InDetConditions/InDetCondServices/InDetCondServices/ISiLorentzAngleTool.h +++ b/InnerDetector/InDetConditions/InDetCondServices/InDetCondServices/ISiLorentzAngleTool.h @@ -32,45 +32,47 @@ public: /** Get the Lorentz angle shift in the local x (phiDist) direction Assumes the center of the detector and is generally cached. */ - virtual double getLorentzShift(const IdentifierHash& elementHash) = 0; + virtual double getLorentzShift(const IdentifierHash& elementHash) const = 0; /** As above, but provide the local position. More accurate but slower */ - virtual double getLorentzShift(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) = 0; + virtual double getLorentzShift(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const = 0; /** Get the Lorentz angle shift in the local y (etaDist) direction Assumes the center of the detector and is generally cached.*/ - virtual double getLorentzShiftEta(const IdentifierHash& elementHash) = 0; + virtual double getLorentzShiftEta(const IdentifierHash& elementHash) const = 0; /** As above, but provide the local position. More accurate but slower. */ - virtual double getLorentzShiftEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) = 0; + virtual double getLorentzShiftEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const = 0; /** Get tan af the Lorentz angle in the local x (phiDist) direction Assumes the center of the detector and is generally cached. */ - virtual double getTanLorentzAngle(const IdentifierHash& elementHash) = 0; + virtual double getTanLorentzAngle(const IdentifierHash& elementHash) const = 0; /** As above, but provide the local position. More accurate but slower. */ - virtual double getTanLorentzAngle(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) = 0; + virtual double getTanLorentzAngle(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const = 0; /** Get tan af the Lorentz angle in the local y (etaDist) direction Assumes the center of the detector and is generally cached */ - virtual double getTanLorentzAngleEta(const IdentifierHash& elementHash) = 0; + virtual double getTanLorentzAngleEta(const IdentifierHash& elementHash) const = 0; /** As above, but provide the local position. More accurate but slower. */ - virtual double getTanLorentzAngleEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) = 0; + virtual double getTanLorentzAngleEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const = 0; /** Get bias voltage */ - virtual double getBiasVoltage(const IdentifierHash& elementHash) = 0; + virtual double getBiasVoltage(const IdentifierHash& elementHash) const = 0; /** Get temperature */ - virtual double getTemperature(const IdentifierHash& elementHash) = 0; + virtual double getTemperature(const IdentifierHash& elementHash) const = 0; /** Get depletion voltage */ - virtual double getDepletionVoltage(const IdentifierHash& elementHash) = 0; + virtual double getDepletionVoltage(const IdentifierHash& elementHash) const = 0; + /** Retrieve detector manager */ + virtual StatusCode retrieveDetectorManager() = 0; }; #endif // ISiLorentzAngleTool_h diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testCalibChipRead.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testCalibChipRead.py index 626dd410015..19411dddb74 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testCalibChipRead.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testCalibChipRead.py @@ -92,7 +92,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" #-------------------------------------------------------------- # Load ReadCalibData Alg and Service diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testCalibRead.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testCalibRead.py index 65047366827..78d88f9c472 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testCalibRead.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testCalibRead.py @@ -86,7 +86,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" #-------------------------------------------------------------- # Load ReadCalibData Alg and Service diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testConfig.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testConfig.py index d895d0cb70b..f4e7ebf10d8 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testConfig.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testConfig.py @@ -61,7 +61,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" from AthenaCommon.AlgSequence import AlgSequence job = AlgSequence() diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testDCSConditions.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testDCSConditions.py index 37541a5d747..745fb33e30c 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testDCSConditions.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testDCSConditions.py @@ -73,7 +73,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" #-------------------------------------------------------------- # Load DCSConditions Alg and Service diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testMajority.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testMajority.py index f2e1a8ff0f7..9d23d725c40 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testMajority.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testMajority.py @@ -61,7 +61,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" #-------------------------------------------------------------- # Load conditions services and alg diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testModuleVeto.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testModuleVeto.py index 649de6a1b17..3c5012f35f0 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testModuleVeto.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testModuleVeto.py @@ -62,7 +62,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" from AthenaCommon.AlgSequence import AlgSequence diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testMonRead.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testMonRead.py index e4c6383a62a..b8e4bb62fc1 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testMonRead.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testMonRead.py @@ -63,7 +63,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" #------------------------------------------------------------ diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testParameters.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testParameters.py index 2cb160c21bc..b767e6e9bfe 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testParameters.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testParameters.py @@ -76,7 +76,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" #-------------------------------------------------------------- # Event selector settings. Use McEventSelector diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testReadout.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testReadout.py index 8ad6e5df4f0..e56ca9507c3 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testReadout.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testReadout.py @@ -61,7 +61,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" from AthenaCommon.AlgSequence import AlgSequence diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testRodVeto.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testRodVeto.py index 26c366b9aeb..e42c908d012 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testRodVeto.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testRodVeto.py @@ -64,7 +64,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" from AthenaCommon.AlgSequence import AlgSequence diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSensors.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSensors.py index d43a2a7045d..261da053050 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSensors.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSensors.py @@ -78,7 +78,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" from SCT_ConditionsTools.SCT_SensorsToolSetup import SCT_SensorsToolSetup sct_SensorsToolSetup = SCT_SensorsToolSetup() diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSilicon.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSilicon.py index 26a5dd72bbc..4b3c8ea3458 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSilicon.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSilicon.py @@ -63,7 +63,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" from AthenaCommon.AlgSequence import AlgSequence job = AlgSequence() diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testStripVeto.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testStripVeto.py index 2cce799c868..408fcea5073 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testStripVeto.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testStripVeto.py @@ -62,7 +62,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" from AthenaCommon.AlgSequence import AlgSequence diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSummary.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSummary.py index 5dcdcdd3c34..c18f7d9c828 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSummary.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testSummary.py @@ -51,7 +51,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" from AthenaCommon.AlgSequence import AlgSequence diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testTdaqEnabled.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testTdaqEnabled.py index d8567908c80..85fbff4239a 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testTdaqEnabled.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testTdaqEnabled.py @@ -75,7 +75,7 @@ import AtlasGeoModel.GeoModelInit # Disable SiLorentzAngleSvc to remove # ERROR ServiceLocatorHelper::createService: wrong interface id IID_665279653 for service ServiceMgr.GeoModelSvc.DetectorTools['PixelDetectorTool'].LorentzAngleSvc="" -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc="" +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool="" from IOVSvc.IOVSvcConf import CondSvc ServiceMgr += CondSvc() diff --git a/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/LorentzAngleSvcSetup.py b/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/LorentzAngleSvcSetup.py index ee9e640ae27..ea9971acb27 100644 --- a/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/LorentzAngleSvcSetup.py +++ b/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/LorentzAngleSvcSetup.py @@ -63,13 +63,13 @@ class LorentzAngleSvcSetup: ## SCT ## if ( DetFlags.detdescr.SCT_on() ): - # Init SCTLorentzAngleSvc + # Init SCTLorentzAngleTool - from SCTLorentzAngleSvcSetup import SCTLorentzAngleSvcSetup - sctLorentzAngleSvcSetup = SCTLorentzAngleSvcSetup() - self.sct = sctLorentzAngleSvcSetup.SCTLorentzAngleSvc - self.sctSiliconConditionsTool = sctLorentzAngleSvcSetup.SCT_SiliconConditionsTool - self.SCT_SiliconConditionsTool = sctLorentzAngleSvcSetup.SCT_SiliconConditionsTool + from SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup + sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() + self.sct = sctLorentzAngleToolSetup.SCTLorentzAngleTool + self.sctSiliconConditionsTool = sctLorentzAngleToolSetup.SCT_SiliconConditionsTool + self.SCT_SiliconConditionsTool = sctLorentzAngleToolSetup.SCT_SiliconConditionsTool # Force the Lorentz angle sercive to use SiliconConditions service (which are assumed to use the DB) # Default is to decide based on GeoModel. @@ -118,6 +118,6 @@ from AthenaCommon.DetFlags import DetFlags if ( DetFlags.detdescr.pixel_on() ): from PixelLorentzAngleSvcSetup import PixelLorentzAngleSvc if ( DetFlags.detdescr.SCT_on() ): - from SCTLorentzAngleSvcSetup import SCTLorentzAngleSvcSetup - sctLorentzAngleSvcSetup = SCTLorentzAngleSvcSetup() - SCTLorentzAngleSvc = sctLorentzAngleSvcSetup.SCTLorentzAngleSvc + from SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup + sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() + SCTLorentzAngleTool = sctLorentzAngleToolSetup.SCTLorentzAngleTool diff --git a/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleSvcSetup.py b/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleSvcSetup.py deleted file mode 100644 index 6fdd25d902f..00000000000 --- a/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleSvcSetup.py +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - - -# Usage: -# -# from SiLorentzAngleSvc.LorentzAngleSvcSetup import SCTLorentzAngleSvcSetup -# -# By default will determine whether to use DB or not from GeoModel. -# To force usage of DB (that is, use SiliconConditionsServices which should -# normally read from DB): -# -# SCTLorentzAngleSvcSetup.forceUseDB() -# -# For more configuration one can get access to the service configurable via -# members pixel and sct: Eg: -# lorentzAngleSvc.pixel.OutputLevel = VERBOSE -# lorentzAngleSvc.sct.OutputLevel = VERBOSE -# print lorentzAngleSvc.pixel -# print lorentzAngleSvc.sct -# -# You can also access the pixel and sct SiliconConditionsSvc: -# -# lorentzAngleSvc.PixelSiliconConditionsSvc.CheckGeoModel = False # same as forceUseDB -# lorentzAngleSvc.SCT_SiliconConditionsSvc.CheckGeoModel = False # same as forceUseDB -# print lorentzAngleSvc.PixelSiliconConditionsSvc -# print lorentzAngleSvc.SCT_SiliconConditionsSvc -# -# -# Alternatively, you can also access the services by: -# from SiLorentzAngleSvc.LorentzAngleSvcSetup import PixelLorentzAngleSvc,SCTLorentzAngleSvc -# -# PixelLorentzAngleSvc.ForceUseDB = True -# SCTLorentzAngleSvc.ForceUseDB = True -# PixelLorentzAngleSvc.OutputLevel = VERBOSE -# SCTLorentzAngleSvc.OutputLevel = VERBOSE -# - -class SCTLorentzAngleSvcSetup: - "Class to simplify setup of LorentzAngleSvc" - def __init__(self, forceUseDB=False, forceUseGeoModel=False): - if forceUseDB and forceUseGeoModel: - from AthenaCommon import Logging - msg = Logging.logging.getLogger("SCTLorentzAngleSvcSetup") - msg.error("Setting is wrong: both forceUseDB and forceUseGeoModel cannot be True at the same time") - return - - # Set up SCT_DCSConditiosnTool if necessary - if not forceUseGeoModel: - from SCT_ConditionsTools.SCT_DCSConditionsToolSetup import SCT_DCSConditionsToolSetup - sct_DCSConditionsToolSetup = SCT_DCSConditionsToolSetup() - sct_DCSConditionsToolSetup.setup() - - # Set up SCT_SiliconConditionsTool - from SCT_ConditionsTools.SCT_SiliconConditionsToolSetup import SCT_SiliconConditionsToolSetup - sct_SiliconConditionsToolSetup = SCT_SiliconConditionsToolSetup() - if forceUseGeoModel: - sct_SiliconConditionsToolSetup.setUseDB(False) - sct_SiliconConditionsToolSetup.setForceUseGeoModel(True) - else: - sct_SiliconConditionsToolSetup.setDcsTool(sct_DCSConditionsToolSetup.getTool()) - sct_SiliconConditionsToolSetup.setup() - sctSiliconConditionsTool = sct_SiliconConditionsToolSetup.getTool() - self.sctSiliconConditionsTool = sctSiliconConditionsTool - self.SCT_SiliconConditionsTool = sctSiliconConditionsTool - - # Set up SCTSiLorentzAngleCondAlg - from AthenaCommon.AlgSequence import AthSequencer - condSeq = AthSequencer("AthCondSeq") - if not hasattr(condSeq, "SCTSiLorentzAngleCondAlg"): - from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SCTSiLorentzAngleCondAlg - from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - condSeq += SCTSiLorentzAngleCondAlg(name = "SCTSiLorentzAngleCondAlg", - SiConditionsTool = sctSiliconConditionsTool, - UseMagFieldSvc = True, - UseMagFieldDcs = (not athenaCommonFlags.isOnline()), - UseGeoModel = forceUseGeoModel) - sctSiLorentzAngleCondAlg = condSeq.SCTSiLorentzAngleCondAlg - if forceUseDB: - sctSiLorentzAngleCondAlg.useSctDefaults = False - - # Set up SCTLorentzAngleSvc - from AthenaCommon.AppMgr import ServiceMgr - if not hasattr(ServiceMgr, "SCTLorentzAngleSvc"): - from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleCHSvc - ServiceMgr += SiLorentzAngleCHSvc(name="SCTLorentzAngleSvc", DetectorName="SCT") - sctLorentzAngleSvc = ServiceMgr.SCTLorentzAngleSvc - # Pass the silicon conditions tool to the Lorentz angle service - # Also make sure UseMagFieldTool is True as AtlasGeoModel sets this to False - # if loaded first. - sctLorentzAngleSvc.UseMagFieldSvc = True - self.SCTLorentzAngleSvc = sctLorentzAngleSvc - - # Force the Lorentz angle sercive to use SiliconConditions service (which are assumed to use the DB) - # Default is to decide based on GeoModel. - def forceUseDB(self) : - "Force usage of conditions DB" - self.SCT_SiliconConditionsTool.CheckGeoModel = False - from AthenaCommon import Logging - msg = Logging.logging.getLogger("SCTLorentzAngleSvcSetup") - msg.warning("Please set forceUseDB in constructor. Unnecessary service, algorithms, folders are configured") - - # Force to use the defaults from GeoModel. In case it is not possible to use DCS - def forceUseGeoModel(self) : - "Force usage of GeoModel defaults" - self.SCT_SiliconConditionsTool.ForceUseGeoModel = True - msg.warning("Please set forceUseGeoModel in constructor. Unnecessary service, algorithms, folders are configured") diff --git a/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleToolSetup.py b/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleToolSetup.py index 2a0ef9cc376..82fb2db8cd1 100644 --- a/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleToolSetup.py +++ b/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleToolSetup.py @@ -13,6 +13,19 @@ class SCTLorentzAngleToolSetup: if not forceUseGeoModel: from SCT_ConditionsTools.SCT_DCSConditionsToolSetup import SCT_DCSConditionsToolSetup sct_DCSConditionsToolSetup = SCT_DCSConditionsToolSetup() + + # For HLT + from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + if athenaCommonFlags.isOnline(): + sct_DCSConditionsToolSetup.setReadAllDBFolders(False) + from AthenaCommon.GlobalFlags import globalflags + if globalflags.DataSource() == "data": + sct_DCSConditionsToolSetup.setDbInstance("SCT") + dcs_folder="/SCT/HLT/DCS" + sct_DCSConditionsToolSetup.setStateFolder(dcs_folder+"/CHANSTAT") + sct_DCSConditionsToolSetup.setHVFolder(dcs_folder+"/HV") + sct_DCSConditionsToolSetup.setTempFolder(dcs_folder+"/MODTEMP") + sct_DCSConditionsToolSetup.setup() # Set up SCT_SiliconConditionsTool diff --git a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SCTSiLorentzAngleCondAlg.cxx b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SCTSiLorentzAngleCondAlg.cxx index a785d4bbf5b..7170f3c43e7 100644 --- a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SCTSiLorentzAngleCondAlg.cxx +++ b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SCTSiLorentzAngleCondAlg.cxx @@ -39,7 +39,7 @@ SCTSiLorentzAngleCondAlg::SCTSiLorentzAngleCondAlg(const std::string& name, ISvc declareProperty("ReadKeyHV", m_readKeyHV, "Key of input SCT HV"); declareProperty("ReadKeyBFieldSensor", m_readKeyBFieldSensor, "Key of input B-field sensor"); declareProperty("WriteKey", m_writeKey, "Key of output SiLorentzAngleCondData"); - // YOU NEED TO USE THE SAME PROPERTIES AS USED IN SCT_LorentzAngleSvc!!! + // YOU NEED TO USE THE SAME PROPERTIES AS USED IN SCTLorentzAngleTool!!! declareProperty("MagFieldSvc", m_magFieldSvc); declareProperty("Temperature", m_temperature = -7., "Default temperature in Celcius."); declareProperty("DepletionVoltage", m_deplVoltage = 70., "Default depletion voltage in Volt."); @@ -221,6 +221,7 @@ StatusCode SCTSiLorentzAngleCondAlg::execute() // the detector is not fully depleted and we need to take this into account. // We take absolute values just in case voltages are signed. const InDetDD::SiDetectorElement* element{m_detManager->getDetectorElement(elementHash)}; + element->invalidateConditions(); // Invalidate cache of conditions which keep Lorentz angle of SiDetectorElement double depletionDepth{element->thickness()}; if (deplVoltage==0.0) { ATH_MSG_WARNING("Depletion voltage in "<<__FILE__<<" is zero, which might be a bug."); diff --git a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.cxx b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.cxx index d5f025c241f..1e70bec1dea 100644 --- a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.cxx +++ b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.cxx @@ -50,7 +50,12 @@ StatusCode SiLorentzAngleTool::initialize() { ATH_CHECK(m_condData.initialize()); // Get the detector manager - CHECK(detStore()->retrieve(m_detManager, m_detectorName)); + if (detStore()->contains<InDetDD::SiDetectorManager>(m_detectorName)) { + ATH_CHECK(detStore()->retrieve(m_detManager, m_detectorName)); + } else { + ATH_MSG_INFO("InDetDD::SiDetectorManager " << m_detectorName << " is not available yet."); + ATH_MSG_INFO("SiLorentzAngleTool::retrieveDetectorManager() has to be called later."); + } // MagneticFieldSvc handles updates itself if (not m_useMagFieldSvc) { @@ -67,7 +72,7 @@ StatusCode SiLorentzAngleTool::finalize() { return StatusCode::SUCCESS; } -double SiLorentzAngleTool::getLorentzShift(const IdentifierHash& elementHash) { +double SiLorentzAngleTool::getLorentzShift(const IdentifierHash& elementHash) const { const SiLorentzAngleCondData* condData{getCondData()}; if (condData) { return condData->getLorentzShift(elementHash); @@ -75,13 +80,13 @@ double SiLorentzAngleTool::getLorentzShift(const IdentifierHash& elementHash) { return s_invalidValue; } -double SiLorentzAngleTool::getLorentzShift(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) { +double SiLorentzAngleTool::getLorentzShift(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const { if (m_ignoreLocalPos) return getLorentzShift(elementHash); // The cache is used to store the results. The cache is therefore invalidated if we specify a position. return getValue(elementHash, locPos, LorentzShift); } -double SiLorentzAngleTool::getLorentzShiftEta(const IdentifierHash& elementHash) { +double SiLorentzAngleTool::getLorentzShiftEta(const IdentifierHash& elementHash) const { const SiLorentzAngleCondData* condData{getCondData()}; if (condData) { return condData->getLorentzShiftEta(elementHash); @@ -89,13 +94,13 @@ double SiLorentzAngleTool::getLorentzShiftEta(const IdentifierHash& elementHash) return s_invalidValue; } -double SiLorentzAngleTool::getLorentzShiftEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) { +double SiLorentzAngleTool::getLorentzShiftEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const { if (m_ignoreLocalPos) return getLorentzShiftEta(elementHash); // The cache is used to store the results. The cache is therefore invalidated if we specify a position. return getValue(elementHash, locPos, LorentzShiftEta); } -double SiLorentzAngleTool::getTanLorentzAngle(const IdentifierHash& elementHash) { +double SiLorentzAngleTool::getTanLorentzAngle(const IdentifierHash& elementHash) const { const SiLorentzAngleCondData* condData{getCondData()}; if (condData) { return condData->getTanLorentzAngle(elementHash); @@ -103,13 +108,13 @@ double SiLorentzAngleTool::getTanLorentzAngle(const IdentifierHash& elementHash) return s_invalidValue; } -double SiLorentzAngleTool::getTanLorentzAngle(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) { +double SiLorentzAngleTool::getTanLorentzAngle(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const { if (m_ignoreLocalPos) return getTanLorentzAngle(elementHash); // The cache is used to store the results. The cache is therefore invalidated if we specify a position. return getValue(elementHash, locPos, TanLorentzAngle); } -double SiLorentzAngleTool::getTanLorentzAngleEta(const IdentifierHash& elementHash) { +double SiLorentzAngleTool::getTanLorentzAngleEta(const IdentifierHash& elementHash) const { const SiLorentzAngleCondData* condData{getCondData()}; if (condData) { return condData->getTanLorentzAngleEta(elementHash); @@ -117,13 +122,13 @@ double SiLorentzAngleTool::getTanLorentzAngleEta(const IdentifierHash& elementHa return s_invalidValue; } -double SiLorentzAngleTool::getTanLorentzAngleEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) { +double SiLorentzAngleTool::getTanLorentzAngleEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const { if (m_ignoreLocalPos) return getTanLorentzAngleEta(elementHash); // The cache is used to store the results. The cache is therefore invalidated if we specify a position. return getValue(elementHash, locPos, TanLorentzAngleEta); } -double SiLorentzAngleTool::getBiasVoltage(const IdentifierHash& elementHash) { +double SiLorentzAngleTool::getBiasVoltage(const IdentifierHash& elementHash) const { const SiLorentzAngleCondData* condData{getCondData()}; if (condData) { return condData->getBiasVoltage(elementHash); @@ -131,7 +136,7 @@ double SiLorentzAngleTool::getBiasVoltage(const IdentifierHash& elementHash) { return s_invalidValue; } -double SiLorentzAngleTool::getTemperature(const IdentifierHash& elementHash) { +double SiLorentzAngleTool::getTemperature(const IdentifierHash& elementHash) const { const SiLorentzAngleCondData* condData{getCondData()}; if (condData) { return condData->getTemperature(elementHash); @@ -139,7 +144,7 @@ double SiLorentzAngleTool::getTemperature(const IdentifierHash& elementHash) { return s_invalidValue; } -double SiLorentzAngleTool::getDepletionVoltage(const IdentifierHash& elementHash) { +double SiLorentzAngleTool::getDepletionVoltage(const IdentifierHash& elementHash) const { const SiLorentzAngleCondData* condData{getCondData()}; if (condData) { return condData->getDepletionVoltage(elementHash); @@ -147,7 +152,7 @@ double SiLorentzAngleTool::getDepletionVoltage(const IdentifierHash& elementHash return s_invalidValue; } -double SiLorentzAngleTool::getValue(const IdentifierHash& elementHash, const Amg::Vector2D& locPos, Variable variable) { +double SiLorentzAngleTool::getValue(const IdentifierHash& elementHash, const Amg::Vector2D& locPos, Variable variable) const { if (not (variable==TanLorentzAngle or variable==LorentzShift or variable==TanLorentzAngleEta or variable==LorentzShiftEta)) { ATH_MSG_WARNING("getValue with Variable=" << variable << " is not available"); return s_invalidValue; @@ -219,7 +224,7 @@ double SiLorentzAngleTool::getCorrectionFactor() const return s_invalidValue; } -Amg::Vector3D SiLorentzAngleTool::getMagneticField(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) { +Amg::Vector3D SiLorentzAngleTool::getMagneticField(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const { // Get the magnetic field. const InDetDD::SiDetectorElement* element{m_detManager->getDetectorElement(elementHash)}; Amg::Vector3D pointvec{element->globalPosition(locPos)}; @@ -249,4 +254,13 @@ const SiLorentzAngleCondData* SiLorentzAngleTool::getCondData() const { return nullptr; } +StatusCode SiLorentzAngleTool::retrieveDetectorManager() { + // If m_detManager is not retrieved yet, it is retrieved. + if (!m_detManager) { + ATH_CHECK(detStore()->retrieve(m_detManager, m_detectorName)); + ATH_MSG_INFO("SiLorentzAngleTool::retrieveDetectorManager() is called now."); + } + return StatusCode::SUCCESS; +} + const double SiLorentzAngleTool::s_invalidValue{std::numeric_limits<double>::quiet_NaN()}; diff --git a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.h b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.h index 09f6874b273..35a1a3fc183 100644 --- a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.h +++ b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.h @@ -44,51 +44,54 @@ public: /** Get the Lorentz shift correction in the local x (phiDist) direction Assumes the center of the detector and is generally cached. */ - virtual double getLorentzShift(const IdentifierHash& elementHash) override; + virtual double getLorentzShift(const IdentifierHash& elementHash) const override; /** As above, but provide the local position. More accurate but slower. */ - virtual double getLorentzShift(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) override; + virtual double getLorentzShift(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const override; /**Get the Lorentz shift correction in the local y (etaDist) direction Assumes the center of the detector and is generally cached. */ - virtual double getLorentzShiftEta(const IdentifierHash& elementHash) override; + virtual double getLorentzShiftEta(const IdentifierHash& elementHash) const override; /** As above, but provide the local position. More accurate but slower. */ - virtual double getLorentzShiftEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) override; + virtual double getLorentzShiftEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const override; /** Get tan af the Lorentz angle in the local x (phiDist) direction Assumes the center of the detector and is generally cached. */ - virtual double getTanLorentzAngle(const IdentifierHash& elementHash) override; + virtual double getTanLorentzAngle(const IdentifierHash& elementHash) const override; /** As above, but provide the local position. More accurate but slower. */ - virtual double getTanLorentzAngle(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) override; + virtual double getTanLorentzAngle(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const override; /** Get tan af the Lorentz angle in the local y (etaDist) direction Assumes the center of the detector and is generally cached. */ - virtual double getTanLorentzAngleEta(const IdentifierHash& elementHash) override; + virtual double getTanLorentzAngleEta(const IdentifierHash& elementHash) const override; /** As above, but provide the local position. More accurate but slower. */ - virtual double getTanLorentzAngleEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) override; + virtual double getTanLorentzAngleEta(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const override; /** Get bias voltage */ - virtual double getBiasVoltage(const IdentifierHash& elementHash) override; + virtual double getBiasVoltage(const IdentifierHash& elementHash) const override; /** Get temperature */ - virtual double getTemperature(const IdentifierHash& elementHash) override; + virtual double getTemperature(const IdentifierHash& elementHash) const override; /** Get depletion voltage */ - virtual double getDepletionVoltage(const IdentifierHash& elementHash) override; + virtual double getDepletionVoltage(const IdentifierHash& elementHash) const override; + + /** Retrieve detector manager */ + virtual StatusCode retrieveDetectorManager() override; private: enum Variable {LorentzShift, LorentzShiftEta, TanLorentzAngle, TanLorentzAngleEta}; - double getValue(const IdentifierHash& elementHash, const Amg::Vector2D& locPos, Variable variable); + double getValue(const IdentifierHash& elementHash, const Amg::Vector2D& locPos, Variable variable) const; double getCorrectionFactor() const; - Amg::Vector3D getMagneticField(const IdentifierHash& elementHash, const Amg::Vector2D& locPos); + Amg::Vector3D getMagneticField(const IdentifierHash& elementHash, const Amg::Vector2D& locPos) const; const SiLorentzAngleCondData* getCondData() const; // Properties diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiCommonItems.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiCommonItems.h index 4999443b479..da6b5ebcb43 100755 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiCommonItems.h +++ b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiCommonItems.h @@ -19,6 +19,7 @@ class AtlasDetectorID; #include "CLHEP/Geometry/Transform3D.h" #include "GeoModelKernel/RCBase.h" #include "InDetCondServices/ISiLorentzAngleSvc.h" +#include "InDetCondServices/ISiLorentzAngleTool.h" namespace InDetDD { @@ -44,8 +45,10 @@ namespace InDetDD { const HepGeom::Transform3D & solenoidFrame() const; void setSolenoidFrame(const HepGeom::Transform3D & transform) const; void setLorentzAngleSvc(const ServiceHandle<ISiLorentzAngleSvc> & lorentzAngleSvc); + void setLorentzAngleTool(const ISiLorentzAngleTool* lorentzAngleTool); ISiLorentzAngleSvc * lorentzAngleSvc() const; - + const ISiLorentzAngleTool* lorentzAngleTool() const; + //Declaring the Message method for further use MsgStream& msg (MSG::Level lvl) const { return m_msg.get() << lvl; } @@ -62,6 +65,7 @@ namespace InDetDD { ServiceHandle<ISiLorentzAngleSvc> m_lorentzAngleSvcHandle; mutable ISiLorentzAngleSvc * m_lorentzAngleSvc; mutable bool m_lorentzAngleSvcInit; + const ISiLorentzAngleTool* m_lorentzAngleTool; }; diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiCommonItems.cxx b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiCommonItems.cxx index e7cd2e0f881..7e002c5179d 100755 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiCommonItems.cxx +++ b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiCommonItems.cxx @@ -13,7 +13,8 @@ SiCommonItems::SiCommonItems(const AtlasDetectorID* const idHelper) m_idHelper(idHelper), m_lorentzAngleSvcHandle("", "SiDetectorElement"), m_lorentzAngleSvc(0), - m_lorentzAngleSvcInit(false) + m_lorentzAngleSvcInit(false), + m_lorentzAngleTool(nullptr) {} void @@ -28,6 +29,12 @@ SiCommonItems::setLorentzAngleSvc(const ServiceHandle<ISiLorentzAngleSvc> & lore m_lorentzAngleSvcHandle = lorentzAngleSvc; } +void +SiCommonItems::setLorentzAngleTool(const ISiLorentzAngleTool* lorentzAngleTool) +{ + m_lorentzAngleTool = lorentzAngleTool; +} + ISiLorentzAngleSvc * SiCommonItems::lorentzAngleSvc() const { @@ -44,5 +51,10 @@ SiCommonItems::lorentzAngleSvc() const return m_lorentzAngleSvc; } +const ISiLorentzAngleTool* +SiCommonItems::lorentzAngleTool() const +{ + return m_lorentzAngleTool; +} } // End namespace InDetDD diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiDetectorElement.cxx b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiDetectorElement.cxx index 82ec775b442..d738df74ca7 100755 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiDetectorElement.cxx +++ b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiDetectorElement.cxx @@ -35,6 +35,7 @@ #include "TrkSurfaces/SurfaceBounds.h" #include "InDetCondServices/ISiLorentzAngleSvc.h" +#include "InDetCondServices/ISiLorentzAngleTool.h" #include <cmath> #include <cassert> #include <limits> @@ -374,15 +375,19 @@ SiDetectorElement::updateConditionsCache() const // Lorentz Angle related stuff // - if (m_commonItems->lorentzAngleSvc()) { + if (isPixel() and m_commonItems->lorentzAngleSvc()) { m_tanLorentzAnglePhi = m_commonItems->lorentzAngleSvc()->getTanLorentzAngle(m_idHash); m_tanLorentzAngleEta = m_commonItems->lorentzAngleSvc()->getTanLorentzAngleEta(m_idHash); m_lorentzCorrection = m_commonItems->lorentzAngleSvc()->getLorentzShift(m_idHash); + } else if (isSCT() and m_commonItems->lorentzAngleTool()) { + m_tanLorentzAnglePhi = m_commonItems->lorentzAngleTool()->getTanLorentzAngle(m_idHash); + m_tanLorentzAngleEta = m_commonItems->lorentzAngleTool()->getTanLorentzAngleEta(m_idHash); + m_lorentzCorrection = m_commonItems->lorentzAngleTool()->getLorentzShift(m_idHash); } else { // Set to zero - m_tanLorentzAnglePhi = 0; - m_tanLorentzAngleEta = 0; - m_lorentzCorrection = 0; + m_tanLorentzAnglePhi = 0.; + m_tanLorentzAngleEta = 0.; + m_lorentzCorrection = 0.; } } diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorTool.h b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorTool.h index 5e303b23f45..36a11dfd331 100755 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorTool.h +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorTool.h @@ -7,6 +7,8 @@ #include "GeoModelUtilities/GeoModelTool.h" #include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" +#include "InDetCondServices/ISiLorentzAngleTool.h" class ISiLorentzAngleSvc; class IGeoDbTagSvc; @@ -33,6 +35,8 @@ public: virtual StatusCode create() override final; virtual StatusCode clear() override final; + virtual StatusCode initialize() override final; + // Register callback function on ConDB object virtual StatusCode registerCallback() override final; @@ -53,7 +57,7 @@ private: ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc; ServiceHandle< IRDBAccessSvc > m_rdbAccessSvc; ServiceHandle< IGeometryDBSvc > m_geometryDBSvc; - ServiceHandle< ISiLorentzAngleSvc > m_lorentzAngleSvc; + ToolHandle< ISiLorentzAngleTool > m_lorentzAngleTool{this, "LorentzAngleTool", "SCTLorentzAngleTool", "Tool to retreive Lorentz angle"}; }; diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_GeoModelAthenaComps.h b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_GeoModelAthenaComps.h index 318ed60a415..60e16f6ed17 100644 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_GeoModelAthenaComps.h +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_GeoModelAthenaComps.h @@ -7,8 +7,7 @@ #include "InDetGeoModelUtils/InDetDDAthenaComps.h" -#include "GaudiKernel/ServiceHandle.h" -class ISiLorentzAngleSvc; +class ISiLorentzAngleTool; class SCT_ID; @@ -19,15 +18,15 @@ public: SCT_GeoModelAthenaComps(); - void setLorentzAngleSvc(const ServiceHandle<ISiLorentzAngleSvc> &); + void setLorentzAngleTool(const ISiLorentzAngleTool*); void setIdHelper(const SCT_ID* idHelper); - const ServiceHandle<ISiLorentzAngleSvc> & lorentzAngleSvc() const; + const ISiLorentzAngleTool* lorentzAngleTool() const; const SCT_ID* getIdHelper() const; private: - // Lorentz angle service - ServiceHandle<ISiLorentzAngleSvc> m_lorentzAngleSvc; + // Lorentz angle tool + const ISiLorentzAngleTool* m_lorentzAngleTool; const SCT_ID* m_idHelper; }; diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py b/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py index 9de063fac83..35491fc3bde 100644 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py @@ -11,16 +11,13 @@ def getSCT_DetectorTool(name="SCT_DetectorTool", **kwargs): kwargs.setdefault("GeoDbTagSvc", "GeoDbTagSvc"); from AthenaCommon.DetFlags import DetFlags if DetFlags.digitize.SCT_on() or DetFlags.haveRDO.SCT_on() or DetFlags.haveRIO.SCT_on(): - # SCTLorentzAngleSvc needed for digi and reco - from AthenaCommon.AppMgr import ServiceMgr - if not hasattr(ServiceMgr,'SCTLorentzAngleSvc'): - from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleCHSvc - SCTLorentzAngleSvc = SiLorentzAngleCHSvc(name = "SCTLorentzAngleSvc", - UseMagFieldSvc = False, - DetectorName = "SCT") - ServiceMgr+=SCTLorentzAngleSvc - kwargs.setdefault("LorentzAngleSvc", "SCTLorentzAngleSvc"); + # SCTLorentzAngleTool needed for digi and reco + from AthenaCommon.AppMgr import ToolSvc + if not hasattr(ToolSvc, "SCTLorentzAngleTool"): + from SiLorentzAngleSvc.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup + sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() + kwargs.setdefault("LorentzAngleTool", ToolSvc.SCTLorentzAngleTool) else: - # SCTLorentzAngleSvc not needed for simulation - kwargs.setdefault("LorentzAngleSvc", ""); + # SCTLorentzAngleTool not needed for simulation + kwargs.setdefault("LorentzAngleTool", "") return CfgMgr.SCT_DetectorTool(name, **kwargs) diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorFactory.cxx b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorFactory.cxx index 81d7fe7981a..365a6ac7092 100755 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorFactory.cxx +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorFactory.cxx @@ -82,7 +82,7 @@ SCT_DetectorFactory::SCT_DetectorFactory(const SCT_GeoModelAthenaComps * athenaC // Create SiCommonItems. These are items that are shared by all elements SiCommonItems * commonItems = new SiCommonItems(athenaComps->getIdHelper()); - commonItems->setLorentzAngleSvc(athenaComps->lorentzAngleSvc()); + commonItems->setLorentzAngleTool(athenaComps->lorentzAngleTool()); m_geometryManager->setCommonItems(commonItems); diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx index 4ab0dfa40c7..eff94e7702e 100755 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ #include "SCT_GeoModel/SCT_DetectorTool.h" @@ -13,7 +13,6 @@ #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "DetDescrConditions/AlignableTransformContainer.h" -#include "InDetCondServices/ISiLorentzAngleSvc.h" #include "GeoModelUtilities/GeoModelExperiment.h" #include "GeoModelInterfaces/IGeoDbTagSvc.h" @@ -42,13 +41,11 @@ SCT_DetectorTool::SCT_DetectorTool( const std::string& type, m_initialLayout(false), m_alignable(true), m_cosmic(false), - m_manager(0), - m_athenaComps(0), + m_manager(nullptr), + m_athenaComps(nullptr), m_geoDbTagSvc("GeoDbTagSvc",name), m_rdbAccessSvc("RDBAccessSvc",name), - m_geometryDBSvc("InDetGeometryDBSvc",name), - m_lorentzAngleSvc("SCTLorentzAngleSvc", name) - + m_geometryDBSvc("InDetGeometryDBSvc",name) { // Get parameter values from jobOptions file declareProperty("DetectorName", m_detectorName); @@ -57,7 +54,6 @@ SCT_DetectorTool::SCT_DetectorTool( const std::string& type, declareProperty("RDBAccessSvc", m_rdbAccessSvc); declareProperty("GeometryDBSvc", m_geometryDBSvc); declareProperty("GeoDbTagSvc", m_geoDbTagSvc); - declareProperty("LorentzAngleSvc", m_lorentzAngleSvc); } // @@ -68,6 +64,22 @@ SCT_DetectorTool::~SCT_DetectorTool() delete m_athenaComps; } +// +// Initialize +// +StatusCode +SCT_DetectorTool::initialize() +{ + // LorentzAngleTool + if (not m_lorentzAngleTool.empty()) { + ATH_CHECK(m_lorentzAngleTool.retrieve()); + } else { + m_lorentzAngleTool.disable(); + } + + return StatusCode::SUCCESS; +} + // // Create the Geometry via the factory corresponding to this tool // @@ -76,45 +88,34 @@ StatusCode SCT_DetectorTool::create() { - StatusCode result = StatusCode::SUCCESS; - // Reinit various singleton type objects. SCT_DataBase::reinit(); SCT_MaterialManager::reinit(); // Get the detector configuration. - StatusCode sc = m_geoDbTagSvc.retrieve(); - if (sc.isFailure()) { - msg(MSG::FATAL) << "Could not locate GeoDbTagSvc" << endmsg; - return (StatusCode::FAILURE); - } + ATH_CHECK(m_geoDbTagSvc.retrieve()); DecodeVersionKey versionKey(&*m_geoDbTagSvc, "SCT"); // Issue error if AUTO. if (versionKey.tag() == "AUTO"){ - msg(MSG::ERROR) << "AUTO Atlas version. Please select a version." << endmsg; + ATH_MSG_ERROR("AUTO Atlas version. Please select a version."); } - - msg(MSG::INFO) << "Building SCT with Version Tag: "<< versionKey.tag() << " at Node: " << versionKey.node() << endmsg; + ATH_MSG_INFO("Building SCT with Version Tag: "<< versionKey.tag() << " at Node: " << versionKey.node()); - sc = m_rdbAccessSvc.retrieve(); - if (sc.isFailure()) { - msg(MSG::FATAL) << "Could not locate RDBAccessSvc" << endmsg; - return (StatusCode::FAILURE); - } + ATH_CHECK(m_rdbAccessSvc.retrieve()); // Print the SCT version tag: std::string sctVersionTag; sctVersionTag = m_rdbAccessSvc->getChildTag("SCT", versionKey.tag(), versionKey.node()); - msg(MSG::INFO) << "SCT Version: " << sctVersionTag << " Package Version: " << PACKAGE_VERSION << endmsg; + ATH_MSG_INFO("SCT Version: " << sctVersionTag << " Package Version: " << PACKAGE_VERSION); // Check if version is empty. If so, then the SCT cannot be built. This may or may not be intentional. We // just issue an INFO message. if (sctVersionTag.empty()) { - msg(MSG::INFO) << "No SCT Version. SCT will not be built." << endmsg; + ATH_MSG_INFO("No SCT Version. SCT will not be built."); } else { @@ -122,13 +123,12 @@ SCT_DetectorTool::create() if (versionKey.custom()) { - msg(MSG::WARNING) << "SCT_DetectorTool: Detector Information coming from a custom configuration!!" << endmsg; + ATH_MSG_WARNING("SCT_DetectorTool: Detector Information coming from a custom configuration!!"); } else { - if(msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << "SCT_DetectorTool: Detector Information coming from the database and job options IGNORED." << endmsg; - msg(MSG::DEBUG) << "Keys for SCT Switches are " << versionKey.tag() << " " << versionKey.node() << endmsg; - } + ATH_MSG_DEBUG("SCT_DetectorTool: Detector Information coming from the database and job options IGNORED."); + ATH_MSG_DEBUG("Keys for SCT Switches are " << versionKey.tag() << " " << versionKey.node()); + IRDBRecordset_ptr switchSet = m_rdbAccessSvc->getRecordsetPtr("SctSwitches", versionKey.tag(), versionKey.node()); const IRDBRecord *switches = (*switchSet)[0]; @@ -142,10 +142,6 @@ SCT_DetectorTool::create() if (!switches->isFieldNull("VERSIONNAME")) { versionName = switches->getString("VERSIONNAME"); } - - // m_initialLayout = switches->getInt("INITIALLAYOUT"); - - } if (versionName.empty()) { @@ -153,44 +149,29 @@ SCT_DetectorTool::create() versionName = "SR1"; } } + { - if(msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << "Creating the SCT" << endmsg; - msg(MSG::DEBUG) << "SCT Geometry Options: " << endmsg; - msg(MSG::DEBUG) << " InitialLayout: " << (m_initialLayout ? "true" : "false") - << endmsg; - msg(MSG::DEBUG) << " Alignable: " << (m_alignable ? "true" : "false") - << endmsg; - msg(MSG::DEBUG) << " CosmicLayout: " << (m_cosmic ? "true" : "false") - << endmsg; - msg(MSG::DEBUG) << " VersionName: " << versionName - << endmsg; - } + ATH_MSG_DEBUG("Creating the SCT"); + ATH_MSG_DEBUG("SCT Geometry Options: "); + ATH_MSG_DEBUG(" InitialLayout: " << (m_initialLayout ? "true" : "false")); + ATH_MSG_DEBUG(" Alignable: " << (m_alignable ? "true" : "false")); + ATH_MSG_DEBUG(" CosmicLayout: " << (m_cosmic ? "true" : "false")); + ATH_MSG_DEBUG(" VersionName: " << versionName); SCT_Options options; options.setAlignable(m_alignable); - - m_manager = 0; + m_manager = nullptr; // // Locate the top level experiment node // - GeoModelExperiment * theExpt; - if (StatusCode::SUCCESS != detStore()->retrieve( theExpt, "ATLAS" )) { - msg(MSG::ERROR) - << "Could not find GeoModelExperiment ATLAS" - << endmsg; - return (StatusCode::FAILURE); - } + GeoModelExperiment * theExpt = nullptr; + ATH_CHECK(detStore()->retrieve( theExpt, "ATLAS" )); // Retrieve the Geometry DB Interface - sc = m_geometryDBSvc.retrieve(); - if (sc.isFailure()) { - msg(MSG::FATAL) << "Could not locate Geometry DB Interface: " << m_geometryDBSvc.name() << endmsg; - return (StatusCode::FAILURE); - } + ATH_CHECK(m_geometryDBSvc.retrieve()); // Pass athena services to factory, etc m_athenaComps = new SCT_GeoModelAthenaComps; @@ -198,20 +179,16 @@ SCT_DetectorTool::create() m_athenaComps->setGeoDbTagSvc(&*m_geoDbTagSvc); m_athenaComps->setGeometryDBSvc(&*m_geometryDBSvc); m_athenaComps->setRDBAccessSvc(&*m_rdbAccessSvc); - m_athenaComps->setLorentzAngleSvc(m_lorentzAngleSvc); - const SCT_ID* idHelper; - if (detStore()->retrieve(idHelper, "SCT_ID").isFailure()) { - msg(MSG::FATAL) << "Could not get SCT ID helper" << endmsg; - return StatusCode::FAILURE; - } else { - m_athenaComps->setIdHelper(idHelper); - } + m_athenaComps->setLorentzAngleTool(m_lorentzAngleTool.get()); + const SCT_ID* idHelper = nullptr; + ATH_CHECK(detStore()->retrieve(idHelper, "SCT_ID")); + + m_athenaComps->setIdHelper(idHelper); // - // LorentzAngleService + // LorentzAngleTool // - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) - << "Lorentz angle service passed to InDetReadoutGeometry with name: " << m_lorentzAngleSvc.name() << endmsg; + ATH_MSG_DEBUG("Lorentz angle service passed to InDetReadoutGeometry with name: " << m_lorentzAngleTool.name()); //try { @@ -225,56 +202,37 @@ SCT_DetectorTool::create() theSCT.create(world); m_manager = theSCT.getDetectorManager(); - if (!m_manager) { - msg(MSG::ERROR) << "SCT_DetectorManager not created" << endmsg; - return( StatusCode::FAILURE ); + if (m_manager==nullptr) { + ATH_MSG_ERROR("SCT_DetectorManager not created"); + return StatusCode::FAILURE; } // Get the manager from the factory and store it in the detector store. // m_detector is non constant so I can not set it to a const pointer. // m_detector = theSCT.getDetectorManager(); - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Registering SCT_DetectorManager. " << endmsg; + ATH_MSG_DEBUG("Registering SCT_DetectorManager. "); - result = detStore()->record(m_manager, m_manager->getName()); - - if (result.isFailure() ) { - msg(MSG::ERROR) << "Could not register SCT_DetectorManager" << endmsg; - return( StatusCode::FAILURE ); - } + ATH_CHECK(detStore()->record(m_manager, m_manager->getName())); theExpt->addManager(m_manager); // Create a symLink to the SiDetectorManager base class const SiDetectorManager * siDetManager = m_manager; - result = detStore()->symLink(m_manager, siDetManager); - if (result.isFailure() ) { - msg(MSG::ERROR) << "Could not make link between SCT_DetectorManager and SiDetectorManager" << endmsg; - return( StatusCode::FAILURE ); - } + ATH_CHECK(detStore()->symLink(m_manager, siDetManager)); } - - // - // LorentzAngleService - // We retrieve it to make sure it is initialized during geometry initialization. - // - if (!m_lorentzAngleSvc.empty()) { - sc = m_lorentzAngleSvc.retrieve(); - if (!sc.isFailure()) { - msg(MSG::INFO) << "Lorentz angle service retrieved: " << m_lorentzAngleSvc << endmsg; - } else { - msg(MSG::INFO) << "Could not retrieve Lorentz angle service:" << m_lorentzAngleSvc << endmsg; - } - } else { - msg(MSG::INFO) << "Lorentz angle service not requested." << endmsg; - } + // LorentzAngleTool + if (m_lorentzAngleTool.get()) { + // SCT_DetectorManager is not available at initialize of m_lorentzAngleTool + ATH_CHECK(m_lorentzAngleTool->retrieveDetectorManager()); + } } // Delete unneeded singleton objects SCT_DataBase::reinit(); SCT_MaterialManager::reinit(); - return result; + return StatusCode::SUCCESS; } StatusCode @@ -284,7 +242,7 @@ SCT_DetectorTool::clear() if(proxy) { proxy->reset(); - m_manager = 0; + m_manager = nullptr; } return StatusCode::SUCCESS; } @@ -299,51 +257,46 @@ SCT_DetectorTool::registerCallback() { std::string folderName = "/Indet/AlignL1/ID"; if (detStore()->contains<CondAttrListCollection>(folderName)) { - msg(MSG::DEBUG) << "Registering callback on global Container with folder " << folderName << endmsg; + ATH_MSG_DEBUG("Registering callback on global Container with folder " << folderName); const DataHandle<CondAttrListCollection> calc; StatusCode ibltmp = detStore()->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool*>(this), calc, folderName); // We don't expect this to fail as we have already checked that the detstore contains the object. if (ibltmp.isFailure()) { - msg(MSG::ERROR) << "Problem when register callback on global Container with folder " << folderName <<endmsg; + ATH_MSG_ERROR("Problem when register callback on global Container with folder " << folderName); } else { sc = StatusCode::SUCCESS; } } else { - msg(MSG::WARNING) << "Unable to register callback on global Container with folder " << folderName <<endmsg; - //return StatusCode::FAILURE; + ATH_MSG_WARNING("Unable to register callback on global Container with folder " << folderName); } folderName = "/Indet/AlignL2/SCT"; if (detStore()->contains<CondAttrListCollection>(folderName)) { - msg(MSG::DEBUG) << "Registering callback on global Container with folder " << folderName << endmsg; + ATH_MSG_DEBUG("Registering callback on global Container with folder " << folderName); const DataHandle<CondAttrListCollection> calc; StatusCode ibltmp = detStore()->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool*>(this), calc, folderName); // We don't expect this to fail as we have already checked that the detstore contains the object. if (ibltmp.isFailure()) { - msg(MSG::ERROR) << "Problem when register callback on global Container with folder " << folderName <<endmsg; + ATH_MSG_ERROR("Problem when register callback on global Container with folder " << folderName); } else { sc = StatusCode::SUCCESS; } } else { - msg(MSG::WARNING) << "Unable to register callback on global Container with folder " << folderName <<endmsg; - //return StatusCode::FAILURE; + ATH_MSG_WARNING("Unable to register callback on global Container with folder " << folderName); } folderName = "/Indet/AlignL3"; if (detStore()->contains<AlignableTransformContainer>(folderName)) { - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Registering callback on AlignableTransformContainer with folder " << folderName << endmsg; + ATH_MSG_DEBUG("Registering callback on AlignableTransformContainer with folder " << folderName); const DataHandle<AlignableTransformContainer> atc; StatusCode sctmp = detStore()->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), atc, folderName); if(sctmp.isFailure()) { - msg(MSG::ERROR) << "Problem when register callback on AlignableTransformContainer with folder " << folderName <<endmsg; + ATH_MSG_ERROR("Problem when register callback on AlignableTransformContainer with folder " << folderName); } else { sc = StatusCode::SUCCESS; } - } - else { - msg(MSG::WARNING) << "Unable to register callback on AlignableTransformContainer with folder " - << folderName << endmsg; - //return StatusCode::FAILURE; + } else { + ATH_MSG_WARNING("Unable to register callback on AlignableTransformContainer with folder " << folderName); } } @@ -351,23 +304,22 @@ SCT_DetectorTool::registerCallback() { std::string folderName = "/Indet/Align"; if (detStore()->contains<AlignableTransformContainer>(folderName)) { - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Registering callback on AlignableTransformContainer with folder " << folderName << endmsg; + ATH_MSG_DEBUG("Registering callback on AlignableTransformContainer with folder " << folderName); const DataHandle<AlignableTransformContainer> atc; StatusCode sctmp = detStore()->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), atc, folderName); if(sctmp.isFailure()) { - msg(MSG::ERROR) << "Problem when register callback on AlignableTransformContainer with folder " << folderName <<endmsg; + ATH_MSG_ERROR("Problem when register callback on AlignableTransformContainer with folder " << folderName); } else { sc = StatusCode::SUCCESS; } } else { - msg(MSG::WARNING) << "Unable to register callback on AlignableTransformContainer with folder " - << folderName << ", Alignment disabled (only if no Run2 scheme is loaded)!" << endmsg; - //return StatusCode::FAILURE; + ATH_MSG_WARNING("Unable to register callback on AlignableTransformContainer with folder " + << folderName << ", Alignment disabled (only if no Run2 scheme is loaded)!"); } } } else { - msg(MSG::INFO) << "Alignment disabled. No callback registered" << endmsg; + ATH_MSG_INFO("Alignment disabled. No callback registered"); // We return failure otherwise it will try and register // a GeoModelSvc callback associated with this callback. return StatusCode::FAILURE; @@ -378,14 +330,14 @@ SCT_DetectorTool::registerCallback() StatusCode SCT_DetectorTool::align(IOVSVC_CALLBACK_ARGS_P(I,keys)) { - if (!m_manager) { - msg(MSG::WARNING) << "Manager does not exist" << endmsg; + if (m_manager==nullptr) { + ATH_MSG_WARNING("Manager does not exist"); return StatusCode::FAILURE; } if (m_alignable) { return m_manager->align(I,keys); } else { - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Alignment disabled. No alignments applied" << endmsg; + ATH_MSG_DEBUG("Alignment disabled. No alignments applied"); return StatusCode::SUCCESS; } } diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_GeoModelAthenaComps.cxx b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_GeoModelAthenaComps.cxx index 6781ce4dd89..bb3720c7a51 100644 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_GeoModelAthenaComps.cxx +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_GeoModelAthenaComps.cxx @@ -7,14 +7,14 @@ SCT_GeoModelAthenaComps::SCT_GeoModelAthenaComps() : InDetDD::AthenaComps("SCT_GeoModel"), - m_lorentzAngleSvc("",""), + m_lorentzAngleTool(nullptr), m_idHelper(0) {} void -SCT_GeoModelAthenaComps::setLorentzAngleSvc(const ServiceHandle<ISiLorentzAngleSvc> & lorentzAngleSvc) +SCT_GeoModelAthenaComps::setLorentzAngleTool(const ISiLorentzAngleTool* lorentzAngleTool) { - m_lorentzAngleSvc = lorentzAngleSvc; + m_lorentzAngleTool = lorentzAngleTool; } void @@ -23,10 +23,10 @@ SCT_GeoModelAthenaComps::setIdHelper(const SCT_ID* idHelper) m_idHelper = idHelper; } -const ServiceHandle<ISiLorentzAngleSvc> & -SCT_GeoModelAthenaComps::lorentzAngleSvc() const +const ISiLorentzAngleTool* +SCT_GeoModelAthenaComps::lorentzAngleTool() const { - return m_lorentzAngleSvc; + return m_lorentzAngleTool; } const SCT_ID* diff --git a/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/SCT_SLHC_GeoModel/SCT_GeoModelAthenaComps.h b/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/SCT_SLHC_GeoModel/SCT_GeoModelAthenaComps.h index a36346cbb4e..8ee36eacc0d 100644 --- a/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/SCT_SLHC_GeoModel/SCT_GeoModelAthenaComps.h +++ b/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/SCT_SLHC_GeoModel/SCT_GeoModelAthenaComps.h @@ -7,9 +7,7 @@ #include "InDetGeoModelUtils/InDetDDAthenaComps.h" -#include "GaudiKernel/ServiceHandle.h" -class ISiLorentzAngleSvc; - +class ISiLorentzAngleTool; class SCT_ID; class IInDetServMatBuilderTool; @@ -22,19 +20,19 @@ public: SCT_GeoModelAthenaComps(); - void setLorentzAngleSvc(const ServiceHandle<ISiLorentzAngleSvc> &); + void setLorentzAngleTool(const ISiLorentzAngleTool*); void setIdHelper(const SCT_ID* idHelper); //Add Builder Tool void setServiceBuilderTool(IInDetServMatBuilderTool * serviceBuilderTool); IInDetServMatBuilderTool *serviceBuilderTool() const; - const ServiceHandle<ISiLorentzAngleSvc> & lorentzAngleSvc() const; + const ISiLorentzAngleTool* lorentzAngleTool() const; const SCT_ID* getIdHelper() const; private: // Lorentz angle service - ServiceHandle<ISiLorentzAngleSvc> m_lorentzAngleSvc; + const ISiLorentzAngleTool* m_lorentzAngleTool; IInDetServMatBuilderTool * m_serviceBuilderTool; const SCT_ID* m_idHelper; diff --git a/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/SCT_SLHC_GeoModel/SCT_SLHC_DetectorTool.h b/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/SCT_SLHC_GeoModel/SCT_SLHC_DetectorTool.h index 932e6093ff6..580b34c0adc 100644 --- a/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/SCT_SLHC_GeoModel/SCT_SLHC_DetectorTool.h +++ b/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/SCT_SLHC_GeoModel/SCT_SLHC_DetectorTool.h @@ -8,6 +8,7 @@ #include "GeoModelUtilities/GeoModelTool.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "InDetCondServices/ISiLorentzAngleTool.h" #include <string> @@ -36,6 +37,8 @@ public: // Standard Destructor virtual ~SCT_SLHC_DetectorTool() override final; + virtual StatusCode initialize() override final; + virtual StatusCode create() override final; virtual StatusCode clear() override final; @@ -52,7 +55,7 @@ private: ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc; ServiceHandle< IRDBAccessSvc > m_rdbAccessSvc; ServiceHandle< IGeometryDBSvc > m_geometryDBSvc; - ServiceHandle< ISiLorentzAngleSvc > m_lorentzAngleSvc; + ToolHandle< ISiLorentzAngleTool > m_lorentzAngleTool{this, "LorentzAngleTool", "SCTLorentzAngleTool", "Tool to retreive Lorentz angle"}; }; #endif // SCT_SLHC_GeoModel_SCT_DETECTORTOOL_H diff --git a/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_DetectorFactory.cxx b/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_DetectorFactory.cxx index f666264cb84..0dc4be21f25 100644 --- a/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_DetectorFactory.cxx +++ b/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_DetectorFactory.cxx @@ -72,7 +72,7 @@ SCT_DetectorFactory::SCT_DetectorFactory(const SCT_GeoModelAthenaComps * athenaC // Create SiCommonItems. These are items that are shared by all elements SiCommonItems * commonItems = new SiCommonItems(athenaComps->getIdHelper()); - commonItems->setLorentzAngleSvc(athenaComps->lorentzAngleSvc()); + commonItems->setLorentzAngleTool(athenaComps->lorentzAngleTool()); m_geometryManager->setCommonItems(commonItems); diff --git a/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_GeoModelAthenaComps.cxx b/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_GeoModelAthenaComps.cxx index 89fdd8ca89b..a42bf5fda15 100644 --- a/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_GeoModelAthenaComps.cxx +++ b/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_GeoModelAthenaComps.cxx @@ -3,21 +3,21 @@ */ #include "SCT_SLHC_GeoModel/SCT_GeoModelAthenaComps.h" -#include "InDetCondServices/ISiLorentzAngleSvc.h" +#include "InDetCondServices/ISiLorentzAngleTool.h" namespace InDetDDSLHC { SCT_GeoModelAthenaComps::SCT_GeoModelAthenaComps() : InDetDD::AthenaComps("SCT_SLHC_GeoModel"), - m_lorentzAngleSvc("",""), + m_lorentzAngleTool(nullptr), m_serviceBuilderTool(0), m_idHelper(0) {} void -SCT_GeoModelAthenaComps::setLorentzAngleSvc(const ServiceHandle<ISiLorentzAngleSvc> & lorentzAngleSvc) +SCT_GeoModelAthenaComps::setLorentzAngleTool(const ISiLorentzAngleTool* lorentzAngleTool) { - m_lorentzAngleSvc = lorentzAngleSvc; + m_lorentzAngleTool = lorentzAngleTool; } void @@ -38,10 +38,10 @@ SCT_GeoModelAthenaComps::setIdHelper(const SCT_ID* idHelper) m_idHelper = idHelper; } -const ServiceHandle<ISiLorentzAngleSvc> & -SCT_GeoModelAthenaComps::lorentzAngleSvc() const +const ISiLorentzAngleTool* +SCT_GeoModelAthenaComps::lorentzAngleTool() const { - return m_lorentzAngleSvc; + return m_lorentzAngleTool; } const SCT_ID* diff --git a/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_SLHC_DetectorTool.cxx b/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_SLHC_DetectorTool.cxx index 4b23192793a..b1751ad1994 100644 --- a/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_SLHC_DetectorTool.cxx +++ b/InnerDetector/InDetDetDescr/SCT_SLHC_GeoModel/src/SCT_SLHC_DetectorTool.cxx @@ -33,13 +33,12 @@ SCT_SLHC_DetectorTool::SCT_SLHC_DetectorTool( const std::string& type, m_detectorName("SCT"), m_alignable(false), m_forceBuild(false), - m_manager(0), - m_athenaComps(0), + m_manager(nullptr), + m_athenaComps(nullptr), m_serviceBuilderTool("", this), m_geoDbTagSvc("GeoDbTagSvc",name), m_rdbAccessSvc("RDBAccessSvc",name), - m_geometryDBSvc("InDetGeometryDBSvc",name), - m_lorentzAngleSvc("SCTLorentzAngleSvc", name) + m_geometryDBSvc("InDetGeometryDBSvc",name) { // Get parameter values from jobOptions file declareProperty("ForceBuild", m_forceBuild); @@ -49,7 +48,6 @@ SCT_SLHC_DetectorTool::SCT_SLHC_DetectorTool( const std::string& type, declareProperty("RDBAccessSvc", m_rdbAccessSvc); declareProperty("GeometryDBSvc", m_geometryDBSvc); declareProperty("GeoDbTagSvc", m_geoDbTagSvc); - declareProperty("LorentzAngleSvc", m_lorentzAngleSvc); } SCT_SLHC_DetectorTool::~SCT_SLHC_DetectorTool() @@ -57,54 +55,56 @@ SCT_SLHC_DetectorTool::~SCT_SLHC_DetectorTool() delete m_athenaComps; } +// Initialize +StatusCode SCT_SLHC_DetectorTool::initialize(){ + // LorentzAngleTool + if (not m_lorentzAngleTool.empty()) { + ATH_CHECK(m_lorentzAngleTool.retrieve()); + } else { + m_lorentzAngleTool.disable(); + } + + return StatusCode::SUCCESS; +} + // Create the Geometry via the factory corresponding to this tool StatusCode SCT_SLHC_DetectorTool::create(){ - StatusCode result = StatusCode::SUCCESS; - // Get the detector configuration. - StatusCode sc = m_geoDbTagSvc.retrieve(); - if (sc.isFailure()) { - msg(MSG::FATAL) << "Could not locate GeoDbTagSvc" << endmsg; - return (StatusCode::FAILURE); - } + ATH_CHECK(m_geoDbTagSvc.retrieve()); DecodeVersionKey versionKey(&*m_geoDbTagSvc, "SCT"); // Issue error if AUTO. if (versionKey.tag() == "AUTO"){ - msg(MSG::ERROR) << "AUTO Atlas version. Please select a version." << endmsg; + ATH_MSG_ERROR("AUTO Atlas version. Please select a version."); } - msg(MSG::INFO) << "Building SCT SLHC with Version Tag: "<< versionKey.tag() << " at Node: " << versionKey.node() << endmsg; + ATH_MSG_INFO("Building SCT SLHC with Version Tag: "<< versionKey.tag() << " at Node: " << versionKey.node()); - sc = m_rdbAccessSvc.retrieve(); - if (sc.isFailure()) { - msg(MSG::FATAL) << "Could not locate RDBAccessSvc" << endmsg; - return (StatusCode::FAILURE); - } + ATH_CHECK(m_rdbAccessSvc.retrieve()); // Print the SCT version tag: std::string sctVersionTag; sctVersionTag = m_rdbAccessSvc->getChildTag("SCT", versionKey.tag(), versionKey.node()); - msg(MSG::INFO) << "SCT Version: " << sctVersionTag << " Package Version: " << PACKAGE_VERSION << endmsg; + ATH_MSG_INFO("SCT Version: " << sctVersionTag << " Package Version: " << PACKAGE_VERSION); // Check if version is empty. If so, then the SCT cannot be built. //This may or may not be intentional. We just issue an INFO message. - if (sctVersionTag.empty()){ - msg(MSG::INFO) << "No SCT Version. SCT_SLHC will not be built." << endmsg; - }else{ + if (sctVersionTag.empty()) { + ATH_MSG_INFO("No SCT Version. SCT_SLHC will not be built."); + } else { std::string versionName; std::string descrName="noDescr"; - if(versionKey.custom()){ - msg(MSG::WARNING) << "SCT_SLHC_DetectorTool: Detector Information coming " - <<"from a custom configuration!!" << endmsg; - }else{ - msg(MSG::DEBUG) <<"SCT_SLHC_DetectorTool: Detector Information coming from the" - <<" database and job options IGNORED." << endmsg; - msg(MSG::DEBUG) << "Keys for SCT Switches are " << versionKey.tag() - << " " << versionKey.node() << endmsg; + if (versionKey.custom()){ + ATH_MSG_WARNING("SCT_SLHC_DetectorTool: Detector Information coming " + <<"from a custom configuration!!"); + } else { + ATH_MSG_DEBUG("SCT_SLHC_DetectorTool: Detector Information coming from the" + <<" database and job options IGNORED."); + ATH_MSG_DEBUG("Keys for SCT Switches are " << versionKey.tag() + << " " << versionKey.node()); IRDBRecordset_ptr switchSet = m_rdbAccessSvc->getRecordsetPtr("SctSwitches", versionKey.tag(), versionKey.node()); const IRDBRecord *switches = (*switchSet)[0]; @@ -119,36 +119,26 @@ StatusCode SCT_SLHC_DetectorTool::create(){ } - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "VersioName = " << versionName << endmsg; - + ATH_MSG_DEBUG("VersioName = " << versionName); // Only build if versionName is "SLHC" or ForceBuild is true if (!m_forceBuild && versionName != "SLHC") { - msg(MSG::INFO) << "Not SLHC version. SCT_SLHC will not be built." << endmsg; + ATH_MSG_INFO("Not SLHC version. SCT_SLHC will not be built."); } else { // SLHC version requested. - msg(MSG::DEBUG) << "Creating the SCT (SLHC version)" << endmsg; + ATH_MSG_DEBUG("Creating the SCT (SLHC version)"); // Create the SCT_DetectorFactory m_manager = 0; // Locate the top level experiment node - GeoModelExperiment * theExpt; - if (StatusCode::SUCCESS != detStore()->retrieve(theExpt, "ATLAS")){ - msg(MSG::ERROR) - << "Could not find GeoModelExperiment ATLAS" - << endmsg; - return (StatusCode::FAILURE); - } + GeoModelExperiment * theExpt = nullptr; + ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS")); // Retrieve the Geometry DB Interface - sc = m_geometryDBSvc.retrieve(); - if (sc.isFailure()) { - msg(MSG::FATAL) << "Could not locate Geometry DB Interface: " << m_geometryDBSvc.name() << endmsg; - return (StatusCode::FAILURE); - } + ATH_CHECK(m_geometryDBSvc.retrieve()); // Pass athena services to factory, etc m_athenaComps = new InDetDDSLHC::SCT_GeoModelAthenaComps; @@ -156,36 +146,31 @@ StatusCode SCT_SLHC_DetectorTool::create(){ m_athenaComps->setGeoDbTagSvc(&*m_geoDbTagSvc); m_athenaComps->setGeometryDBSvc(&*m_geometryDBSvc); m_athenaComps->setRDBAccessSvc(&*m_rdbAccessSvc); - m_athenaComps->setLorentzAngleSvc(m_lorentzAngleSvc); + m_athenaComps->setLorentzAngleTool(m_lorentzAngleTool.get()); - const SCT_ID* idHelper; - if (detStore()->retrieve(idHelper, "SCT_ID").isFailure()) { - msg(MSG::FATAL) << "Could not get SCT ID helper" << endmsg; - return StatusCode::FAILURE; - } else { - m_athenaComps->setIdHelper(idHelper); - } + const SCT_ID* idHelper = nullptr; + ATH_CHECK(detStore()->retrieve(idHelper, "SCT_ID")); + m_athenaComps->setIdHelper(idHelper); // // LorentzAngleService // - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) - << "Lorentz angle service passed to InDetReadoutGeometry with name: " << m_lorentzAngleSvc.name() << endmsg; + ATH_MSG_DEBUG("Lorentz angle tool passed to InDetReadoutGeometry with name: " << m_lorentzAngleTool.name()); // Service builder tool if (!m_serviceBuilderTool.empty()) { - sc = m_serviceBuilderTool.retrieve(); + StatusCode sc = m_serviceBuilderTool.retrieve(); if (!sc.isFailure()) { - msg(MSG::INFO) << "Service builder tool retrieved: " << m_serviceBuilderTool << endmsg; + ATH_MSG_INFO("Service builder tool retrieved: " << m_serviceBuilderTool); m_athenaComps->setServiceBuilderTool(&*m_serviceBuilderTool); } else { - msg(MSG::ERROR) << "Could not retrieve " << m_serviceBuilderTool << ", some services will not be built." << endmsg; + ATH_MSG_ERROR("Could not retrieve " << m_serviceBuilderTool << ", some services will not be built."); } } else { // This will become an error once the tool is ready. - //msg(MSG::ERROR) << "Service builder tool not specified. Some services will not be built" << endmsg; - msg(MSG::INFO) << "Service builder tool not specified." << endmsg; + // ATH_MSG_ERROR("Service builder tool not specified. Some services will not be built"); + ATH_MSG_INFO("Service builder tool not specified."); } @@ -195,52 +180,31 @@ StatusCode SCT_SLHC_DetectorTool::create(){ InDetDDSLHC::SCT_Options options; options.setAlignable(m_alignable); InDetDDSLHC::SCT_DetectorFactory theSCT(m_athenaComps, options); - if(descrName.compare("TrackingGeometry")!=0) - theSCT.create(world); - else - msg(MSG::INFO) << "SCT_SLHC - TrackingGeometry tag - no geometry built" << endmsg; + if(descrName.compare("TrackingGeometry")!=0) theSCT.create(world); + else ATH_MSG_INFO("SCT_SLHC - TrackingGeometry tag - no geometry built"); m_manager = theSCT.getDetectorManager(); - if (!m_manager) { - msg(MSG::ERROR) << "SCT_DetectorManager not created" << endmsg; - return( StatusCode::FAILURE ); + if (m_manager==nullptr) { + ATH_MSG_ERROR("SCT_DetectorManager not created"); + return StatusCode::FAILURE; } // Get the manager from the factory and store it in the detector store. - msg(MSG::DEBUG) << "Registering SCT_DetectorManager. " << endmsg; - result = detStore()->record(m_manager, m_manager->getName()); - if (result.isFailure() ) { - msg(MSG::ERROR) << "Could not register SCT_DetectorManager" << endmsg; - return( StatusCode::FAILURE ); - } + ATH_MSG_DEBUG("Registering SCT_DetectorManager. "); + ATH_CHECK(detStore()->record(m_manager, m_manager->getName())); theExpt->addManager(m_manager); // Create a symLink to the SiDetectorManager base class const SiDetectorManager * siDetManager = m_manager; - result = detStore()->symLink(m_manager, siDetManager); - if(result.isFailure()){ - msg(MSG::ERROR) << "Could not make link between SCT_DetectorManager and " - <<"SiDetectorManager" << endmsg; - return( StatusCode::FAILURE ); - } + ATH_CHECK(detStore()->symLink(m_manager, siDetManager)); - - // - // LorentzAngleService - // We retrieve it to make sure it is initialized during geometry initialization. - // - if (!m_lorentzAngleSvc.empty()) { - sc = m_lorentzAngleSvc.retrieve(); - if (!sc.isFailure()) { - msg(MSG::INFO) << "Lorentz angle service retrieved: " << m_lorentzAngleSvc << endmsg; - } else { - msg(MSG::INFO) << "Could not retrieve Lorentz angle service:" << m_lorentzAngleSvc << endmsg; - } - } else { - msg(MSG::INFO) << "Lorentz angle service not requested." << endmsg; - } + // LorentzAngleTool + if (m_lorentzAngleTool.get()) { + // SCT_DetectorManager is not available at initialize of m_lorentzAngleTool + ATH_CHECK(m_lorentzAngleTool->retrieveDetectorManager()); + } } } - return result; + return StatusCode::SUCCESS; } StatusCode @@ -249,7 +213,7 @@ SCT_SLHC_DetectorTool::clear() SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<InDetDD::SCT_DetectorManager>::ID(),m_manager->getName()); if(proxy) { proxy->reset(); - m_manager = 0; + m_manager = nullptr; } return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetExample/InDetDetDescrExample/InDetDetDescrExample/ReadSiDetectorElements.h b/InnerDetector/InDetExample/InDetDetDescrExample/InDetDetDescrExample/ReadSiDetectorElements.h index 8dfd2949488..6e9b34d503c 100755 --- a/InnerDetector/InDetExample/InDetDetDescrExample/InDetDetDescrExample/ReadSiDetectorElements.h +++ b/InnerDetector/InDetExample/InDetDetDescrExample/InDetDetDescrExample/ReadSiDetectorElements.h @@ -13,6 +13,7 @@ #include "GeoPrimitives/GeoPrimitives.h" #include "SiPropertiesSvc/ISiPropertiesTool.h" #include "InDetConditionsSummaryService/ISiliconConditionsTool.h" +#include "InDetCondServices/ISiLorentzAngleTool.h" #include <vector> @@ -23,10 +24,9 @@ namespace InDetDD{ class SiDetectorElement; } -class ISiLorentzAngleSvc; class ISiliconConditionsSvc; class ISiPropertiesSvc; -class AtlasDetectorID; +class ISiLorentzAngleSvc; class AtlasDetectorID; class PixelID; class SCT_ID; @@ -59,6 +59,7 @@ public: bool m_useConditionsTools; ToolHandle<ISiliconConditionsTool> m_siConditionsTool{this, "SiConditionsTool", "SCT_SiliconConditionsTool", "Silicon conditions tool"}; ToolHandle<ISiPropertiesTool> m_siPropertiesTool{this, "SiPropertiesTool", "SiPropertiesTool", "Silicon properties tool"}; + ToolHandle<ISiLorentzAngleTool> m_siLorentzAngleTool{this, "SiLorentzAngleTool", "SiLorentzAngleTool", "Silicon Lorentz anglet tool"}; // Other const InDetDD::SiDetectorManager * m_manager; diff --git a/InnerDetector/InDetExample/InDetDetDescrExample/share/ReadSiDetectorElements_jobOptions.py b/InnerDetector/InDetExample/InDetDetDescrExample/share/ReadSiDetectorElements_jobOptions.py index 1549233d623..0470162fe20 100755 --- a/InnerDetector/InDetExample/InDetDetDescrExample/share/ReadSiDetectorElements_jobOptions.py +++ b/InnerDetector/InDetExample/InDetDetDescrExample/share/ReadSiDetectorElements_jobOptions.py @@ -106,12 +106,12 @@ sct_SiPropertiesToolSetup.setSiliconTool(sctSiliconConditionsTool) sct_SiPropertiesToolSetup.setup() sctSiPropertiesTool = sct_SiPropertiesToolSetup.getTool() -ReadSCTElements.SiLorentzAngleSvc = lorentzAngleSvc.sct ReadSCTElements.UseConditionsTools = True +ReadSCTElements.SiLorentzAngleTool = lorentzAngleSvc.sct ReadSCTElements.SiPropertiesTool = sctSiPropertiesTool ReadSCTElements.SiConditionsTool = sctSiliconConditionsTool -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc=lorentzAngleSvc.sct +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool=lorentzAngleSvc.sct print ReadPixelElements print lorentzAngleSvc.pixel diff --git a/InnerDetector/InDetExample/InDetDetDescrExample/src/ReadSiDetectorElements.cxx b/InnerDetector/InDetExample/InDetDetDescrExample/src/ReadSiDetectorElements.cxx index 9b8be09cf5f..e50fae914b5 100755 --- a/InnerDetector/InDetExample/InDetDetDescrExample/src/ReadSiDetectorElements.cxx +++ b/InnerDetector/InDetExample/InDetDetDescrExample/src/ReadSiDetectorElements.cxx @@ -102,14 +102,16 @@ StatusCode ReadSiDetectorElements::initialize(){ // If common pixel/SCT code can copy to pointer to AtlasDetectorID m_idHelper = m_sctIdHelper; } - StatusCode sc = m_siLorentzAngleSvc.retrieve(); - if (sc.isFailure()) { - ATH_MSG_ERROR( "Could not retrieve Lorentz Angle Svc: " << m_siLorentzAngleSvc.name() ); - } + if (m_useConditionsTools) { + ATH_CHECK(m_siLorentzAngleTool.retrieve()); ATH_CHECK(m_siConditionsTool.retrieve()); ATH_CHECK(m_siPropertiesTool.retrieve()); } else { + StatusCode sc = m_siLorentzAngleSvc.retrieve(); + if (sc.isFailure()) { + ATH_MSG_ERROR( "Could not retrieve Lorentz Angle Svc: " << m_siLorentzAngleSvc.name() ); + } sc = m_siPropertiesSvc.retrieve(); if (sc.isFailure()) { ATH_MSG_ERROR( "Could not retrieve silicon properties svc: " << m_siPropertiesSvc.name() ); @@ -118,6 +120,7 @@ StatusCode ReadSiDetectorElements::initialize(){ if (sc.isFailure()) { ATH_MSG_ERROR( "Could not retrieve silicon conditions service: " << m_siConditionsSvc.name() ); } + m_siLorentzAngleTool.disable(); m_siConditionsTool.disable(); m_siPropertiesTool.disable(); } diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py index 2292f879361..762a0dbd622 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py @@ -1,3 +1,4 @@ + # block include of file, this is used by many packages include.block ("InDetRecExample/InDetRecConditionsAccess.py") @@ -356,8 +357,8 @@ if DetFlags.haveRIO.SCT_on(): condTools.append(condTool) InDetSCT_ConditionsSummaryToolWithoutFlagged.ConditionsTools = condTools - # Setup Lorentz angle service. - from SiLorentzAngleSvc.SCTLorentzAngleSvcSetup import SCTLorentzAngleSvcSetup + # Setup Lorentz angle tool. + from SiLorentzAngleSvc.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup forceUseDB = False forceUseGeoModel = False @@ -369,8 +370,8 @@ if DetFlags.haveRIO.SCT_on(): else: forceUseGeoModel = True - sctLorentzAngleSvcSetup = SCTLorentzAngleSvcSetup(forceUseDB=forceUseDB, forceUseGeoModel=forceUseGeoModel) - SCTLorentzAngleSvc = sctLorentzAngleSvcSetup.SCTLorentzAngleSvc + sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup(forceUseDB=forceUseDB, forceUseGeoModel=forceUseGeoModel) + SCTLorentzAngleTool = sctLorentzAngleToolSetup.SCTLorentzAngleTool # # --- Load necessary TRT conditions folders diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/geometry.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/geometry.py index 7dffc9396d4..a4280efe5f7 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/geometry.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/geometry.py @@ -34,10 +34,12 @@ simFlags.SimLayout='ATLAS-SLHC-02-00-00' simFlags.SimLayout.set_On() simFlags.EventFilter.set_On() -from SiLorentzAngleSvc.LorentzAngleSvcSetup import SCTLorentzAngleSvc -# SCTLorentzAngleSvc.OutputLevel=VERBOSE -SCTLorentzAngleSvc.SiConditionsServices=None -SCTLorentzAngleSvc.Temperature=-20. -SCTLorentzAngleSvc.BiasVoltage=400. -SCTLorentzAngleSvc.DepletionVoltage=70. -SCTLorentzAngleSvc.CorrectionFactor=1.0 +from AthenaCommon.AlgSequence import AthSequencer +condSeq = AthSequencer("AthCondSeq") +if hasattr(condSeq, "SCTSiLorentzAngleCondAlg"): + # condSeq.SCTSiLorentzAngleCondAlg.OutputLevel=VERBOSE + condSeq.SCTSiLorentzAngleCondAlg.SiConditionsTool="" + condSeq.SCTSiLorentzAngleCondAlg.Temperature=-20. + condSeq.SCTSiLorentzAngleCondAlg.BiasVoltage=400. + condSeq.SCTSiLorentzAngleCondAlg.DepletionVoltage=70. + diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py index cc96e24fae2..1f7b6ddefee 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py @@ -264,6 +264,8 @@ class SCT_ConditionsToolsSetup: from AthenaCommon.AppMgr import ServiceMgr self.svcMgr = ServiceMgr + from AthenaCommon.AppMgr import ToolSvc + self.toolSvc = ToolSvc from IOVDbSvc.CondDB import conddb self.condDB = conddb @@ -298,7 +300,7 @@ class SCT_ConditionsToolsSetup: self.monitorTool = self.initMonitorTool(self.instanceName('InDetSCT_MonitorConditionsTool')) self.dcsTool = self.initDcsTool('InDetSCT_DCSConditionsTool') - self.lorentzSvc = self.initLorentzAngleSvc('SCTLorentzAngleSvc') + self.lorentzTool = self.initLorentzAngleTool('SCTLorentzAngleTool') self.summaryToolWoFlagged = self.initSummaryToolWithoutFlagged(self.instanceName('InDetSCT_ConditionsSummaryToolWithoutFlagged')) @@ -452,8 +454,8 @@ class SCT_ConditionsToolsSetup: else: return None - def initLorentzAngleSvc(self, instanceName): - # Set up Silicon Conditions Service + def initLorentzAngleTool(self, instanceName): + # Set up Silicon Conditions Tool from SCT_ConditionsTools.SCT_SiliconConditionsToolSetup import SCT_SiliconConditionsToolSetup sct_SiliconConditionsToolSetup = SCT_SiliconConditionsToolSetup() sct_SiliconConditionsToolSetup.setDcsTool(self.dcsTool) @@ -476,13 +478,13 @@ class SCT_ConditionsToolsSetup: UseMagFieldDcs = (not athenaCommonFlags.isOnline())) sctSiLorentzAngleCondAlg = condSeq.SCTSiLorentzAngleCondAlg - "Inititalize Lorentz angle Service" - if not hasattr(self.svcMgr, instanceName): - from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleCHSvc - self.svcMgr += SiLorentzAngleCHSvc(name = instanceName, + "Inititalize Lorentz angle Tool" + if not hasattr(self.toolSvc, instanceName): + from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleTool + self.toolSvc += SiLorentzAngleTool(name = instanceName, DetectorName = "SCT") - SCTLorentzAngleSvc = getattr(self.svcMgr, instanceName) - SCTLorentzAngleSvc.UseMagFieldSvc = True #may need also MagFieldSvc instance + SCTLorentzAngleTool = getattr(self.toolSvc, instanceName) + SCTLorentzAngleTool.UseMagFieldSvc = True #may need also MagFieldSvc instance def instanceName(self, toolname): return self.prefix+toolname diff --git a/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py b/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py index c0b941fc4cb..819b44873ae 100755 --- a/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py +++ b/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py @@ -108,12 +108,12 @@ sct_SiPropertiesToolSetup.setSiliconTool(sctSiliconConditionsTool) sct_SiPropertiesToolSetup.setup() sctSiPropertiesTool = sct_SiPropertiesToolSetup.getTool() -ReadSCTElements.SiLorentzAngleSvc = lorentzAngleSvc.sct ReadSCTElements.UseConditionsTools = True +ReadSCTElements.SiLorentzAngleTool = lorentzAngleSvc.sct ReadSCTElements.SiPropertiesTool = sctSiPropertiesTool ReadSCTElements.SiConditionsTool = sctSiliconConditionsTool -ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc=lorentzAngleSvc.sct +ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleTool=lorentzAngleSvc.sct print ReadPixelElements print lorentzAngleSvc.pixel -- GitLab