![]() |
|
|||
File indexing completed on 2025-02-23 09:22:43
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 /// \file runAndEvent/RE02/src/RE02NestedPhantomParameterisation.cc 0027 /// \brief Implementation of the RE02NestedPhantomParameterisation class 0028 // 0029 // 0030 /////////////////////////////////////////////////////////////////////////////// 0031 #include "RE02NestedPhantomParameterisation.hh" 0032 0033 #include "G4Box.hh" 0034 #include "G4LogicalVolume.hh" 0035 #include "G4Material.hh" 0036 #include "G4ThreeVector.hh" 0037 #include "G4VPhysicalVolume.hh" 0038 #include "G4VTouchable.hh" 0039 0040 //======================================================================= 0041 // (RE02NestedPhantomParameterisation) 0042 // 0043 // (Description) 0044 // Class for nested parameterisation. 0045 // This parameterisation handles material and transfomation of voxles. 0046 // 0047 // T.Aso Created. Nov.2007. 0048 // 0049 //////////////////////////////////////////////////////////////////// 0050 0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0052 RE02NestedPhantomParameterisation ::RE02NestedPhantomParameterisation( 0053 const G4ThreeVector& voxelSize, G4int nz, std::vector<G4Material*>& mat) 0054 : G4VNestedParameterisation(), 0055 fdX(voxelSize.x()), 0056 fdY(voxelSize.y()), 0057 fdZ(voxelSize.z()), 0058 fNz(nz), 0059 fMat(mat) 0060 { 0061 // Position of voxels. 0062 // x and y positions are already defined in DetectorConstruction 0063 // by using replicated volume. Here only we need to define is z positions 0064 // of voxles. 0065 fpZ.clear(); 0066 G4double zp; 0067 for (G4int iz = 0; iz < fNz; iz++) { 0068 zp = (-fNz + 1 + 2 * iz) * fdZ; 0069 fpZ.push_back(zp); 0070 } 0071 } 0072 0073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0074 RE02NestedPhantomParameterisation::~RE02NestedPhantomParameterisation() 0075 { 0076 fpZ.clear(); 0077 } 0078 0079 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0080 // 0081 // Material assignment to geometry. 0082 // 0083 G4Material* RE02NestedPhantomParameterisation ::ComputeMaterial(G4VPhysicalVolume* /*currentVol*/, 0084 const G4int copyNo, 0085 const G4VTouchable* parentTouch) 0086 { 0087 if (parentTouch == 0) 0088 return fMat[0]; // protection for initialization and 0089 // vis at idle state 0090 // Copy number of voxels. 0091 // Copy number of X and Y are obtained from replication number. 0092 // Copy nymber of Z is the copy number of current voxel. 0093 G4int ix = parentTouch->GetReplicaNumber(0); 0094 G4int iy = parentTouch->GetReplicaNumber(1); 0095 G4int iz = copyNo; 0096 // For demonstration purpose,a couple of materials are chosen alternately. 0097 G4Material* mat = 0; 0098 if (ix % 2 == 0 && iy % 2 == 0 && iz % 2 == 0) 0099 mat = fMat[0]; 0100 else 0101 mat = fMat[1]; 0102 0103 return mat; 0104 } 0105 0106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0107 // 0108 // Number of Materials 0109 // Material scanner is required for preparing physics tables and so on before 0110 // stating simulation, so that G4 has to know number of materials. 0111 G4int RE02NestedPhantomParameterisation::GetNumberOfMaterials() const 0112 { 0113 return fMat.size(); 0114 } 0115 0116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0117 // 0118 // GetMaterial 0119 // This is needed for material scanner and realizing geometry. 0120 // 0121 G4Material* RE02NestedPhantomParameterisation::GetMaterial(G4int i) const 0122 { 0123 return fMat[i]; 0124 } 0125 0126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0127 // 0128 // Transformation of voxels. 0129 // 0130 void RE02NestedPhantomParameterisation ::ComputeTransformation(const G4int copyNo, 0131 G4VPhysicalVolume* physVol) const 0132 { 0133 G4ThreeVector position(0., 0., fpZ[copyNo]); 0134 physVol->SetTranslation(position); 0135 } 0136 0137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0138 // 0139 // Dimensions are always same in this RE02 example. 0140 // 0141 void RE02NestedPhantomParameterisation ::ComputeDimensions(G4Box& box, const G4int, 0142 const G4VPhysicalVolume*) const 0143 { 0144 box.SetXHalfLength(fdX); 0145 box.SetYHalfLength(fdY); 0146 box.SetZHalfLength(fdZ); 0147 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |