ATLAS Offline Software
VolumeIntersection.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // VolumeIntersection.h, (c) ATLAS Detector software
8 
9 #ifndef TRKDETDESCRGEOMODELCNV_VOLUMEINTERSECTION_H
10 #define TRKDETDESCRGEOMODELCNV_VOLUMEINTERSECTION_H
11 
12 #include <memory>
13 #include <utility> //for std::pair
14 #include <vector>
15 
17 
18 namespace Trk {
19 class Volume;
20 }
21 
22 namespace Trk {
23 
24 struct PolygonCache {
25  double hZ{0.};
26  double minZ{0.};
27  double maxZ{0.};
29  int nVtx{0};
30  std::vector<Amg::Vector3D> vertices{};
31  std::vector<std::pair<double, double>> xyVertices{}; // size+1
32  std::vector<bool> commonVertices{};
33  std::vector<std::pair<double, double>> edges{};
34  PolygonCache() = default;
35 };
36 
37 struct EdgeCross {
38 
39  std::pair<int, int> edge_id{};
40  std::pair<double, double> edge_pos{};
41  bool used{false};
42  EdgeCross(std::pair<int, int> ei, std::pair<double, double> ep)
43  : edge_id(std::move(ei)), edge_pos(std::move(ep)){};
44 };
45 
56 
57  public:
58  static std::pair<bool, std::unique_ptr<Trk::Volume>> intersect(
59  const Volume& volA, const Volume& volB) ;
60 
61  static std::pair<bool, std::unique_ptr<Trk::Volume>> intersectApproximative(
62  const Volume& volA, const Volume& volB) ;
63 
64  private:
65  static PolygonCache polygonXY(const Volume& inVol, int swap = 0) ;
68 
69  static bool inside(const std::pair<double, double>& vtx,
70  const std::vector<std::pair<double, double>>& pgon) ;
71 
72  static double det(const std::pair<double, double>& a,
73  const std::pair<double, double>& b, bool) ;
74 };
75 
76 } // end of namespace Trk
77 
78 #endif
used
Trk::VolumeIntersection::intersectPgon
static Trk::PolygonCache intersectPgon(Trk::PolygonCache &, Trk::PolygonCache &)
Definition: VolumeIntersection.cxx:108
Trk::EdgeCross::edge_pos
std::pair< double, double > edge_pos
Definition: VolumeIntersection.h:40
Trk::EdgeCross::EdgeCross
EdgeCross(std::pair< int, int > ei, std::pair< double, double > ep)
Definition: VolumeIntersection.h:42
Trk::EdgeCross
Definition: VolumeIntersection.h:37
Trk::PolygonCache::edges
std::vector< std::pair< double, double > > edges
Definition: VolumeIntersection.h:33
Trk::PolygonCache::center
Amg::Vector3D center
Definition: VolumeIntersection.h:28
Trk::PolygonCache::PolygonCache
PolygonCache()=default
Trk::VolumeIntersection::intersect
static std::pair< bool, std::unique_ptr< Trk::Volume > > intersect(const Volume &volA, const Volume &volB)
Definition: VolumeIntersection.cxx:38
Trk::PolygonCache::commonVertices
std::vector< bool > commonVertices
Definition: VolumeIntersection.h:32
Trk::PolygonCache::xyVertices
std::vector< std::pair< double, double > > xyVertices
Definition: VolumeIntersection.h:31
Trk::PolygonCache::nVtx
int nVtx
Definition: VolumeIntersection.h:29
Trk::VolumeIntersection::intersectApproximative
static std::pair< bool, std::unique_ptr< Trk::Volume > > intersectApproximative(const Volume &volA, const Volume &volB)
Definition: VolumeIntersection.cxx:416
Trk::EdgeCross::edge_id
std::pair< int, int > edge_id
Definition: VolumeIntersection.h:39
Trk::VolumeIntersection::polygonXY
static PolygonCache polygonXY(const Volume &inVol, int swap=0)
Definition: VolumeIntersection.cxx:238
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Trk::PolygonCache::hZ
double hZ
Definition: VolumeIntersection.h:25
Trk::VolumeIntersection::inside
static bool inside(const std::pair< double, double > &vtx, const std::vector< std::pair< double, double >> &pgon)
Definition: VolumeIntersection.cxx:387
Trk::VolumeIntersection
Definition: VolumeIntersection.h:55
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::PolygonCache
Definition: VolumeIntersection.h:24
a
TList * a
Definition: liststreamerinfos.cxx:10
Trk::PolygonCache::maxZ
double maxZ
Definition: VolumeIntersection.h:27
Trk::VolumeIntersection::det
static double det(const std::pair< double, double > &a, const std::pair< double, double > &b, bool)
Definition: VolumeIntersection.cxx:405
GeoShapeConverter.h
Trk::PolygonCache::vertices
std::vector< Amg::Vector3D > vertices
Definition: VolumeIntersection.h:30
Trk::Volume
Definition: Volume.h:35
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
Trk::PolygonCache::minZ
double minZ
Definition: VolumeIntersection.h:26