diff --git a/Projects/AnalysisBase/externals.txt b/Projects/AnalysisBase/externals.txt index 8f8aa0218f965c8f050e6917204907293a04e6e4..1c9e07805ec7590349a6640c7c68e06fdcea249e 100644 --- a/Projects/AnalysisBase/externals.txt +++ b/Projects/AnalysisBase/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AnalysisBaseExternalsVersion = 2.0.28 +AnalysisBaseExternalsVersion = 2.0.29 diff --git a/Projects/AnalysisTop/externals.txt b/Projects/AnalysisTop/externals.txt index 25a315ed3f3fb1d3eb84ec6e28f857160f9e83d9..ba052e034ad03a4649c650a55586aa69142e38b7 100644 --- a/Projects/AnalysisTop/externals.txt +++ b/Projects/AnalysisTop/externals.txt @@ -1,4 +1,4 @@ # Versions of the various externals to build before starting the build of # this project, when doing a full stack nightly build. -AnalysisBaseExternalsVersion = 2.0.28 +AnalysisBaseExternalsVersion = 2.0.29 diff --git a/Projects/AthDataQuality/externals.txt b/Projects/AthDataQuality/externals.txt index 213291871d90621535f007c08aac0210d507f5cd..52c57407abade2338592ff8a1062879d25e14cad 100644 --- a/Projects/AthDataQuality/externals.txt +++ b/Projects/AthDataQuality/externals.txt @@ -5,4 +5,4 @@ # an "origin/" prefix before it. For tags however this is explicitly # forbidden. -AtlasExternalsVersion = 2.0.28 +AtlasExternalsVersion = 2.0.29 diff --git a/Projects/AthSimulation/externals.txt b/Projects/AthSimulation/externals.txt index 06f1ef0591cd8e34d0f27a5a1a9850b57e780062..5793156229b3f0881b1d07e8e2b80e0cfd1341c7 100644 --- a/Projects/AthSimulation/externals.txt +++ b/Projects/AthSimulation/externals.txt @@ -6,7 +6,7 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthSimulationExternalsVersion = 2.0.28 +AthSimulationExternalsVersion = 2.0.29 # The version of atlas/Gaudi to use: GaudiVersion = v31r0.004 diff --git a/Projects/Athena/externals.txt b/Projects/Athena/externals.txt index 426abe2585bb23014e3ee9e3be0abeb1f8080c99..5006007520a8f86e81a4336bff9a12847cad07e6 100644 --- a/Projects/Athena/externals.txt +++ b/Projects/Athena/externals.txt @@ -6,7 +6,7 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthenaExternalsVersion = 2.0.28 +AthenaExternalsVersion = 2.0.29 # The version of atlas/Gaudi to use: GaudiVersion = v31r0.004 diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ATLASMagneticFieldWrapper.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ATLASMagneticFieldWrapper.h index 1725a3b8508c8d4cfbcda1136b3660ac683d953c..559fb8779682d189ce0ec2c26b2e1df3953c404b 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ATLASMagneticFieldWrapper.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ATLASMagneticFieldWrapper.h @@ -7,7 +7,7 @@ #include "MagFieldInterfaces/IMagFieldSvc.h" #include "Acts/Utilities/Definitions.hpp" -#include "Acts/MagneticField/concept/AnyFieldLookup.hpp" +#include "Acts/Utilities/MagneticFieldContext.hpp" class ATLASMagneticFieldWrapper { @@ -17,6 +17,10 @@ public: struct Cache { // empty, no cache for now + + Cache(std::reference_wrapper<const Acts::MagneticFieldContext> /*mctx*/) { + // does nothing, but is required + } }; // FieldCell is not needed anymore, keep it for backwards compatibility right now. @@ -32,7 +36,7 @@ public: { Acts::Vector3D bfield; m_fieldService->getField(&pos, &bfield); - + bfield *= m_bFieldUnit; // kT -> T; return bfield; @@ -76,7 +80,7 @@ public: return bfield; } - + Acts::Vector3D getField(const Acts::Vector3D& pos, Cache& /*cache*/) const { @@ -94,7 +98,7 @@ public: return bfield; } - + Acts::Vector3D getFieldGradient(const Acts::Vector3D& position, Acts::ActsMatrixD<3, 3>& gradient, @@ -104,16 +108,16 @@ public: } // only kept for backwards compatibility - Acts::concept::AnyFieldCell<> + FieldCell getFieldCell(const Acts::Vector3D& /*position*/) const { return m_fieldCell; } - + private: // only kept for backwards compatibility FieldCell m_fieldCell; - + MagField::IMagFieldSvc *m_fieldService; const double m_bFieldUnit = 1000.*Acts::units::_T; }; diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsDetectorElement.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsDetectorElement.h index bc40d819be36a2fadf1e7110c3890a3b07f4ee99..2fcf30d7562faf09561962270f9875e98a02ccec 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsDetectorElement.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsDetectorElement.h @@ -13,7 +13,7 @@ // ACTS #include "Acts/Detector/DetectorElementBase.hpp" - +#include "Acts/Utilities/GeometryContext.hpp" // STL #include <mutex> @@ -57,11 +57,11 @@ public: identify() const; /// Return local to global transform associated with this identifier - virtual const Acts::Transform3D& - transform() const final override; void storeTransform(ActsAlignmentStore* gas) const; + virtual const Acts::Transform3D & + transform(const Acts::GeometryContext &gctx) const final override; /// Return surface associated with this identifier, which should come from the diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationTool.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationTool.h index 5b94ae591fc16ceb6d924be7ad12299c17041ba1..4062cf9dfad38b0627b2f834448c6d73d3c6f232 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationTool.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationTool.h @@ -10,9 +10,11 @@ #include "GaudiKernel/IInterface.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/Property.h" +#include "GaudiKernel/EventContext.h" // PACKAGE #include "ActsGeometry/ActsTrackingGeometryTool.h" +#include "ActsGeometry/ActsGeometryContext.h" // ACTS #include "Acts/Propagator/EigenStepper.hpp" @@ -25,6 +27,8 @@ #include "Acts/Propagator/detail/StandardAborters.hpp" #include "ActsGeometry/ATLASMagneticFieldWrapper.h" #include "Acts/MagneticField/ConstantBField.hpp" +#include "Acts/Utilities/MagneticFieldContext.hpp" +#include "Acts/Utilities/Result.hpp" // BOOST #include <boost/variant/variant.hpp> @@ -53,12 +57,19 @@ public: template <typename parameters_t> std::vector<Acts::detail::Step> - propagate(const parameters_t& startParameters, + propagate(const EventContext& ctx, + const parameters_t& startParameters, double pathLimit = std::numeric_limits<double>::max()) const { ATH_MSG_VERBOSE(name() << "::" << __FUNCTION__ << " begin"); - Options options; + Acts::MagneticFieldContext mctx; + const ActsGeometryContext& gctx + = m_trackingGeometryTool->getGeometryContext(ctx); + + auto anygctx = gctx.any(); + + Options options(anygctx, mctx); options.pathLimit = pathLimit; bool debug = msg().level() == MSG::VERBOSE; options.debug = debug; @@ -73,7 +84,13 @@ public: std::vector<Acts::detail::Step> steps; DebugOutput::result_type debugOutput; - std::tie(steps, debugOutput) = boost::apply_visitor(visitor, *m_varProp); + auto res = boost::apply_visitor(visitor, *m_varProp); + if (!res.ok()) { + ATH_MSG_ERROR("Got error during propagation:" << res.error() + << ". Returning empty step vector."); + return {}; + } + std::tie(steps, debugOutput) = std::move(*res); if(debug) { ATH_MSG_VERBOSE(debugOutput.debugString); @@ -85,8 +102,11 @@ public: return steps; } - void - prepareAlignment() const; + const ActsTrackingGeometryTool* + trackingGeometryTool() const + { + return m_trackingGeometryTool.get(); + } private: // set up options for propagation @@ -107,37 +127,41 @@ private: std::unique_ptr<VariantPropagator> m_varProp; + using ResultType = Acts::Result<std::pair<std::vector<Acts::detail::Step>, + DebugOutput::result_type>>; template <typename parameters_t, typename options_t> - struct PropagatorVisitor - : boost::static_visitor<std::pair<std::vector<Acts::detail::Step>, - DebugOutput::result_type>> { + struct PropagatorVisitor + : boost::static_visitor<ResultType> { PropagatorVisitor(const parameters_t& parameters, options_t options) : m_parameters(parameters), m_options(std::move(options)) {} template <typename propagator_t> - std::pair<std::vector<Acts::detail::Step>, DebugOutput::result_type> + ResultType operator()(const propagator_t& propagator) const { - const auto& result = propagator.propagate(m_parameters, m_options); - auto steppingResults = result.template get<SteppingLogger::result_type>(); - auto debugOutput = result.template get<DebugOutput::result_type>(); + auto result = propagator.propagate(m_parameters, m_options); + if (!result.ok()) { + return result.error(); + } + auto& propRes = *result; + + auto steppingResults = propRes.template get<SteppingLogger::result_type>(); + auto debugOutput = propRes.template get<DebugOutput::result_type>(); // try to force return value optimization, not sure this is necessary - return {std::move(steppingResults.steps), std::move(debugOutput)}; + return std::make_pair(std::move(steppingResults.steps), std::move(debugOutput)); } const parameters_t& m_parameters; options_t m_options; }; - + ServiceHandle<MagField::IMagFieldSvc> m_fieldServiceHandle; ToolHandle<ActsTrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", "ActsTrackingGeometryTool"}; - Options m_propagationOptions; - Gaudi::Property<std::string> m_fieldMode{this, "FieldMode", "ATLAS"}; Gaudi::Property<std::vector<double>> m_constantFieldVector{this, "ConstantFieldVector", {0, 0, 0}}; diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsGeometryContext.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsGeometryContext.h new file mode 100644 index 0000000000000000000000000000000000000000..27c32c3ba14f8dfaf745313da45db0128d33768e --- /dev/null +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsGeometryContext.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ACTSGEOMETRY_ACTSGEOMETRYCONTEXT_H +#define ACTSGEOMETRY_ACTSGEOMETRYCONTEXT_H + +#include "ActsGeometry/ActsAlignmentStore.h" + +#include "AthenaKernel/CLASS_DEF.h" +#include "AthenaKernel/CondCont.h" + +#include "Acts/Utilities/GeometryContext.hpp" + +#include <memory> + +struct ActsGeometryContext { + + bool construction{false}; + + std::unique_ptr<const ActsAlignmentStore> ownedAlignmentStore{nullptr}; + + const ActsAlignmentStore* alignmentStore{nullptr}; + + Acts::GeometryContext + any() const + { + return {this}; + } +}; + +CLASS_DEF(ActsGeometryContext, 51464195, 1) +CONDCONT_DEF( ActsGeometryContext , 11228079 ); + +#endif diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsLayerBuilder.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsLayerBuilder.h index 696ecfc2cac0b77784a6f1a1a6bff6b2fb3109c2..7ca4fdc2398498e9cd238bbb2324cbe2ac920893 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsLayerBuilder.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsLayerBuilder.h @@ -14,6 +14,7 @@ #include "Acts/Tools/ILayerBuilder.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/GeometryContext.hpp" class ActsTrackingGeomtrySvc; @@ -77,13 +78,13 @@ public: ~ActsLayerBuilder() {} const Acts::LayerVector - negativeLayers() const override; + negativeLayers(const Acts::GeometryContext& gctx) const override; const Acts::LayerVector - centralLayers() const override; + centralLayers(const Acts::GeometryContext& gctx) const override; const Acts::LayerVector - positiveLayers() const override; + positiveLayers(const Acts::GeometryContext& gctx) const override; /// Name identification // const std::string& @@ -139,7 +140,7 @@ private: // @param layers is goint to be filled // @param type is the indication which ones to build -1 | 0 | 1 void - buildLayers(Acts::LayerVector& layersOutput, int type = 0); + buildLayers(const Acts::GeometryContext& gctx, Acts::LayerVector& layersOutput, int type = 0); }; #endif diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsObjWriterTool.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsObjWriterTool.h index 615a04f6aaf1f9a0ef2afa97c8f45736ea5c02b2..945de291de1b0fe559cf9d984b0425df2a06a0d9 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsObjWriterTool.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsObjWriterTool.h @@ -10,6 +10,7 @@ #include "GaudiKernel/IAlgTool.h" #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/IInterface.h" +#include "ActsGeometry/ActsGeometryContext.h" #include "GaudiKernel/Property.h" /*no forward decl: typedef*/ @@ -33,12 +34,12 @@ public: ActsObjWriterTool(const std::string& type, const std::string& name, const IInterface* parent); - + void - write(const Acts::TrackingGeometry&); + write(const ActsGeometryContext& gctx, const Acts::TrackingGeometry&); private: - + Gaudi::Property<std::string> m_outputDirectory{this, "OutputDirectory", ".", ""}; Gaudi::Property<std::vector<std::string>> m_subDetectors{this, "SubDetectors", {}, ""}; diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsStrawLayerBuilder.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsStrawLayerBuilder.h index 5391de6bbd5580d9252d8fbcc72ddec3424fc01b..2a9f3ae9feb1e0393f35912cdc3dbcbb23e248a7 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsStrawLayerBuilder.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsStrawLayerBuilder.h @@ -13,6 +13,7 @@ // ACTS #include "Acts/Tools/ILayerBuilder.hpp" #include "Acts/Utilities/Logger.hpp" +#include "Acts/Utilities/GeometryContext.hpp" class TRT_ID; class ActsTrackingGeometrySvc; @@ -30,7 +31,7 @@ class ActsStrawLayerBuilder : public Acts::ILayerBuilder public: using ElementVector = std::vector<std::shared_ptr<const ActsDetectorElement>>; - + struct Config { /// string based identification @@ -41,7 +42,7 @@ public: const ActsTrackingGeometrySvc* trackingGeometrySvc = nullptr; const TRT_ID* idHelper = nullptr; }; - + /// Constructor /// @param cfg is the configuration struct /// @param logger the local logging instance @@ -52,21 +53,21 @@ public: { m_cfg = cfg; } - + ~ActsStrawLayerBuilder() {} const Acts::LayerVector - negativeLayers() const override; + negativeLayers(const Acts::GeometryContext& gctx) const override; const Acts::LayerVector - centralLayers() const override; + centralLayers(const Acts::GeometryContext& gctx) const override; const Acts::LayerVector - centralLayers(); + centralLayers(const Acts::GeometryContext& gctx); const Acts::LayerVector - positiveLayers() const override; - + positiveLayers(const Acts::GeometryContext& gctx) const override; + const std::string& identification() const override { @@ -74,7 +75,7 @@ public: } const Acts::LayerVector - endcapLayers(int side); + endcapLayers(const Acts::GeometryContext& gctx, int side); private: /// configruation object @@ -86,7 +87,7 @@ private: { return *m_logger; } - + /// logging instance std::unique_ptr<const Acts::Logger> m_logger; diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometrySvc.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometrySvc.h index 1acae91e6e584858e967db2fc964a4d0eb5b7ef3..bb40f58ca77ecd806b882ae03228ebd72df7161e 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometrySvc.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometrySvc.h @@ -44,44 +44,41 @@ public: StatusCode initialize() override; //virtual StatusCode finalize() override; - + ActsTrackingGeometrySvc( const std::string& name, ISvcLocator* pSvcLocator ); std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry() override; - - void - setAlignmentStore(const ActsAlignmentStore* gas, const EventContext& ctx) override; - - const ActsAlignmentStore* - getAlignmentStore(const EventContext& ctx) const override; + void + populateAlignmentStore(ActsAlignmentStore *store) const override; + + const ActsAlignmentStore* + getNominalAlignmentStore() const override; private: - std::shared_ptr<const Acts::ITrackingVolumeBuilder> + std::shared_ptr<const Acts::ITrackingVolumeBuilder> makeVolumeBuilder(const InDetDD::InDetDetectorManager* manager, std::shared_ptr<const Acts::CylinderVolumeHelper> cvh, bool toBeamline = false); ServiceHandle<StoreGateSvc> m_detStore; const InDetDD::SiDetectorManager* p_pixelManager; const InDetDD::SiDetectorManager* p_SCTManager; const InDetDD::TRT_DetectorManager* p_TRTManager; - + std::shared_ptr<std::vector<std::shared_ptr<const ActsDetectorElement>>> m_elementStore; std::shared_ptr<const Acts::TrackingGeometry> m_trackingGeometry; - + const TRT_ID *m_TRT_idHelper; - + + std::unique_ptr<const ActsAlignmentStore> m_nominalAlignmentStore{nullptr}; + Gaudi::Property<bool> m_useMaterialMap{this, "UseMaterialMap", false, ""}; Gaudi::Property<std::string> m_materialMapInputFile{this, "MaterialMapInputFile", "", ""}; Gaudi::Property<std::vector<size_t>> m_barrelMaterialBins{this, "BarrelMaterialBins", {10, 10}}; Gaudi::Property<std::vector<size_t>> m_endcapMaterialBins{this, "EndcapMaterialBins", {5, 20}}; - - mutable std::unordered_map<EventContext::ContextID_t, const ActsAlignmentStore*> m_gasMap; - mutable std::mutex m_gasMapMutex; - }; -#endif +#endif diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometryTool.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometryTool.h index 56efe7caaf938fd6f23a7fd08541947b3298f158..d9a9ee1a96f451c98362ea061ddf2afc8ac528e5 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometryTool.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometryTool.h @@ -10,9 +10,11 @@ #include "GaudiKernel/IInterface.h" #include "GaudiKernel/ServiceHandle.h" #include "StoreGate/ReadCondHandleKey.h" +#include "GaudiKernel/EventContext.h" // PACKAGE #include "ActsGeometry/ActsAlignmentStore.h" // ReadCondHandleKey wants complete type +#include "ActsGeometry/ActsGeometryContext.h" // ACTS @@ -20,6 +22,7 @@ namespace Acts { class TrackingGeometry; } +class ActsGeometryContext; class IActsTrackingGeometrySvc; static const InterfaceID IID_ActsTrackingGeometryTool("ActsTrackingGeometryTool", 1, 0); @@ -36,13 +39,18 @@ public: std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry() const; - StatusCode prepareAlignment() const; + const ActsGeometryContext& + getGeometryContext(const EventContext& ctx = Gaudi::Hive::currentContext()) const; + + ActsGeometryContext + getNominalGeometryContext() const; + private: ServiceHandle<IActsTrackingGeometrySvc> m_trackingGeometrySvc; - SG::ReadCondHandleKey<ActsAlignmentStore> m_rchk {this, "PixelAlignmentKey", "PixelAlignment", "cond read key"}; + SG::ReadCondHandleKey<ActsGeometryContext> m_rchk {this, "PixelAlignmentKey", "PixelAlignment", "cond read key"}; }; diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/GeomShiftCondAlg.h b/Tracking/Acts/ActsGeometry/ActsGeometry/GeomShiftCondAlg.h index 7370fcaabe911758d5795d5a5e2e21b8c0b4ea1e..d5f71fd1d1c9d3593513373f3ba0488f7cec1870 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/GeomShiftCondAlg.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/GeomShiftCondAlg.h @@ -28,15 +28,16 @@ class StoreGateSvc; class IActsTrackingGeometrySvc; class ActsAlignmentStore; class GeoAlignableTransform; +class ActsGeometryContext; class GeomShiftCondAlg : public AthAlgorithm { - + public: - + GeomShiftCondAlg (const std::string& name, ISvcLocator* pSvcLocator); virtual ~GeomShiftCondAlg(); - + virtual bool isClonable() const override { return true; } virtual StatusCode initialize() override; @@ -44,10 +45,10 @@ public: virtual StatusCode finalize() override; private: - + SG::ReadHandleKey<EventInfo> m_evt {this,"EvtInfo", "McEventInfo", "EventInfo name"}; - SG::WriteCondHandleKey<ActsAlignmentStore> m_wchk {this, "PixelAlignmentKey", "PixelAlignment", "cond handle key"}; + SG::WriteCondHandleKey<ActsGeometryContext> m_wchk {this, "PixelAlignmentKey", "PixelAlignment", "cond handle key"}; Gaudi::Property<double> m_zShiftPerLB {this, "ZShiftPerLB", 10.5, ""}; @@ -62,4 +63,3 @@ private: std::vector<const GeoAlignableTransform*> m_topAligns; }; - diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/IActsTrackingGeometrySvc.h b/Tracking/Acts/ActsGeometry/ActsGeometry/IActsTrackingGeometrySvc.h index a175dfccf5c9ad71b8a1b49cd6be8c90e6740b7d..082c0f21bc6322b0964c9e6d3fb089f76a56750d 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/IActsTrackingGeometrySvc.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/IActsTrackingGeometrySvc.h @@ -27,12 +27,12 @@ class IActsTrackingGeometrySvc : virtual public IInterface { trackingGeometry() = 0; virtual - void - setAlignmentStore(const ActsAlignmentStore* gas, const EventContext& ctx) = 0; - + void + populateAlignmentStore(ActsAlignmentStore *store) const = 0; + virtual const ActsAlignmentStore* - getAlignmentStore(const EventContext& ctx) const = 0; + getNominalAlignmentStore() const = 0; }; diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/NominalAlignmentCondAlg.h b/Tracking/Acts/ActsGeometry/ActsGeometry/NominalAlignmentCondAlg.h index 539ea274621b99de89245af03c0cf4176096e396..7b1539a57baa793ab71bdbdb6e8e00c2307c331c 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/NominalAlignmentCondAlg.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/NominalAlignmentCondAlg.h @@ -18,6 +18,8 @@ class IActsTrackingGeometrySvc; class ActsAlignmentStore; +class ActsGeometryContext; + /// @class NominalAlignmentCondAlg /// Conditions algorithm which produces an (effectively) @@ -25,12 +27,12 @@ class ActsAlignmentStore; /// nominal alignments (= identity deltas) /// class NominalAlignmentCondAlg : public AthAlgorithm { - + public: - + NominalAlignmentCondAlg (const std::string& name, ISvcLocator* pSvcLocator); virtual ~NominalAlignmentCondAlg(); - + virtual bool isClonable() const override { return true; } virtual StatusCode initialize() override; @@ -38,11 +40,10 @@ public: virtual StatusCode finalize() override; private: - - SG::WriteCondHandleKey<ActsAlignmentStore> m_wchk {this, "PixelAlignmentKey", "PixelAlignment", "cond handle key"}; + + SG::WriteCondHandleKey<ActsGeometryContext> m_wchk {this, "PixelAlignmentKey", "PixelAlignment", "cond handle key"}; ServiceHandle<ICondSvc> m_cs; ServiceHandle<IActsTrackingGeometrySvc> m_trackingGeometrySvc; }; - diff --git a/Tracking/Acts/ActsGeometry/src/ActsDetectorElement.cxx b/Tracking/Acts/ActsGeometry/src/ActsDetectorElement.cxx index 534854401ae1ca55d96db84ec018c4b4c95e2e8a..40d18ca9b725bf37973c3dbd44f2165ba573639d 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsDetectorElement.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsDetectorElement.cxx @@ -16,6 +16,7 @@ // PACKAGE #include "ActsGeometry/ActsTrackingGeometrySvc.h" #include "ActsGeometry/ActsAlignmentStore.h" +#include "ActsGeometry/ActsGeometryContext.h" // ACTS #include "Acts/Surfaces/StrawSurface.hpp" @@ -23,6 +24,7 @@ #include "Acts/Surfaces/PlaneSurface.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/TrapezoidBounds.hpp" +#include "Acts/Utilities/GeometryContext.hpp" // STL #include <mutex> @@ -94,7 +96,7 @@ ActsDetectorElement::ActsDetectorElement( m_detElement = detElem; m_defTransform = trf; m_explicitIdentifier = id; - + // we know this is a straw double length = detElem->strawLength()*0.5; @@ -112,15 +114,15 @@ ActsDetectorElement::ActsDetectorElement( throw std::runtime_error("Cannot get tube radius for element in ActsDetectorElement c'tor"); } } - + auto lineBounds = std::make_shared<const Acts::LineBounds>(innerTubeRadius, length); m_bounds = lineBounds; m_surface = Acts::Surface::makeShared<Acts::StrawSurface>(lineBounds, *this); } -IdentityHelper -ActsDetectorElement::identityHelper() const +IdentityHelper +ActsDetectorElement::identityHelper() const { size_t which = m_detElement.which(); if (which == 0) { @@ -129,32 +131,31 @@ ActsDetectorElement::identityHelper() const throw std::domain_error("Cannot get IdentityHelper for TRT element"); } } - + const Acts::Transform3D& -ActsDetectorElement::transform() const +ActsDetectorElement::transform(const Acts::GeometryContext& anygctx) const { - - - auto ctx = Gaudi::Hive::currentContext(); - - if (!ctx.valid()) { - // this is really only the case single threaded, but let's be safe and lock it down - // also, we're not super afraid about performance here + // any cast to known context type + const ActsGeometryContext* gctx = std::any_cast<const ActsGeometryContext*>(anygctx); + + // This is needed for initial geometry construction. At that point, we don't have a + // consistent view of the geometry yet, and thus we can't populate an alignment store + // at that time. + if (gctx->construction) { + // this should only happen at initialize (1 thread, but mutex anyway) return getDefaultTransformMutexed(); } - // retrieve GAS from tracking geometry svc - const ActsAlignmentStore* alignmentStore = m_trackingGeometrySvc->getAlignmentStore(ctx); + // unpack the alignment store from the context + const ActsAlignmentStore* alignmentStore = gctx->alignmentStore; // no GAS, is this initialization? - if (alignmentStore == nullptr) { - throw std::runtime_error("ActsAlignmentStore could not be found for valid context."); - } + assert(alignmentStore != nullptr); + // get the correct cached transform const Transform3D* cachedTrf = alignmentStore->getTransform(this); - if (cachedTrf == nullptr) { - throw std::runtime_error("Detector transform not found in ActsAlignmentStore."); - } + + assert(cachedTrf != nullptr); return *cachedTrf; } @@ -169,12 +170,12 @@ ActsDetectorElement::storeTransform(ActsAlignmentStore* gas) const Transform3D operator()(const InDetDD::SiDetectorElement* detElem) const { - Amg::Transform3D g2l + Amg::Transform3D g2l = detElem->getMaterialGeom()->getAbsoluteTransform(m_store); return g2l * Amg::CLHEPTransformToEigen(detElem->recoToHitTransform()); } - + Transform3D operator()(const InDetDD::TRT_BaseElement*) const { return *m_trtTrf; @@ -184,7 +185,7 @@ ActsDetectorElement::storeTransform(ActsAlignmentStore* gas) const const Transform3D* m_trtTrf; }; - Transform3D trf + Transform3D trf = boost::apply_visitor(get_transform(gas, m_defTransform.get()), m_detElement); gas->setTransform(this, trf); @@ -203,12 +204,12 @@ ActsDetectorElement::getDefaultTransformMutexed() const Transform3D operator()(const InDetDD::SiDetectorElement* detElem) const { - Amg::Transform3D g2l + Amg::Transform3D g2l = detElem->getMaterialGeom()->getDefAbsoluteTransform(); return g2l * Amg::CLHEPTransformToEigen(detElem->recoToHitTransform()); } - + Transform3D operator()(const InDetDD::TRT_BaseElement*) const { return *m_trtTrf; @@ -216,13 +217,13 @@ ActsDetectorElement::getDefaultTransformMutexed() const const Transform3D* m_trtTrf; }; - + std::lock_guard<std::mutex> guard(m_cacheMutex); if (m_defTransform) { return *m_defTransform; } // transform not yet set - m_defTransform + m_defTransform = std::make_shared<const Transform3D>( boost::apply_visitor(get_default_transform(m_defTransform.get()), m_detElement)); diff --git a/Tracking/Acts/ActsGeometry/src/ActsExtrapolationAlg.cxx b/Tracking/Acts/ActsGeometry/src/ActsExtrapolationAlg.cxx index d72ae620323b1e45d327d57edd72d86a2d9b88b3..bfd4e55bb033b653dcd42873846ba27e1ac8068e 100755 --- a/Tracking/Acts/ActsGeometry/src/ActsExtrapolationAlg.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsExtrapolationAlg.cxx @@ -21,6 +21,7 @@ // PACKAGE #include "ActsGeometry/ActsExtrapolationTool.h" #include "ActsInterop/Logger.h" +#include "ActsGeometry/ActsGeometryContext.h" //#include "ActsGeometry/IActsMaterialTrackWriterSvc.h" // OTHER @@ -57,12 +58,11 @@ StatusCode ActsExtrapolationAlg::initialize() { return StatusCode::SUCCESS; } -StatusCode ActsExtrapolationAlg::execute(const EventContext& ctx) const +StatusCode ActsExtrapolationAlg::execute(const EventContext& ctx) const { ATH_MSG_VERBOSE(name() << "::" << __FUNCTION__); - m_extrapolationTool->prepareAlignment(); ATHRNG::RNGWrapper* rngWrapper = m_rndmGenSvc->getEngine(this); rngWrapper->setSeed( name(), ctx ); CLHEP::HepRandomEngine* rngEngine = rngWrapper->getEngine(ctx); @@ -92,29 +92,29 @@ StatusCode ActsExtrapolationAlg::execute(const EventContext& ctx) const double charge = rngEngine->flat() > 0.5 ? -1 : 1; double qop = charge / momentum.norm(); - - std::shared_ptr<Acts::PerigeeSurface> surface + + std::shared_ptr<Acts::PerigeeSurface> surface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3D(0, 0, 0)); Acts::ActsVectorD<5> pars; pars << d0, z0, phi, theta, qop; std::unique_ptr<Acts::ActsSymMatrixD<5>> cov = nullptr; - + std::vector<Acts::detail::Step> steps; if(charge != 0.) { - // charged extrapolation - with hit recording - Acts::BoundParameters startParameters( + // Perigee, no alignment -> default geo context + ActsGeometryContext gctx + = m_extrapolationTool->trackingGeometryTool()->getNominalGeometryContext(); + auto anygctx = gctx.any(); + Acts::BoundParameters startParameters(anygctx, std::move(cov), std::move(pars), std::move(surface)); - steps = m_extrapolationTool->propagate(startParameters); + steps = m_extrapolationTool->propagate(ctx, startParameters); m_propStepWriterSvc->write(steps); } - - - ATH_MSG_VERBOSE(name() << " execute done"); return StatusCode::SUCCESS; @@ -142,4 +142,3 @@ void ActsExtrapolationAlg::writeStepsObj(std::vector<Acts::detail::Step> steps) out << lstr.str() << std::endl; } - diff --git a/Tracking/Acts/ActsGeometry/src/ActsExtrapolationTool.cxx b/Tracking/Acts/ActsGeometry/src/ActsExtrapolationTool.cxx index 2a2fd77ac63886ac99b1822c09d3d577d0388023..f790e00b3eed1c2ade4712d3aeda5d5d80ba3630 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsExtrapolationTool.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsExtrapolationTool.cxx @@ -26,14 +26,14 @@ #include <memory> ActsExtrapolationTool::ActsExtrapolationTool(const std::string& type, const std::string& name, - const IInterface* parent) + const IInterface* parent) : AthAlgTool(type, name, parent), m_fieldServiceHandle("AtlasFieldSvc", name) { } - -StatusCode + +StatusCode ActsExtrapolationTool::initialize() { using namespace std::literals::string_literals; @@ -42,7 +42,7 @@ ActsExtrapolationTool::initialize() ATH_MSG_INFO("Initializing ACTS extrapolation"); ATH_CHECK( m_trackingGeometryTool.retrieve() ); - std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry + std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry = m_trackingGeometryTool->trackingGeometry(); Acts::Navigator navigator(trackingGeometry); @@ -54,7 +54,7 @@ ActsExtrapolationTool::initialize() using BField_t = ATLASMagneticFieldWrapper; BField_t bField(m_fieldServiceHandle.get()); auto stepper = Acts::EigenStepper<BField_t>(std::move(bField)); - auto propagator = Acts::Propagator<decltype(stepper), Acts::Navigator>(std::move(stepper), + auto propagator = Acts::Propagator<decltype(stepper), Acts::Navigator>(std::move(stepper), std::move(navigator)); m_varProp = std::make_unique<VariantPropagator>(propagator); } @@ -67,7 +67,7 @@ ActsExtrapolationTool::initialize() using BField_t = Acts::ConstantBField; BField_t bField(Bx, By, Bz); auto stepper = Acts::EigenStepper<BField_t>(std::move(bField)); - auto propagator = Acts::Propagator<decltype(stepper), Acts::Navigator>(std::move(stepper), + auto propagator = Acts::Propagator<decltype(stepper), Acts::Navigator>(std::move(stepper), std::move(navigator)); m_varProp = std::make_unique<VariantPropagator>(propagator); } @@ -75,10 +75,3 @@ ActsExtrapolationTool::initialize() ATH_MSG_INFO("ACTS extrapolation successfully initialized"); return StatusCode::SUCCESS; } - - -void -ActsExtrapolationTool::prepareAlignment() const -{ - m_trackingGeometryTool->prepareAlignment(); -} diff --git a/Tracking/Acts/ActsGeometry/src/ActsLayerBuilder.cxx b/Tracking/Acts/ActsGeometry/src/ActsLayerBuilder.cxx index 3743ddeeb6aa7df272d405f5d14e6ae156bc085c..4d0aef027181caec9ae8a40616e55f89772889ab 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsLayerBuilder.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsLayerBuilder.cxx @@ -11,49 +11,50 @@ #include "ActsInterop/IdentityHelper.h" // ACTS -#include "Acts/Material/SurfaceMaterialProxy.hpp" +#include "Acts/Material/ProtoSurfaceMaterial.hpp" #include "Acts/Surfaces/CylinderSurface.hpp" #include "Acts/Surfaces/DiscSurface.hpp" #include "Acts/Layers/GenericApproachDescriptor.hpp" -#include "Acts/Utilities/ApproachDescriptor.hpp" +#include "Acts/Layers/ApproachDescriptor.hpp" #include "Acts/Layers/ProtoLayer.hpp" #include "Acts/Tools/LayerCreator.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" using Acts::Surface; using Acts::Transform3D; using Acts::Translation3D; const Acts::LayerVector -ActsLayerBuilder::negativeLayers() const +ActsLayerBuilder::negativeLayers(const Acts::GeometryContext& gctx) const { ACTS_VERBOSE("Building negative layers"); // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<ActsLayerBuilder*>(this); Acts::LayerVector nVector; - mutableThis->buildLayers(nVector, -1); + mutableThis->buildLayers(gctx, nVector, -1); return nVector; } const Acts::LayerVector -ActsLayerBuilder::centralLayers() const +ActsLayerBuilder::centralLayers(const Acts::GeometryContext& gctx) const { ACTS_VERBOSE("Building central layers"); // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<ActsLayerBuilder*>(this); Acts::LayerVector cVector; - mutableThis->buildLayers(cVector, 0); + mutableThis->buildLayers(gctx, cVector, 0); return cVector; } const Acts::LayerVector -ActsLayerBuilder::positiveLayers() const +ActsLayerBuilder::positiveLayers(const Acts::GeometryContext& gctx) const { ACTS_VERBOSE("Building positive layers"); // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<ActsLayerBuilder*>(this); Acts::LayerVector pVector; - mutableThis->buildLayers(pVector, 1); + mutableThis->buildLayers(gctx, pVector, 1); return pVector; } @@ -80,7 +81,8 @@ ActsLayerBuilder::getDetectorElements() const } void -ActsLayerBuilder::buildLayers(Acts::LayerVector& layersOutput, int type) +ActsLayerBuilder::buildLayers(const Acts::GeometryContext& gctx, + Acts::LayerVector& layersOutput, int type) { std::vector<std::shared_ptr<const ActsDetectorElement>> elements = getDetectorElements(); @@ -138,7 +140,7 @@ ActsLayerBuilder::buildLayers(Acts::LayerVector& layersOutput, int type) for (const auto& layerPair : layers) { const std::vector<std::shared_ptr<const Surface>>& layerSurfaces = layerPair.second; auto key = layerPair.first; - Acts::ProtoLayer pl(layerSurfaces); + Acts::ProtoLayer pl(gctx, layerSurfaces); ACTS_VERBOSE("Layer #" << n << " with layerKey: (" << key.first << ", " << key.second << ")"); if (type == 0) { // BARREL @@ -155,14 +157,14 @@ ActsLayerBuilder::buildLayers(Acts::LayerVector& layersOutput, int type) for (const auto& layerPair : layers) { std::unique_ptr<Acts::ApproachDescriptor> approachDescriptor = nullptr; - std::shared_ptr<const Acts::SurfaceMaterialProxy> materialProxy = nullptr; + std::shared_ptr<const Acts::ProtoSurfaceMaterial> materialProxy = nullptr; // use ref here, copy later const std::vector<std::shared_ptr<const Surface>>& layerSurfaces = layerPair.second; if (type == 0) { // BARREL // layers and extent are determined, build actual layer - Acts::ProtoLayer pl(layerSurfaces); + Acts::ProtoLayer pl(gctx, layerSurfaces); pl.envR = {0, 0}; pl.envZ = {20, 20}; @@ -194,7 +196,7 @@ ActsLayerBuilder::buildLayers(Acts::LayerVector& layersOutput, int type) binsZ, -layerHalfZ, layerHalfZ, Acts::open, Acts::binZ, transform); materialProxy - = std::make_shared<const Acts::SurfaceMaterialProxy>(materialBinUtil); + = std::make_shared<const Acts::ProtoSurfaceMaterial>(materialBinUtil); ACTS_VERBOSE("[L] Layer is marked to carry support material on Surface ( " "inner=0 / center=1 / outer=2 ) : " << "inner"); @@ -207,7 +209,7 @@ ActsLayerBuilder::buildLayers(Acts::LayerVector& layersOutput, int type) // set material on inner // @TODO: make this configurable somehow - innerBoundary->setAssociatedMaterial(materialProxy); + innerBoundary->assignSurfaceMaterial(materialProxy); std::vector<std::shared_ptr<const Acts::Surface>> aSurfaces; aSurfaces.push_back(std::move(innerBoundary)); @@ -217,16 +219,17 @@ ActsLayerBuilder::buildLayers(Acts::LayerVector& layersOutput, int type) approachDescriptor = std::make_unique<Acts::GenericApproachDescriptor>(std::move(aSurfaces)); - auto layer = m_cfg.layerCreator->cylinderLayer(layerSurfaces, - Acts::equidistant, - Acts::equidistant, - pl, + auto layer = m_cfg.layerCreator->cylinderLayer(gctx, + layerSurfaces, + Acts::equidistant, + Acts::equidistant, + pl, transform, std::move(approachDescriptor)); layersOutput.push_back(layer); } else { // ENDCAP - Acts::ProtoLayer pl(layerSurfaces); + Acts::ProtoLayer pl(gctx, layerSurfaces); pl.envR = {0, 0}; pl.envZ = {10, 10}; @@ -269,7 +272,7 @@ ActsLayerBuilder::buildLayers(Acts::LayerVector& layersOutput, int type) matBinsR, pl.minR, pl.maxR, Acts::open, Acts::binR, transformNominal); materialProxy - = std::make_shared<const Acts::SurfaceMaterialProxy>(materialBinUtil); + = std::make_shared<const Acts::ProtoSurfaceMaterial>(materialBinUtil); ACTS_VERBOSE("[L] Layer is marked to carry support material on Surface ( " "inner=0 / center=1 / outer=2 ) : " << "inner"); @@ -283,7 +286,7 @@ ActsLayerBuilder::buildLayers(Acts::LayerVector& layersOutput, int type) // set material on inner // @TODO: make this configurable somehow - innerBoundary->setAssociatedMaterial(materialProxy); + innerBoundary->assignSurfaceMaterial(materialProxy); int nModPhi = std::numeric_limits<int>::max(); int nModR = 0; @@ -319,9 +322,10 @@ ActsLayerBuilder::buildLayers(Acts::LayerVector& layersOutput, int type) approachDescriptor = std::make_unique<Acts::GenericApproachDescriptor>(aSurfaces); - auto layer = m_cfg.layerCreator->discLayer(layerSurfaces, - nBinsR, - nBinsPhi, + auto layer = m_cfg.layerCreator->discLayer(gctx, + layerSurfaces, + nBinsR, + nBinsPhi, pl, transformNominal, std::move(approachDescriptor)); diff --git a/Tracking/Acts/ActsGeometry/src/ActsObjWriterTool.cxx b/Tracking/Acts/ActsGeometry/src/ActsObjWriterTool.cxx index bc4c6eff8c6e4123c166b116a24ca7d0bb049a30..3a3f832d842ef553591a7a537f240a1346e0077b 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsObjWriterTool.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsObjWriterTool.cxx @@ -11,6 +11,7 @@ // Gaudi / Athena #include "GaudiKernel/IInterface.h" +#include "ActsGeometry/ActsGeometryContext.h" // ACTS #include "Acts/Detector/TrackingGeometry.hpp" @@ -20,14 +21,14 @@ ActsObjWriterTool::ActsObjWriterTool(const std::string& type, const std::string& name, - const IInterface* parent) + const IInterface* parent) : AthAlgTool(type, name, parent) { //declareProperty("OutputDirectory", m_outputDirectory = ""); //declareProperty("SubDetectors", m_subDetectors = {}); } - -StatusCode + +StatusCode ActsObjWriterTool::initialize() { @@ -69,13 +70,11 @@ ActsObjWriterTool::initialize() m_tgObjWriter = std::make_shared<Acts::ObjTrackingGeometryWriter>(tgObjWriterConfig); - return StatusCode::SUCCESS; } void -ActsObjWriterTool::write(const Acts::TrackingGeometry& tg) +ActsObjWriterTool::write(const ActsGeometryContext& gctx, const Acts::TrackingGeometry& tg) { - m_tgObjWriter->write(tg); + m_tgObjWriter->write(gctx.any(), tg); } - diff --git a/Tracking/Acts/ActsGeometry/src/ActsStrawLayerBuilder.cxx b/Tracking/Acts/ActsGeometry/src/ActsStrawLayerBuilder.cxx index e488c87ac0e3a11b3e1089d58a8746cb2f181580..dc9700cf12f0747e56c855f687488c7d80272778 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsStrawLayerBuilder.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsStrawLayerBuilder.cxx @@ -20,6 +20,7 @@ #include "Acts/Tools/LayerCreator.hpp" #include "Acts/Utilities/Definitions.hpp" #include "Acts/Layers/ProtoLayer.hpp" +#include "Acts/Utilities/GeometryContext.hpp" // STL #include <iostream> @@ -29,33 +30,33 @@ using Acts::Transform3D; using Acts::Vector3D; const Acts::LayerVector -ActsStrawLayerBuilder::negativeLayers() const +ActsStrawLayerBuilder::negativeLayers(const Acts::GeometryContext& gctx) const { // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<ActsStrawLayerBuilder*>(this); - return mutableThis->endcapLayers(-1); + return mutableThis->endcapLayers(gctx, -1); } const Acts::LayerVector -ActsStrawLayerBuilder::centralLayers() const +ActsStrawLayerBuilder::centralLayers(const Acts::GeometryContext& gctx) const { // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<ActsStrawLayerBuilder*>(this); - return mutableThis->centralLayers(); + return mutableThis->centralLayers(gctx); } const Acts::LayerVector -ActsStrawLayerBuilder::positiveLayers() const +ActsStrawLayerBuilder::positiveLayers(const Acts::GeometryContext& gctx) const { // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<ActsStrawLayerBuilder*>(this); - return mutableThis->endcapLayers(1); + return mutableThis->endcapLayers(gctx, 1); } const Acts::LayerVector -ActsStrawLayerBuilder::centralLayers() +ActsStrawLayerBuilder::centralLayers(const Acts::GeometryContext& gctx) { ACTS_VERBOSE("Building central Straw layers") @@ -126,7 +127,7 @@ ActsStrawLayerBuilder::centralLayers() fudge = radius / 4.; // calculate min/max R and Z - Vector3D ctr = straw->center(); + Vector3D ctr = straw->center(gctx); pl.maxR = std::max(pl.maxR, ctr.perp() + radius); pl.minR = std::min(pl.minR, ctr.perp() - radius); pl.maxZ = std::max(pl.maxZ, ctr.z() + length); @@ -146,8 +147,8 @@ ActsStrawLayerBuilder::centralLayers() pl.minR = prev.maxR + prev.envR.second + pl.envR.first + fudge; } - std::shared_ptr<Acts::Layer> layer - = m_cfg.layerCreator->cylinderLayer(std::move(layerSurfaces), 100, 1, pl); + std::shared_ptr<Acts::Layer> layer + = m_cfg.layerCreator->cylinderLayer(gctx, std::move(layerSurfaces), 100, 1, pl); layers.push_back(layer); protoLayers.push_back(pl); @@ -158,7 +159,7 @@ ActsStrawLayerBuilder::centralLayers() } const Acts::LayerVector -ActsStrawLayerBuilder::endcapLayers(int side) +ActsStrawLayerBuilder::endcapLayers(const Acts::GeometryContext& gctx, int side) { ACTS_VERBOSE("Building endcap Straw layers") @@ -220,7 +221,7 @@ ActsStrawLayerBuilder::endcapLayers(int side) double radius = strawBounds->r(); double length = strawBounds->halflengthZ(); - Vector3D ctr = straw->center(); + Vector3D ctr = straw->center(gctx); pl.maxZ = std::max(pl.maxZ, ctr.z() + radius); pl.minZ = std::min(pl.minZ, ctr.z() - radius); pl.maxR = std::max(pl.maxR, ctr.perp() + length); @@ -233,8 +234,8 @@ ActsStrawLayerBuilder::endcapLayers(int side) } } - std::shared_ptr<Acts::Layer> layer - = m_cfg.layerCreator->discLayer(std::move(wheelSurfaces), 1, 100, pl); + std::shared_ptr<Acts::Layer> layer + = m_cfg.layerCreator->discLayer(gctx, std::move(wheelSurfaces), 1, 100, pl); layers.push_back(layer); ACTS_VERBOSE(" - Collected " << wheelSurfaces.size() << " straws"); } diff --git a/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometrySvc.cxx b/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometrySvc.cxx index 6429115a50878f2d87bbe13b06e31f4cfe61ae37..2402d6bdd624c0008b8b1e8df6b43eec937ffc08 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometrySvc.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometrySvc.cxx @@ -21,6 +21,7 @@ #include "Acts/Tools/CylinderVolumeHelper.hpp" #include "Acts/Tools/TrackingGeometryBuilder.hpp" #include "Acts/Tools/CylinderVolumeBuilder.hpp" +#include "Acts/ActsVersion.hpp" // PACKAGE #include "ActsGeometry/ActsLayerBuilder.h" @@ -29,6 +30,7 @@ #include "ActsInterop/IdentityHelper.h" #include "ActsInterop/Logger.h" #include "ActsGeometry/ActsAlignmentStore.h" +#include "ActsGeometry/ActsGeometryContext.h" ActsTrackingGeometrySvc::ActsTrackingGeometrySvc(const std::string& name, ISvcLocator* svc) @@ -42,7 +44,11 @@ StatusCode ActsTrackingGeometrySvc::initialize() { ATH_MSG_INFO(name() << " is initializing"); - + ATH_MSG_INFO("Acts version is: v" << Acts::VersionMajor << "." + << Acts::VersionMinor << "." + << Acts::VersionPatch + << " [" << Acts::CommitHash << "]"); + ATH_CHECK ( m_detStore->retrieve(p_pixelManager, "Pixel") ); ATH_CHECK ( m_detStore->retrieve(p_SCTManager, "SCT") ); ATH_CHECK ( m_detStore->retrieve(p_TRTManager, "TRT") ); @@ -50,14 +56,17 @@ ActsTrackingGeometrySvc::initialize() if (m_detStore->retrieve(m_TRT_idHelper, "TRT_ID").isFailure()) { msg(MSG::ERROR) << "Could not retrieve TRT ID Helper" << endmsg; } - + + + Acts::LayerArrayCreator::Config lacCfg; auto layerArrayCreator = std::make_shared<const Acts::LayerArrayCreator>( - makeActsAthenaLogger(this, "LayArrCrtr", "ActsTGSvc")); + lacCfg, makeActsAthenaLogger(this, "LayArrCrtr", "ActsTGSvc")); + Acts::TrackingVolumeArrayCreator::Config tvcCfg; auto trackingVolumeArrayCreator = std::make_shared<const Acts::TrackingVolumeArrayCreator>( - makeActsAthenaLogger(this, "TrkVolArrCrtr", "ActsTGSvc")); + tvcCfg, makeActsAthenaLogger(this, "TrkVolArrCrtr", "ActsTGSvc")); Acts::CylinderVolumeHelper::Config cvhConfig; cvhConfig.layerArrayCreator = layerArrayCreator; @@ -72,23 +81,23 @@ ActsTrackingGeometrySvc::initialize() try { // PIXEL tgbConfig.trackingVolumeBuilders.push_back([this, cylinderVolumeHelper]( - const auto& inner, const auto&) { + const auto& gctx, const auto& inner, const auto&) { auto tv = makeVolumeBuilder(p_pixelManager, cylinderVolumeHelper, true); - return tv->trackingVolume(inner); + return tv->trackingVolume(gctx, inner); }); - + // SCT tgbConfig.trackingVolumeBuilders.push_back([this, cylinderVolumeHelper]( - const auto& inner, const auto&) { + const auto& gctx, const auto& inner, const auto&) { auto tv = makeVolumeBuilder(p_SCTManager, cylinderVolumeHelper); - return tv->trackingVolume(inner); + return tv->trackingVolume(gctx, inner); }); // TRT tgbConfig.trackingVolumeBuilders.push_back([this, cylinderVolumeHelper]( - const auto& inner, const auto&) { + const auto& gctx, const auto& inner, const auto&) { auto tv = makeVolumeBuilder(p_TRTManager, cylinderVolumeHelper); - return tv->trackingVolume(inner); + return tv->trackingVolume(gctx, inner); }); } catch (const std::invalid_argument& e) { @@ -100,14 +109,25 @@ ActsTrackingGeometrySvc::initialize() auto trackingGeometryBuilder = std::make_shared<const Acts::TrackingGeometryBuilder>(tgbConfig, makeActsAthenaLogger(this, "TrkGeomBldr", "ActsTGSvc")); - - m_trackingGeometry = trackingGeometryBuilder->trackingGeometry(); - - //const Acts::TrackingVolume* = m_trackingGeometry->highestTrackingVolume(); + // default geometry context, this is nominal + ActsGeometryContext constructionContext; + constructionContext.construction = true; + + m_trackingGeometry = trackingGeometryBuilder + ->trackingGeometry(constructionContext.any()); + + ATH_MSG_VERBOSE("Building nominal alignment store"); + ActsAlignmentStore* nominalAlignmentStore = new ActsAlignmentStore(); + + populateAlignmentStore(nominalAlignmentStore); + + // manage ownership + m_nominalAlignmentStore = std::unique_ptr<const ActsAlignmentStore>(nominalAlignmentStore); + ATH_MSG_INFO("Acts TrackingGeometry construction completed"); - + return StatusCode::SUCCESS; } @@ -118,7 +138,7 @@ ActsTrackingGeometrySvc::trackingGeometry() { return m_trackingGeometry; } -std::shared_ptr<const Acts::ITrackingVolumeBuilder> +std::shared_ptr<const Acts::ITrackingVolumeBuilder> ActsTrackingGeometrySvc::makeVolumeBuilder(const InDetDD::InDetDetectorManager* manager, std::shared_ptr<const Acts::CylinderVolumeHelper> cvh, bool toBeamline) { std::string managerName = manager->getName(); @@ -127,7 +147,7 @@ ActsTrackingGeometrySvc::makeVolumeBuilder(const InDetDD::InDetDetectorManager* std::shared_ptr<const Acts::ILayerBuilder> gmLayerBuilder; if (manager->getName() == "TRT") { - auto matcher = [](Acts::BinningValue /*bValue*/, const Acts::Surface* /*aS*/, + auto matcher = [](const Acts::GeometryContext& /*gctx*/, Acts::BinningValue /*bValue*/, const Acts::Surface* /*aS*/, const Acts::Surface* /*bS*/) -> bool { return false; }; @@ -158,15 +178,15 @@ ActsTrackingGeometrySvc::makeVolumeBuilder(const InDetDD::InDetDetectorManager* //gmLayerBuilder->positiveLayers(); } else { - auto matcher = [](Acts::BinningValue bValue, const Acts::Surface* aS, - const Acts::Surface* bS) -> bool { + auto matcher = [](const Acts::GeometryContext& /*gctx*/, Acts::BinningValue bValue, + const Acts::Surface* aS, const Acts::Surface* bS) -> bool { auto a = dynamic_cast<const ActsDetectorElement*>(aS->associatedDetectorElement()); auto b = dynamic_cast<const ActsDetectorElement*>(bS->associatedDetectorElement()); if ((not a) or (not b)){ throw std::runtime_error("Cast of surface associated element to ActsDetectorElement failed in ActsTrackingGeometrySvc::makeVolumeBuilder"); } - + IdentityHelper idA = a->identityHelper(); IdentityHelper idB = b->identityHelper(); @@ -186,7 +206,7 @@ ActsTrackingGeometrySvc::makeVolumeBuilder(const InDetDD::InDetDetectorManager* } if (bValue == Acts::binR) { - return (idA.eta_module() == idB.eta_module()) + return (idA.eta_module() == idB.eta_module()) && (idA.layer_disk() == idB.layer_disk()) && (idB.bec() == idA.bec()); } @@ -208,7 +228,7 @@ ActsTrackingGeometrySvc::makeVolumeBuilder(const InDetDD::InDetDetectorManager* ActsLayerBuilder::Config cfg; - + if(managerName == "Pixel") { cfg.subdetector = ActsDetectorElement::Subdetector::Pixel; } @@ -221,14 +241,14 @@ ActsTrackingGeometrySvc::makeVolumeBuilder(const InDetDD::InDetDetectorManager* throw std::invalid_argument("Number of barrel material bin counts != 2"); } std::vector<size_t> brlBins(m_barrelMaterialBins); - cfg.barrelMaterialBins = {brlBins.at(0), + cfg.barrelMaterialBins = {brlBins.at(0), brlBins.at(1)}; if (m_endcapMaterialBins.size() != 2) { throw std::invalid_argument("Number of endcap material bin counts != 2"); } std::vector<size_t> ecBins(m_endcapMaterialBins); - cfg.endcapMaterialBins = {ecBins.at(0), + cfg.endcapMaterialBins = {ecBins.at(0), ecBins.at(1)}; cfg.mng = static_cast<const InDetDD::SiDetectorManager*>(manager); @@ -261,16 +281,19 @@ ActsTrackingGeometrySvc::makeVolumeBuilder(const InDetDD::InDetDetectorManager* } void -ActsTrackingGeometrySvc::setAlignmentStore(const ActsAlignmentStore* gas, const EventContext& ctx) +ActsTrackingGeometrySvc::populateAlignmentStore(ActsAlignmentStore *store) const { - std::lock_guard<std::mutex> lock(m_gasMapMutex); - m_gasMap[ctx.slot()] = gas; + // populate the alignment store with all detector elements + m_trackingGeometry->visitSurfaces( + [store](const Acts::Surface* srf) { + const Acts::DetectorElementBase* detElem = srf->associatedDetectorElement(); + const auto* gmde = dynamic_cast<const ActsDetectorElement*>(detElem); + gmde->storeTransform(store); + }); } const ActsAlignmentStore* -ActsTrackingGeometrySvc::getAlignmentStore(const EventContext& ctx) const +ActsTrackingGeometrySvc::getNominalAlignmentStore() const { - std::lock_guard<std::mutex> lock(m_gasMapMutex); - if (m_gasMap.find(ctx.slot()) == m_gasMap.end()) return nullptr; - return m_gasMap[ctx.slot()]; + return m_nominalAlignmentStore.get(); } diff --git a/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx b/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx index 2ca8c6261cdeb2fc75087a7f876c0e80e3c4e35b..563aeb090ac45b3de2fbc6b0e901e562d093062d 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx @@ -5,6 +5,7 @@ #include "ActsGeometry/ActsTrackingGeometryTool.h" // ATHENA +#include "GaudiKernel/EventContext.h" // PACKAGE #include "ActsGeometry/ActsAlignmentStore.h" @@ -15,13 +16,13 @@ #include <memory> ActsTrackingGeometryTool::ActsTrackingGeometryTool(const std::string& type, const std::string& name, - const IInterface* parent) + const IInterface* parent) : AthAlgTool(type, name, parent), m_trackingGeometrySvc("ActsTrackingGeometrySvc", name) { } - -StatusCode + +StatusCode ActsTrackingGeometryTool::initialize() { ATH_MSG_INFO(name() << " initializing"); @@ -39,21 +40,25 @@ ActsTrackingGeometryTool::trackingGeometry() const return m_trackingGeometrySvc->trackingGeometry(); } -StatusCode -ActsTrackingGeometryTool::prepareAlignment() const +const ActsGeometryContext& +ActsTrackingGeometryTool::getGeometryContext(const EventContext& ctx) const { - ATH_MSG_DEBUG("Setting up alignment for this event"); - SG::ReadCondHandle<ActsAlignmentStore> rch(m_rchk); + ATH_MSG_DEBUG("Creating alignment context for event"); + SG::ReadCondHandle<ActsGeometryContext> rch(m_rchk, ctx); - if (!rch.isValid()) { - ATH_MSG_ERROR("Preparing alignment not possible, ReadCondHandle invalid"); - return StatusCode::FAILURE; + if(!rch.isValid()) { + ATH_MSG_ERROR("Creating alignment context failed: read cond handle invalid!"); } - - const ActsAlignmentStore* gas = *rch; - m_trackingGeometrySvc->setAlignmentStore(gas, Gaudi::Hive::currentContext()); - ATH_MSG_DEBUG("ActsAlignmentStore registered successfully"); + return **rch; +} + +ActsGeometryContext +ActsTrackingGeometryTool::getNominalGeometryContext() const +{ + + ActsGeometryContext gctx; + gctx.alignmentStore = m_trackingGeometrySvc->getNominalAlignmentStore(); - return StatusCode::SUCCESS; + return gctx; } diff --git a/Tracking/Acts/ActsGeometry/src/ActsWriteTrackingGeometry.cxx b/Tracking/Acts/ActsGeometry/src/ActsWriteTrackingGeometry.cxx index e97a4e057b4786a770ff123ee2e5347d8a02dcc1..6fc7a6d5b74920670f060a79d928361886530680 100755 --- a/Tracking/Acts/ActsGeometry/src/ActsWriteTrackingGeometry.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsWriteTrackingGeometry.cxx @@ -12,6 +12,7 @@ // PACKAGE #include "ActsGeometry/IActsTrackingGeometrySvc.h" +#include "ActsGeometry/ActsGeometryContext.h" // STL #include <string> @@ -34,13 +35,15 @@ StatusCode ActsWriteTrackingGeometry::initialize() { } StatusCode ActsWriteTrackingGeometry::execute() { - ATH_CHECK( m_trackingGeometryTool->prepareAlignment() ); auto trackingGeometry = m_trackingGeometryTool->trackingGeometry(); - m_objWriterTool->write(*trackingGeometry); + + // Use nominal context + ActsGeometryContext defGctx; + + m_objWriterTool->write(defGctx, *trackingGeometry); return StatusCode::SUCCESS; } StatusCode ActsWriteTrackingGeometry::finalize() { return StatusCode::SUCCESS; } - diff --git a/Tracking/Acts/ActsGeometry/src/NominalAlignmentCondAlg.cxx b/Tracking/Acts/ActsGeometry/src/NominalAlignmentCondAlg.cxx index db58edd284671ab7f0a6e66df659bd05518fb259..fdf3769c3bcd5c699b1f51cf2c6ffe0277680b6b 100644 --- a/Tracking/Acts/ActsGeometry/src/NominalAlignmentCondAlg.cxx +++ b/Tracking/Acts/ActsGeometry/src/NominalAlignmentCondAlg.cxx @@ -16,6 +16,7 @@ #include "ActsGeometry/IActsTrackingGeometrySvc.h" #include "ActsGeometry/ActsDetectorElement.h" #include "ActsGeometry/ActsAlignmentStore.h" +#include "ActsGeometry/ActsGeometryContext.h" // ACTS #include "Acts/Utilities/Definitions.hpp" @@ -23,8 +24,8 @@ #include "Acts/Surfaces/Surface.hpp" -NominalAlignmentCondAlg::NominalAlignmentCondAlg( const std::string& name, - ISvcLocator* pSvcLocator ) : +NominalAlignmentCondAlg::NominalAlignmentCondAlg( const std::string& name, + ISvcLocator* pSvcLocator ) : ::AthAlgorithm( name, pSvcLocator ), m_cs("CondSvc",name), m_trackingGeometrySvc("ActsTrackingGeometrySvc", name) @@ -46,7 +47,7 @@ StatusCode NominalAlignmentCondAlg::initialize() { } if (m_cs->regHandle(this, m_wchk).isFailure()) { - ATH_MSG_ERROR("unable to register WriteCondHandle " << m_wchk.fullKey() + ATH_MSG_ERROR("unable to register WriteCondHandle " << m_wchk.fullKey() << " with CondSvc"); return StatusCode::FAILURE; } @@ -62,7 +63,7 @@ StatusCode NominalAlignmentCondAlg::finalize() { StatusCode NominalAlignmentCondAlg::execute() { ATH_MSG_DEBUG(name() << "::" << __FUNCTION__); - SG::WriteCondHandle<ActsAlignmentStore> wch(m_wchk); + SG::WriteCondHandle<ActsGeometryContext> wch(m_wchk); EventIDBase now(getContext().eventID()); @@ -74,7 +75,7 @@ StatusCode NominalAlignmentCondAlg::execute() { } else { - ATH_MSG_DEBUG(" CondHandle " << wch.key() + ATH_MSG_DEBUG(" CondHandle " << wch.key() << " not valid now (" << now << "). Setting nominal alignment cond"); @@ -87,30 +88,14 @@ StatusCode NominalAlignmentCondAlg::execute() { ATH_MSG_DEBUG("Will register nominal alignment for range: " << r); - // create empty alignment store, no deltas - ActsAlignmentStore* alignmentStore = new ActsAlignmentStore(); - - // populate the alignment store with all detector elements - auto trkGeom = m_trackingGeometrySvc->trackingGeometry(); - - - ATH_MSG_DEBUG("Populating ActsAlignmentStore for IOV"); - size_t nElems = 0; - trkGeom->visitSurfaces( - [alignmentStore, &nElems](const Acts::Surface* srf) { - const Acts::DetectorElementBase* detElem = srf->associatedDetectorElement(); - const auto* gmde = dynamic_cast<const ActsDetectorElement*>(detElem); - if (gmde){ - gmde->storeTransform(alignmentStore); - nElems++; - } - }); - ATH_MSG_DEBUG("ActsAlignmentStore populated for " << nElems << " detector elements"); - - - if (wch.record(r, alignmentStore).isFailure()) { - ATH_MSG_ERROR("could not record nominal ActsAlignmentStore " << wch.key() - << " = " << alignmentStore + // get a nominal alignment store from the tracking geometry service + // and plug it into a geometry context + auto gctx = std::make_unique<ActsGeometryContext>(); + gctx->alignmentStore = m_trackingGeometrySvc->getNominalAlignmentStore(); + + // and write it to the conditions store + if (wch.record(r, gctx.release()).isFailure()) { + ATH_MSG_ERROR("could not record nominal ActsGeometryContext " << wch.key() << " with EventRange " << r); return StatusCode::FAILURE; } diff --git a/Tracking/Acts/ActsGeometry/src/util/ObjSurfaceWriter.cxx b/Tracking/Acts/ActsGeometry/src/util/ObjSurfaceWriter.cxx index ce21ef70cd74569d9fb8a75f2d73311bff974935..59a4c0b17f58161849e0b5557bf7fbbd85b5a916 100644 --- a/Tracking/Acts/ActsGeometry/src/util/ObjSurfaceWriter.cxx +++ b/Tracking/Acts/ActsGeometry/src/util/ObjSurfaceWriter.cxx @@ -52,7 +52,8 @@ Acts::ObjSurfaceWriter::write(const std::string& sinfo) } void -Acts::ObjSurfaceWriter::write(const Acts::Surface& surface) +Acts::ObjSurfaceWriter::write(const Acts::GeometryContext &gctx, + const Acts::Surface &surface) { std::lock_guard<std::mutex> lock(m_write_mutex); @@ -62,7 +63,7 @@ Acts::ObjSurfaceWriter::write(const Acts::Surface& surface) auto scalor = m_cfg.outputScalor; // let's get the bounds & the transform const Acts::SurfaceBounds& surfaceBounds = surface.bounds(); - auto sTransform = surface.transform(); + auto sTransform = surface.transform(gctx); // dynamic_cast to PlanarBounds const Acts::PlanarBounds* planarBounds @@ -112,14 +113,16 @@ Acts::ObjSurfaceWriter::write(const Acts::Surface& surface) auto cylinderSurface = dynamic_cast<const Acts::CylinderSurface*>(&surface); - Acts::PolyhedronRepresentation ph = cylinderSurface->polyhedronRepresentation(); + Acts::PolyhedronRepresentation ph = + cylinderSurface->polyhedronRepresentation(gctx); (*(m_cfg.outputStream)) << ph.objString(m_vtnCounter.vcounter); m_vtnCounter.vcounter += ph.vertices.size(); } else if(strawSurface) { - Acts::PolyhedronRepresentation ph = strawSurface->polyhedronRepresentation(); + Acts::PolyhedronRepresentation ph = + strawSurface->polyhedronRepresentation(gctx); (*(m_cfg.outputStream)) << ph.objString(m_vtnCounter.vcounter); m_vtnCounter.vcounter += ph.vertices.size(); diff --git a/Tracking/Acts/ActsGeometry/src/util/ObjSurfaceWriter.h b/Tracking/Acts/ActsGeometry/src/util/ObjSurfaceWriter.h index e734f1ffe883396efb9072df1ac9a3dee459d394..2f207a659242c67102fea2227d5f9a9d415ada1d 100644 --- a/Tracking/Acts/ActsGeometry/src/util/ObjSurfaceWriter.h +++ b/Tracking/Acts/ActsGeometry/src/util/ObjSurfaceWriter.h @@ -6,6 +6,7 @@ #pragma once +#include "Acts/Utilities/GeometryContext.hpp" #include <fstream> #include <iostream> #include <mutex> @@ -73,7 +74,7 @@ public: /// The write interface /// @param surface to be written out void - write(const Acts::Surface& surface); + write(const Acts::GeometryContext &gctx, const Acts::Surface &surface); /// write a bit of string /// @param is the string to be written diff --git a/Tracking/Acts/ActsGeometry/src/util/ObjTrackingGeometryWriter.cxx b/Tracking/Acts/ActsGeometry/src/util/ObjTrackingGeometryWriter.cxx index 1eae3bedb271de7d236d822583b569c03b93af0c..4fc1e7c45ce582c5987ad24fe2a80d29394fa99a 100644 --- a/Tracking/Acts/ActsGeometry/src/util/ObjTrackingGeometryWriter.cxx +++ b/Tracking/Acts/ActsGeometry/src/util/ObjTrackingGeometryWriter.cxx @@ -9,6 +9,7 @@ #include <iostream> #include "Acts/Detector/TrackingVolume.hpp" #include "Acts/Surfaces/Surface.hpp" +#include "Acts/Utilities/GeometryContext.hpp" Acts::ObjTrackingGeometryWriter::ObjTrackingGeometryWriter( const ObjTrackingGeometryWriter::Config& cfg) @@ -23,18 +24,18 @@ Acts::ObjTrackingGeometryWriter::name() const } void -Acts::ObjTrackingGeometryWriter::write(const Acts::TrackingGeometry& tGeometry) +Acts::ObjTrackingGeometryWriter::write(const Acts::GeometryContext& gctx, const Acts::TrackingGeometry& tGeometry) { ACTS_DEBUG(">>Obj: Writer for TrackingGeometry object called."); // get the world volume auto world = tGeometry.highestTrackingVolume(); - if (world) write(*world); + if (world) write(gctx, *world); // return the success code } /// process this volume void -Acts::ObjTrackingGeometryWriter::write(const Acts::TrackingVolume& tVolume) +Acts::ObjTrackingGeometryWriter::write(const Acts::GeometryContext& gctx, const Acts::TrackingVolume& tVolume) { ACTS_DEBUG(">>Obj: Writer for TrackingVolume object called."); // get the confined layers and process them @@ -68,7 +69,7 @@ Acts::ObjTrackingGeometryWriter::write(const Acts::TrackingVolume& tVolume) surfaceWriter->write(m_cfg.sensitiveGroupPrefix); // loop over the surface for (auto surface : layer->surfaceArray()->surfaces()) { - if (surface) surfaceWriter->write(*surface); + if (surface) surfaceWriter->write(gctx, *surface); } } } @@ -77,7 +78,7 @@ Acts::ObjTrackingGeometryWriter::write(const Acts::TrackingVolume& tVolume) if (tVolume.confinedVolumes()) { // loop over the volumes and write what they have for (auto volume : tVolume.confinedVolumes()->arrayObjects()) { - write(*volume.get()); + write(gctx, *volume.get()); } } } diff --git a/Tracking/Acts/ActsGeometry/src/util/ObjTrackingGeometryWriter.h b/Tracking/Acts/ActsGeometry/src/util/ObjTrackingGeometryWriter.h index e83d338d0c2128fffc546fc68f6b12e413450b85..d3e7b5a39fc198ca825898e0f3db0b2b74b3f0c8 100644 --- a/Tracking/Acts/ActsGeometry/src/util/ObjTrackingGeometryWriter.h +++ b/Tracking/Acts/ActsGeometry/src/util/ObjTrackingGeometryWriter.h @@ -14,6 +14,7 @@ #include "Acts/Detector/TrackingGeometry.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Logger.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { class TrackingVolume; @@ -62,7 +63,7 @@ public: /// @param tGeometry is the geometry to be written out /// @return ProcessCode to indicate success/failure void - write(const Acts::TrackingGeometry& tGeometry); + write(const Acts::GeometryContext& gctx, const Acts::TrackingGeometry& tGeometry); private: Config m_cfg; ///< the config class @@ -70,7 +71,7 @@ private: /// process this volume /// @param tVolume the volume to be processed void - write(const Acts::TrackingVolume& tVolume); + write(const Acts::GeometryContext& gctx, const Acts::TrackingVolume& tVolume); /// Private access to the logging instance const Acts::Logger&