Changeset 1230 for trunk/examples/extended/medical/DICOM/src
- Timestamp:
- Jan 8, 2010, 3:02:48 PM (14 years ago)
- Location:
- trunk/examples/extended/medical/DICOM/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/extended/medical/DICOM/src/DicomDetectorConstruction.cc
r807 r1230 451 451 } 452 452 453 454 #include "G4SDManager.hh" 455 #include "G4MultiFunctionalDetector.hh" 456 #include "G4PSDoseDeposit_RegNav.hh" 457 458 //------------------------------------------------------------- 459 void DicomDetectorConstruction::SetScorer(G4LogicalVolume* voxel_logic) 460 { 461 462 G4SDManager* SDman = G4SDManager::GetSDMpointer(); 463 // 464 // Sensitive Detector Name 465 G4String concreteSDname = "PatientSD"; 466 467 //------------------------ 468 // MultiFunctionalDetector 469 //------------------------ 470 // 471 // Define MultiFunctionalDetector with name. 472 G4MultiFunctionalDetector* MFDet = new G4MultiFunctionalDetector(concreteSDname); 473 SDman->AddNewDetector( MFDet ); // Register SD to SDManager 474 475 voxel_logic->SetSensitiveDetector(MFDet); 476 477 G4PSDoseDeposit_RegNav* scorer = new G4PSDoseDeposit_RegNav("DoseDeposit"); 478 MFDet->RegisterPrimitive(scorer); 479 480 } 481 -
trunk/examples/extended/medical/DICOM/src/DicomNestedPhantomParameterisation.cc
r807 r1230 24 24 // ******************************************************************** 25 25 // 26 /////////////////////////////////////////////////////////////////////////////// 26 // $Id: DicomNestedPhantomParameterisation.cc,v 1.5 2009/01/27 10:44:58 gcosmo Exp $ 27 // GEANT4 tag $Name: geant4-09-03-cand-01 $ 28 // 29 // -------------------------------------------------------------------- 27 30 #include "DicomNestedPhantomParameterisation.hh" 28 31 … … 34 37 #include "G4Material.hh" 35 38 36 DicomNestedPhantomParameterisation::DicomNestedPhantomParameterisation( 37 const G4ThreeVector& voxelSize, 38 std::vector<G4Material*>& mat): 39 G4VNestedParameterisation(),fdX(voxelSize.x()),fdY(voxelSize.y()),fdZ(voxelSize.z()),fMaterials(mat) 39 DicomNestedPhantomParameterisation:: 40 DicomNestedPhantomParameterisation(const G4ThreeVector& voxelSize, 41 std::vector<G4Material*>& mat): 42 G4VNestedParameterisation(), fdX(voxelSize.x()), 43 fdY(voxelSize.y()), fdZ(voxelSize.z()), fMaterials(mat) 40 44 { 41 45 // Position of voxels. 42 // x and y positions are already defined in DetectorConstruction 43 // by using replicated volume. Here only we need to define is z positions of voxes.46 // x and y positions are already defined in DetectorConstruction by using 47 // replicated volume. Here only we need to define is z positions of voxels. 44 48 } 45 49 … … 48 52 } 49 53 50 void DicomNestedPhantomParameterisation::SetNoVoxel( size_t nx, size_t ny, size_t nz ) 54 void DicomNestedPhantomParameterisation:: 55 SetNoVoxel( size_t nx, size_t ny, size_t nz ) 51 56 { 52 57 fnX = nx; … … 58 63 // Material assignment to geometry. 59 64 // 60 G4Material* DicomNestedPhantomParameterisation:: ComputeMaterial(G4VPhysicalVolume* ,61 62 65 G4Material* DicomNestedPhantomParameterisation:: 66 ComputeMaterial(G4VPhysicalVolume*, const G4int copyNoZ, 67 const G4VTouchable* parentTouch) 63 68 { 64 if(parentTouch==0) return fMaterials[0]; // protection for initialization and vis at idle state 69 // protection for initialization and vis at idle state 70 // 71 if(parentTouch==0) return fMaterials[0]; 72 65 73 // Copy number of voxels. 66 74 // Copy number of X and Y are obtained from replication number. … … 70 78 G4int iz = copyNoZ; 71 79 72 G4int copyNo = ix + fn Z*iy + fnX*fnY*iz;80 G4int copyNo = ix + fnX*iy + fnX*fnY*iz; 73 81 74 82 size_t matIndex = GetMaterialIndex(copyNo); 75 83 76 84 return fMaterials[ matIndex ]; 77 78 85 } 79 86 … … 86 93 87 94 // 88 // Number of Materials 89 // Material scanner is required for preparing physics tables and so on before 90 // stating simulation, so that G4 has to know number of materials. 91 G4int DicomNestedPhantomParameterisation::GetNumberOfMaterials() const{ 95 // Number of Materials 96 // Material scanner is required for preparing physics tables and so on before 97 // starting simulation, so that G4 has to know number of materials. 98 // 99 G4int DicomNestedPhantomParameterisation::GetNumberOfMaterials() const 100 { 92 101 return fMaterials.size(); 93 102 } … … 97 106 // This is needed for material scanner and realizing geometry. 98 107 // 99 G4Material* DicomNestedPhantomParameterisation::GetMaterial(G4int i) const{ 108 G4Material* DicomNestedPhantomParameterisation::GetMaterial(G4int i) const 109 { 100 110 return fMaterials[i]; 101 111 } … … 104 114 // Transformation of voxels. 105 115 // 106 void DicomNestedPhantomParameterisation::ComputeTransformation(const G4int copyNo, 107 G4VPhysicalVolume* physVol)const{ 116 void DicomNestedPhantomParameterisation:: 117 ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const 118 { 108 119 G4ThreeVector position(0.,0.,(2*copyNo+1)*fdZ - fdZ*fnZ); 109 110 120 physVol->SetTranslation(position); 111 121 } … … 114 124 // Dimensions are always same in this RE02 example. 115 125 // 116 void DicomNestedPhantomParameterisation:: ComputeDimensions(G4Box& box,117 const G4int , 118 const G4VPhysicalVolume* ) const{126 void DicomNestedPhantomParameterisation:: 127 ComputeDimensions( G4Box& box, const G4int, const G4VPhysicalVolume* ) const 128 { 119 129 box.SetXHalfLength(fdX); 120 130 box.SetYHalfLength(fdY); -
trunk/examples/extended/medical/DICOM/src/DicomPhysicsList.cc
r807 r1230 54 54 DicomPhysicsList::DicomPhysicsList(): G4VUserPhysicsList() 55 55 { 56 defaultCutValue = 1. e-3*mm;57 cutForGamma = 1. e-3*mm;56 defaultCutValue = 1.*mm; 57 cutForGamma = 1.*mm; 58 58 cutForElectron = defaultCutValue; 59 59 cutForPositron = defaultCutValue; -
trunk/examples/extended/medical/DICOM/src/DicomPrimaryGeneratorAction.cc
r807 r1230 65 65 G4String particleName; 66 66 G4ParticleDefinition* particle 67 = particleTable->FindParticle(particleName=" gamma");67 = particleTable->FindParticle(particleName="e-"); 68 68 particleGun->SetParticleDefinition(particle); 69 G4ThreeVector dir(2.*CLHEP::RandFlat::shoot()-1.,2.*CLHEP::RandFlat::shoot()-1.,2.*CLHEP::RandFlat::shoot()-1); 69 // put the e- in the x direction of the patient (z in the accelerator axs) to hit patient in the central slice of the phantom 70 G4ThreeVector dir(0,1,0); 71 //G4ThreeVector dir(2.*CLHEP::RandFlat::shoot()-1.,2.*CLHEP::RandFlat::shoot()-1.,-CLHEP::RandFlat::shoot()); 70 72 dir /= dir.mag(); 71 73 particleGun->SetParticleMomentumDirection(dir); 72 74 particleGun->SetParticleEnergy(5.*MeV); 73 particleGun->SetParticlePosition(G4ThreeVector(0.,0.,-20.)); // put it close to the patient voxels 75 //put it at SAD = 1 m on xy plane of central slice 76 particleGun->SetParticlePosition(G4ThreeVector(0.,-99.9*cm,-27.)); 77 //particleGun->SetParticlePosition(G4ThreeVector(0.,0.,-22.)); 74 78 particleGun->GeneratePrimaryVertex(anEvent); 75 79 } -
trunk/examples/extended/medical/DICOM/src/RegularDicomDetectorConstruction.cc
r807 r1230 95 95 //----- Set this physical volume as having a regular structure of type 1, so that G4RegularNavigation is used 96 96 patient_phys->SetRegularStructureId(1); // if not set, G4VoxelNavigation will be used instead 97 98 SetScorer(voxel_logic); 97 99 } 98 100
Note: See TracChangeset
for help on using the changeset viewer.