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 /// \file runAndEvent/RE02/include/RE02NestedPhantomParameterisation.hh 27 /// \brief Definition of the RE02NestedPhantomParameterisation class 28 // 29 // 30 // 31 #ifndef RE02NESTEDPARAMETERISATION_HH 32 #define RE02NESTEDPARAMETERISATION_HH 33 34 #include "G4ThreeVector.hh" 35 #include "G4Types.hh" 36 #include "G4VNestedParameterisation.hh" 37 #include "G4VTouchable.hh" 38 39 #include <vector> 40 41 class G4VPhysicalVolume; 42 class G4VSolid; 43 class G4Material; 44 45 // CSG Entities which may be parameterised/replicated 46 // 47 class G4Box; 48 class G4Tubs; 49 class G4Trd; 50 class G4Trap; 51 class G4Cons; 52 class G4Sphere; 53 class G4Orb; 54 class G4Ellipsoid; 55 class G4Torus; 56 class G4Para; 57 class G4Polycone; 58 class G4Polyhedra; 59 class G4Hype; 60 61 // 62 /// A nested parameterisation class for a phantom 63 /// 64 /// (Description) 65 /// This parameterisation handles material and transfomation of voxles. 66 /// 67 /// - G4Material* ComputeMaterial(G4VPhysicalVolume *currentVol, 68 /// const G4int repNo, 69 /// const G4VTouchable *parentTouch=0) 70 /// returns material. 71 /// if ix%2==0 && iy%2==0 && iz%2==0 then fMat[0] 72 /// else fMat[1] 73 /// 74 /// - G4int GetNumberOfMaterials() const 75 /// returns the number of material defined in fMat 76 /// 77 /// - G4Material* GetMaterial(G4int idx) const 78 /// returns the i-th material of fMat 79 /// 80 /// - void ComputeTransformation(const G4int no, 81 /// G4VPhysicalVolume *currentPV) const 82 /// returns a transformation with the physical volume of the 2nd argument 83 /// according to copyNo 84 /// Its position is defined as G4ThreeVector(0.,0.,fpZ[copyNo]). 85 /// 86 /// - void ComputeDimensions(G4Box &, const G4int, 87 /// const G4VPhysicalVolume *) const 88 /// returns dimensions of this parameterized volume with the physical 89 /// volume of the 3rd argument. 90 /// 91 // 92 class RE02NestedPhantomParameterisation : public G4VNestedParameterisation 93 { 94 public: // with description 95 RE02NestedPhantomParameterisation(const G4ThreeVector& voxelSize, G4int nz, 96 std::vector<G4Material*>& mat); 97 ~RE02NestedPhantomParameterisation(); 98 99 // Methods required in derived classes 100 // ----------------------------------- 101 G4Material* ComputeMaterial(G4VPhysicalVolume* currentVol, const G4int repNo, 102 const G4VTouchable* parentTouch = 0); 103 // Required method, as it is the reason for this class. 104 // Must cope with parentTouch=0 for navigator's SetupHierarchy 105 106 G4int GetNumberOfMaterials() const; 107 G4Material* GetMaterial(G4int idx) const; 108 // Needed to define materials for instances of Nested Parameterisation 109 // Current convention: each call should return the materials 110 // of all instances with the same mother/ancestor volume. 111 112 void ComputeTransformation(const G4int no, G4VPhysicalVolume* currentPV) const; 113 114 // Methods optional in derived classes 115 // ----------------------------------- 116 117 // Additional standard Parameterisation methods, 118 // which can be optionally defined, in case solid is used. 119 120 void ComputeDimensions(G4Box&, const G4int, const G4VPhysicalVolume*) const; 121 122 private: // Dummy declarations to get rid of warnings ... 123 void ComputeDimensions(G4Trd&, const G4int, const G4VPhysicalVolume*) const {} 124 void ComputeDimensions(G4Trap&, const G4int, const G4VPhysicalVolume*) const {} 125 void ComputeDimensions(G4Cons&, const G4int, const G4VPhysicalVolume*) const {} 126 void ComputeDimensions(G4Sphere&, const G4int, const G4VPhysicalVolume*) const {} 127 void ComputeDimensions(G4Orb&, const G4int, const G4VPhysicalVolume*) const {} 128 void ComputeDimensions(G4Ellipsoid&, const G4int, const G4VPhysicalVolume*) const {} 129 void ComputeDimensions(G4Torus&, const G4int, const G4VPhysicalVolume*) const {} 130 void ComputeDimensions(G4Para&, const G4int, const G4VPhysicalVolume*) const {} 131 void ComputeDimensions(G4Hype&, const G4int, const G4VPhysicalVolume*) const {} 132 void ComputeDimensions(G4Tubs&, const G4int, const G4VPhysicalVolume*) const {} 133 void ComputeDimensions(G4Polycone&, const G4int, const G4VPhysicalVolume*) const {} 134 void ComputeDimensions(G4Polyhedra&, const G4int, const G4VPhysicalVolume*) const {} 135 // G4Material* ComputeMaterial(const G4int repNo, 136 // G4VPhysicalVolume* currentVol, 137 // const G4VTouchable* parentTouch) 138 // { return ComputeMaterial( currentVol, repNo, parentTouch ); } 139 using G4VNestedParameterisation::ComputeMaterial; 140 141 private: 142 G4double fdX, fdY, fdZ; 143 G4int fNz; 144 // 145 std::vector<G4double> fpZ; 146 std::vector<G4Material*> fMat; 147 }; 148 149 #endif 150