Project
Loading...
Searching...
No Matches
TrackingGeometryManager.h
Go to the documentation of this file.
1// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
17
18#ifndef ALICEO2_ACTS_TRACKINGGEOMETRYMANAGER_H
19#define ALICEO2_ACTS_TRACKINGGEOMETRYMANAGER_H
20
21#include <memory>
22#include <string>
23#include <string_view>
24#include <unordered_map>
25
26#include "Acts/Utilities/Logger.hpp"
27
29
30namespace o2::acts
31{
32
59{
60 public:
62
64 void setBuilder(std::unique_ptr<ITrackingGeometryBuilder> builder);
65 bool hasBuilder() const { return mBuilder != nullptr; }
66
69 void setMaterialMapFile(std::string fileName) { mMaterialMapFile = std::move(fileName); }
70 const std::string& getMaterialMapFile() const { return mMaterialMapFile; }
71
72 void setLogLevel(Acts::Logging::Level level) { mLogLevel = level; }
73
76 void build();
77
81 void buildFromFile(std::string_view geomFileName);
82
83 bool isBuilt() const { return mGeometry != nullptr; }
84 void clear();
85
87 std::shared_ptr<const Acts::TrackingGeometry> getShared();
88 const Acts::TrackingGeometry& get();
89
95
112 double toleranceCm = 1e-3,
113 SensorPathProvider pathProvider = {});
114
118 const Acts::GeometryContext& getNominalContext() const { return mNominalContext; }
119
122 std::size_t getNDecoratedSurfaces() const { return mNDecoratedSurfaces; }
123
124 private:
126
127 void doBuild();
128 void applyMaterialMapImpl(Acts::TrackingGeometry& geometry);
129
130 std::unique_ptr<ITrackingGeometryBuilder> mBuilder;
131 std::string mMaterialMapFile;
132 Acts::Logging::Level mLogLevel = Acts::Logging::INFO;
133
134 Acts::GeometryContext mNominalContext;
135 std::shared_ptr<const Acts::TrackingGeometry> mGeometry;
136 std::vector<std::shared_ptr<const Acts::SurfacePlacementBase>> mElementStore;
137 SurfaceIndexMap mIndex;
139 std::unordered_map<int, SurfaceIndexMap> mDetIndices;
140 std::size_t mNDecoratedSurfaces = 0;
141};
142
143} // namespace o2::acts
144
145#endif // ALICEO2_ACTS_TRACKINGGEOMETRYMANAGER_H
Detector-agnostic interface for building an Acts::TrackingGeometry from TGeo.
void setLogLevel(Acts::Logging::Level level)
const Acts::GeometryContext & getNominalContext() const
const std::string & getMaterialMapFile() const
static TrackingGeometryManager & instance()
void buildFromFile(std::string_view geomFileName)
void setBuilder(std::unique_ptr< ITrackingGeometryBuilder > builder)
Install the detector-specific builder. Must be called before the first build.
void setMaterialMapFile(std::string fileName)
const Acts::TrackingGeometry & get()
std::shared_ptr< const Acts::TrackingGeometry > getShared()
Builds on first call if not built yet.
GLint level
Definition glcorearb.h:275
std::function< std::string(int sensorID)> SensorPathProvider
Full TGeo node path of one sensor, e.g. o2::trk::GeometryTGeo::getMatrixPath().