Project
Loading...
Searching...
No Matches
o2::acts::TrackingGeometryManager Class Reference

#include <TrackingGeometryManager.h>

Public Member Functions

void setBuilder (std::unique_ptr< ITrackingGeometryBuilder > builder)
 Install the detector-specific builder. Must be called before the first build.
 
bool hasBuilder () const
 
void setMaterialMapFile (std::string fileName)
 
const std::string & getMaterialMapFile () const
 
void setLogLevel (Acts::Logging::Level level)
 
void build ()
 
void buildFromFile (std::string_view geomFileName)
 
bool isBuilt () const
 
void clear ()
 
std::shared_ptr< const Acts::TrackingGeometry > getShared ()
 Builds on first call if not built yet.
 
const Acts::TrackingGeometry & get ()
 
const SurfaceIndexMap & getIndex ()
 
const SurfaceIndexMap & getIndex (const o2::detectors::DetMatrixCache &cache, double toleranceCm=1e-3, SensorPathProvider pathProvider={})
 
const Acts::GeometryContext & getNominalContext () const
 
std::size_t getNDecoratedSurfaces () const
 

Static Public Member Functions

static TrackingGeometryManager & instance ()
 

Detailed Description

Provider of the shared, immutable Acts::TrackingGeometry.

Follows the same pattern as o2::base::Propagator::Instance(), o2::base::GRPGeomHelper::instance() and o2::its::GeometryTGeo::Instance(): a process-wide lazily-built singleton fed from the geometry O2 already has live in memory. It fetches nothing by itself – the caller is responsible for making gGeoManager available first, normally by declaring o2::base::GRPGeomRequest::Aligned and calling o2::base::GRPGeomHelper::instance().checkUpdates(pc).

Typical use in a DPL task:

void init(InitContext&) {
TrackingGeometryManager::instance().setBuilder(std::make_unique<MyBuilder>(cfg));
}
void run(ProcessingContext& pc) {
o2::base::GRPGeomHelper::instance().checkUpdates(pc); // gGeoManager now live
const auto& tg = TrackingGeometryManager::instance().get(); // built once
}
static TrackingGeometryManager & instance()
void setBuilder(std::unique_ptr< ITrackingGeometryBuilder > builder)
Install the detector-specific builder. Must be called before the first build.
const Acts::TrackingGeometry & get()
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)

Thread safety: build() is not re-entrant and is expected to run once, before any parallel processing. Once built the geometry is immutable and all accessors are safe to call concurrently.

Definition at line 58 of file TrackingGeometryManager.h.

Member Function Documentation

◆ build()

void o2::acts::TrackingGeometryManager::build ( )

Build from the live gGeoManager.

Exceptions
std::runtime_errorif no builder is set or no geometry is loaded

Definition at line 87 of file TrackingGeometryManager.cxx.

◆ buildFromFile()

void o2::acts::TrackingGeometryManager::buildFromFile ( std::string_view  geomFileName)

Build from a TGeo file, for macros and tests running outside a workflow. Loads the file through o2::base::GeometryManager, so it ends up in gGeoManager exactly as it would inside a workflow.

Definition at line 103 of file TrackingGeometryManager.cxx.

◆ clear()

void o2::acts::TrackingGeometryManager::clear ( )

Definition at line 76 of file TrackingGeometryManager.cxx.

◆ get()

const Acts::TrackingGeometry & o2::acts::TrackingGeometryManager::get ( )

Definition at line 201 of file TrackingGeometryManager.cxx.

◆ getIndex() [1/2]

const SurfaceIndexMap & o2::acts::TrackingGeometryManager::getIndex ( )

Sensor <-> surface lookup, as filled by the builder. Empty if the builder did not provide one – which is the normal case when the geometry spans several detectors, since each has its own sensor numbering. Use the overload below for those.

Definition at line 206 of file TrackingGeometryManager.cxx.

◆ getIndex() [2/2]

const SurfaceIndexMap & o2::acts::TrackingGeometryManager::getIndex ( const o2::detectors::DetMatrixCache &  cache,
double  toleranceCm = 1e-3,
SensorPathProvider  pathProvider = {} 
)

Sensor <-> surface lookup for one detector, built from its geometry helper on first request and cached per detector afterwards.

Pass pathProvider whenever the detector offers one – it makes the match an identity rather than a geometric inference, see makeSurfaceIndex():

mgr.getIndex(*trkGeo, 1e-3,
[trkGeo](int id) { return std::string(trkGeo->getMatrixPath(id).Data()); });
static GeometryTGeo * Instance()
Parameters
cachea DetMatrixCache-derived helper with a filled L2G cache, e.g. o2::trk::GeometryTGeo::Instance()
toleranceCmmatching tolerance, see makeSurfaceIndex()
pathProvideroptional TGeo path lookup for exact identification

Definition at line 214 of file TrackingGeometryManager.cxx.

◆ getMaterialMapFile()

const std::string & o2::acts::TrackingGeometryManager::getMaterialMapFile ( ) const
inline

Definition at line 70 of file TrackingGeometryManager.h.

◆ getNDecoratedSurfaces()

std::size_t o2::acts::TrackingGeometryManager::getNDecoratedSurfaces ( ) const
inline

Number of surfaces that received material during decoration. Zero when no material map was configured.

Definition at line 122 of file TrackingGeometryManager.h.

◆ getNominalContext()

const Acts::GeometryContext & o2::acts::TrackingGeometryManager::getNominalContext ( ) const
inline

Context the geometry was built with. Carries no alignment payload: O2 bakes alignment into the TGeo matrices before the ACTS geometry is built, so the nominal transforms are already the aligned ones.

Definition at line 118 of file TrackingGeometryManager.h.

◆ getShared()

std::shared_ptr< const Acts::TrackingGeometry > o2::acts::TrackingGeometryManager::getShared ( )

Builds on first call if not built yet.

Definition at line 193 of file TrackingGeometryManager.cxx.

◆ hasBuilder()

bool o2::acts::TrackingGeometryManager::hasBuilder ( ) const
inline

Definition at line 65 of file TrackingGeometryManager.h.

◆ instance()

TrackingGeometryManager & o2::acts::TrackingGeometryManager::instance ( )
static

Definition at line 60 of file TrackingGeometryManager.cxx.

◆ isBuilt()

bool o2::acts::TrackingGeometryManager::isBuilt ( ) const
inline

Definition at line 83 of file TrackingGeometryManager.h.

◆ setBuilder()

void o2::acts::TrackingGeometryManager::setBuilder ( std::unique_ptr< ITrackingGeometryBuilder >  builder)

Install the detector-specific builder. Must be called before the first build.

Definition at line 66 of file TrackingGeometryManager.cxx.

◆ setLogLevel()

void o2::acts::TrackingGeometryManager::setLogLevel ( Acts::Logging::Level  level)
inline

Definition at line 72 of file TrackingGeometryManager.h.

◆ setMaterialMapFile()

void o2::acts::TrackingGeometryManager::setMaterialMapFile ( std::string  fileName)
inline

Path to an ACTS JSON material map, applied after construction. Empty (the default) means no material decoration.

Definition at line 69 of file TrackingGeometryManager.h.


The documentation for this class was generated from the following files: