Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4SPSAngDistribution.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 //
27 //
28 // MODULE: G4SPSAngDistribution.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 //
39 // CHANGE HISTORY
40 // --------------
41 // 06/06/2014 A Dotti
42 // For thread safety: this is a shared object,
43 // mutex has been added to control access to shared resources (data members).
44 // in Getters and Setters, mutex is NOT used in GenerateOne because it is
45 // assumed that properties are not changed during event loop.
46 //
47 // 26/10/2004 F Lei
48 // Added a "focused" option to allow all primary particles pointing to
49 // a user specified focusing point.
50 //
51 // Version 1.0, 05/02/2004, Fan Lei, Created.
52 // Based on the G4GeneralParticleSource class in Geant4 v6.0
53 //
55 //
56 // Class Description:
57 //
58 // To generate the direction of a primary vertex according to the defined distribution
59 //
61 //
62 // MEMBER FUNCTIONS
63 // ----------------
64 //
65 // G4SPSAngDistribution ()
66 // Constructor: Initializes variables
67 //
68 // ~G4SPSAngDistribution ()
69 // Destructor:
70 //
71 // void SetAngDistType(G4String)
72 // Used to set the type of angular distribution wanted. Arguments
73 // are iso, cos, beam and user for isotropic, cosine-law, beam and user-defined
74 // respectively.
75 //
76 // void DefineAngRefAxes(G4String, G4ThreeVector)
77 // DefineAngRefAxes is used in a similar way as SetPosRot to
78 // define vectors, one x' and one in the plane x'y', to create
79 // a rotated set of axes for the angular distribution.
80 //
81 // void SetMinTheta(G4double)
82 // Sets the minimum value for the angle theta.
83 //
84 // void SetMinPhi(G4double)
85 // Sets the minimum value for phi.
86 //
87 // void SetMaxTheta(G4double)
88 // Sets the maximum value for theta.
89 //
90 // void SetMaxPhi(G4double)
91 // Sets the maximum value for phi.
92 //
93 // void UserDefAngTheta(G4ThreeVector)
94 // This method allows the user to define a histogram in Theta.
95 //
96 // void UserDefAngPhi(G4ThreeVector)
97 // This method allows the user to define a histogram in phi.
98 //
99 // void GenerateIsotropicFlux()
100 // This method generates momentum vectors for particles according
101 // to an isotropic distribution.
102 //
103 // void GenerateCosineLawFlux()
104 // This method generates momentum vectors for particles according
105 // to a cosine-law distribution.
106 //
107 // void GenerateFocusedFlux()
108 // This method generates momentum vectors for particles pointing to
109 // an user specified focusing point.
110 //
111 // void GenerateUserDefFlux()
112 // Controls generation of momentum vectors according to user-defined
113 // distributions.
114 //
115 // G4double GenerateUserDefTheta()
116 // Generates the theta angle according to a user-defined distribution.
117 //
118 // G4double GenerateUserDefPhi()
119 // Generates phi according to a user-defined distribution.
120 //
121 // void SetBeamSigmaInAngR(G4double);
122 // Sets the sigma for 1D beam
123 //
124 // void SetBeamSigmaInAngX(G4double);
125 // Sets the first sigma for 2D beam
126 //
127 // void SetBeamSigmaInAngY(G4double);
128 // Sets the second sigma for 2D beam
129 //
130 // void SetUserWRTSurface(G4bool)
131 // Allows user to have user-defined spectra either with respect to the
132 // co-ordinate system (default) or with respect to the surface normal.
133 //
134 // void SetPosDistribution(G4SPSPosDistribution* a) {posDist = a; };
135 // Sets the required position generator, required for determining the cosine-law distribution
136 //
137 // void SetBiasRndm (G4SPSRandomGenerator* a)
138 // Sets the biased random number generator
139 //
140 // G4ThreeVector GenerateOne();
141 // Generate one random direction
142 //
143 // void ReSetHist(G4String);
144 // Re-sets the histogram for user defined distribution
145 //
146 // void SetVerbosity(G4int)
147 // Sets the verbosity level.
148 //
150 //
151 #ifndef G4SPSAngDistribution_h
152 #define G4SPSAngDistribution_h 1
153 
155 #include "G4DataInterpolation.hh"
156 #include "G4ParticleMomentum.hh"
157 
158 #include "G4SPSPosDistribution.hh"
159 #include "G4SPSRandomGenerator.hh"
160 
161 #include "G4Threading.hh"
162 #include "G4AutoLock.hh"
163 
175 {
176 public:
179 
180  // Angular Distribution Methods
181  void SetAngDistType(G4String);
183  void SetMinTheta(G4double);
184  void SetMinPhi(G4double);
185  void SetMaxTheta(G4double);
186  void SetMaxPhi(G4double);
193  void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection);
196  //
199  // method to re-set the histograms
200  void ReSetHist(G4String);
201  //
202  // Set the verbosity level.
203  void SetVerbosity(G4int a);
204  // some get methods
211  //
213 
214 private:
215  // These methods generate the momentum vectors for the particles.
216  void GenerateFocusedFlux(G4ParticleMomentum& outputMom);
217  void GenerateIsotropicFlux(G4ParticleMomentum& outputMom);
218  void GenerateCosineLawFlux(G4ParticleMomentum& outputMom);
219  void GenerateBeamFlux(G4ParticleMomentum& outputMom);
220  void GeneratePlanarFlux(G4ParticleMomentum& outputMom);
221  void GenerateUserDefFlux(G4ParticleMomentum& outputMom);
222  G4double GenerateUserDefTheta();
223  G4double GenerateUserDefPhi();
224 
225 private:
226 
227  // Angular distribution variables.
228  G4String AngDistType; // String to hold Ang dist type iso, cos, user
229  G4ThreeVector AngRef1, AngRef2, AngRef3; // Reference axes for ang dist
230  G4double MinTheta, MaxTheta, MinPhi, MaxPhi; // min/max theta/phi
231  G4double DR,DX,DY ; // Standard deviations for beam divergence
232  G4double Theta, Phi; // Store these for use with DEBUG
233  G4ThreeVector FocusPoint ; // the focusing point in mother coordinates
234  G4bool IPDFThetaExist, IPDFPhiExist; // tell whether IPDF histos exist
235  G4PhysicsOrderedFreeVector UDefThetaH; // Theta histo data
236  G4PhysicsOrderedFreeVector IPDFThetaH; //Cumulative Theta histogram.
237  G4PhysicsOrderedFreeVector UDefPhiH; // Phi histo bins
238  G4PhysicsOrderedFreeVector IPDFPhiH; // Cumulative phi histogram.
239  G4String UserDistType; //String to hold user distributions
240  G4bool UserWRTSurface; // G4bool to tell whether user wants distribution wrt
241  // surface normals or co-ordinate system
242  G4bool UserAngRef; // Set to true when user defines a new coordinates
243  //
244  G4ParticleMomentum particle_momentum_direction;
245  //
246  G4SPSPosDistribution* posDist; // need it here for the cosine-law distri
247  G4SPSRandomGenerator* angRndm; // biased random generator
248 
249  // Verbosity
250  G4int verbosityLevel;
251  //
252  G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
253  //
254  G4Mutex mutex; //protect access to shared resources
255 };
256 
257 #endif
void SetBeamSigmaInAngR(G4double)
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
void SetBeamSigmaInAngY(G4double)
int G4int
Definition: G4Types.hh:78
void UserDefAngPhi(G4ThreeVector)
void UserDefAngTheta(G4ThreeVector)
G4ParticleMomentum GenerateOne()
bool G4bool
Definition: G4Types.hh:79
void SetBiasRndm(G4SPSRandomGenerator *a)
void DefineAngRefAxes(G4String, G4ThreeVector)
G4int G4Mutex
Definition: G4Threading.hh:173
void SetPosDistribution(G4SPSPosDistribution *a)
void SetFocusPoint(G4ThreeVector)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
double G4double
Definition: G4Types.hh:76
void SetBeamSigmaInAngX(G4double)