ATLAS Offline Software
Loading...
Searching...
No Matches
IApproachDescriptor.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6// IApproachDescriptor.h, (c) ATLAS Detector software
8
9#ifndef TRKGEOMETRY_IAPPROACHDESCRIPTOR_H
10#define TRKGEOMETRY_IAPPROACHDESCRIPTOR_H
11
12// Trk
13#include <memory>
14
17#include "TrkSurfaces/Surface.h"
18namespace Trk {
19
24
25class ApproachSurfaces : public std::vector<Surface*> {
26 public:
27 // Default constructor
29
30 // Desctructur with cleanup
32 for (auto& sf : (*this)) {
33 delete sf;
34 }
35 }
36};
37
44
46 public:
47 // Default constructor
48 IApproachDescriptor(std::unique_ptr<ApproachSurfaces> aSurfaces,
49 bool rebuild = true)
50 : m_approachSurfaces(std::move(aSurfaces)),
54
55 // Default constructor
57 std::unique_ptr<BinnedArray<const ApproachSurfaces>> aSurfaceArray,
58 std::unique_ptr<Surface> aSurfaceArraySurface = nullptr)
59 : m_approachSurfaces(nullptr),
60 m_approachSurfaceArraySurface(std::move(aSurfaceArraySurface)),
61 m_approachSurfaceArray(std::move(aSurfaceArray)),
62 m_rebuild(false) {}
63
64 virtual ~IApproachDescriptor() = default;
65
66 // register Layer
67 void registerLayer(const Layer& lay);
68
69 // Telling you if it needs to be rebuilt
70 bool rebuild() const;
71
79 const Amg::Vector3D& pos, const Amg::Vector3D& dir) const = 0;
80
81 private:
82 // register the Layer
83 void registerLayerToSurfaces(const Layer& lay,
84 const ApproachSurfaces& aSurfaces);
85
88
89 protected:
90 std::unique_ptr<ApproachSurfaces> m_approachSurfaces;
91 std::unique_ptr<Surface> m_approachSurfaceArraySurface;
92 std::unique_ptr<BinnedArray<const ApproachSurfaces>> m_approachSurfaceArray;
94};
95
96inline bool IApproachDescriptor::rebuild() const { return m_rebuild; }
97
101 m_approachSurfaceArraySurface->associateLayer(lay);
103 }
105 std::span<ApproachSurfaces const * const> aSurfaceObjects =
106 m_approachSurfaceArray->arrayObjects();
107 for (auto& aSurfaces : aSurfaceObjects) {
108 registerLayerToSurfaces(lay, *aSurfaces);
109 }
110 }
111}
112
114 const Layer& lay, const ApproachSurfaces& aSurfaces) {
115 for (Trk::Surface* aSurface : aSurfaces) {
116 aSurface->associateLayer(lay);
117 aSurface->setOwner(Trk::TGOwn);
118 }
119}
120} // namespace Trk
121
122#endif // TRKGEOMETRY_IAPPROACHDESCRIPTOR_H
123
just implement the delete on the objects
Binned Array for avoiding map searches/.
Definition BinnedArray.h:36
std::unique_ptr< ApproachSurfaces > m_approachSurfaces
void registerLayerToSurfaces(const Layer &lay, const ApproachSurfaces &aSurfaces)
IApproachDescriptor(std::unique_ptr< BinnedArray< const ApproachSurfaces > > aSurfaceArray, std::unique_ptr< Surface > aSurfaceArraySurface=nullptr)
IApproachDescriptor(const IApproachDescriptor &)=delete
IApproachDescriptor & operator=(const IApproachDescriptor &)=delete
IApproachDescriptor(std::unique_ptr< ApproachSurfaces > aSurfaces, bool rebuild=true)
void registerLayer(const Layer &lay)
virtual ~IApproachDescriptor()=default
std::unique_ptr< BinnedArray< const ApproachSurfaces > > m_approachSurfaceArray
std::unique_ptr< Surface > m_approachSurfaceArraySurface
virtual const ApproachSurfaces * approachSurfaces(const Amg::Vector3D &pos, const Amg::Vector3D &dir) const =0
get the compatible surfaces
Base Class for a Detector Layer in the Tracking realm.
Definition Layer.h:72
Abstract Base Class for tracking surfaces.
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
STL namespace.