[831] | 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 | // |
---|
[1058] | 27 | // $Id: G4PhantomParameterisation.hh,v 1.5 2009/05/19 18:27:03 arce Exp $ |
---|
[1337] | 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[831] | 29 | // |
---|
| 30 | // |
---|
| 31 | // class G4PhantomParameterisation |
---|
| 32 | // |
---|
| 33 | // Class description: |
---|
| 34 | // |
---|
| 35 | // Describes regular parameterisations: a set of boxes of equal dimension |
---|
| 36 | // in the x, y and z dimensions. The G4PVParameterised volume using this |
---|
| 37 | // class must be placed inside a volume that is completely filled by these |
---|
| 38 | // boxes. |
---|
| 39 | |
---|
| 40 | // History: |
---|
| 41 | // - Created. P. Arce, May 2007 |
---|
| 42 | // ********************************************************************* |
---|
| 43 | |
---|
| 44 | #ifndef G4PhantomParameterisation_HH |
---|
| 45 | #define G4PhantomParameterisation_HH |
---|
| 46 | |
---|
| 47 | #include <vector> |
---|
| 48 | |
---|
| 49 | #include "G4Types.hh" |
---|
| 50 | #include "G4VPVParameterisation.hh" |
---|
| 51 | #include "G4AffineTransform.hh" |
---|
| 52 | |
---|
| 53 | class G4VPhysicalVolume; |
---|
| 54 | class G4VTouchable; |
---|
| 55 | class G4VSolid; |
---|
| 56 | class G4Material; |
---|
| 57 | |
---|
| 58 | // Dummy forward declarations ... |
---|
| 59 | |
---|
| 60 | class G4Box; |
---|
| 61 | class G4Tubs; |
---|
| 62 | class G4Trd; |
---|
| 63 | class G4Trap; |
---|
| 64 | class G4Cons; |
---|
| 65 | class G4Orb; |
---|
| 66 | class G4Sphere; |
---|
| 67 | class G4Torus; |
---|
| 68 | class G4Para; |
---|
| 69 | class G4Hype; |
---|
| 70 | class G4Polycone; |
---|
| 71 | class G4Polyhedra; |
---|
| 72 | |
---|
| 73 | class G4PhantomParameterisation : public G4VPVParameterisation |
---|
| 74 | { |
---|
| 75 | public: // with description |
---|
| 76 | |
---|
| 77 | G4PhantomParameterisation(); |
---|
| 78 | ~G4PhantomParameterisation(); |
---|
| 79 | |
---|
| 80 | virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const; |
---|
| 81 | |
---|
| 82 | virtual G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume *); |
---|
| 83 | |
---|
| 84 | virtual G4Material* ComputeMaterial(const G4int repNo, |
---|
| 85 | G4VPhysicalVolume *currentVol, |
---|
| 86 | const G4VTouchable *parentTouch=0); |
---|
| 87 | // Dummy declarations ... |
---|
| 88 | |
---|
| 89 | void ComputeDimensions (G4Box &, const G4int, |
---|
| 90 | const G4VPhysicalVolume*) const {} |
---|
| 91 | void ComputeDimensions (G4Tubs&, const G4int, |
---|
| 92 | const G4VPhysicalVolume*) const {} |
---|
| 93 | void ComputeDimensions (G4Trd&, const G4int, |
---|
| 94 | const G4VPhysicalVolume*) const {} |
---|
| 95 | void ComputeDimensions (G4Trap&, const G4int, |
---|
| 96 | const G4VPhysicalVolume*) const {} |
---|
| 97 | void ComputeDimensions (G4Cons&, const G4int, |
---|
| 98 | const G4VPhysicalVolume*) const {} |
---|
| 99 | void ComputeDimensions (G4Orb&, const G4int, |
---|
| 100 | const G4VPhysicalVolume*) const {} |
---|
| 101 | void ComputeDimensions (G4Sphere&, const G4int, |
---|
| 102 | const G4VPhysicalVolume*) const {} |
---|
| 103 | void ComputeDimensions (G4Torus&, const G4int, |
---|
| 104 | const G4VPhysicalVolume*) const {} |
---|
| 105 | void ComputeDimensions (G4Para&, const G4int, |
---|
| 106 | const G4VPhysicalVolume*) const {} |
---|
| 107 | void ComputeDimensions (G4Hype&, const G4int, |
---|
| 108 | const G4VPhysicalVolume*) const {} |
---|
| 109 | void ComputeDimensions (G4Polycone&, const G4int, |
---|
| 110 | const G4VPhysicalVolume*) const {} |
---|
| 111 | void ComputeDimensions (G4Polyhedra&, const G4int, |
---|
| 112 | const G4VPhysicalVolume*) const {} |
---|
| 113 | |
---|
| 114 | void BuildContainerSolid( G4VPhysicalVolume *pPhysicalVol ); |
---|
[1058] | 115 | void BuildContainerSolid( G4VSolid *pMotherSolid ); |
---|
[831] | 116 | // Save as container solid the parent of the voxels. Check that the |
---|
| 117 | // voxels fill it completely. |
---|
| 118 | |
---|
| 119 | G4int GetReplicaNo( const G4ThreeVector& localPoint, |
---|
| 120 | const G4ThreeVector& localDir ); |
---|
| 121 | // Get the voxel number corresponding to the point in the container |
---|
| 122 | // frame. Use 'localDir' to avoid precision problems at the surfaces. |
---|
| 123 | |
---|
| 124 | // Set and Get methods |
---|
| 125 | |
---|
| 126 | inline void SetMaterials(std::vector<G4Material*>& mates ); |
---|
| 127 | |
---|
| 128 | inline void SetMaterialIndices( size_t* matInd ); |
---|
| 129 | |
---|
| 130 | void SetVoxelDimensions( G4double halfx, G4double halfy, G4double halfz ); |
---|
| 131 | void SetNoVoxel( size_t nx, size_t ny, size_t nz ); |
---|
| 132 | |
---|
| 133 | inline G4double GetVoxelHalfX() const; |
---|
| 134 | inline G4double GetVoxelHalfY() const; |
---|
| 135 | inline G4double GetVoxelHalfZ() const; |
---|
| 136 | inline size_t GetNoVoxelX() const; |
---|
| 137 | inline size_t GetNoVoxelY() const; |
---|
| 138 | inline size_t GetNoVoxelZ() const; |
---|
| 139 | inline size_t GetNoVoxel() const; |
---|
| 140 | |
---|
| 141 | inline std::vector<G4Material*> GetMaterials() const; |
---|
| 142 | inline size_t* GetMaterialIndices() const; |
---|
| 143 | inline G4VSolid* GetContainerSolid() const; |
---|
| 144 | |
---|
| 145 | G4ThreeVector GetTranslation(const G4int copyNo ) const; |
---|
| 146 | |
---|
| 147 | G4bool SkipEqualMaterials() const; |
---|
| 148 | void SetSkipEqualMaterials( G4bool skip ); |
---|
| 149 | |
---|
| 150 | size_t GetMaterialIndex( size_t nx, size_t ny, size_t nz) const; |
---|
| 151 | size_t GetMaterialIndex( size_t copyNo) const; |
---|
| 152 | |
---|
| 153 | G4Material* GetMaterial( size_t nx, size_t ny, size_t nz) const; |
---|
| 154 | G4Material* GetMaterial( size_t copyNo ) const; |
---|
| 155 | |
---|
| 156 | void CheckVoxelsFillContainer( G4double contX, G4double contY, |
---|
| 157 | G4double contZ ) const; |
---|
| 158 | // Check that the voxels fill it completely. |
---|
| 159 | |
---|
| 160 | private: |
---|
| 161 | |
---|
| 162 | void ComputeVoxelIndices(const G4int copyNo, size_t& nx, |
---|
| 163 | size_t& ny, size_t& nz ) const; |
---|
| 164 | // Convert the copyNo to voxel numbers in x, y and z. |
---|
| 165 | |
---|
| 166 | void CheckCopyNo( const G4int copyNo ) const; |
---|
| 167 | // Check that the copy number is within limits. |
---|
| 168 | |
---|
| 169 | private: |
---|
| 170 | |
---|
| 171 | G4double fVoxelHalfX,fVoxelHalfY,fVoxelHalfZ; |
---|
| 172 | // Half dimension of voxels (assume they are boxes). |
---|
| 173 | size_t fNoVoxelX,fNoVoxelY,fNoVoxelZ; |
---|
| 174 | // Number of voxel in x, y and z dimensions. |
---|
| 175 | size_t fNoVoxelXY; |
---|
| 176 | // Number of voxels in x times number of voxels in y (for speed-up). |
---|
| 177 | size_t fNoVoxel; |
---|
| 178 | // Total number of voxels (for speed-up). |
---|
| 179 | |
---|
| 180 | std::vector<G4Material*> fMaterials; |
---|
| 181 | // List of materials of the voxels. |
---|
| 182 | size_t* fMaterialIndices; |
---|
| 183 | // Index in fMaterials that correspond to each voxel. |
---|
| 184 | |
---|
| 185 | G4VSolid* fContainerSolid; |
---|
| 186 | // Save as container solid the parent of the voxels. |
---|
| 187 | // Check that the voxels fill it completely. |
---|
| 188 | |
---|
| 189 | G4double fContainerWallX, fContainerWallY, fContainerWallZ; |
---|
| 190 | // Save position of container wall for speed-up. |
---|
| 191 | |
---|
| 192 | G4double kCarTolerance; |
---|
| 193 | // Relative surface tolerance. |
---|
| 194 | |
---|
| 195 | G4bool bSkipEqualMaterials; |
---|
| 196 | // Flag to skip surface when two voxel have same material or not |
---|
| 197 | }; |
---|
| 198 | |
---|
| 199 | #include "G4PhantomParameterisation.icc" |
---|
| 200 | |
---|
| 201 | #endif |
---|