File indexing completed on 2026-09-22 08:51:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 #ifndef G4PhantomParameterisation_HH
0038 #define G4PhantomParameterisation_HH 1
0039
0040 #include <vector>
0041
0042 #include "G4Types.hh"
0043 #include "G4VPVParameterisation.hh"
0044 #include "G4AffineTransform.hh"
0045 #include "G4VTouchable.hh"
0046
0047 class G4VPhysicalVolume;
0048 class G4VSolid;
0049 class G4Material;
0050
0051
0052
0053 class G4Box;
0054 class G4Tubs;
0055 class G4Trd;
0056 class G4Trap;
0057 class G4Cons;
0058 class G4Orb;
0059 class G4Sphere;
0060 class G4Ellipsoid;
0061 class G4Torus;
0062 class G4Para;
0063 class G4Hype;
0064 class G4Polycone;
0065 class G4Polyhedra;
0066
0067
0068
0069
0070
0071
0072
0073
0074 class G4PhantomParameterisation : public G4VPVParameterisation
0075 {
0076 public:
0077
0078
0079
0080
0081 G4PhantomParameterisation();
0082 ~G4PhantomParameterisation() override;
0083
0084 void ComputeTransformation(const G4int, G4VPhysicalVolume *) const override;
0085
0086 G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume *) override;
0087
0088 G4Material* ComputeMaterial(const G4int repNo,
0089 G4VPhysicalVolume* currentVol,
0090 const G4VTouchable* parentTouch=nullptr) override;
0091
0092
0093
0094 void ComputeDimensions (G4Box &, const G4int,
0095 const G4VPhysicalVolume*) const override {}
0096 void ComputeDimensions (G4Tubs&, const G4int,
0097 const G4VPhysicalVolume*) const override {}
0098 void ComputeDimensions (G4Trd&, const G4int,
0099 const G4VPhysicalVolume*) const override {}
0100 void ComputeDimensions (G4Trap&, const G4int,
0101 const G4VPhysicalVolume*) const override {}
0102 void ComputeDimensions (G4Cons&, const G4int,
0103 const G4VPhysicalVolume*) const override {}
0104 void ComputeDimensions (G4Orb&, const G4int,
0105 const G4VPhysicalVolume*) const override {}
0106 void ComputeDimensions (G4Sphere&, const G4int,
0107 const G4VPhysicalVolume*) const override {}
0108 void ComputeDimensions (G4Ellipsoid&,const G4int,
0109 const G4VPhysicalVolume*) const override {}
0110 void ComputeDimensions (G4Torus&, const G4int,
0111 const G4VPhysicalVolume*) const override {}
0112 void ComputeDimensions (G4Para&, const G4int,
0113 const G4VPhysicalVolume*) const override {}
0114 void ComputeDimensions (G4Hype&, const G4int,
0115 const G4VPhysicalVolume*) const override {}
0116 void ComputeDimensions (G4Polycone&, const G4int,
0117 const G4VPhysicalVolume*) const override {}
0118 void ComputeDimensions (G4Polyhedra&, const G4int,
0119 const G4VPhysicalVolume*) const override {}
0120
0121
0122
0123
0124
0125 void BuildContainerSolid( G4VPhysicalVolume* pPhysicalVol );
0126 void BuildContainerSolid( G4VSolid* pMotherSolid );
0127
0128
0129
0130
0131
0132
0133 virtual G4int GetReplicaNo( const G4ThreeVector& localPoint,
0134 const G4ThreeVector& localDir );
0135
0136
0137
0138 inline void SetMaterials(std::vector<G4Material*>& mates );
0139
0140 inline void SetMaterialIndices( std::size_t* matInd );
0141
0142 void SetVoxelDimensions( G4double halfx, G4double halfy, G4double halfz );
0143 void SetNoVoxels( std::size_t nx, std::size_t ny, std::size_t nz );
0144
0145 inline G4double GetVoxelHalfX() const;
0146 inline G4double GetVoxelHalfY() const;
0147 inline G4double GetVoxelHalfZ() const;
0148 inline std::size_t GetNoVoxelsX() const;
0149 inline std::size_t GetNoVoxelsY() const;
0150 inline std::size_t GetNoVoxelsZ() const;
0151 inline std::size_t GetNoVoxels() const;
0152
0153 inline std::vector<G4Material*> GetMaterials() const;
0154 inline std::size_t* GetMaterialIndices() const;
0155 inline G4VSolid* GetContainerSolid() const;
0156
0157 G4ThreeVector GetTranslation(const G4int copyNo ) const;
0158
0159 G4bool SkipEqualMaterials() const;
0160 void SetSkipEqualMaterials( G4bool skip );
0161
0162 std::size_t GetMaterialIndex( std::size_t nx, std::size_t ny, std::size_t nz) const;
0163 std::size_t GetMaterialIndex( std::size_t copyNo) const;
0164
0165 G4Material* GetMaterial( std::size_t nx, std::size_t ny, std::size_t nz) const;
0166 G4Material* GetMaterial( std::size_t copyNo ) const;
0167
0168
0169
0170
0171 void CheckVoxelsFillContainer( G4double contX, G4double contY,
0172 G4double contZ ) const;
0173
0174 private:
0175
0176
0177
0178
0179 void ComputeVoxelIndices(const G4int copyNo, std::size_t& nx,
0180 std::size_t& ny, std::size_t& nz ) const;
0181
0182
0183
0184
0185 void CheckCopyNo( const G4long copyNo ) const;
0186
0187 protected:
0188
0189
0190 G4double fVoxelHalfX = 0.0, fVoxelHalfY = 0.0, fVoxelHalfZ = 0.0;
0191
0192
0193 std::size_t fNoVoxelsX = 0, fNoVoxelsY = 0, fNoVoxelsZ = 0;
0194
0195
0196 std::size_t fNoVoxelsXY = 0;
0197
0198
0199 std::size_t fNoVoxels = 0;
0200
0201
0202 std::vector<G4Material*> fMaterials;
0203
0204
0205 std::size_t* fMaterialIndices = nullptr;
0206
0207
0208 G4VSolid* fContainerSolid = nullptr;
0209
0210
0211 G4double fContainerWallX=0.0, fContainerWallY=0.0, fContainerWallZ=0.0;
0212
0213
0214 G4double kCarTolerance;
0215
0216
0217 G4bool bSkipEqualMaterials = true;
0218 };
0219
0220 #include "G4PhantomParameterisation.icc"
0221
0222 #endif