Geant4-11
G4SPSRandomGenerator.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// G4SPSRandomGenerator
27//
28// Class Description:
29//
30// Special random number generator used by G4GeneralParticleSource to allow
31// biasing applied at the lowest level for all distributions.
32// This is a shared class between threads.
33// Only one thread should use the set-methods here.
34// Note that this is exactly what is achieved using UI commands.
35// If you use the set methods to set defaults in your
36// application take care that only one thread is executing them.
37// In addition take care of calling these methods before the run is started
38// Do not use the setters during the event loop
39
40// Author: Fan Lei, QinetiQ ltd.
41// Customer: ESA/ESTEC
42// History:
43// - 05/02/2004, Fan Lei - Created.
44// Based on the G4GeneralParticleSource class
45// - 06/06/2014, Andrea Dotti
46// Added a mutex to protect access to shared resources (data members).
47// Getters and Setters are mutex'd but not the GetRand* methods,
48// because it is assumed these are called only during the event loop
49// during which the status of this class is invariant
50// --------------------------------------------------------------------
51#ifndef G4SPSRandomGenerator_hh
52#define G4SPSRandomGenerator_hh 1
53
56#include "G4ThreeVector.hh"
57#include "G4Threading.hh"
58#include "G4Cache.hh"
59
61{
62 public:
63
65 // Constructor: initializes variables
66
68 // Destructor
69
70 // Biasing Methods
71
72 void SetXBias(const G4ThreeVector&);
73 // Allows the user to re-distribute the random
74 // numbers used to generate x co-ordinates
75
76 void SetYBias(const G4ThreeVector&);
77 // Allows the user to re-distribute the random
78 // numbers used to generate y co-ordinates
79
80 void SetZBias(const G4ThreeVector&);
81 // Allows the user to re-distribute the random
82 // numbers used to generate z co-ordinates
83
84 void SetThetaBias(const G4ThreeVector&);
85 // Allows the user to re-distribute the random
86 // numbers used to generate values of theta
87
88 void SetPhiBias(const G4ThreeVector&);
89 // Allows the user to re-distribute the random
90 // numbers used to generate values of phi
91
92 void SetEnergyBias(const G4ThreeVector&);
93 // Allows the user to re-distribute the random
94 // numbers used to generate the energies
95
96 void SetPosThetaBias(const G4ThreeVector&);
97 // Allows the user to re-distribute the random
98 // numbers used to generate values of theta for position distribution
99
100 void SetPosPhiBias(const G4ThreeVector&);
101 // Allows the user to re-distribute the random
102 // numbers used to generate values of phi for position distribution
103
105 // Generates the random number for x, with or without biasing
106
108 // Generates the random number for y, with or without biasing
109
111 // Generates the random number for z, with or without biasing
112
114 // Generates the random number for theta, with or without biasing
115
117 // Generates the random number for phi, with or without biasing
118
120 // Generates the random number for energy, with or without biasing
121
123 // Generates the random number for theta, with or without biasing
124 // for position distribution
125
127 // Generates the random number for phi, with or without biasing
128 // for position distribution
129
130 void SetIntensityWeight(G4double weight);
131
132 G4double GetBiasWeight() const ;
133 // Returns the weight change after biasing
134
135 // method to re-set the histograms
136 void ReSetHist(const G4String&);
137 // Resets the histogram for user defined distribution
138
139 void SetVerbosity(G4int a);
140 // Sets the verbosity level
141
142 private:
143
144 // Encapsulate in a struct to guarantee that correct
145 // initial state is set via constructor
146 //
147 struct a_check
148 {
150 a_check() { val = false; }
151 };
152
153 // See .cc for an explanation of this in method GenRandX()
154 //
187
189 {
191 bweights_t();
192 G4double& operator[] (const int i);
193 };
195 // record x,y,z,theta,phi,energy,posThet,posPhi,intensity weights
196
198 // Verbosity
199
201 // Protect shared resources
202};
203
204#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
G4PhysicsFreeVector IPDFPosThetaBiasH
void SetIntensityWeight(G4double weight)
G4PhysicsFreeVector IPDFXBiasH
G4Cache< a_check > local_IPDFYBias
void SetXBias(const G4ThreeVector &)
G4Cache< a_check > local_IPDFPosThetaBias
G4PhysicsFreeVector PosThetaBiasH
G4PhysicsFreeVector IPDFEnergyBiasH
void SetEnergyBias(const G4ThreeVector &)
G4Cache< a_check > local_IPDFXBias
G4PhysicsFreeVector ZBiasH
void SetPosPhiBias(const G4ThreeVector &)
G4PhysicsFreeVector IPDFPosPhiBiasH
G4PhysicsFreeVector IPDFThetaBiasH
G4PhysicsFreeVector EnergyBiasH
G4PhysicsFreeVector PhiBiasH
G4PhysicsFreeVector XBiasH
G4Cache< a_check > local_IPDFPosPhiBias
G4Cache< a_check > local_IPDFThetaBias
G4PhysicsFreeVector YBiasH
void SetThetaBias(const G4ThreeVector &)
G4double GetBiasWeight() const
G4PhysicsFreeVector PosPhiBiasH
void SetYBias(const G4ThreeVector &)
G4Cache< a_check > local_IPDFPhiBias
G4Cache< a_check > local_IPDFEnergyBias
void SetPosThetaBias(const G4ThreeVector &)
G4PhysicsFreeVector ThetaBiasH
G4Cache< a_check > local_IPDFZBias
G4PhysicsFreeVector IPDFZBiasH
void SetPhiBias(const G4ThreeVector &)
void SetZBias(const G4ThreeVector &)
G4PhysicsFreeVector IPDFYBiasH
G4PhysicsFreeVector IPDFPhiBiasH
void ReSetHist(const G4String &)
G4Cache< bweights_t > bweights