Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
examples
extended
medical
DICOM
src
DicomPrimaryGeneratorAction.cc
Go to the documentation of this file.
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
//
28
//
29
// The code was written by :
30
// *Louis Archambault louis.archambault@phy.ulaval.ca,
31
// *Luc Beaulieu beaulieu@phy.ulaval.ca
32
// +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
33
//
34
//
35
// *Centre Hospitalier Universitaire de Quebec (CHUQ),
36
// Hotel-Dieu de Quebec, departement de Radio-oncologie
37
// 11 cote du palais. Quebec, QC, Canada, G1R 2J6
38
// tel (418) 525-4444 #6720
39
// fax (418) 691 5268
40
//
41
// + Université Laval, Québec (QC) Canada
42
//*******************************************************
43
44
#include "
DicomPrimaryGeneratorAction.hh
"
45
46
#include "
G4Event.hh
"
47
#include "
G4ParticleGun.hh
"
48
#include "
G4ParticleTable.hh
"
49
#include "
DicomRegularDetectorConstruction.hh
"
50
#include "
G4ParticleDefinition.hh
"
51
#include "
G4SystemOfUnits.hh
"
52
#include "
Randomize.hh
"
53
#include "
CLHEP/Random/RandFlat.h
"
54
55
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
DicomPrimaryGeneratorAction::DicomPrimaryGeneratorAction
()
57
{
58
G4int
nParticle = 1;
59
fParticleGun =
new
G4ParticleGun
(nParticle);
60
}
61
62
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63
DicomPrimaryGeneratorAction::~DicomPrimaryGeneratorAction
()
64
{
65
delete
fParticleGun;
66
}
67
68
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
void
DicomPrimaryGeneratorAction::GeneratePrimaries
(
G4Event
*anEvent)
70
{
71
G4ParticleTable
* particleTable =
G4ParticleTable::GetParticleTable
();
72
G4String
particleName;
73
G4ParticleDefinition
* particle
74
= particleTable->
FindParticle
(particleName=
"e-"
);
75
fParticleGun->
SetParticleDefinition
(particle);
76
// 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
77
G4ThreeVector
dir
(0,0,1);
78
//G4ThreeVector dir(2.*CLHEP::RandFlat::shoot()-1.,2.*CLHEP::RandFlat::shoot()-1.,-CLHEP::RandFlat::shoot());
79
dir /= dir.
mag
();
80
fParticleGun->
SetParticleMomentumDirection
(dir);
81
fParticleGun->
SetParticleEnergy
(10.*
MeV
);
82
//put it at SAD = 1 m on xy plane of central slice
83
fParticleGun->
SetParticlePosition
(
G4ThreeVector
(0.,0.,-0.1));
84
//fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,-22.));
85
fParticleGun->
GeneratePrimaryVertex
(anEvent);
86
}
87
Generated on Sat May 25 2013 14:32:57 for Geant4 by
1.8.4