Skip to content
Snippets Groups Projects
Commit 229a3e89 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'adapt-to-acts-v0.9.2' into 'master'

Adapt to Acts v0.9.2

See merge request atlas/athena!23164
parents 23a3d209 4667f20d
No related branches found
No related tags found
No related merge requests found
Showing
with 200 additions and 135 deletions
......@@ -6,4 +6,4 @@
# forbidden.
# The version of atlas/atlasexternals to use:
AnalysisBaseExternalsVersion = 2.0.28
AnalysisBaseExternalsVersion = 2.0.29
# 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
......@@ -5,4 +5,4 @@
# an "origin/" prefix before it. For tags however this is explicitly
# forbidden.
AtlasExternalsVersion = 2.0.28
AtlasExternalsVersion = 2.0.29
......@@ -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
......@@ -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
......@@ -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;
};
......
......@@ -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
......
......@@ -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}};
......
/*
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
......@@ -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
......@@ -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", {}, ""};
......
......@@ -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;
......
......@@ -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
......@@ -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"};
};
......
......@@ -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;
};
......@@ -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;
};
......
......@@ -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;
};
......@@ -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));
......
......@@ -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;
}
......@@ -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();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment