EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Surface.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Surface.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
26 
27 #include <memory>
28 
29 namespace Acts {
30 
31 class DetectorElementBase;
32 class SurfaceBounds;
33 class ISurfaceMaterial;
34 class Layer;
35 class TrackingVolume;
36 class IVisualization3D;
37 
39 using SurfaceIntersection = ObjectIntersection<Surface>;
40 
52 class Surface : public virtual GeometryObject,
53  public std::enable_shared_from_this<Surface> {
54  public:
59  enum SurfaceType {
60  Cone = 0,
61  Cylinder = 1,
62  Disc = 2,
63  Perigee = 3,
64  Plane = 4,
65  Straw = 5,
67  Other = 7
68  };
69 
70  protected:
75  Surface(const Transform3D& transform = Transform3D::Identity());
76 
83  Surface(const Surface& other);
84 
88  Surface(const DetectorElementBase& detelement);
89 
98  Surface(const GeometryContext& gctx, const Surface& other,
99  const Transform3D& shift);
100 
101  public:
102  virtual ~Surface();
103 
107  template <class T, typename... Args>
108  static std::shared_ptr<T> makeShared(Args&&... args) {
109  return std::shared_ptr<T>(new T(std::forward<Args>(args)...));
110  }
111 
121  std::shared_ptr<Surface> getSharedPtr();
122 
132  std::shared_ptr<const Surface> getSharedPtr() const;
133 
139  Surface& operator=(const Surface& other);
140 
149  virtual bool operator==(const Surface& other) const;
150 
154  virtual bool operator!=(const Surface& sf) const;
155 
156  public:
158  virtual SurfaceType type() const = 0;
159 
168  virtual const Transform3D& transform(const GeometryContext& gctx) const;
169 
176  virtual Vector3D center(const GeometryContext& gctx) const;
177 
187  virtual Vector3D normal(const GeometryContext& gctx,
188  const Vector2D& lposition) const = 0;
189 
197 
200  virtual Vector3D normal(const GeometryContext& gctx,
201  const Vector3D& position) const;
202 
208  //
210  virtual Vector3D normal(const GeometryContext& gctx) const {
211  return normal(gctx, center(gctx));
212  }
213 
216  virtual const SurfaceBounds& bounds() const = 0;
217 
221 
224  const Layer* associatedLayer() const;
225 
231  void associateLayer(const Layer& lay);
232 
235  const ISurfaceMaterial* surfaceMaterial() const;
236 
239  const std::shared_ptr<const ISurfaceMaterial>& surfaceMaterialSharedPtr()
240  const;
241 
249  void assignSurfaceMaterial(std::shared_ptr<const ISurfaceMaterial> material);
250 
261  bool isOnSurface(const GeometryContext& gctx, const Vector3D& position,
262  const Vector3D& momentum,
263  const BoundaryCheck& bcheck = true) const;
264 
270  virtual bool insideBounds(const Vector2D& lposition,
271  const BoundaryCheck& bcheck = true) const;
272 
284  const Vector2D& lposition,
285  const Vector3D& momentum) const = 0;
286 
299  const Vector3D& position,
300  const Vector3D& momentum) const = 0;
301 
314  const Vector3D& position,
315  const Vector3D& momentum) const;
316 
331  virtual void initJacobianToGlobal(const GeometryContext& gctx,
332  BoundToFreeMatrix& jacobian,
333  const Vector3D& position,
334  const Vector3D& direction,
335  const BoundVector& pars) const;
336 
353  FreeToBoundMatrix& jacobian,
354  const Vector3D& position,
355  const Vector3D& direction) const;
356 
374  const GeometryContext& gctx, const Vector3D& position,
375  const Vector3D& direction, const RotationMatrix3D& rft,
376  const BoundToFreeMatrix& jacobian) const;
377 
386  virtual double pathCorrection(const GeometryContext& gctx,
387  const Vector3D& position,
388  const Vector3D& direction) const = 0;
389 
399  const Vector3D& position,
400  const Vector3D& direction,
401  const BoundaryCheck& bcheck) const = 0;
402 
407  virtual std::ostream& toStream(const GeometryContext& gctx,
408  std::ostream& sl) const;
409 
411  virtual std::string name() const = 0;
412 
426  size_t lseg) const = 0;
427 
443  const GeometryContext& gctx, const FreeVector& derivatives,
444  const Vector3D& position, const Vector3D& direction) const;
445 
461  const GeometryContext& gctx, const RotationMatrix3D& rotToLocalZAxis,
462  const Vector3D& position, const Vector3D& direction) const;
463 
473  const GeometryContext& gctx, const Vector3D& position) const = 0;
474 
475  protected:
478  Transform3D m_transform = Transform3D::Identity();
479 
482 
485  const Layer* m_associatedLayer{nullptr};
486 
490 
492  std::shared_ptr<const ISurfaceMaterial> m_surfaceMaterial;
493 };
494 
496 
497 } // namespace Acts