Geant4 11.2.2
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// class 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// History:
36// - Created: P.Arce, May 2007
37//---------------------------------------------------------------------
38#ifndef G4PhantomParameterisation_HH
39#define G4PhantomParameterisation_HH
40
41#include <vector>
42
43#include "G4Types.hh"
45#include "G4AffineTransform.hh"
46#include "G4VTouchable.hh"
47
49class G4VSolid;
50class G4Material;
51
52// Dummy forward declarations ...
53
54class G4Box;
55class G4Tubs;
56class G4Trd;
57class G4Trap;
58class G4Cons;
59class G4Orb;
60class G4Sphere;
61class G4Ellipsoid;
62class G4Torus;
63class G4Para;
64class G4Hype;
65class G4Polycone;
66class G4Polyhedra;
67
69{
70 public:
71
74
75 void ComputeTransformation(const G4int, G4VPhysicalVolume *) const override;
76
77 G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume *) override;
78
79 G4Material* ComputeMaterial(const G4int repNo,
80 G4VPhysicalVolume* currentVol,
81 const G4VTouchable* parentTouch=nullptr) override;
82 // Dummy declarations ...
83
85 const G4VPhysicalVolume*) const override {}
87 const G4VPhysicalVolume*) const override {}
89 const G4VPhysicalVolume*) const override {}
91 const G4VPhysicalVolume*) const override {}
93 const G4VPhysicalVolume*) const override {}
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 {}
110
111 void BuildContainerSolid( G4VPhysicalVolume* pPhysicalVol );
112 void BuildContainerSolid( G4VSolid* pMotherSolid );
113 // Save as container solid the parent of the voxels. Check that the
114 // voxels fill it completely.
115
116 virtual G4int GetReplicaNo( const G4ThreeVector& localPoint,
117 const G4ThreeVector& localDir );
118 // Get the voxel number corresponding to the point in the container
119 // frame. Use 'localDir' to avoid precision problems at the surfaces.
120
121 // Set and Get methods
122
123 inline void SetMaterials(std::vector<G4Material*>& mates );
124
125 inline void SetMaterialIndices( std::size_t* matInd );
126
127 void SetVoxelDimensions( G4double halfx, G4double halfy, G4double halfz );
128 void SetNoVoxels( std::size_t nx, std::size_t ny, std::size_t nz );
129
130 inline G4double GetVoxelHalfX() const;
131 inline G4double GetVoxelHalfY() const;
132 inline G4double GetVoxelHalfZ() const;
133 inline std::size_t GetNoVoxelsX() const;
134 inline std::size_t GetNoVoxelsY() const;
135 inline std::size_t GetNoVoxelsZ() const;
136 inline std::size_t GetNoVoxels() const;
137
138 inline std::vector<G4Material*> GetMaterials() const;
139 inline std::size_t* GetMaterialIndices() const;
141
142 G4ThreeVector GetTranslation(const G4int copyNo ) const;
143
146
147 std::size_t GetMaterialIndex( std::size_t nx, std::size_t ny, std::size_t nz) const;
148 std::size_t GetMaterialIndex( std::size_t copyNo) const;
149
150 G4Material* GetMaterial( std::size_t nx, std::size_t ny, std::size_t nz) const;
151 G4Material* GetMaterial( std::size_t copyNo ) const;
152
153 void CheckVoxelsFillContainer( G4double contX, G4double contY,
154 G4double contZ ) const;
155 // Check that the voxels fill it completely.
156
157 private:
158
159 void ComputeVoxelIndices(const G4int copyNo, std::size_t& nx,
160 std::size_t& ny, std::size_t& nz ) const;
161 // Convert the copyNo to voxel numbers in x, y and z.
162
163 void CheckCopyNo( const G4long copyNo ) const;
164 // Check that the copy number is within limits.
165
166 protected:
167
169 // Half dimension of voxels (assume they are boxes).
170 std::size_t fNoVoxelsX = 0, fNoVoxelsY = 0, fNoVoxelsZ = 0;
171 // Number of voxel in x, y and z dimensions.
172 std::size_t fNoVoxelsXY = 0;
173 // Number of voxels in x times number of voxels in y (for speed-up).
174 std::size_t fNoVoxels = 0;
175 // Total number of voxels (for speed-up).
176
177 std::vector<G4Material*> fMaterials;
178 // List of materials of the voxels.
179 std::size_t* fMaterialIndices = nullptr;
180 // Index in fMaterials that correspond to each voxel.
181
183 // Save as container solid the parent of the voxels.
184 // Check that the voxels fill it completely.
185
187 // Save position of container wall for speed-up.
188
190 // Relative surface tolerance.
191
193 // Flag to skip surface when two voxel have same material or not
194};
195
196#include "G4PhantomParameterisation.icc"
197
198#endif
double G4double
Definition G4Types.hh:83
long G4long
Definition G4Types.hh:87
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
Definition G4Box.hh:56
Definition G4Orb.hh:56
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
Definition G4Trd.hh:63