source: trunk/examples/advanced/medical_linac/include/ML2PrimaryGenerationAction.hh@ 1254

Last change on this file since 1254 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

  • Property svn:executable set to *
File size: 4.5 KB
RevLine 
[1230]1//
2// ********************************************************************
3// * DISCLAIMER *
4// * *
5// * The following disclaimer summarizes all the specific disclaimers *
6// * of contributors to this software. The specific disclaimers,which *
7// * govern, are listed with their locations in: *
8// * http://cern.ch/geant4/license *
9// * *
10// * Neither the authors of this software system, nor their employing *
11// * institutes,nor the agencies providing financial support for this *
12// * work make any representation or warranty, express or implied, *
13// * regarding this software system or assume any liability for its *
14// * use. *
15// * *
16// * This code implementation is the intellectual property of the *
17// * GEANT4 collaboration. *
18// * By copying, distributing or modifying the Program (or any work *
19// * based on the Program) you indicate your acceptance of this *
20// * statement, and all its terms. *
21// ********************************************************************
22//
23// The code was written by :
24// ^Claudio Andenna claudio.andenna@iss.infn.it, claudio.andenna@ispesl.it
25// *Barbara Caccia barbara.caccia@iss.it
26// with the support of Pablo Cirrone (LNS, INFN Catania Italy)
27//
28// ^ISPESL and INFN Roma, gruppo collegato Sanità, Italy
29// *Istituto Superiore di Sanità and INFN Roma, gruppo collegato Sanità, Italy
30// Viale Regina Elena 299, 00161 Roma (Italy)
31// tel (39) 06 49902246
32// fax (39) 06 49387075
33//
34// more information:
35// http://g4advancedexamples.lngs.infn.it/Examples/medical-linac
36//
37//*******************************************************//
38
39
40#ifndef CML2PrimaryGenerationActionH
41#define CML2PrimaryGenerationActionH
42
43
44#include "G4VUserPrimaryGeneratorAction.hh"
45#include "G4ParticleTable.hh"
46#include "G4ParticleGun.hh"
47#include "G4Event.hh"
48#include "G4Timer.hh"
49#include "Randomize.hh"
50
51#include "G4ParticleDefinition.hh"
52#include "ML2SinputData.hh"
53#include "ML2SDWithParticle.hh"
54#include "ML2SDWithVoxels.hh"
55
56class G4ParticleGun;
57class G4ParticleDefinition;
58class CML2PrimaryGenerationActionMessenger;
59
60class CML2PrimaryGenerationAction : public G4VUserPrimaryGeneratorAction
61{
62public:
63 CML2PrimaryGenerationAction(SPrimaryParticle *primaryParticleData);
64 ~CML2PrimaryGenerationAction(void);
65 void design();
66 void GeneratePrimaries(G4Event *anEvent);
67 inline void setNIdenticalParticles(G4int val){this->nIdenticalParticles=val;};
68 inline void setNLoopsPhSpParticles(G4int val){this->nLoopsPhSpParticles=val;};
69 inline void setNMaxParticlesInRamPhaseSpace(G4int val){this->nMaxParticlesInRamPhaseSpace=val;};
70
71 inline void setGunMeanEnergy(G4double val){this->GunMeanEnegy=val;};
72 inline void setGunStdEnergy(G4double val){this->GunStdEnegy=val;};
73 inline void setGunRadious(G4double val){this->GunRadious=val;};
74 inline void setCalculatedPhaseSpaceFileIN(G4String val){this->calculatedPhaseSpaceFileIN=val;};
75 inline void setSourceTypeName(G4String val)
76 {
77 this->sourceTypeName=val;
78 if (this->sourceTypeName=="randomTarget")
79 {
80 this->idParticleSource=id_randomTarget;
81 }
82 else if (this->sourceTypeName=="phaseSpace")
83 {
84 this->idParticleSource=id_phaseSpace;
85 }
86 };
87
88private:
89 void setGunRandom();
90 void setGunCalculatedPhaseSpace();
91 void GenerateFromRandom();
92 void GenerateFromCalculatedPhaseSpace();
93 void fillParticlesContainer();
94 bool itIsTheSameParticle(Sparticle *p1, Sparticle *p2);
95
96 G4int nBeam, nIdenticalParticles, nLoopsPhSpParticles, idGunType, nMaxParticlesInRamPhaseSpace, idParticleSource;
97 G4double GunMeanEnegy, GunStdEnegy, GunRadious;
98 G4String calculatedPhaseSpaceFileIN;
99
100 CML2PrimaryGenerationActionMessenger *PrimaryGenerationActionMessenger;
101
102
103 G4ThreeVector dir, pos;
104 G4double ek;
105
106 G4Timer myTime;
107 G4double sinTheta, cosTheta, phi;
108 G4double ro, alfa;
109 G4ParticleGun *particleGun;
110 G4ParticleDefinition *gamma;
111 G4ParticleDefinition *electron;
112 G4ParticleDefinition *positron;
113 G4int nEventsPerRun;
114 SPrimaryParticle *primaryParticleData;
115 Sparticle *particles, *particle;
116 int nParticle, nPhSpParticles, nRandomParticles, idCurrentParticleSource;
117 Sparticle *firstFileParticle, *lastLoadedParticle;
118 G4String sourceTypeName;
119};
120
121#endif
Note: See TracBrowser for help on using the repository browser.