Geant4-11
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// G4SPSPosDistribution
27//
28// Class Description:
29//
30// To generate the position of a primary vertex according to
31// the defined distribution. This is a shared class between threads.
32// Only one thread should use the set-methods here.
33// Note that this is exactly what is achieved using UI commands.
34// If you use the set methods to set defaults in your application take care
35// that only one thread is executing them.
36// In addition take care of calling these methods before the run is started
37// Do not use these setters during the event loop
38
39// Author: Fan Lei, QinetiQ ltd.
40// Customer: ESA/ESTEC
41// History:
42// - 05/02/2004, Fan Lei, Created.
43// Based on the G4GeneralParticleSource class.
44// - 06/06/2014, Andrea Dotti
45// Added mutex to control access to shared resources (data members).
46// In Getters and Setters, mutex is NOT used in GenerateOne because
47// it is assumed that properties are not changed during event loop.
48// - 13/02/2017, Maxime Chauvin
49// Added surface and volume shape "EllipticCylinder"
50// --------------------------------------------------------------------
51#ifndef G4SPSPosDistribution_hh
52#define G4SPSPosDistribution_hh 1
53
54#include "G4Navigator.hh"
56#include "G4Threading.hh"
57#include "G4Cache.hh"
58
60{
61 public:
62
64 // Constructor: initializes data and instantiates the Navigator class
65
67 // Destructor
68
69 // Methods to create source position dist
70
71 void SetPosDisType(const G4String&);
72 // Allows user to choose Point, Plane, Surface or Volume source
73 // position distributions
74
75 void SetPosDisShape(const G4String&);
76 // Allows the user to choose the particular shape they wish for the
77 // position distribution. Choices are: Square, Circle, Ellipse,
78 // Rectangle, Sphere, Ellipsoid, Cylinder, Parallelepiped
79
80 void SetCentreCoords(const G4ThreeVector&);
81 // Sets the coordinates of the centre of the position distribution
82
83 void SetPosRot1(const G4ThreeVector&);
84 // Used to specify the coordinate system for the position distribution
85 // along with SetPosRot2. Sets the vector x' and need not be a unit vector
86
87 void SetPosRot2(const G4ThreeVector&);
88 // Used in connection with SetPosRot1. This sets a vector in the plane
89 // x'y'. By a series of cross products x', y', z' are generated. Again
90 // need not be a unit vector
91
92 void SetHalfX(G4double);
93 // Sets the half length in x
94
95 void SetHalfY(G4double);
96 // Sets the half length in y
97
98 void SetHalfZ(G4double);
99 // Sets the half length in z
100
101 void SetRadius(G4double);
102 // Sets the radius where appropriate for source distribution shapes
103
104 void SetRadius0(G4double);
105 // Sets the inner radius where appropriate for source distribution shapes
106
108 // Sets the sigma for 1D beam
109
111 // Sets the first sigma for 2D beam
112
114 // Sets the second sigma for 2D beam
115
116 void SetParAlpha(G4double);
117 // Sets the angle Alpha in the Parallelepiped shapes
118
119 void SetParTheta(G4double);
120 // Sets the angle Theta in the Parallelepiped shapes
121
122 void SetParPhi(G4double);
123 // Sets the angle Phi in the Parallelepiped shapes
124
125 void ConfineSourceToVolume(const G4String&);
126 // Used to confine the start positions to a particular volume
127
129 // Sets the biased random number generator
130
131 void SetVerbosity(G4int a);
132 // Sets the verbosity level
133
135 // Generate one random position
136
137 const G4String& GetPosDisType() const;
138 const G4String& GetPosDisShape() const;
139 const G4ThreeVector& GetCentreCoords() const;
140 G4double GetHalfX() const;
141 G4double GetHalfY() const;
142 G4double GetHalfZ() const;
143 G4double GetRadius() const;
144 inline G4double GetRadius0() const { return Radius0; }
145 inline G4double GetParAlpha() const { return ParAlpha; }
146 inline G4double GetParTheta() const { return ParTheta; }
147 inline G4double GetParPhi() const { return ParPhi; }
148 inline const G4ThreeVector& GetRotx() const { return Rotx; }
149 inline const G4ThreeVector& GetRoty() const { return Roty; }
150 inline const G4ThreeVector& GetRotz() const { return Rotz; }
151 inline G4bool GetConfined() const { return Confine; }
152 inline const G4String& GetConfineVolume() const { return VolName; }
153
154 const G4ThreeVector& GetSideRefVec1() const;
155 const G4ThreeVector& GetSideRefVec2() const;
156 const G4ThreeVector& GetSideRefVec3() const;
157 const G4String& GetSourcePosType() const;
158 const G4ThreeVector& GetParticlePos() const;
159
160 private:
161
163
164 // The following functions generate the source position
165 //
166 void GeneratePointSource(G4ThreeVector& outoutPos);
167 void GeneratePointsInBeam(G4ThreeVector& outoutPos);
168 void GeneratePointsInPlane(G4ThreeVector& outoutPos);
169 void GeneratePointsOnSurface(G4ThreeVector& outputPos);
170 void GeneratePointsInVolume(G4ThreeVector& outputPos);
171
173
174 private:
175
176 // NOTE:
177 // This is a shared resource, however setters that
178 // changes the parameters via UI commands are by design
179 // thread-safe because only one thread will call these methods
180 // See G4GeneralParticleSourceMessenger constructor for an explanation
181 //
182 struct thread_data_t // Caching of some data
183 {
189 };
190
192 // Point, Plane, Surface, Volume
194 // Circle, Square, Rectangle, etc...
196 // Coordinates of centre of input shape
198 // Unit vectors defining rotation matrix
200 // Half lengths
202 // Radius for circles or spheres
204 // The inner radius of an annulus
206 // Standard deviation in radial, x, y for beam type source
208 // Angle for Right Parallellepipeds
210 // If true confines source distribution to VolName
212 // Volume name
214 // Verbosity
216 // Biased random generator
217
220};
221
222#endif
std::mutex G4Mutex
Definition: G4Threading.hh:81
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const G4ThreeVector & GetCentreCoords() const
G4double GetParAlpha() const
void GeneratePointSource(G4ThreeVector &outoutPos)
void GeneratePointsInVolume(G4ThreeVector &outputPos)
void SetPosRot2(const G4ThreeVector &)
void GeneratePointsOnSurface(G4ThreeVector &outputPos)
const G4String & GetConfineVolume() const
void ConfineSourceToVolume(const G4String &)
void GeneratePointsInBeam(G4ThreeVector &outoutPos)
void SetBiasRndm(G4SPSRandomGenerator *a)
const G4String & GetPosDisType() const
const G4ThreeVector & GetRotx() const
const G4ThreeVector & GetRotz() const
void SetPosDisShape(const G4String &)
const G4ThreeVector & GetParticlePos() const
void SetCentreCoords(const G4ThreeVector &)
const G4String & GetSourcePosType() const
const G4ThreeVector & GetSideRefVec2() const
G4SPSRandomGenerator * PosRndm
G4Cache< thread_data_t > ThreadData
const G4String & GetPosDisShape() const
const G4ThreeVector & GetSideRefVec3() const
G4bool IsSourceConfined(G4ThreeVector &outputPos)
const G4ThreeVector & GetSideRefVec1() const
void SetPosRot1(const G4ThreeVector &)
void GeneratePointsInPlane(G4ThreeVector &outoutPos)
G4double GetParTheta() const
void SetPosDisType(const G4String &)
const G4ThreeVector & GetRoty() const