ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimPrimaryGeneratorAction.hh
Go to the documentation of this file.
1 // - AUTHOR: Hector Alvarez-Pol 11/2004
2 /******************************************************************
3  * Copyright (C) 2005-2016, Hector Alvarez-Pol *
4  * All rights reserved. *
5  * *
6  * License according to GNU LESSER GPL (see lgpl-3.0.txt). *
7  * For the list of contributors see CREDITS. *
8  ******************************************************************/
9 
10 #ifndef ActarSimPrimaryGeneratorAction_h
11 #define ActarSimPrimaryGeneratorAction_h 1
12 
13 #include "G4VUserPrimaryGeneratorAction.hh"
14 #include "G4ThreeVector.hh"
15 #include "G4ParticleTable.hh"
16 #include "G4IonTable.hh"
17 #include "G4ParticleDefinition.hh"
18 #include "G4Ions.hh"
19 #include "G4ParticleGun.hh"
20 #include "G4ParticleMomentum.hh"
21 #include "globals.hh"
22 
24 
25 class G4Event;
29 
30 class ActarSimPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
31 private:
32  G4ParticleGun* particleGun; ///< Pointer to G4particleGun object initialized in constructor
33  G4ParticleTable* particleTable; ///< Pointer to the G4ParticleTable
34  G4IonTable* ionTable; ///< Pointer to the G4IonTable
35  ActarSimPrimaryGeneratorMessenger* gunMessenger; ///< Pointer to messenger
36  //ActarSimEventGenerator *pReadEvGen;
37 
38  ActarSimGasDetectorConstruction* gasDetector; ///< Pointer to gas detector constructor, to get some geometrical info
39 
40  G4Ions* incidentIon; ///< Pointer to incident ion
41  G4Ions* targetIon; ///< Pointer to target ion
42  G4Ions* scatteredIon; ///< Pointer to scattered ion
43  G4Ions* recoilIon; ///< Pointer to recoil ion
44  G4double incidentIonCharge; ///< Charge of incident ion
45  G4double targetIonCharge; ///< Charge of target ion
46  G4double scatteredIonCharge; ///< Charge of scattered ion
47  G4double recoilIonCharge; ///< Charge of recoil ion
48  G4double reactionQ; ///< Reaction Q
49  G4double labEnergy; ///< Laboratory energy
50  G4double incidentEnergy; ///< Total incident ion energy
51  G4double thetaLabAngle; ///< Polar angle in the laboratory system
52 
53  G4String randomVertexZPositionFlag; ///< Flag to control the (random) Z position of the vertex
54  G4double randomVertexZPositionMin; ///< Minimum value for the (random) Z position of the vertex
55  G4double randomVertexZPositionMax; ///< Maximum value for the (random) Z position of the vertex
56  G4double vertexZPosition; ///< Value for the (random) Z position of the vertex
57 
58  //beam parameters
59  G4double emittance; ///< Beam emittance
60  G4double beamRadiusAtEntrance; ///< Beam radius at the entrance point
61 
62  G4ThreeVector beamPosition; ///< Beam position at the entrance
63  G4ParticleMomentum beamMomentumDirection; ///< Beam (momentum) direction
64  G4bool beamDirectionFlag; ///< Flag for a beam direction defined by angles (0) or vector (1)
65 
66  G4double lengthParameter; ///< Parameter coming from the geometry selection
67  G4double randomThetaMin; ///< Minimum random theta angle in CINE
68  G4double randomThetaMax; ///< Maximum random theta angle in CINE
69 
70  G4double randomPhiMin; ///< Minimum random phi angle in CINE
71  G4double randomPhiMax; ///< Maximum random phi angle in CINE
72 
73  G4String beamInteractionFlag; ///< Flag for beam interaction mode
74  G4String realisticBeamFlag; ///< Flag for realistic beam interaction
75  G4String reactionFromEvGenFlag; ///< Flag for a reaction taken from the tabulated Ev Generator
76  G4String reactionFromCrossSectionFlag; ///< Flag for a reaction taken from the Ev Generator+CINE
77  G4String reactionFromFileFlag; ///< Flag for a reaction taken from a file
78  G4String reactionFromCineFlag; ///< Flag for a reaction calculated using Cine
79  G4String randomThetaFlag; ///< Flag for a random theta angle in CINE
80  G4String randomPhiFlag; ///< Flag for a random phi angle in CINE
81  G4String alphaSourceFlag; ///< Flag for a alpha source emitter
82  G4String reactionFile; ///< File definition for a reaction
83 
84  G4String reactionFromKineFlag; ///< Flag for using KINE
85  G4double thetaCMAngle; ///< Center of mass polar angle
86  G4double userThetaAngle; ///< User theta angle
87  G4double userPhiAngle; ///< User phi angle
88  G4double massOfProjectile; ///< Mass of the projectile ion
89  G4double massOfTarget; ///< Mass of target ion
90  G4double massOfScattered; ///< Mass of the scattered ion
91  G4double massOfRecoiled; ///< Mass of the recoil ion
92  G4double exEnergyOfProjectile; ///< Energy of the projectile ion
93  G4double exEnergyOfTarget; ///< Energy of the target ion
94  G4double exEnergyOfScattered; ///< Energy of the scattered ion
95  G4double exEnergyOfRecoiled; ///< Energy of the recoil ion
96  G4ThreeVector vertexPosition; ///< Position of the vertex
97  G4String randomPhiAngleFlag; ///< Flag for a random phi angle
98 
99 public:
102 
103  void GeneratePrimaries(G4Event* anEvent);
104 
105  void SetReactionFromCineFlag(G4String val) { reactionFromCineFlag = val;}
106  void SetIncidentIon(G4Ions* aIonDef) { incidentIon = aIonDef;}
107  void SetTargetIon(G4Ions* aIonDef) { targetIon = aIonDef;}
108  void SetScatteredIon(G4Ions* aIonDef) { scatteredIon = aIonDef;}
109  void SetRecoilIon(G4Ions* aIonDef) { recoilIon = aIonDef;}
110  void SetIncidentIonCharge(G4double aCharge) { incidentIonCharge = aCharge; }
111  void SetTargetIonCharge(G4double aCharge) { targetIonCharge = aCharge; }
112  void SetScatteredIonCharge(G4double aCharge) { scatteredIonCharge = aCharge; }
113  void SetRecoilIonCharge(G4double aCharge) { recoilIonCharge = aCharge; }
114  //void SetIncidentIonExcEnergy(G4double aExcEnergy) { incidentIonExcEnergy = aExcEnergy; }
115  //void SetTargetIonExcEnergy(G4double aExcEnergy) { targetIonExcEnergy = aExcEnergy; }
116  //void SetScatteredIonExcEnergy(G4double aExcEnergy) { scatteredIonExcEnergy = aExcEnergy; }
117  //void SetRecoilIonExcEnergy(G4double aExcEnergy) { recoilIonExcEnergy = aExcEnergy; }
118 
119  // corresponding Kine part
120  void SetReactionFromKineFlag(G4String val) { reactionFromKineFlag = val;}
121 
122  void SetThetaCMAngle(G4double val){thetaCMAngle=val; beamDirectionFlag=0;}
123  void SetUserThetaAngle(G4double val){userThetaAngle=val; beamDirectionFlag=0;}
124  void SetUserPhiAngle(G4double val){userPhiAngle=val; beamDirectionFlag=0;}
125 
126  G4double GetThetaCMAngle(){return thetaCMAngle;}
127  G4double GetUserThetaAngle(){return userThetaAngle;}
128  G4double GetUserPhiAngle(){return userPhiAngle;}
129 
130  void SetMassOfProjectile(G4double val){massOfProjectile=val;}
131  void SetMassOfTarget(G4double val){massOfTarget=val;}
132  void SetMassOfScattered(G4double val){massOfScattered=val;}
133  void SetMassOfRecoiled(G4double val){massOfRecoiled=val;}
134 
136  G4double GetMassOfTarget(){return massOfTarget;}
138  G4double GetMassOfRecoiled(){return massOfRecoiled;}
139 
140  void SetExEnergyOfProjectile(G4double val){exEnergyOfProjectile=val;}
141  void SetExEnergyOfTarget(G4double val) {exEnergyOfTarget=val;}
142  void SetExEnergyOfScattered(G4double val) {exEnergyOfScattered=val;}
143  void SetExEnergyOfRecoiled(G4double val) {exEnergyOfRecoiled=val;}
144 
149 
150  void SetRandomVertexZPositionFlag(G4String val) {randomVertexZPositionFlag=val;}
152  void SetVertexPosition(G4ThreeVector apos) {vertexPosition=apos;}
153  G4ThreeVector GetVertexPosition(){return vertexPosition;}
154 
155  void SetRandomPhiAngleFlag(G4String val) { randomPhiAngleFlag = val;}
156  // end of corresponding Kine part
157 
158  void SetReactionQ(G4double val) { reactionQ = val;}
159 
160  void SetLabEnergy(G4double val) { labEnergy = val;}
161 
162  void SetIncidentEnergy(G4double val) { incidentEnergy = val;}
163 
164  void SetThetaLabAngle(G4double val) { thetaLabAngle = val;}
165  void SetVertexZPosition(G4double val) { vertexZPosition = val;} // vertex Z position, dypang 080704
166 
167  void SetRandomThetaVal(G4double min, G4double max) {
168  randomThetaMin = min;
169  randomThetaMax = max;
170  }
171 
172  void SetRandomPhiVal(G4double min, G4double max) {
173  randomPhiMin = min;
174  randomPhiMax = max;
175  }
176 
177  void SetRandomVertexZPositionVal(G4double min, G4double max) {
178  randomVertexZPositionMin = min;
179  randomVertexZPositionMax = max;
180  }
181 
182  void SetBeamInteractionFlag(G4String val) { beamInteractionFlag = val;}
183 
184  void SetRealisticBeamFlag(G4String val) { realisticBeamFlag = val;}
185  void SetReactionFromFileFlag(G4String val) { reactionFromFileFlag = val;}
186 
187  void SetReactionFromEvGenFlag(G4String val) { reactionFromEvGenFlag = val;}
188  void SetReactionFromCrossSectionFlag(G4String val) { reactionFromCrossSectionFlag = val;}
189 
190  void SetRandomThetaFlag(G4String val) { randomThetaFlag = val;}
191  void SetRandomPhiFlag(G4String val) { randomPhiFlag = val;}
192  void SetAlphaSourceFlag(G4String val) { alphaSourceFlag = val;}
193  void SetReactionFile(G4String val) { reactionFile = val;}
194 
195  //virtual void SetInitialValues();
196 
197  void SetEmittance(G4double val){emittance = val;}
198  void SetBeamRadiusAtEntrance(G4double val){beamRadiusAtEntrance = val;}
199  G4double GetEmittance(){return emittance;}
201 
202  void SetParticleDefinition(G4ParticleDefinition * aParticleDefinition)
203  { particleGun->SetParticleDefinition(aParticleDefinition);}
204  inline void SetParticleMomentum(G4ParticleMomentum aMomentum)
205  { particleGun->SetParticleMomentum(aMomentum);}
206  inline void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
207  { particleGun->SetParticleMomentumDirection(aMomentumDirection); }
208  inline void SetParticleEnergy(G4double aKineticEnergy)
209  { particleGun->SetParticleEnergy(aKineticEnergy); incidentEnergy = aKineticEnergy;}
210  inline void SetParticleCharge(G4double aCharge)
211  { particleGun->SetParticleCharge(aCharge); }
212  inline void SetParticlePolarization(G4ThreeVector aVal)
213  { particleGun->SetParticlePolarization(aVal); }
214  inline void SetParticlePosition(G4ThreeVector aPos)
215  { particleGun->SetParticlePosition(aPos); }
216  inline void SetParticleTime(G4double aTime)
217  { particleGun->SetParticleTime(aTime); }
218  inline void SetNumberOfParticles(G4int i)
219  { particleGun->SetNumberOfParticles(i); }
220 
221  void SetBeamMomentumDirection(G4ParticleMomentum aMomentumDirection)
222  { beamMomentumDirection=aMomentumDirection; beamDirectionFlag=1;}
223  void SetBeamPosition(G4ThreeVector aPos)
224  { beamPosition=aPos;}
225 
226  inline G4ParticleDefinition* GetParticleDefinition()
227  { return particleGun->GetParticleDefinition(); }
228  inline G4ParticleMomentum GetParticleMomentumDirection()
229  { return particleGun->GetParticleMomentumDirection(); }
230  inline G4double GetParticleEnergy()
231  { return particleGun->GetParticleEnergy(); }
232  inline G4double GetParticleCharge()
233  { return particleGun->GetParticleCharge(); }
234  inline G4ThreeVector GetParticlePolarization()
235  { return particleGun->GetParticlePolarization(); }
236  inline G4ThreeVector GetParticlePosition()
237  { return particleGun->GetParticlePosition(); }
238  inline G4double GetParticleTime()
239  { return particleGun->GetParticleTime(); }
240  inline G4int GetNumberOfParticles()
241  { return particleGun->GetNumberOfParticles(); }
242 
243  G4double GetRandomThetaMin() {return randomThetaMin;}
244  G4double GetRandomThetaMax() {return randomThetaMax;}
245 
246  G4Ions* GetIncidentIon(){return incidentIon;}
247  G4Ions* GetTargetIon(){return targetIon;}
248  G4Ions* GetScatteredIon(){return scatteredIon;}
249  G4Ions* GetRecoilIon(){return recoilIon;}
254  //G4double GetIncidentIonExcEnergy(){return incidentIonExcEnergy;}
255  //G4double GetTargetIonExcEnergy(){return targetIonExcEnergy;}
256  //G4double GetScatteredIonExcEnergy(){return scatteredIonExcEnergy;}
257  //G4double GetRecoilIonExcEnergy(){return recoilIonExcEnergy;}
258  G4double GetReactionQ(){return reactionQ;}
259  G4double GetLabEnergy(){return labEnergy;}
260  G4double GetIncidentEnergy(){return incidentEnergy;}
261  G4double GetThetaLabAngle(){return thetaLabAngle;}
263 };
264 #endif
void SetBeamMomentumDirection(G4ParticleMomentum aMomentumDirection)
G4String randomThetaFlag
Flag for a random theta angle in CINE.
G4String reactionFromCineFlag
Flag for a reaction calculated using Cine.
G4double exEnergyOfScattered
Energy of the scattered ion.
G4bool beamDirectionFlag
Flag for a beam direction defined by angles (0) or vector (1)
G4String reactionFromFileFlag
Flag for a reaction taken from a file.
G4double lengthParameter
Parameter coming from the geometry selection.
G4double exEnergyOfTarget
Energy of the target ion.
void SetParticleMomentum(G4ParticleMomentum aMomentum)
G4IonTable * ionTable
Pointer to the G4IonTable.
G4double thetaLabAngle
Polar angle in the laboratory system.
void SetRandomThetaVal(G4double min, G4double max)
G4double incidentEnergy
Total incident ion energy.
G4double randomThetaMax
Maximum random theta angle in CINE.
G4double randomPhiMin
Minimum random phi angle in CINE.
G4String reactionFromEvGenFlag
Flag for a reaction taken from the tabulated Ev Generator.
G4String randomPhiFlag
Flag for a random phi angle in CINE.
G4double massOfProjectile
Mass of the projectile ion.
G4ParticleMomentum beamMomentumDirection
Beam (momentum) direction.
G4double targetIonCharge
Charge of target ion.
G4double randomThetaMin
Minimum random theta angle in CINE.
G4double randomVertexZPositionMax
Maximum value for the (random) Z position of the vertex.
G4ThreeVector vertexPosition
Position of the vertex.
G4ThreeVector beamPosition
Beam position at the entrance.
G4ParticleGun * particleGun
Pointer to G4particleGun object initialized in constructor.
G4Ions * incidentIon
Pointer to incident ion.
G4double randomVertexZPositionMin
Minimum value for the (random) Z position of the vertex.
G4double exEnergyOfProjectile
Energy of the projectile ion.
G4double massOfRecoiled
Mass of the recoil ion.
G4String reactionFromKineFlag
Flag for using KINE.
void SetRandomVertexZPositionVal(G4double min, G4double max)
G4ParticleTable * particleTable
Pointer to the G4ParticleTable.
G4String reactionFile
File definition for a reaction.
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
G4Ions * recoilIon
Pointer to recoil ion.
G4double thetaCMAngle
Center of mass polar angle.
G4double incidentIonCharge
Charge of incident ion.
ActarSimPrimaryGeneratorAction()
Constructor: init values are filled.
G4double massOfScattered
Mass of the scattered ion.
G4double recoilIonCharge
Charge of recoil ion.
G4Ions * targetIon
Pointer to target ion.
ActarSimGasDetectorConstruction * gasDetector
Pointer to gas detector constructor, to get some geometrical info.
G4String reactionFromCrossSectionFlag
Flag for a reaction taken from the Ev Generator+CINE.
G4double exEnergyOfRecoiled
Energy of the recoil ion.
G4Ions * scatteredIon
Pointer to scattered ion.
G4String realisticBeamFlag
Flag for realistic beam interaction.
G4String alphaSourceFlag
Flag for a alpha source emitter.
ActarSimPrimaryGeneratorMessenger * gunMessenger
Pointer to messenger.
G4double vertexZPosition
Value for the (random) Z position of the vertex.
G4String randomVertexZPositionFlag
Flag to control the (random) Z position of the vertex.
G4double scatteredIonCharge
Charge of scattered ion.
void SetRandomPhiVal(G4double min, G4double max)
void SetParticleEnergy(G4double aKineticEnergy)
G4String randomPhiAngleFlag
Flag for a random phi angle.
G4double beamRadiusAtEntrance
Beam radius at the entrance point.
G4double randomPhiMax
Maximum random phi angle in CINE.
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
G4String beamInteractionFlag
Flag for beam interaction mode.