Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // << 27 /// \file medical/DICOM/src/DicomPrimaryGenera << 28 /// \brief Implementation of the DicomPrimaryG << 29 // << 30 // The code was written by : 23 // The code was written by : 31 // *Louis Archambault louis.archambault@p << 24 // *Louis Archambault louis.archambault@phy.ulaval.ca, 32 // *Luc Beaulieu beaulieu@phy.ulaval.ca 25 // *Luc Beaulieu beaulieu@phy.ulaval.ca 33 // +Vincent Hubert-Tremblay at tigre.2@sy 26 // +Vincent Hubert-Tremblay at tigre.2@sympatico.ca 34 // 27 // 35 // 28 // 36 // *Centre Hospitalier Universitaire de Quebec 29 // *Centre Hospitalier Universitaire de Quebec (CHUQ), 37 // Hotel-Dieu de Quebec, departement de Radio- 30 // Hotel-Dieu de Quebec, departement de Radio-oncologie 38 // 11 cote du palais. Quebec, QC, Canada, G1R 31 // 11 cote du palais. Quebec, QC, Canada, G1R 2J6 39 // tel (418) 525-4444 #6720 32 // tel (418) 525-4444 #6720 40 // fax (418) 691 5268 33 // fax (418) 691 5268 41 // 34 // 42 // + Université Laval, Québec (QC) Canada << 35 // + Université Laval, Québec (QC) Canada 43 //******************************************** 36 //******************************************************* 44 #include "DicomPrimaryGeneratorAction.hh" << 45 37 46 #include "CLHEP/Random/RandFlat.h" << 38 #include "DicomPrimaryGeneratorAction.hh" 47 #include "DicomRegularDetectorConstruction.hh" << 48 39 49 #include "G4Event.hh" 40 #include "G4Event.hh" 50 #include "G4ParticleDefinition.hh" << 51 #include "G4ParticleGun.hh" 41 #include "G4ParticleGun.hh" 52 #include "G4ParticleTable.hh" 42 #include "G4ParticleTable.hh" 53 #include "G4SystemOfUnits.hh" << 43 #include "DicomGeometry.hh" >> 44 #include "G4ParticleDefinition.hh" 54 #include "Randomize.hh" 45 #include "Randomize.hh" 55 46 56 //....oooOO0OOooo........oooOO0OOooo........oo << 57 DicomPrimaryGeneratorAction::DicomPrimaryGener 47 DicomPrimaryGeneratorAction::DicomPrimaryGeneratorAction() 58 : G4VUserPrimaryGeneratorAction(), fParticle << 59 { 48 { 60 G4int nParticle = 1; 49 G4int nParticle = 1; 61 fParticleGun = new G4ParticleGun(nParticle); << 50 particleGun = new G4ParticleGun(nParticle); 62 } 51 } 63 52 64 //....oooOO0OOooo........oooOO0OOooo........oo << 65 DicomPrimaryGeneratorAction::~DicomPrimaryGene 53 DicomPrimaryGeneratorAction::~DicomPrimaryGeneratorAction() 66 { 54 { 67 delete fParticleGun; << 55 delete particleGun; 68 } 56 } 69 57 70 //....oooOO0OOooo........oooOO0OOooo........oo << 58 void DicomPrimaryGeneratorAction::GeneratePrimaries(G4Event *anEvent) 71 void DicomPrimaryGeneratorAction::GeneratePrim << 72 { 59 { 73 G4ParticleTable* particleTable = G4ParticleT 60 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); 74 G4String particleName; 61 G4String particleName; 75 G4ParticleDefinition* particle = particleTab << 62 G4ParticleDefinition* particle 76 fParticleGun->SetParticleDefinition(particle << 63 = particleTable->FindParticle(particleName="gamma"); 77 // put the e- in the x direction of the pati << 64 particleGun->SetParticleDefinition(particle); 78 // to hit patient in the central slice of th << 65 // ---- MGP ---- Numbers in the code should be replaced by const 79 G4ThreeVector dir(0, 0, 1); << 66 particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.*cm,0.*cm)); 80 // G4ThreeVector dir(2.*CLHEP::RandFlat::sho << 67 particleGun->SetParticleEnergy(5.*MeV); 81 // 2.*CLHEP::RandFlat::shoot()-1.,-CLHEP::Ra << 68 particleGun->SetParticlePosition(G4ThreeVector(0.,0.,0.)); 82 dir /= dir.mag(); << 69 particleGun->GeneratePrimaryVertex(anEvent); 83 fParticleGun->SetParticleMomentumDirection(d << 84 fParticleGun->SetParticleEnergy(100. * MeV); << 85 // put it at SAD = 1 m on xy plane of centra << 86 fParticleGun->SetParticlePosition(G4ThreeVec << 87 // fParticleGun->SetParticlePosition(G4Three << 88 fParticleGun->GeneratePrimaryVertex(anEvent) << 89 } 70 } >> 71 90 72