ATLAS Offline Software
VolumeConverter.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 // VolumeConverter.h, (c) ATLAS Detector software
8 
9 #ifndef TRKDETDESCRGEOMODELCNV_VOLUMECONVERTER_H
10 #define TRKDETDESCRGEOMODELCNV_VOLUMECONVERTER_H
11 
12 #include <cmath> //for M_PI
13 #include <utility> //for std::pair
14 #include <vector>
15 
20 #include "TrkGeometry/Material.h" //used in typedef
21 
22 class GeoVPhysVol;
23 
24 namespace Trk {
25 class TrackingVolume;
26 class VolumeBounds;
27 } // namespace Trk
28 
29 namespace Trk {
30 
31 using MaterialComponent = std::pair<Material, double>;
32 
33 struct VolumeSpan {
34  double phiMin{0.};
35  double phiMax{2 * M_PI};
36  double rMin{0.};
37  double rMax{1.e5};
38  double xMin{-1.e5};
39  double xMax{1.e5};
40  double yMin{-1.e5};
41  double yMax{1.e5};
42  double zMin{-1.e5};
43  double zMax{1.e5};
44 };
45 
46 struct VolumePart {
47  std::vector<std::shared_ptr<Volume>> parts{};
48  double sign{1.};
49 };
50 using VolumePartVec = std::vector<VolumePart>;
51 
60 class VolumeConverter : public AthMessaging {
61 
62  public:
65  std::unique_ptr<TrackingVolume> translate(const GeoVPhysVol* gv,
66  bool simplify, bool blend,
67  double blendMassLimit) const;
68 
69  using VolumePair =
70  std::pair<std::shared_ptr<Volume>, std::shared_ptr<Volume>>;
71  using VolumePairVec = std::vector<VolumePair>;
74  static VolumePairVec splitComposedVolume(const Volume& trVol) ;
75 
76  double resolveBooleanVolume(const Volume& trVol, double tolerance) const;
77 
79  std::unique_ptr<VolumeSpan> findVolumeSpan(
80  const VolumeBounds& volBounds, const Amg::Transform3D& transform,
81  double zTol, double phiTol) const;
82 
84  double calculateVolume(const Volume& vol, bool nonBooleanOnly = false,
85  double precision = 1.e-3) const;
86 
88  double estimateFraction(const VolumePair& sub, double precision) const;
89 
91  void collectMaterial(const GeoVPhysVol* pv, Trk::MaterialProperties& layMat,
92  double sf) const;
93 
96  const GeoVPhysVol* gv,
97  std::vector<Trk::MaterialComponent>& materialContent) const;
98 
99  private:
100  double leadingVolume(const GeoShape* sh) const;
101 
103 
104  static constexpr double s_precisionInX0 =
105  1.e-3; // tentative required precision of the material thickness
106  // estimate
107 };
108 
109 } // end of namespace Trk
110 
111 #endif
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
Trk::VolumePartVec
std::vector< VolumePart > VolumePartVec
Definition: VolumeConverter.h:50
Trk::VolumeConverter::m_geoShapeConverter
Trk::GeoShapeConverter m_geoShapeConverter
shape converter
Definition: VolumeConverter.h:102
Trk::VolumeSpan::xMax
double xMax
Definition: VolumeConverter.h:39
Trk::VolumeConverter::calculateVolume
double calculateVolume(const Volume &vol, bool nonBooleanOnly=false, double precision=1.e-3) const
Volume calculation : by default return analytical solution only.
Definition: VolumeConverter.cxx:927
Trk::VolumeConverter::VolumePairVec
std::vector< VolumePair > VolumePairVec
Definition: VolumeConverter.h:71
Trk::VolumeConverter::s_precisionInX0
static constexpr double s_precisionInX0
Definition: VolumeConverter.h:104
Trk::VolumeConverter::findVolumeSpan
std::unique_ptr< VolumeSpan > findVolumeSpan(const VolumeBounds &volBounds, const Amg::Transform3D &transform, double zTol, double phiTol) const
Estimation of the geometrical volume span.
Definition: VolumeConverter.cxx:424
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Trk::VolumeSpan::phiMax
double phiMax
Definition: VolumeConverter.h:35
Trk::VolumePart::sign
double sign
Definition: VolumeConverter.h:48
Trk::VolumeConverter::collectMaterial
void collectMaterial(const GeoVPhysVol *pv, Trk::MaterialProperties &layMat, double sf) const
material collection for layers
Definition: VolumeConverter.cxx:1035
Trk::VolumeSpan::rMax
double rMax
Definition: VolumeConverter.h:37
Trk::VolumeConverter
Definition: VolumeConverter.h:60
Trk::VolumeSpan::yMin
double yMin
Definition: VolumeConverter.h:40
Trk::VolumeBounds
Definition: VolumeBounds.h:45
Trk::VolumeConverter::estimateFraction
double estimateFraction(const VolumePair &sub, double precision) const
the tricky part of volume calculation
Definition: VolumeConverter.cxx:1004
Trk::GeoShapeConverter
Definition: GeoShapeConverter.h:42
Trk::VolumePart
Definition: VolumeConverter.h:46
Trk::VolumeConverter::collectMaterialContent
void collectMaterialContent(const GeoVPhysVol *gv, std::vector< Trk::MaterialComponent > &materialContent) const
material collection for volumes
Definition: VolumeConverter.cxx:1060
RCU::Shell
Definition: ShellExec.cxx:28
Trk::VolumeConverter::leadingVolume
double leadingVolume(const GeoShape *sh) const
Definition: VolumeConverter.cxx:1135
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
Trk::VolumeConverter::resolveBooleanVolume
double resolveBooleanVolume(const Volume &trVol, double tolerance) const
Definition: VolumeConverter.cxx:226
tolerance
Definition: suep_shower.h:17
Trk::MaterialComponent
std::pair< Material, double > MaterialComponent
Definition: VolumeConverter.h:31
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::VolumeSpan::phiMin
double phiMin
Definition: VolumeConverter.h:34
GeoMaterialConverter.h
Trk::VolumeSpan::zMax
double zMax
Definition: VolumeConverter.h:43
Trk::VolumeSpan::yMax
double yMax
Definition: VolumeConverter.h:41
Trk::MaterialProperties
Definition: MaterialProperties.h:40
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
AthMessaging.h
Trk::VolumeConverter::VolumePair
std::pair< std::shared_ptr< Volume >, std::shared_ptr< Volume > > VolumePair
Definition: VolumeConverter.h:70
VolumeIntersection.h
python.changerun.pv
pv
Definition: changerun.py:81
GeoShapeConverter.h
Trk::VolumePart::parts
std::vector< std::shared_ptr< Volume > > parts
Definition: VolumeConverter.h:47
Trk::VolumeSpan::zMin
double zMin
Definition: VolumeConverter.h:42
Trk::VolumeConverter::translate
std::unique_ptr< TrackingVolume > translate(const GeoVPhysVol *gv, bool simplify, bool blend, double blendMassLimit) const
translation of GeoVPhysVol to Trk::TrackingVolume
Definition: VolumeConverter.cxx:42
Trk::VolumeConverter::splitComposedVolume
static VolumePairVec splitComposedVolume(const Volume &trVol)
Decomposition of volume into set of non-overlapping subtractions from analytically calculable volume.
Definition: VolumeConverter.cxx:348
Trk::VolumeSpan
Definition: VolumeConverter.h:33
Trk::VolumeSpan::rMin
double rMin
Definition: VolumeConverter.h:36
Trk::Volume
Definition: Volume.h:35
Trk::VolumeConverter::VolumeConverter
VolumeConverter()
Definition: VolumeConverter.cxx:40
Material.h
Trk::VolumeSpan::xMin
double xMin
Definition: VolumeConverter.h:38