Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geant4Converters.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Geant4Converters.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022 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 
14 
15 #include <array>
16 #include <memory>
17 #include <tuple>
18 
19 #include "G4RotationMatrix.hh"
20 #include "G4ThreeVector.hh"
21 #include "G4Transform3D.hh"
22 
23 class G4Box;
24 class G4Material;
25 class G4Trd;
26 class G4Trap;
27 class G4Tubs;
28 class G4VSolid;
29 class G4VPhysicalVolume;
30 
31 namespace Acts {
32 
34  // A potential scalar between Geant4 and ACTS
36 
42  Transform3 transform(const G4ThreeVector& g4Trans);
43 
50  Transform3 transform(const G4RotationMatrix& g4Rot,
51  const G4ThreeVector& g4Trans);
52 
58  Transform3 transform(const G4Transform3D& g4Trf);
59 
65  Transform3 transform(const G4VPhysicalVolume& g4PhysVol);
66 };
67 
68 class AnnulusBounds;
69 class CylinderBounds;
70 class RadialBounds;
71 class RectangleBounds;
72 class TrapezoidBounds;
73 class PlanarBounds;
74 class LineBounds;
75 
76 // The following set of converters convert a Geant4 volume shape
77 // to an ACTS surface bounds object, this is for converting the volume
78 // based geometry into a surfaced based one.
79 //
80 // The obviously smallest expansion/extrusion is condensed to the epsilon
81 // thin surface.
88  bool keepAxisOrder = false;
89 
95  std::tuple<std::shared_ptr<CylinderBounds>, ActsScalar> cylinderBounds(
96  const G4Tubs& g4Tubs);
97 
103  std::tuple<std::shared_ptr<RadialBounds>, ActsScalar> radialBounds(
104  const G4Tubs& g4Tubs);
105 
111  std::shared_ptr<LineBounds> lineBounds(const G4Tubs& g4Tubs);
112 
118  std::tuple<std::shared_ptr<RectangleBounds>, std::array<int, 2u>, ActsScalar>
119  rectangleBounds(const G4Box& g4Box);
120 
126  std::tuple<std::shared_ptr<TrapezoidBounds>, std::array<int, 2u>, ActsScalar>
127  trapezoidBounds(const G4Trd& g4Trd);
128 
135  std::tuple<std::shared_ptr<PlanarBounds>, std::array<int, 2u>, ActsScalar>
136  planarBounds(const G4VSolid& g4Solid);
137 };
138 
141  Surface::SurfaceType forcedType = Surface::SurfaceType::Other;
142 
151  std::shared_ptr<Surface> surface(const G4VPhysicalVolume& g4PhysVol,
152  const Transform3& toGlobal,
153  bool convertMaterial = false,
154  ActsScalar compressed = 0.);
155 };
156 
157 class Material;
160 
162  Material material(const G4Material& g4Material, ActsScalar compression = 1);
163 
170  std::shared_ptr<HomogeneousSurfaceMaterial> surfaceMaterial(
171  const G4Material& g4Material, ActsScalar original, ActsScalar compressed);
172 };
173 
175 
182  std::shared_ptr<CylinderVolumeBounds> cylinderBounds(const G4Tubs& g4Tubs);
183 };
184 
185 } // namespace Acts