Skip to content
Snippets Groups Projects
Commit 300eb9ce authored by Johannes Junggeburth's avatar Johannes Junggeburth :dog2: Committed by Vakhtang Tsulaia
Browse files

ActsGeometry - Introduce NoDeletePtr & DetectorAlignStore & misc

Update 4 files

- /Tracking/Acts/ActsGeoUtils/src/SurfaceCache.cxx
- /Tracking/Acts/ActsGeometry/src/DetectorVolumeSvc.cxx
- /Tracking/Acts/ActsGeometry/ActsGeometry/DetectorVolumeSvc.h
- /Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IDetectorVolumeSvc.h
parent 9864a027
No related branches found
No related tags found
No related merge requests found
Showing
with 197 additions and 71 deletions
...@@ -124,7 +124,7 @@ StatusCode MuonReadoutElement::strawSurfaceFactory(const IdentifierHash& hash, ...@@ -124,7 +124,7 @@ StatusCode MuonReadoutElement::strawSurfaceFactory(const IdentifierHash& hash,
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
auto insert_itr = m_surfaces.insert(std::make_unique<ActsTrk::SurfaceCache>((*transformCache).get(), detectorType())); auto insert_itr = m_surfaces.insert(std::make_unique<ActsTrk::SurfaceCache>((*transformCache).get()));
if(!insert_itr.second){ if(!insert_itr.second){
ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" - "<<idHelperSvc()->toString(identify()) ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" - "<<idHelperSvc()->toString(identify())
<<" Insertion to muon surface cache failed for hash "<<hash); <<" Insertion to muon surface cache failed for hash "<<hash);
...@@ -145,7 +145,7 @@ StatusCode MuonReadoutElement::planeSurfaceFactory(const IdentifierHash& hash, s ...@@ -145,7 +145,7 @@ StatusCode MuonReadoutElement::planeSurfaceFactory(const IdentifierHash& hash, s
<<" no transform cache available for hash "<<hash); <<" no transform cache available for hash "<<hash);
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
auto insert_itr = m_surfaces.insert(std::make_unique<ActsTrk::SurfaceCache>((*transformCache).get(), detectorType())); auto insert_itr = m_surfaces.insert(std::make_unique<ActsTrk::SurfaceCache>((*transformCache).get()));
if(!insert_itr.second){ if(!insert_itr.second){
ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" - "<<idHelperSvc()->toString(identify()) ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" - "<<idHelperSvc()->toString(identify())
<<" Insertion to muon surface cache failed for hash "<<hash); <<" Insertion to muon surface cache failed for hash "<<hash);
......
...@@ -68,6 +68,8 @@ def TruthParticleHitCountAlgCfg(flags, ...@@ -68,6 +68,8 @@ def TruthParticleHitCountAlgCfg(flags,
**kwargs) -> ComponentAccumulator: **kwargs) -> ComponentAccumulator:
acc = ComponentAccumulator() acc = ComponentAccumulator()
acc.merge( MapToInDetSimDataWrapCfg(flags, 'ITkStripSDO_Map') ) acc.merge( MapToInDetSimDataWrapCfg(flags, 'ITkStripSDO_Map') )
from ActsConfig.ActsGeometryConfig import ActsTrackingGeometryToolCfg
kwargs.setdefault("TrackingGeometryTool", acc.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)))
kwargs.setdefault('PixelClustersToTruthAssociationMap','ITkPixelClustersToTruthParticles') kwargs.setdefault('PixelClustersToTruthAssociationMap','ITkPixelClustersToTruthParticles')
kwargs.setdefault('StripClustersToTruthAssociationMap','ITkStripClustersToTruthParticles') kwargs.setdefault('StripClustersToTruthAssociationMap','ITkStripClustersToTruthParticles')
kwargs.setdefault('TruthParticleHitCountsOut','TruthParticleHitCounts') kwargs.setdefault('TruthParticleHitCountsOut','TruthParticleHitCounts')
......
/* /*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef ACTSGEOUTILS_DEFS_H #ifndef ACTSGEOUTILS_DEFS_H
#define ACTSGEOUTILS_DEFS_H #define ACTSGEOUTILS_DEFS_H
/// Header file to manage the common inlcudes /// Header file to manage the common inlcudes
#include <GeoPrimitives/GeoPrimitives.h>
#include <GeoPrimitives/GeoPrimitivesHelpers.h> #include <GeoPrimitives/GeoPrimitivesHelpers.h>
///
#include <ActsGeometryInterfaces/ActsGeometryContext.h> #include <ActsGeometryInterfaces/ActsGeometryContext.h>
#include <ActsGeometryInterfaces/RawGeomAlignStore.h>
#include <limits> #include <limits>
#include <set> #include <set>
......
/*
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ActsGeoUtils_NODELETEPTR_H
#define ActsGeoUtils_NODELETEPTR_H
#include <memory>
/**
* @brief: The NoDeletePtr is a shared_ptr with disabled deleter.
*
*/
namespace ActsTrk {
template<class Obj>
class NoDeletePtr: public std::shared_ptr<Obj> {
public:
struct Deleter {
void operator()(Obj*) const{}
};
NoDeletePtr(Obj* ptr):
std::shared_ptr<Obj>(ptr, Deleter{}){
}
};
}
#endif
\ No newline at end of file
...@@ -19,7 +19,8 @@ namespace ActsTrk { ...@@ -19,7 +19,8 @@ namespace ActsTrk {
/// Factory method to create new SurfaceBounds. /// Factory method to create new SurfaceBounds.
template<class... argList> std::shared_ptr<BoundType> make_bounds(argList... args) { template<class... argList> std::shared_ptr<BoundType> make_bounds(argList... args) {
return (*m_store.insert(std::make_shared<BoundType>(args...)).first); return (*m_store.insert(std::make_shared<BoundType>(args...)).first);
} }
size_t size() const { return m_store.size() ;}
private: private:
/** @brief: Comparison struct to construct sets of Acts::Surface bounds with unique elements. /** @brief: Comparison struct to construct sets of Acts::Surface bounds with unique elements.
* Two elements are considered to be identical if all of their parameters match within epsilon. * Two elements are considered to be identical if all of their parameters match within epsilon.
......
...@@ -23,7 +23,7 @@ namespace ActsTrk { ...@@ -23,7 +23,7 @@ namespace ActsTrk {
public: public:
/** @brief: Standard constructor taking the tranasform cache of the element and the detector type. /** @brief: Standard constructor taking the tranasform cache of the element and the detector type.
**/ **/
SurfaceCache(const TransformCache* transformCache, ActsTrk::DetectorType type); SurfaceCache(const TransformCache* transformCache);
/// Returns the transformation stored in the TransformCache. /// Returns the transformation stored in the TransformCache.
const Acts::Transform3& transform(const Acts::GeometryContext& gctx) const override final; const Acts::Transform3& transform(const Acts::GeometryContext& gctx) const override final;
...@@ -47,7 +47,6 @@ namespace ActsTrk { ...@@ -47,7 +47,6 @@ namespace ActsTrk {
const TransformCache* transformCache() const; const TransformCache* transformCache() const;
private: private:
const TransformCache* m_transformCache{nullptr}; const TransformCache* m_transformCache{nullptr};
ActsTrk::DetectorType m_type{ActsTrk::DetectorType::UnDefined};
std::shared_ptr<Acts::Surface> m_surface{nullptr}; std::shared_ptr<Acts::Surface> m_surface{nullptr};
}; };
/// Comparison operators /// Comparison operators
......
/* /*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/ */
#include <ActsGeoUtils/SurfaceCache.h> #include <ActsGeoUtils/SurfaceCache.h>
#include <GeoModelHelpers/throwExcept.h>
#ifndef SIMULATIONBASE #ifndef SIMULATIONBASE
#define THROW_RUNTIME(message) \
{ \
std::stringstream except{}; \
except<<__FILE__<<":"<<__LINE__<<" "; \
except<<message<<std::endl; \
throw std::runtime_error(except.str()); \
}
namespace ActsTrk{ namespace ActsTrk{
SurfaceCache::SurfaceCache(const TransformCache* transformCache, SurfaceCache::SurfaceCache(const TransformCache* transformCache):
DetectorType type): m_transformCache{transformCache}{}
m_transformCache{transformCache},
m_type{type} {}
const TransformCache* SurfaceCache::transformCache() const { return m_transformCache; } const TransformCache* SurfaceCache::transformCache() const { return m_transformCache; }
const Acts::Transform3& SurfaceCache::transform(const Acts::GeometryContext& anygctx) const { const Acts::Transform3& SurfaceCache::transform(const Acts::GeometryContext& anygctx) const {
const ActsGeometryContext* gctx = anygctx.get<const ActsGeometryContext*>(); const ActsGeometryContext* gctx = anygctx.get<const ActsGeometryContext*>();
// unpack the alignment store from the context // unpack the alignment store from the context
ActsGeometryContext::SubDetAlignments::const_iterator itr = gctx->alignmentStores.find(m_type); const DetectorType type = m_transformCache->parent()->detectorType();
/// If no alignment for Detector technology x is found, parse a nullptr which is equivalent to ActsGeometryContext::SubDetAlignments::const_iterator itr = gctx->alignmentStores.find(type);
/// invoking the internal cache store
const AlignmentStore* store{itr == gctx->alignmentStores.end() ? nullptr : itr->second.get()}; const AlignmentStore* store{itr == gctx->alignmentStores.end() ? nullptr : itr->second.get()};
return m_transformCache->getTransform(store); return m_transformCache->getTransform(store);
/// Will be used in the next MR
/// return m_transformCache->getTransform(gctx->getStore(m_transformCache->parent()->detectorType()).get());
} }
const Acts::Surface& SurfaceCache::surface() const { const Acts::Surface& SurfaceCache::surface() const {
if (!m_surface) THROW_RUNTIME("Surface has not been set before"); if (!m_surface) THROW_EXCEPTION("Surface has not been set before");
return *m_surface; return *m_surface;
} }
Acts::Surface& SurfaceCache::surface() { Acts::Surface& SurfaceCache::surface() {
if (!m_surface) THROW_RUNTIME("Surface has not been set before"); if (!m_surface) THROW_EXCEPTION("Surface has not been set before");
return *m_surface; return *m_surface;
} }
std::shared_ptr<Acts::Surface> SurfaceCache::getSurface() const { return m_surface; } std::shared_ptr<Acts::Surface> SurfaceCache::getSurface() const { return m_surface; }
...@@ -42,5 +35,4 @@ namespace ActsTrk{ ...@@ -42,5 +35,4 @@ namespace ActsTrk{
void SurfaceCache::setSurface(std::shared_ptr<Acts::Surface> surface) { m_surface = surface; } void SurfaceCache::setSurface(std::shared_ptr<Acts::Surface> surface) { m_surface = surface; }
IdentifierHash SurfaceCache::hash() const { return m_transformCache->hash(); } IdentifierHash SurfaceCache::hash() const { return m_transformCache->hash(); }
} }
#undef THROW_RUNTIME
#endif #endif
\ No newline at end of file
/* /*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef ACTSGEOMETRY_ACTSMATERIALSTEPCONVERTERTOOL_H #ifndef ACTSGEOMETRY_ACTSMATERIALSTEPCONVERTERTOOL_H
...@@ -12,9 +12,6 @@ ...@@ -12,9 +12,6 @@
#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ServiceHandle.h"
#include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/ReadCondHandleKey.h"
// PACKAGE
#include "ActsGeometryInterfaces/AlignmentStore.h" // ReadCondHandleKey wants complete type
#include "ActsGeometryInterfaces/ActsGeometryContext.h"
#include "ActsGeometryInterfaces/IActsMaterialStepConverterTool.h" #include "ActsGeometryInterfaces/IActsMaterialStepConverterTool.h"
class ActsMaterialStepConverterTool : public extends<AthAlgTool, IActsMaterialStepConverterTool> class ActsMaterialStepConverterTool : public extends<AthAlgTool, IActsMaterialStepConverterTool>
......
/* /*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef ACTSGEOMETRY_ACTSDETECTORVOLUMESVC_H #ifndef ACTSGEOMETRY_ACTSDETECTORVOLUMESVC_H
...@@ -24,17 +24,15 @@ namespace ActsTrk{ ...@@ -24,17 +24,15 @@ namespace ActsTrk{
class DetectorVolumeSvc : public extends<AthService, IDetectorVolumeSvc> { class DetectorVolumeSvc : public extends<AthService, IDetectorVolumeSvc> {
public: public:
StatusCode initialize() override; DetectorVolumeSvc( const std::string& name, ISvcLocator* pSvcLocator );
DetectorVolumeSvc( const std::string& name, ISvcLocator* pSvcLocator ); StatusCode initialize() override;
DetectorPtr detector() const override; DetectorPtr detector() const override;
unsigned int populateAlignmentStore(ActsTrk::RawGeomAlignStore& store) const override; unsigned int populateAlignmentStore(AlignmentStore& store) const override;
const ActsGeometryContext& getNominalContext() const override; const ActsGeometryContext& getNominalContext() const override;
StatusCode checkAlignComplete(const ActsGeometryContext& ctx) const override;
private: private:
std::shared_ptr<const Acts::Experimental::Detector> buildDetector() const; std::shared_ptr<const Acts::Experimental::Detector> buildDetector() const;
......
...@@ -26,6 +26,7 @@ atlas_add_library( ActsGeometryLib ...@@ -26,6 +26,7 @@ atlas_add_library( ActsGeometryLib
LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${TBB_LIBRARIES} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${TBB_LIBRARIES}
ActsCore ActsCore
ActsGeometryInterfacesLib ActsGeometryInterfacesLib
ActsGeoUtils
ActsInteropLib ActsInteropLib
ActsPluginJson ActsPluginJson
AthenaBaseComps AthenaBaseComps
...@@ -60,7 +61,6 @@ atlas_add_component( ActsGeometry ...@@ -60,7 +61,6 @@ atlas_add_component( ActsGeometry
src/ActsSurfaceMappingTool.cxx src/ActsSurfaceMappingTool.cxx
src/ActsVolumeMappingTool.cxx src/ActsVolumeMappingTool.cxx
src/ActsObjWriterTool.cxx src/ActsObjWriterTool.cxx
#src/ActsExCellWriterSvc.cxx
src/ActsMaterialStepConverterTool.cxx src/ActsMaterialStepConverterTool.cxx
src/ActsMaterialJsonWriterTool.cxx src/ActsMaterialJsonWriterTool.cxx
src/ActsMaterialTrackWriterSvc.cxx src/ActsMaterialTrackWriterSvc.cxx
......
/* /*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/ */
#include "ActsGeometry/DetectorVolumeSvc.h" #include "ActsGeometry/DetectorVolumeSvc.h"
#include "ActsGeoUtils/NoDeletePtr.h"
// ATHENA // ATHENA
#include "GaudiKernel/EventContext.h" #include "GaudiKernel/EventContext.h"
#include "GeoPrimitives/GeoPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h"
...@@ -31,14 +31,14 @@ StatusCode DetectorVolumeSvc::initialize() { ...@@ -31,14 +31,14 @@ StatusCode DetectorVolumeSvc::initialize() {
} }
std::shared_ptr<const Acts::Experimental::Detector> DetectorVolumeSvc::detector() const { std::shared_ptr<const Acts::Experimental::Detector> DetectorVolumeSvc::detector() const {
ATH_MSG_INFO("Retrieving tracking geometry");
if (!m_detector.isValid()) { if (!m_detector.isValid()) {
ATH_MSG_INFO("Build the Acts tracking detector");
m_detector.set(buildDetector()); m_detector.set(buildDetector());
} }
return *m_detector.ptr(); return *m_detector.ptr();
} }
unsigned int DetectorVolumeSvc::populateAlignmentStore(ActsTrk::RawGeomAlignStore& /*store*/) const { unsigned int DetectorVolumeSvc::populateAlignmentStore(AlignmentStore& /*store*/) const {
return 0; return 0;
} }
...@@ -46,15 +46,11 @@ const ActsGeometryContext& DetectorVolumeSvc::getNominalContext() const { ...@@ -46,15 +46,11 @@ const ActsGeometryContext& DetectorVolumeSvc::getNominalContext() const {
return m_nomContext; return m_nomContext;
} }
StatusCode DetectorVolumeSvc::checkAlignComplete(const ActsGeometryContext& /*ctx*/) const {
return StatusCode::SUCCESS;
}
std::shared_ptr<const Acts::Experimental::Detector> DetectorVolumeSvc::buildDetector() const { std::shared_ptr<const Acts::Experimental::Detector> DetectorVolumeSvc::buildDetector() const {
ActsGeometryContext gctx{}; ActsGeometryContext gctx{};
std::vector<std::shared_ptr<const Acts::Experimental::IDetectorComponentBuilder> > builders; std::vector<std::shared_ptr<const Acts::Experimental::IDetectorComponentBuilder> > builders;
for (const auto &builder : m_builderTools) { for (const auto &builder : m_builderTools) {
builders.push_back(std::shared_ptr<const Acts::Experimental::IDetectorComponentBuilder>(builder.get(), [](auto*){})); builders.push_back(NoDeletePtr<const Acts::Experimental::IDetectorComponentBuilder>(builder.get()));
} }
//Define config for cylindrical container builder //Define config for cylindrical container builder
......
/*
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ACTSGEOMETRYINTERFACES_RawGeomAlignStore_H
#define ACTSGEOMETRYINTERFACES_RawGeomAlignStore_H
/// Put first the GeoPrimitives
#include "ActsGeometryInterfaces/GeometryDefs.h"
///
#include "AthenaKernel/CLASS_DEF.h"
#include "AthenaKernel/CondCont.h"
#include "GeoModelUtilities/GeoAlignmentStore.h"
#include "GeoModelUtilities/TransientConstSharedPtr.h"
#include "CxxUtils/CachedUniquePtr.h"
/// The ActsFromGeoAlignStore is an adaptor to go from the GeoModel world caching the
/// rigid transformations of the detector elements to the Acts world where transformations
namespace ActsTrk {
class DetectorAlignStore {
public:
/// @brief Copy constructor
DetectorAlignStore(const DetectorAlignStore& other) = default;
/// @brief Default constructor
DetectorAlignStore(const DetectorType _type);
/// @brief Default virtual destructor
virtual ~DetectorAlignStore() = default;
/// @brief Store containing the aligned GeoModel nodes
std::shared_ptr<GeoAlignmentStore> geoModelAlignment{std::make_unique<GeoAlignmentStore>()};
/// @brief Store holding the transfomations used by the Acts algorithms
class TrackingAlignStore{
public:
TrackingAlignStore(const DetectorType detType);
/** @brief Returns a unique ID to the client under which the client can store its transformation
* inside the container.*/
static unsigned int drawTicket(const DetectorType detType);
/** @brief Returns the number of all distributed tickets */
static unsigned int distributedTickets(const DetectorType detType);
/** @brief */
static void giveBackTicket(const DetectorType detType, unsigned int ticketNo);
/** @brief Returns the transformation associated with the ticket number */
const Amg::Transform3D* getTransform(unsigned int ticketNo) const {
return m_transforms[ticketNo].get();
}
/** @brief Caches for the given ticket number the transformation in the store and returns the
* const reference to it */
const Amg::Transform3D& setTransform(unsigned int ticketNo, Amg::Transform3D && trf) const {
return (*m_transforms.at(ticketNo).set(std::make_unique<Amg::Transform3D>(std::move(trf))));
}
static constexpr unsigned s_techs{static_cast<unsigned>(DetectorType::UnDefined)};
using TicketCounterArr = std::array<std::atomic<unsigned>, s_techs>;
using ReturnedTicketArr = std::array<std::vector<unsigned>, s_techs>;
private:
static TicketCounterArr s_clientCounter ATLAS_THREAD_SAFE;
static ReturnedTicketArr s_returnedTickets ATLAS_THREAD_SAFE;
std::vector<CxxUtils::CachedUniquePtr<Amg::Transform3D>> m_transforms{};
};
/// @brief The aligned detector element type
DetectorType detType{DetectorType::UnDefined};
/// @brief Pointer to the store caching the final tracking transformations
using TrackingAlignStorePtr = GeoModel::TransientConstSharedPtr<TrackingAlignStore>;
TrackingAlignStorePtr trackingAlignment{std::make_unique<TrackingAlignStore>(detType)};
/// @brief The muon system contains additional parameters such as B-lines, as-built, passivation
struct InternalAlignStore{};
using InternalAlignPtr = GeoModel::TransientConstSharedPtr<InternalAlignStore>;
InternalAlignPtr internalAlignment{};
};
} // namespace ActsTrk
CLASS_DEF( ActsTrk::DetectorAlignStore , 167523695 , 1 );
CONDCONT_DEF( ActsTrk::DetectorAlignStore , 133556083 );
#endif
/* /*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef ACTSGEOMETRYINTERFACES_GEOMETRYDEFS_H #ifndef ACTSGEOMETRYINTERFACES_GEOMETRYDEFS_H
#define ACTSGEOMETRYINTERFACES_GEOMETRYDEFS_H #define ACTSGEOMETRYINTERFACES_GEOMETRYDEFS_H
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
namespace ActsTrk { namespace ActsTrk {
/// Simple enum to Identify the Type of the /// Simple enum to Identify the Type of the
/// ACTS sub detector /// ACTS sub detector
enum class DetectorType { enum class DetectorType: unsigned short {
UnDefined = 0,
/// Inner detector legacy /// Inner detector legacy
Pixel, Pixel,
Sct, Sct,
...@@ -28,7 +27,8 @@ namespace ActsTrk { ...@@ -28,7 +27,8 @@ namespace ActsTrk {
Tgc, /// Thin gap champers Tgc, /// Thin gap champers
Csc, /// Maybe not needed in the migration Csc, /// Maybe not needed in the migration
Mm, /// Micromegas (NSW) Mm, /// Micromegas (NSW)
sTgc /// Small Thing Gap chambers (NSW) sTgc, /// Small Thing Gap chambers (NSW)
UnDefined
}; };
inline std::string to_string(const DetectorType& type) { inline std::string to_string(const DetectorType& type) {
......
/* /*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef ACTSGEOMETRYINTERFACES_IACTSDETECTORVOLUMESVC_H #ifndef ACTSGEOMETRYINTERFACES_IACTSDETECTORVOLUMESVC_H
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "GaudiKernel/IService.h" #include "GaudiKernel/IService.h"
#include "ActsGeometryInterfaces/ActsGeometryContext.h" #include "ActsGeometryInterfaces/ActsGeometryContext.h"
#include "ActsGeometryInterfaces/RawGeomAlignStore.h"
#include "Acts/Detector/Detector.hpp" #include "Acts/Detector/Detector.hpp"
...@@ -15,21 +14,28 @@ ...@@ -15,21 +14,28 @@
namespace ActsTrk{ namespace ActsTrk{
/** @brief Interface of the service providing the Acts::Detector which implements
* the navigation delegate paradigm and eventually replace the legacy tracking geometry
*
*/
class IDetectorVolumeSvc : virtual public IService { class IDetectorVolumeSvc : virtual public IService {
public: public:
DeclareInterfaceID(IDetectorVolumeSvc, 1, 0); DeclareInterfaceID(IDetectorVolumeSvc, 1, 0);
virtual ~IDetectorVolumeSvc() = default; virtual ~IDetectorVolumeSvc() = default;
/// Returns a pointer to the internal ACTS Detector
/// Returns the pointer to the Acts::Detector representing all ATLAS tracking layers
/// If the method is called for the first time, the detector is instantiated assuming perfect
/// alignment of the layers.
using DetectorPtr = std::shared_ptr<const Acts::Experimental::Detector>; using DetectorPtr = std::shared_ptr<const Acts::Experimental::Detector>;
virtual DetectorPtr detector() const = 0; virtual DetectorPtr detector() const = 0;
/// Caches the final transformations in the alignment store for a given sub detector type /// Caches the final transformations in the alignment store for a given sub detector type
/// (defined by an internal flag in the Store). Returns the number of added elements /// (defined by an internal flag in the Store). Returns the number of added elements
virtual unsigned int populateAlignmentStore(ActsTrk::RawGeomAlignStore& store) const = 0; using AlignmentStore = ActsGeometryContext::AlignmentStore;
/// Checks whether the GeometryContext has alignment stores foreach active subdetector virtual unsigned int populateAlignmentStore(AlignmentStore& store) const = 0;
/// excluding the TRTs. Returns a StatusCode::FAILURE if an AlignmentStore is missing
virtual StatusCode checkAlignComplete(const ActsGeometryContext& ctx) const = 0;
/// Returns an empty nominal context without any alignment caches /// Returns an empty nominal context without any alignment caches
virtual const ActsGeometryContext& getNominalContext() const = 0; virtual const ActsGeometryContext& getNominalContext() const = 0;
}; };
......
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
# Declare the package name: # Declare the package name:
atlas_subdir( ActsGeometryInterfaces ) atlas_subdir( ActsGeometryInterfaces )
...@@ -12,15 +12,8 @@ endif() ...@@ -12,15 +12,8 @@ endif()
# Component(s) in the package: # Component(s) in the package:
atlas_add_library( ActsGeometryInterfacesLib atlas_add_library( ActsGeometryInterfacesLib
src/DetectorAlignStore.cxx
ActsGeometryInterfaces/*.h ActsGeometryInterfaces/*.h
INTERFACE
PUBLIC_HEADERS ActsGeometryInterfaces PUBLIC_HEADERS ActsGeometryInterfaces
LINK_LIBRARIES LINK_LIBRARIES ${extra_libs} AthenaBaseComps AthenaKernel GaudiKernel GeoModelUtilities GeoPrimitives
${extra_libs} Identifier TrkEventPrimitives )
AthenaBaseComps
AthenaKernel
GaudiKernel
GeoModelUtilities
GeoPrimitives
Identifier
TrkEventPrimitives )
#include "ActsGeometryInterfaces/DetectorAlignStore.h"
#include "CxxUtils/ArrayHelper.h"
namespace{
std::mutex s_ticketMutex{};
}
namespace ActsTrk{
DetectorAlignStore::DetectorAlignStore(const DetectorType type) :
detType{type} {}
using TicketCounterArr = DetectorAlignStore::TrackingAlignStore::TicketCounterArr;
using ReturnedTicketArr = DetectorAlignStore::TrackingAlignStore::ReturnedTicketArr;
TicketCounterArr DetectorAlignStore::TrackingAlignStore::s_clientCounter{};
ReturnedTicketArr DetectorAlignStore::TrackingAlignStore::s_returnedTickets{};
DetectorAlignStore::TrackingAlignStore::TrackingAlignStore(const DetectorType type) {
m_transforms.resize(distributedTickets(type));
}
unsigned int DetectorAlignStore::TrackingAlignStore::drawTicket(const DetectorType type) {
std::lock_guard guard{s_ticketMutex};
const unsigned int idx = static_cast<unsigned>(type);
if (s_returnedTickets[idx].size()) {
unsigned int distTicket = (*s_returnedTickets[idx].begin());
s_returnedTickets[idx].erase(s_returnedTickets[idx].begin());
return distTicket;
}
return s_clientCounter[idx]++;
}
unsigned int DetectorAlignStore::TrackingAlignStore::distributedTickets(const DetectorType type) {
return s_clientCounter[static_cast<unsigned int>(type)];
}
void DetectorAlignStore::TrackingAlignStore::giveBackTicket(const DetectorType type, unsigned int ticketNo) {
std::lock_guard guard{s_ticketMutex};
s_returnedTickets[static_cast<unsigned int>(type)].push_back(ticketNo);
}
}
\ No newline at end of file
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