Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PhantomParameterisation.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4PhantomParameterisation
27//
28// Class description:
29//
30// Describes regular parameterisations: a set of boxes of equal dimension
31// in the x, y and z dimensions. The G4PVParameterised volume using this
32// class must be placed inside a volume that is completely filled by these
33// boxes.
34
35// Author: Pedro Arce (CIEMAT), May 2007
36//---------------------------------------------------------------------
37#ifndef G4PhantomParameterisation_HH
38#define G4PhantomParameterisation_HH 1
39
40#include <vector>
41
42#include "G4Types.hh"
44#include "G4AffineTransform.hh"
45#include "G4VTouchable.hh"
46
48class G4VSolid;
49class G4Material;
50
51// Dummy forward declarations ...
52
53class G4Box;
54class G4Tubs;
55class G4Trd;
56class G4Trap;
57class G4Cons;
58class G4Orb;
59class G4Sphere;
60class G4Ellipsoid;
61class G4Torus;
62class G4Para;
63class G4Hype;
64class G4Polycone;
65class G4Polyhedra;
66
67/**
68 * @brief G4PhantomParameterisation describes regular parameterisations: a set
69 * of boxes of equal dimension in the x, y and z dimensions.
70 * The G4PVParameterised volume using this class must be placed inside a volume
71 * that is completely filled by these boxes.
72 */
73
75{
76 public:
77
78 /**
79 * Constructor and Destructor.
80 */
83
84 void ComputeTransformation(const G4int, G4VPhysicalVolume *) const override;
85
86 G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume *) override;
87
88 G4Material* ComputeMaterial(const G4int repNo,
89 G4VPhysicalVolume* currentVol,
90 const G4VTouchable* parentTouch=nullptr) override;
91 /**
92 * Dummy declarations ...
93 */
95 const G4VPhysicalVolume*) const override {}
97 const G4VPhysicalVolume*) const override {}
99 const G4VPhysicalVolume*) const override {}
101 const G4VPhysicalVolume*) const override {}
103 const G4VPhysicalVolume*) const override {}
105 const G4VPhysicalVolume*) const override {}
107 const G4VPhysicalVolume*) const override {}
109 const G4VPhysicalVolume*) const override {}
111 const G4VPhysicalVolume*) const override {}
113 const G4VPhysicalVolume*) const override {}
115 const G4VPhysicalVolume*) const override {}
117 const G4VPhysicalVolume*) const override {}
119 const G4VPhysicalVolume*) const override {}
120
121 /**
122 * Saves as container solid the parent of the voxels.
123 * Checks that the voxels fill it completely.
124 */
125 void BuildContainerSolid( G4VPhysicalVolume* pPhysicalVol );
126 void BuildContainerSolid( G4VSolid* pMotherSolid );
127
128
129 /**
130 * Gets the voxel number corresponding to the point in the container
131 * frame. Uses 'localDir' to avoid precision problems at the surfaces.
132 */
133 virtual G4int GetReplicaNo( const G4ThreeVector& localPoint,
134 const G4ThreeVector& localDir );
135
136 /** Set and Get methods */
137
138 inline void SetMaterials(std::vector<G4Material*>& mates );
139
140 inline void SetMaterialIndices( std::size_t* matInd );
141
142 void SetVoxelDimensions( G4double halfx, G4double halfy, G4double halfz );
143 void SetNoVoxels( std::size_t nx, std::size_t ny, std::size_t nz );
144
145 inline G4double GetVoxelHalfX() const;
146 inline G4double GetVoxelHalfY() const;
147 inline G4double GetVoxelHalfZ() const;
148 inline std::size_t GetNoVoxelsX() const;
149 inline std::size_t GetNoVoxelsY() const;
150 inline std::size_t GetNoVoxelsZ() const;
151 inline std::size_t GetNoVoxels() const;
152
153 inline std::vector<G4Material*> GetMaterials() const;
154 inline std::size_t* GetMaterialIndices() const;
156
157 G4ThreeVector GetTranslation(const G4int copyNo ) const;
158
161
162 std::size_t GetMaterialIndex( std::size_t nx, std::size_t ny, std::size_t nz) const;
163 std::size_t GetMaterialIndex( std::size_t copyNo) const;
164
165 G4Material* GetMaterial( std::size_t nx, std::size_t ny, std::size_t nz) const;
166 G4Material* GetMaterial( std::size_t copyNo ) const;
167
168 /**
169 * Checks that the voxels fill it completely.
170 */
171 void CheckVoxelsFillContainer( G4double contX, G4double contY,
172 G4double contZ ) const;
173
174 private:
175
176 /**
177 * Converts the copyNo to voxel numbers in x, y and z.
178 */
179 void ComputeVoxelIndices(const G4int copyNo, std::size_t& nx,
180 std::size_t& ny, std::size_t& nz ) const;
181
182 /**
183 * Checks that the copy number is within limits.
184 */
185 void CheckCopyNo( const G4long copyNo ) const;
186
187 protected:
188
189 /** Half dimension of voxels (assume they are boxes). */
191
192 /** Number of voxel in x, y and z dimensions. */
193 std::size_t fNoVoxelsX = 0, fNoVoxelsY = 0, fNoVoxelsZ = 0;
194
195 /** Number of voxels in x times number of voxels in y (for speed-up). */
196 std::size_t fNoVoxelsXY = 0;
197
198 /** Total number of voxels (for speed-up). */
199 std::size_t fNoVoxels = 0;
200
201 /** List of materials of the voxels. */
202 std::vector<G4Material*> fMaterials;
203
204 /** Index in fMaterials that correspond to each voxel. */
205 std::size_t* fMaterialIndices = nullptr;
206
207 /** Saves as container solid the parent of the voxels. */
209
210 /** Save position of container wall for speed-up. */
212
213 /** Relative surface tolerance. */
215
216 /** Flag to skip surface when two voxel have same material or not. */
218};
219
220#include "G4PhantomParameterisation.icc"
221
222#endif
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
long G4long
Definition G4Types.hh:87
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4TouchableHistory G4VTouchable
G4VTouchable is a G4TouchableHistory object.
G4Box is a cuboid of given half lengths dx,dy,dz. The Box is centred on the origin with sides paralle...
Definition G4Box.hh:58
G4Cons is, in the general case, a Phi segment of a cone, with half-length fDz, inner and outer radii ...
Definition G4Cons.hh:85
G4Ellipsoid is an ellipsoidal solid, optionally cut at a given Z.
G4Hype is a tube with hyperbolic profile; it describes an hyperbolic volume with curved sides paralle...
Definition G4Hype.hh:72
G4Orb represents a full sphere.
Definition G4Orb.hh:59
G4Para represents a parallelepiped, essentially a box with half lengths dx,dy,dz 'skewed' so that the...
Definition G4Para.hh:86
void SetVoxelDimensions(G4double halfx, G4double halfy, G4double halfz)
virtual G4int GetReplicaNo(const G4ThreeVector &localPoint, const G4ThreeVector &localDir)
void BuildContainerSolid(G4VPhysicalVolume *pPhysicalVol)
G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *) override
void CheckVoxelsFillContainer(G4double contX, G4double contY, G4double contZ) const
void SetMaterials(std::vector< G4Material * > &mates)
G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=nullptr) override
std::size_t * GetMaterialIndices() const
void ComputeDimensions(G4Trap &, const G4int, const G4VPhysicalVolume *) const override
G4Material * GetMaterial(std::size_t nx, std::size_t ny, std::size_t nz) const
void ComputeDimensions(G4Orb &, const G4int, const G4VPhysicalVolume *) const override
void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const override
G4double GetVoxelHalfZ() const
G4VSolid * GetContainerSolid() const
std::size_t GetNoVoxelsX() const
void ComputeDimensions(G4Para &, const G4int, const G4VPhysicalVolume *) const override
void SetSkipEqualMaterials(G4bool skip)
std::size_t GetMaterialIndex(std::size_t nx, std::size_t ny, std::size_t nz) const
G4ThreeVector GetTranslation(const G4int copyNo) const
void ComputeDimensions(G4Hype &, const G4int, const G4VPhysicalVolume *) const override
void ComputeTransformation(const G4int, G4VPhysicalVolume *) const override
G4double GetVoxelHalfY() const
void ComputeDimensions(G4Cons &, const G4int, const G4VPhysicalVolume *) const override
void ComputeDimensions(G4Ellipsoid &, const G4int, const G4VPhysicalVolume *) const override
std::vector< G4Material * > GetMaterials() const
G4bool SkipEqualMaterials() const
void ComputeDimensions(G4Polyhedra &, const G4int, const G4VPhysicalVolume *) const override
void ComputeDimensions(G4Torus &, const G4int, const G4VPhysicalVolume *) const override
std::size_t GetNoVoxels() const
G4double GetVoxelHalfX() const
std::size_t GetNoVoxelsZ() const
std::vector< G4Material * > fMaterials
~G4PhantomParameterisation() override
void SetMaterialIndices(std::size_t *matInd)
void ComputeDimensions(G4Trd &, const G4int, const G4VPhysicalVolume *) const override
void SetNoVoxels(std::size_t nx, std::size_t ny, std::size_t nz)
void ComputeDimensions(G4Tubs &, const G4int, const G4VPhysicalVolume *) const override
void ComputeDimensions(G4Sphere &, const G4int, const G4VPhysicalVolume *) const override
void ComputeDimensions(G4Polycone &, const G4int, const G4VPhysicalVolume *) const override
std::size_t GetNoVoxelsY() const
G4Polycone represents a composed closed shape (PCON) made of cones and cylinders, along the Z axis wi...
Definition G4Polycone.hh:82
G4Polyhedra represents a composed closed polyhedra (PGON) made of planar sizes along the Z axis,...
G4Sphere is, in the general case, a section of a spherical shell, between specified phi and theta ang...
Definition G4Sphere.hh:89
G4Torus represents a torus or torus segment with curved sides parallel to the z-axis....
Definition G4Torus.hh:102
G4Trap is a general trapezoid: the faces perpendicular to the Z planes are trapezia,...
Definition G4Trap.hh:116
G4Trd is a trapezoid with the X and Y dimensions varying along Z.
Definition G4Trd.hh:65
G4Tubs is a tube or tube segment with curved sides parallel to the Z-axis. The tube has a specified h...
Definition G4Tubs.hh:85
G4VPVParameterisation()=default
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid is an abstract base class for solids, physical shapes that can be tracked through....
Definition G4VSolid.hh:80