Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4SPSPosDistribution.hh
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 //
26 ///////////////////////////////////////////////////////////////////////////////
27 //
28 // MODULE: G4SPSPosDistribution.hh
29 //
30 // Version: 1.0
31 // Date: 5/02/04
32 // Author: Fan Lei
33 // Organisation: QinetiQ ltd.
34 // Customer: ESA/ESTEC
35 //
36 ///////////////////////////////////////////////////////////////////////////////
37 //
38 // CHANGE HISTORY
39 // --------------
40 //
41 //
42 // Version 1.0, 05/02/2004, Fan Lei, Created.
43 // Based on the G4GeneralParticleSource class in Geant4 v6.0
44 //
45 ///////////////////////////////////////////////////////////////////////////////
46 //
47 //
48 // Class Description:
49 //
50 // To generate the position of a primary vertex according to the defined distribution
51 //
52 ///////////////////////////////////////////////////////////////////////////////
53 //
54 // MEMBER FUNCTIONS
55 // ----------------
56 //
57 // G4SPSPosDistribution ()
58 // Constructor: Initializes variables and instantiates the Navigator class
59 //
60 // ~G4SPSPosDistribution ()
61 // Destructor:
62 //
63 // void SetPosDisType(G4String)
64 // Allows user to choose Point, Plane, Surface or Volume source
65 // position distributions.
66 //
67 // void SetPosDisShape(G4String)
68 // Allows the user to choose the particular shape they wish for the
69 // position distribution. Choices are Square, Circle, Ellipse, Rectangle,
70 // Sphere, Ellipsoid, Cylinder, Parallelepiped.
71 //
72 // void SetCentreCoords(G4ThreeVector)
73 // Sets the co-ordinates of the centre of the position distribution.
74 //
75 // void SetPosRot1(G4ThreeVector)
76 // Used to specify the co-ordinate system for the position distribution
77 // along with SetPosRot2. SetPosRot1 sets the vector x' and need not be
78 // a unit vector.
79 //
80 // void SetPosRot2(G4ThreeVector)
81 // Used in connection with SetPosRot1. This sets a vector in the plane
82 // x'y'. By a series of cross products x', y', z' are generated. Again
83 // need not be a unit vector.
84 //
85 // void SetHalfX(G4double)
86 // Sets the half length in x.
87 //
88 // void SetHalfY(G4double)
89 // Sets the half length in y.
90 //
91 // void SetHalfZ(G4double)
92 // Sets the half length in z.
93 //
94 // void SetRadius(G4double)
95 // Sets the radius where appropriate for source distribution shapes.
96 //
97 // void SetRadius0(G4double)
98 // Sets the inner radius where appropriate for source distribution shapes.
99 //
100 // void SetBeamSigmaInR(G4double);
101 // Sets the sigma for 1D beam
102 //
103 // void SetBeamSigmaInX(G4double);
104 // Sets the first sigma for 2D beam
105 //
106 // void SetBeamSigmaInY(G4double);
107 // Sets the second sigma for 2D beam
108 //
109 // void SetParAlpha(G4double)
110 // Sets the angle Alpha in the Parallelepiped shapes.
111 //
112 // void SetParTheta(G4double)
113 // Sets the angle Theta in the Parallelepiped shapes.
114 //
115 // void SetParPhi(G4double)
116 // Sets the angle Phi in the Parallelepiped shapes.
117 //
118 // void ConfineSourceToVolume(G4String)
119 // Used to confine the start positions to a particular volume.
120 //
121 // void SetBiasRndm (G4SPSRandomGenerator* a) { posRndm = a ; };
122 // Sets the biased random number generator
123 //
124 // G4ThreeVector GenerateOne();
125 // Generate one random position
126 //
127 // void SetVerbosity(G4int)
128 // Sets the verbosity level.
129 //
130 ///////////////////////////////////////////////////////////////////////////////
131 //
132 #ifndef G4SPSPosDistribution_h
133 #define G4SPSPosDistribution_h 1
134 
135 #include "G4Navigator.hh"
136 #include "G4SPSRandomGenerator.hh"
137 
139 {
140  //
141  friend class G4SPSAngDistribution;
142 public:
145 
146  // methods to create source position dist.
147  void SetPosDisType(G4String); // Point, Plane, Surface, Volume
148  inline G4String GetPosDisType() { return SourcePosType; };
149  void SetPosDisShape(G4String);
150  inline G4String GetPosDisShape() { return Shape; };
151  // SetPosDisShape - Square, Circle, Annulus, Ellipse, Rectangle, Sphere,
152  // Ellipsoid, Cylinder, Right (parallelepiped).
154  inline G4ThreeVector GetCentreCoords() { return CentreCoords; } ;
155  void SetPosRot1(G4ThreeVector);
156  void SetPosRot2(G4ThreeVector);
157  void SetHalfX(G4double);
158  inline G4double GetHalfX() { return halfx; } ;
159  void SetHalfY(G4double);
160  inline G4double GetHalfY() { return halfy; } ;
161  void SetHalfZ(G4double);
162  inline G4double GetHalfZ() { return halfz; } ;
163  void SetRadius(G4double);
164  inline G4double GetRadius() { return Radius; };
165  void SetRadius0(G4double);
169  void SetParAlpha(G4double);
170  void SetParTheta(G4double);
171  void SetParPhi(G4double);
173  //
174  void SetBiasRndm (G4SPSRandomGenerator* a) { posRndm = a ; };
175  // Set the verbosity level.
176  void SetVerbosity(G4int a) {verbosityLevel = a; } ;
177  //
179 
180 private:
181 
182  void GenerateRotationMatrices();
183  // the following routines generate the source position
184  void GeneratePointSource();
185  void GeneratePointsInBeam();
186  void GeneratePointsInPlane();
187  void GeneratePointsOnSurface();
188  void GeneratePointsInVolume();
189 
190  G4bool IsSourceConfined();
191 
192 private:
193 
194  // Position distribution Variables
195  G4String SourcePosType; //Point,Plane,Surface,Volume
196  G4String Shape; //Circle,Square,Rectangle etc..
197  G4double halfx, halfy, halfz; //half lengths
198  G4double Radius; //Radius for circles or spheres
199  G4double Radius0; // The inner radius of an annulus
200  G4double SR,SX,SY; // Standard deviation in raduial, x, y for beam type source
201  G4ThreeVector CentreCoords; // Coords of centre of input shape
202  G4ThreeVector Rotx, Roty, Rotz; // Unit vectors defining rotation matrix
203  G4double ParAlpha, ParTheta, ParPhi; //Angle for Right Parallellepipeds
204  G4bool Confine; //If true confines source distribution to VolName
205  G4String VolName;
206  G4ThreeVector SideRefVec1,SideRefVec2,SideRefVec3; //Side rotation matrices
207  G4ThreeVector particle_position; // the final particle position to be returned
208  //
209  G4Navigator *gNavigator;
210  //
211  G4SPSRandomGenerator* posRndm; // biased random generator
212  // Verbosity
213  G4int verbosityLevel;
214 
215 };
216 
217 #endif
218 
219 
220 
221 
void SetBiasRndm(G4SPSRandomGenerator *a)
int G4int
Definition: G4Types.hh:78
void SetCentreCoords(G4ThreeVector)
bool G4bool
Definition: G4Types.hh:79
void SetPosRot1(G4ThreeVector)
void SetPosRot2(G4ThreeVector)
double G4double
Definition: G4Types.hh:76
void ConfineSourceToVolume(G4String)
G4ThreeVector GetCentreCoords()