Geant4 Cross Reference |
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 // Code developed by: 28 // S.Guatelli, M. Large and A. Malaroda, University of Wollongong 29 // 30 // Code based on the extended example DICOM 31 // 32 #ifndef ICRP110PhantomNestedParameterisation_HH 33 #define ICRP110PhantomNestedParameterisation_HH 34 35 #include <vector> 36 #include <map> 37 38 #include "G4Types.hh" 39 #include "G4ThreeVector.hh" 40 #include "G4VTouchable.hh" 41 #include "G4VNestedParameterisation.hh" 42 43 class G4VPhysicalVolume; 44 class G4VSolid; 45 class G4Material; 46 class G4VisAttributes; 47 48 // CSG Entities which may be parameterised/replicated 49 class G4Box; 50 class G4Tubs; 51 class G4Trd; 52 class G4Trap; 53 class G4Cons; 54 class G4Sphere; 55 class G4Ellipsoid; 56 class G4Orb; 57 class G4Torus; 58 class G4Para; 59 class G4Polycone; 60 class G4Polyhedra; 61 class G4Hype; 62 63 /// Implements a G4VNestedParameterisation 64 65 class ICRP110PhantomNestedParameterisation : public G4VNestedParameterisation 66 { 67 public: 68 69 explicit ICRP110PhantomNestedParameterisation(const G4ThreeVector& voxelSize, 70 std::vector<G4Material*>& mat, 71 G4int fnX_ = 0, G4int fnY_ = 0, G4int fnZ_ = 0); 72 // the total number of voxels along X, Y and Z 73 // are initialised to zero 74 75 ~ICRP110PhantomNestedParameterisation(); 76 77 78 virtual G4Material* ComputeMaterial(G4VPhysicalVolume *currentVol, 79 const G4int repNo, 80 const G4VTouchable *parentTouch ); 81 G4int GetNumberOfMaterials() const; 82 G4Material* GetMaterial(G4int idx) const; 83 84 G4int GetMaterialIndex( G4int copyNo) const; 85 86 void SetMaterialIndices( size_t* matInd ){ fMaterialIndices = matInd;} 87 // This method passes the information of the matID associated to each voxel 88 // from the DetectorConstruction to the NestedParameterisation class 89 90 void SetNoVoxel( G4int nx, G4int ny, G4int nz ); 91 // This method passes the total number of voxels along X, Y and Z from 92 // the DetectorConstruction to the NestedParameterisation class 93 94 void ComputeTransformation(const G4int no, 95 G4VPhysicalVolume *currentPV) const; 96 97 // Additional standard Parameterisation methods, 98 // which can be optionally defined, in case solid is used. 99 void ComputeDimensions(G4Box &, const G4int, 100 const G4VPhysicalVolume *) const; 101 102 103 private: // Dummy declarations to get rid of warnings ... 104 105 void ComputeDimensions (G4Trd&, const G4int, 106 const G4VPhysicalVolume*) const {} 107 void ComputeDimensions (G4Trap&, const G4int, 108 const G4VPhysicalVolume*) const {} 109 void ComputeDimensions (G4Cons&, const G4int, 110 const G4VPhysicalVolume*) const {} 111 void ComputeDimensions (G4Sphere&, const G4int, 112 const G4VPhysicalVolume*) const {} 113 void ComputeDimensions (G4Ellipsoid&, const G4int, 114 const G4VPhysicalVolume*) const {} 115 void ComputeDimensions (G4Orb&, const G4int, 116 const G4VPhysicalVolume*) const {} 117 void ComputeDimensions (G4Torus&, const G4int, 118 const G4VPhysicalVolume*) const {} 119 void ComputeDimensions (G4Para&, const G4int, 120 const G4VPhysicalVolume*) const {} 121 void ComputeDimensions (G4Hype&, const G4int, 122 const G4VPhysicalVolume*) const {} 123 void ComputeDimensions (G4Tubs&, const G4int, 124 const G4VPhysicalVolume*) const {} 125 void ComputeDimensions (G4Polycone&, const G4int, 126 const G4VPhysicalVolume*) const {} 127 void ComputeDimensions (G4Polyhedra&, const G4int, 128 const G4VPhysicalVolume*) const {} 129 130 void ReadColourData(); 131 132 using G4VNestedParameterisation::ComputeMaterial; 133 134 private: 135 136 G4double fdX,fdY,fdZ; // Half of the voxels along X, Y and Z 137 G4int fnX,fnY,fnZ; // Number of voxels along X, Y and Z 138 std::vector<G4Material*> fMaterials; // Vector with materials 139 size_t* fMaterialIndices; // Index of the material associated to each voxel 140 std::map<G4String,G4VisAttributes*> fColours; 141 }; 142 #endif 143