source: trunk/source/geometry/navigation/include/G4PhantomParameterisation.hh @ 921

Last change on this file since 921 was 921, checked in by garnier, 15 years ago

en test de gl2ps. Problemes de libraries

  • Property svn:executable set to *
File size: 7.5 KB
Line 
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//
27// $Id: G4PhantomParameterisation.hh,v 1.4 2008/01/22 15:02:36 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-02-cand-01 $
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
53class G4VPhysicalVolume;
54class G4VTouchable; 
55class G4VSolid;
56class G4Material;
57
58// Dummy forward declarations ...
59
60class G4Box;
61class G4Tubs;
62class G4Trd;
63class G4Trap;
64class G4Cons;
65class G4Orb;
66class G4Sphere;
67class G4Torus;
68class G4Para;
69class G4Hype;
70class G4Polycone;
71class G4Polyhedra;
72
73class 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 );
115      // Save as container solid the parent of the voxels. Check that the
116      // voxels fill it completely.
117
118    G4int GetReplicaNo( const G4ThreeVector& localPoint,
119                        const G4ThreeVector& localDir );
120      // Get the voxel number corresponding to the point in the container
121      // frame. Use 'localDir' to avoid precision problems at the surfaces.
122
123    // Set and Get methods
124
125    inline void SetMaterials(std::vector<G4Material*>& mates );
126
127    inline void SetMaterialIndices( size_t* matInd );
128
129    void SetVoxelDimensions( G4double halfx, G4double halfy, G4double halfz );
130    void SetNoVoxel( size_t nx, size_t ny, size_t nz );
131   
132    inline G4double GetVoxelHalfX() const;
133    inline G4double GetVoxelHalfY() const;
134    inline G4double GetVoxelHalfZ() const;
135    inline size_t GetNoVoxelX() const;
136    inline size_t GetNoVoxelY() const;
137    inline size_t GetNoVoxelZ() const;
138    inline size_t GetNoVoxel() const;
139
140    inline std::vector<G4Material*> GetMaterials() const;
141    inline size_t* GetMaterialIndices() const;
142    inline G4VSolid* GetContainerSolid() const;
143
144    G4ThreeVector GetTranslation(const G4int copyNo ) const;
145
146    G4bool SkipEqualMaterials() const;
147    void SetSkipEqualMaterials( G4bool skip );
148
149    size_t GetMaterialIndex( size_t nx, size_t ny, size_t nz) const;
150    size_t GetMaterialIndex( size_t copyNo) const;
151
152    G4Material* GetMaterial( size_t nx, size_t ny, size_t nz) const;
153    G4Material* GetMaterial( size_t copyNo ) const;
154
155    void CheckVoxelsFillContainer( G4double contX, G4double contY,
156                                   G4double contZ ) const;
157      // Check that the voxels fill it completely.
158
159  private:
160
161    void ComputeVoxelIndices(const G4int copyNo, size_t& nx,
162                                   size_t& ny, size_t& nz ) const;
163      // Convert the copyNo to voxel numbers in x, y and z.
164
165    void CheckCopyNo( const G4int copyNo ) const;
166      // Check that the copy number is within limits.
167
168  private:
169
170    G4double fVoxelHalfX,fVoxelHalfY,fVoxelHalfZ;
171      // Half dimension of voxels (assume they are boxes).
172    size_t fNoVoxelX,fNoVoxelY,fNoVoxelZ;
173      // Number of voxel in x, y and z dimensions.
174    size_t fNoVoxelXY;
175      // Number of voxels in x times number of voxels in y (for speed-up).
176    size_t fNoVoxel;
177      // Total number of voxels (for speed-up).
178
179    std::vector<G4Material*> fMaterials;
180      // List of materials of the voxels.
181    size_t* fMaterialIndices;
182      // Index in fMaterials that correspond to each voxel.
183
184    G4VSolid* fContainerSolid;
185      // Save as container solid the parent of the voxels.
186      // Check that the voxels fill it completely.
187
188    G4double fContainerWallX, fContainerWallY, fContainerWallZ;
189      // Save position of container wall for speed-up.
190
191    G4double kCarTolerance;
192      // Relative surface tolerance.
193
194    G4bool bSkipEqualMaterials;
195      // Flag to skip surface when two voxel have same material or not
196};
197
198#include "G4PhantomParameterisation.icc"
199
200#endif
Note: See TracBrowser for help on using the repository browser.