ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4SPSPosDistribution.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4SPSPosDistribution.hh
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 //
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 //
37 //
38 // CHANGE HISTORY
39 // --------------
40 //
41 // 29/05/2019 M Asai
42 // Added confinement getters.
43 //
44 // 30/04/2017 J Allison
45 // Added GetRotx,y,z access functions.
46 //
47 // 06/06/2014 A Dotti
48 // For thread safety: this is a shared object,
49 // mutex has been added to control access to shared resources (data members).
50 // in Getters and Setters, mutex is NOT used in GenerateOne because it is
51 // assumed that properties are not changed during event loop.
52 //
53 // Version 1.0, 05/02/2004, Fan Lei, Created.
54 // Based on the G4GeneralParticleSource class in Geant4 v6.0
55 //
57 //
58 //
59 // Class Description:
60 //
61 // To generate the position of a primary vertex according to the defined distribution
62 //
64 //
65 // MEMBER FUNCTIONS
66 // ----------------
67 //
68 // G4SPSPosDistribution ()
69 // Constructor: Initializes variables and instantiates the Navigator class
70 //
71 // ~G4SPSPosDistribution ()
72 // Destructor:
73 //
74 // void SetPosDisType(G4String)
75 // Allows user to choose Point, Plane, Surface or Volume source
76 // position distributions.
77 //
78 // void SetPosDisShape(G4String)
79 // Allows the user to choose the particular shape they wish for the
80 // position distribution. Choices are Square, Circle, Ellipse, Rectangle,
81 // Sphere, Ellipsoid, Cylinder, Parallelepiped.
82 //
83 // void SetCentreCoords(G4ThreeVector)
84 // Sets the co-ordinates of the centre of the position distribution.
85 //
86 // void SetPosRot1(G4ThreeVector)
87 // Used to specify the co-ordinate system for the position distribution
88 // along with SetPosRot2. SetPosRot1 sets the vector x' and need not be
89 // a unit vector.
90 //
91 // void SetPosRot2(G4ThreeVector)
92 // Used in connection with SetPosRot1. This sets a vector in the plane
93 // x'y'. By a series of cross products x', y', z' are generated. Again
94 // need not be a unit vector.
95 //
96 // void SetHalfX(G4double)
97 // Sets the half length in x.
98 //
99 // void SetHalfY(G4double)
100 // Sets the half length in y.
101 //
102 // void SetHalfZ(G4double)
103 // Sets the half length in z.
104 //
105 // void SetRadius(G4double)
106 // Sets the radius where appropriate for source distribution shapes.
107 //
108 // void SetRadius0(G4double)
109 // Sets the inner radius where appropriate for source distribution shapes.
110 //
111 // void SetBeamSigmaInR(G4double);
112 // Sets the sigma for 1D beam
113 //
114 // void SetBeamSigmaInX(G4double);
115 // Sets the first sigma for 2D beam
116 //
117 // void SetBeamSigmaInY(G4double);
118 // Sets the second sigma for 2D beam
119 //
120 // void SetParAlpha(G4double)
121 // Sets the angle Alpha in the Parallelepiped shapes.
122 //
123 // void SetParTheta(G4double)
124 // Sets the angle Theta in the Parallelepiped shapes.
125 //
126 // void SetParPhi(G4double)
127 // Sets the angle Phi in the Parallelepiped shapes.
128 //
129 // void ConfineSourceToVolume(G4String)
130 // Used to confine the start positions to a particular volume.
131 //
132 // void SetBiasRndm (G4SPSRandomGenerator* a) { posRndm = a ; };
133 // Sets the biased random number generator
134 //
135 // G4ThreeVector GenerateOne();
136 // Generate one random position
137 //
138 // void SetVerbosity(G4int)
139 // Sets the verbosity level.
140 //
142 //
143 #ifndef G4SPSPosDistribution_h
144 #define G4SPSPosDistribution_h 1
145 
146 #include "G4Navigator.hh"
147 #include "G4SPSRandomGenerator.hh"
148 #include "G4Threading.hh"
149 #include "G4Cache.hh"
150 
163 {
164 public:
167 
177  // methods to create source position dist.
178  void SetPosDisType(G4String); // Point, Plane, Surface, Volume
179  void SetPosDisShape(G4String);
180  // SetPosDisShape - Square, Circle, Annulus, Ellipse, Rectangle, Sphere,
181  // Ellipsoid, Cylinder, Right (parallelepiped).
183  void SetPosRot1(G4ThreeVector);
184  void SetPosRot2(G4ThreeVector);
185  void SetHalfX(G4double);
186  void SetHalfY(G4double);
187  void SetHalfZ(G4double);
188  void SetRadius(G4double);
189  void SetRadius0(G4double);
193  void SetParAlpha(G4double);
194  void SetParTheta(G4double);
195  void SetParPhi(G4double);
197  //
199  // Set the verbosity level.
200  void SetVerbosity(G4int a);
201  //
203 
204  G4String GetPosDisType() const;
205  G4String GetPosDisShape() const;
207  G4double GetHalfX() const;
208  G4double GetHalfY() const;
209  G4double GetHalfZ() const;
210  G4double GetRadius() const;
211  G4double GetRadius0() const {return Radius0;}
212  G4double GetParAlpha() const {return ParAlpha;}
213  G4double GetParTheta() const {return ParTheta;}
214  G4double GetParPhi() const {return ParPhi;}
215  const G4ThreeVector& GetRotx() const {return Rotx;}
216  const G4ThreeVector& GetRoty() const {return Roty;}
217  const G4ThreeVector& GetRotz() const {return Rotz;}
218  G4bool GetConfined() const { return Confine; }
219  const G4String& GetConfineVolume() const { return VolName; }
220 
224  G4String GetSourcePosType() const;
226 
227 private:
228 
230  // the following routines generate the source position
231  void GeneratePointSource(G4ThreeVector& outoutPos);
232  void GeneratePointsInBeam(G4ThreeVector& outoutPos);
233  void GeneratePointsInPlane(G4ThreeVector& outoutPos);
234  void GeneratePointsOnSurface(G4ThreeVector& outputPos);
235  void GeneratePointsInVolume(G4ThreeVector& outputPos);
236 
238 
239 private:
240  //VERY IMPORTANT:
241  //This is a shared resource, however setters that
242  //changes the parameters via UI commands are by design
243  //thread-safe because only one thread will call these methods
244  //See G4GeneralParticleSourceMessenger constructor for an explanation
245  struct thread_data_t {
246  //Caching of some data
251  thread_data_t();
252  };
253  //Point,Plane,Surface,Volume
255  //Circle,Square,Rectangle etc..
257  // Coords of centre of input shape
259  // Unit vectors defining rotation matrix
263  //half lengths
267  //Radius for circles or spheres
269  // The inner radius of an annulus
271  // Standard deviation in raduial, x, y for beam type source
275  //Angle for Right Parallellepipeds
279  //If true confines source distribution to VolName
282  // Verbosity
285  // biased random generator
288 };
289 
290 
291 #endif
292 
293 
294 
295