G4PhantomParameterisation.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 //
00030 // class G4PhantomParameterisation
00031 //
00032 // Class description:
00033 // 
00034 // Describes regular parameterisations: a set of boxes of equal dimension
00035 // in the x, y and z dimensions. The G4PVParameterised volume using this
00036 // class must be placed inside a volume that is completely filled by these
00037 // boxes.
00038 
00039 // History:
00040 // - Created.    P. Arce, May 2007
00041 // *********************************************************************
00042 
00043 #ifndef G4PhantomParameterisation_HH
00044 #define G4PhantomParameterisation_HH
00045 
00046 #include <vector>
00047 
00048 #include "G4Types.hh"
00049 #include "G4VPVParameterisation.hh"
00050 #include "G4AffineTransform.hh"
00051 
00052 class G4VPhysicalVolume;
00053 class G4VTouchable; 
00054 class G4VSolid;
00055 class G4Material;
00056 
00057 // Dummy forward declarations ...
00058 
00059 class G4Box;
00060 class G4Tubs;
00061 class G4Trd;
00062 class G4Trap;
00063 class G4Cons;
00064 class G4Orb;
00065 class G4Sphere;
00066 class G4Torus;
00067 class G4Para;
00068 class G4Hype;
00069 class G4Polycone;
00070 class G4Polyhedra;
00071 
00072 class G4PhantomParameterisation : public G4VPVParameterisation
00073 {
00074   public:  // with description
00075 
00076     G4PhantomParameterisation();
00077    ~G4PhantomParameterisation();
00078 
00079     virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const;
00080   
00081     virtual G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume *);
00082   
00083     virtual G4Material* ComputeMaterial(const G4int repNo, 
00084                                               G4VPhysicalVolume *currentVol,
00085                                         const G4VTouchable *parentTouch=0);
00086   // Dummy declarations ...
00087 
00088     void ComputeDimensions (G4Box &, const G4int,
00089                             const G4VPhysicalVolume*) const {}
00090     void ComputeDimensions (G4Tubs&, const G4int,
00091                             const G4VPhysicalVolume*) const {}
00092     void ComputeDimensions (G4Trd&, const G4int,
00093                             const G4VPhysicalVolume*) const {}
00094     void ComputeDimensions (G4Trap&, const G4int,
00095                             const G4VPhysicalVolume*) const {}
00096     void ComputeDimensions (G4Cons&, const G4int,
00097                             const G4VPhysicalVolume*) const {}
00098     void ComputeDimensions (G4Orb&, const G4int,
00099                             const G4VPhysicalVolume*) const {}
00100     void ComputeDimensions (G4Sphere&, const G4int,
00101                             const G4VPhysicalVolume*) const {}
00102     void ComputeDimensions (G4Torus&, const G4int,
00103                             const G4VPhysicalVolume*) const {}
00104     void ComputeDimensions (G4Para&, const G4int,
00105                             const G4VPhysicalVolume*) const {}
00106     void ComputeDimensions (G4Hype&, const G4int,
00107                             const G4VPhysicalVolume*) const {}
00108     void ComputeDimensions (G4Polycone&, const G4int,
00109                             const G4VPhysicalVolume*) const {}
00110     void ComputeDimensions (G4Polyhedra&, const G4int,
00111                             const G4VPhysicalVolume*) const {}
00112   
00113     void BuildContainerSolid( G4VPhysicalVolume *pPhysicalVol );
00114     void BuildContainerSolid( G4VSolid *pMotherSolid );
00115       // Save as container solid the parent of the voxels. Check that the
00116       // voxels fill it completely.
00117 
00118     virtual G4int GetReplicaNo( const G4ThreeVector& localPoint,
00119                         const G4ThreeVector& localDir );
00120       // Get the voxel number corresponding to the point in the container
00121       // frame. Use 'localDir' to avoid precision problems at the surfaces.
00122 
00123     // Set and Get methods
00124 
00125     inline void SetMaterials(std::vector<G4Material*>& mates );
00126 
00127     inline void SetMaterialIndices( size_t* matInd );
00128 
00129     void SetVoxelDimensions( G4double halfx, G4double halfy, G4double halfz );
00130     void SetNoVoxel( size_t nx, size_t ny, size_t nz );
00131     
00132     inline G4double GetVoxelHalfX() const;
00133     inline G4double GetVoxelHalfY() const;
00134     inline G4double GetVoxelHalfZ() const;
00135     inline size_t GetNoVoxelX() const;
00136     inline size_t GetNoVoxelY() const;
00137     inline size_t GetNoVoxelZ() const;
00138     inline size_t GetNoVoxel() const;
00139 
00140     inline std::vector<G4Material*> GetMaterials() const;
00141     inline size_t* GetMaterialIndices() const;
00142     inline G4VSolid* GetContainerSolid() const;
00143 
00144     G4ThreeVector GetTranslation(const G4int copyNo ) const;
00145 
00146     G4bool SkipEqualMaterials() const;
00147     void SetSkipEqualMaterials( G4bool skip );
00148 
00149     size_t GetMaterialIndex( size_t nx, size_t ny, size_t nz) const;
00150     size_t GetMaterialIndex( size_t copyNo) const;
00151 
00152     G4Material* GetMaterial( size_t nx, size_t ny, size_t nz) const;
00153     G4Material* GetMaterial( size_t copyNo ) const;
00154 
00155     void CheckVoxelsFillContainer( G4double contX, G4double contY,
00156                                    G4double contZ ) const;
00157       // Check that the voxels fill it completely.
00158 
00159   private:
00160 
00161     void ComputeVoxelIndices(const G4int copyNo, size_t& nx,
00162                                    size_t& ny, size_t& nz ) const;
00163       // Convert the copyNo to voxel numbers in x, y and z.
00164 
00165     void CheckCopyNo( const G4int copyNo ) const;
00166       // Check that the copy number is within limits.
00167 
00168   protected:
00169 
00170     G4double fVoxelHalfX,fVoxelHalfY,fVoxelHalfZ;
00171       // Half dimension of voxels (assume they are boxes).
00172     size_t fNoVoxelX,fNoVoxelY,fNoVoxelZ;
00173       // Number of voxel in x, y and z dimensions.
00174     size_t fNoVoxelXY;
00175       // Number of voxels in x times number of voxels in y (for speed-up).
00176     size_t fNoVoxel;
00177       // Total number of voxels (for speed-up).
00178 
00179     std::vector<G4Material*> fMaterials;
00180       // List of materials of the voxels.
00181     size_t* fMaterialIndices;
00182       // Index in fMaterials that correspond to each voxel.
00183 
00184     G4VSolid* fContainerSolid;
00185       // Save as container solid the parent of the voxels.
00186       // Check that the voxels fill it completely.
00187 
00188     G4double fContainerWallX, fContainerWallY, fContainerWallZ;
00189       // Save position of container wall for speed-up.
00190 
00191     G4double kCarTolerance;
00192       // Relative surface tolerance.
00193 
00194     G4bool bSkipEqualMaterials;
00195       // Flag to skip surface when two voxel have same material or not
00196 };
00197 
00198 #include "G4PhantomParameterisation.icc"
00199 
00200 #endif

Generated on Mon May 27 17:49:18 2013 for Geant4 by  doxygen 1.4.7