ATLAS Offline Software
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"
18 namespace Trk {
19 
25 class 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 
46  public:
47  // Default constructor
48  IApproachDescriptor(std::unique_ptr<ApproachSurfaces> aSurfaces,
49  bool rebuild = true)
50  : m_approachSurfaces(std::move(aSurfaces)),
52  m_approachSurfaceArray(nullptr),
53  m_rebuild(rebuild) {}
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;
93  bool m_rebuild;
94 };
95 
96 inline bool IApproachDescriptor::rebuild() const { return m_rebuild; }
97 
98 inline void IApproachDescriptor::registerLayer(const Layer& lay) {
101  m_approachSurfaceArraySurface->associateLayer(lay);
103  }
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 
Surface.h
Trk::IApproachDescriptor::IApproachDescriptor
IApproachDescriptor(std::unique_ptr< ApproachSurfaces > aSurfaces, bool rebuild=true)
Definition: IApproachDescriptor.h:48
BinnedArray.h
Trk::IApproachDescriptor::approachSurfaces
virtual const ApproachSurfaces * approachSurfaces(const Amg::Vector3D &pos, const Amg::Vector3D &dir) const =0
get the compatible surfaces
Trk::IApproachDescriptor::m_approachSurfaceArraySurface
std::unique_ptr< Surface > m_approachSurfaceArraySurface
Definition: IApproachDescriptor.h:91
Trk::IApproachDescriptor::m_approachSurfaces
std::unique_ptr< ApproachSurfaces > m_approachSurfaces
Definition: IApproachDescriptor.h:90
Trk::ApproachSurfaces::~ApproachSurfaces
~ApproachSurfaces()
Definition: IApproachDescriptor.h:31
Trk::IApproachDescriptor::registerLayerToSurfaces
void registerLayerToSurfaces(const Layer &lay, const ApproachSurfaces &aSurfaces)
Definition: IApproachDescriptor.h:113
Trk::ApproachSurfaces
Definition: IApproachDescriptor.h:25
Trk::IApproachDescriptor::m_approachSurfaceArray
std::unique_ptr< BinnedArray< const ApproachSurfaces > > m_approachSurfaceArray
Definition: IApproachDescriptor.h:92
Trk::IApproachDescriptor
Definition: IApproachDescriptor.h:45
GeoPrimitives.h
Trk::IApproachDescriptor::registerLayer
void registerLayer(const Layer &lay)
Definition: IApproachDescriptor.h:98
Trk::IApproachDescriptor::IApproachDescriptor
IApproachDescriptor(const IApproachDescriptor &)=delete
vector
Definition: MultiHisto.h:13
Trk::IApproachDescriptor::operator=
IApproachDescriptor & operator=(const IApproachDescriptor &)=delete
Trk::IApproachDescriptor::IApproachDescriptor
IApproachDescriptor(std::unique_ptr< BinnedArray< const ApproachSurfaces >> aSurfaceArray, std::unique_ptr< Surface > aSurfaceArraySurface=nullptr)
Definition: IApproachDescriptor.h:56
Trk::IApproachDescriptor::m_rebuild
bool m_rebuild
Definition: IApproachDescriptor.h:93
beamspotman.dir
string dir
Definition: beamspotman.py:623
Trk::TGOwn
@ TGOwn
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:55
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
Trk::IApproachDescriptor::~IApproachDescriptor
virtual ~IApproachDescriptor()=default
Trk::BinnedArray
Definition: BinnedArray.h:38
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
Trk::BinnedArraySpan
std::span< T > BinnedArraySpan
Definition: BinnedArray.h:34
Trk::ApproachSurfaces::ApproachSurfaces
ApproachSurfaces()
Definition: IApproachDescriptor.h:28
Trk::Layer
Definition: Layer.h:73
Trk::IApproachDescriptor::rebuild
bool rebuild() const
Definition: IApproachDescriptor.h:96