[807] | 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: S.Guatelli, guatelli@ge.infn.it |
---|
| 28 | // |
---|
| 29 | // ************************************ |
---|
| 30 | // * * |
---|
| 31 | // * RemSimROGeometry.cc * |
---|
| 32 | // * * |
---|
| 33 | // ************************************ |
---|
| 34 | // |
---|
| 35 | // $Id: RemSimROGeometry.cc,v 1.6 2006/06/29 16:24:13 gunter Exp $ |
---|
[1337] | 36 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[807] | 37 | // |
---|
| 38 | #include "RemSimROGeometry.hh" |
---|
| 39 | #include "RemSimDummySD.hh" |
---|
| 40 | #include "G4LogicalVolume.hh" |
---|
| 41 | #include "G4VPhysicalVolume.hh" |
---|
| 42 | #include "G4PVPlacement.hh" |
---|
| 43 | #include "G4PVReplica.hh" |
---|
| 44 | #include "G4SDManager.hh" |
---|
| 45 | #include "G4Box.hh" |
---|
| 46 | #include "G4Tubs.hh" |
---|
| 47 | #include "G4SubtractionSolid.hh" |
---|
| 48 | #include "G4ThreeVector.hh" |
---|
| 49 | #include "G4Material.hh" |
---|
| 50 | |
---|
| 51 | RemSimROGeometry::RemSimROGeometry(G4double astronautDimX, |
---|
| 52 | G4double astronautDimY, |
---|
| 53 | G4double astronautDimZ, |
---|
| 54 | G4int numberOfVoxelsZ, |
---|
| 55 | G4double trans): |
---|
| 56 | |
---|
| 57 | astronautDimensionX(astronautDimX), |
---|
| 58 | astronautDimensionY(astronautDimY), |
---|
| 59 | astronautDimensionZ(astronautDimZ), |
---|
| 60 | numberOfVoxelsAlongZ(numberOfVoxelsZ), |
---|
| 61 | translation(trans), |
---|
| 62 | ROAstronautZDivisionPhys(0) |
---|
| 63 | { |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | RemSimROGeometry::~RemSimROGeometry() |
---|
| 67 | { |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | G4VPhysicalVolume* RemSimROGeometry::Build() |
---|
| 71 | { |
---|
| 72 | // A dummy material is used to fill the volumes of the readout geometry. |
---|
| 73 | // (It will be allowed to set a NULL pointer in volumes of such virtual |
---|
| 74 | // division in future, since this material is irrelevant for tracking.) |
---|
| 75 | |
---|
| 76 | G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3); |
---|
| 77 | |
---|
| 78 | G4double worldDimensionX = 30.0*m; |
---|
| 79 | G4double worldDimensionY = 30.0*m; |
---|
| 80 | G4double worldDimensionZ = 30.0*m; |
---|
| 81 | |
---|
| 82 | // world volume of ROGeometry ... |
---|
| 83 | G4Box *ROWorld = new G4Box("ROWorld", |
---|
| 84 | worldDimensionX, |
---|
| 85 | worldDimensionY, |
---|
| 86 | worldDimensionZ); |
---|
| 87 | |
---|
| 88 | G4LogicalVolume *ROWorldLog = new G4LogicalVolume(ROWorld, |
---|
| 89 | dummyMat, |
---|
| 90 | "ROWorldLog", |
---|
| 91 | 0,0,0); |
---|
| 92 | |
---|
| 93 | G4VPhysicalVolume *ROWorldPhys = new G4PVPlacement(0, |
---|
| 94 | G4ThreeVector(), |
---|
| 95 | "ROWorldPhys", |
---|
| 96 | ROWorldLog, |
---|
| 97 | 0,false,0); |
---|
| 98 | |
---|
| 99 | // ROGeometry corresponding to the phantom |
---|
| 100 | G4Box *ROAstronaut = new G4Box("ROAstronaut", |
---|
| 101 | astronautDimensionX/2., |
---|
| 102 | astronautDimensionY/2., |
---|
| 103 | astronautDimensionZ/2.); |
---|
| 104 | |
---|
| 105 | G4LogicalVolume *ROAstronautLog = new G4LogicalVolume(ROAstronaut, |
---|
| 106 | dummyMat, |
---|
| 107 | "ROAstronautLog", |
---|
| 108 | 0,0,0); |
---|
| 109 | |
---|
| 110 | G4VPhysicalVolume *ROAstronautPhys = new G4PVPlacement(0, |
---|
| 111 | G4ThreeVector(0.,0.,translation), |
---|
| 112 | "AstronautPhys", |
---|
| 113 | ROAstronautLog, |
---|
| 114 | ROWorldPhys, |
---|
| 115 | false,0); |
---|
| 116 | |
---|
| 117 | // Z division ... |
---|
| 118 | G4double voxelSizeZ = astronautDimensionZ/numberOfVoxelsAlongZ; |
---|
| 119 | |
---|
| 120 | G4Box *ROAstronautZDivision = new G4Box("ROAstronautZDivision", |
---|
| 121 | astronautDimensionX/2, |
---|
| 122 | astronautDimensionY/2., |
---|
| 123 | voxelSizeZ/2.); |
---|
| 124 | |
---|
| 125 | G4LogicalVolume *ROAstronautZDivisionLog = new G4LogicalVolume(ROAstronautZDivision, |
---|
| 126 | dummyMat, |
---|
| 127 | "ROAstronautZDivisionLog", |
---|
| 128 | 0,0,0); |
---|
| 129 | |
---|
| 130 | ROAstronautZDivisionPhys = new G4PVReplica("ROAstronautXDivisionPhys", |
---|
| 131 | ROAstronautZDivisionLog, |
---|
| 132 | ROAstronautPhys, |
---|
| 133 | kZAxis, |
---|
| 134 | numberOfVoxelsAlongZ, |
---|
| 135 | voxelSizeZ); |
---|
| 136 | RemSimDummySD *dummySD = new RemSimDummySD; |
---|
| 137 | ROAstronautZDivisionLog -> SetSensitiveDetector(dummySD); |
---|
| 138 | |
---|
| 139 | return ROWorldPhys; |
---|
| 140 | } |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | |
---|