source: trunk/source/event/include/G4SPSEneDistribution.hh@ 1026

Last change on this file since 1026 was 816, checked in by garnier, 17 years ago

import all except CVS

File size: 8.7 KB
RevLine 
[816]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: G4SPSEneDistribution.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 energy of a primary vertex according to the defined distribution
51//
52///////////////////////////////////////////////////////////////////////////////
53//
54// MEMBER FUNCTIONS
55// ----------------
56//
57// G4SPSEneDistribution ()
58// Constructor: Initializes variables
59//
60// ~G4SPSEneDistribution ()
61// Destructor:
62//
63// void SetEnergyDisType(G4String)
64// Allows the user to choose the energy distribution type. The arguments
65// are Mono (mono-energetic), Lin (linear), Pow (power-law), Exp
66// (exponential), Gauss (gaussian), Brem (bremsstrahlung), BBody (black-body), Cdg
67// (cosmic diffuse gamma-ray), User (user-defined), Arb (arbitrary
68// point-wise), Epn (energy per nucleon).
69//
70// void SetEmin(G4double)
71// Sets the minimum energy.
72//
73// void SetEmax(G4double)
74// Sets the maximum energy.
75//
76// void SetMonoEnergy(G4double)
77// Sets energy for mono-energetic distribution.
78//
79// void SetAlpha(G4double)
80// Sets alpha for a power-law distribution.
81//
82// void SetTemp(G4double)
83// Sets Temperature for a Brem or BBody distributions.
84//
85// void SetEzero(G4double)
86// Sets Ezero for an exponential distribution.
87//
88// void SetGradient(G4double)
89// Sets gradient for a linear distribution.
90//
91// void SetInterCept(G4double)
92// Sets intercept for a linear distribution.
93//
94// void UserEnergyHisto(G4ThreeVector)
95// Allows user to defined a histogram for the energy distribution.
96//
97// void ArbEnergyHisto(G4ThreeVector)
98// Allows the user to define an Arbitrary set of points for the
99// energy distribution.
100//
101// void EpnEnergyHisto(G4ThreeVector)
102// Allows the user to define an Energy per nucleon histogram.
103//
104// void Calculate()
105// Controls the calculation of Integral PDF for the Cdg and BBody
106// distributions.
107//
108// void InputEnergySpectra(G4bool)
109// Allows the user to choose between momentum and energy histograms
110// for user-defined histograms and arbitrary point-wise spectr.
111// The default is true (energy).
112//
113// void InputDifferentialSpectra(G4bool)
114// Allows the user to choose between integral and differential
115// distributions when using the arbitrary point-wise option.
116//
117// void ArbInterpolate(G4String)
118// ArbInterpolate allows the user to specify the type of function to
119// interpolate the Arbitrary points spectrum with.
120//
121// void SetBiasRndm (G4SPSRandomGenerator* a)
122// Sets the biased random number generator
123//
124// G4double GenerateOne(G4ParticleDefinition*);
125// Generate one random energy for the specified particle
126//
127// void ReSetHist(G4String);
128// Re-sets the histogram for user defined distribution
129//
130// void SetVerbosity(G4int)
131// Sets the verbosity level.
132//
133///////////////////////////////////////////////////////////////////////////////
134
135#ifndef G4SPSEneDistribution_h
136#define G4SPSEneDistribution_h 1
137
138#include "G4PhysicsOrderedFreeVector.hh"
139#include "G4ParticleMomentum.hh"
140#include "G4ParticleDefinition.hh"
141#include "G4DataInterpolation.hh"
142
143//
144#include "G4SPSRandomGenerator.hh"
145
146class G4SPSEneDistribution
147{
148public:
149 G4SPSEneDistribution ();
150 ~G4SPSEneDistribution ();
151
152 void SetEnergyDisType(G4String);
153 inline G4String GetEnergyDisType() {return EnergyDisType;};
154 void SetEmin(G4double);
155 inline G4double GetEmin() {return Emin;} ;
156 inline G4double GetArbEmin() {return ArbEmin;} ;
157 void SetEmax(G4double);
158 inline G4double GetEmax() {return Emax;} ;
159 inline G4double GetArbEmax() {return ArbEmax;};
160 void SetMonoEnergy(G4double);
161 void SetAlpha(G4double);
162 void SetTemp(G4double);
163 void SetBeamSigmaInE(G4double);
164 void SetEzero(G4double);
165 void SetGradient(G4double);
166 void SetInterCept(G4double);
167 void UserEnergyHisto(G4ThreeVector);
168 void ArbEnergyHisto(G4ThreeVector);
169 void EpnEnergyHisto(G4ThreeVector);
170
171 void InputEnergySpectra(G4bool);
172 void InputDifferentialSpectra(G4bool);
173 void ArbInterpolate(G4String);
174 inline G4String GetIntType() {return IntType;};
175 void Calculate();
176 //
177 void SetBiasRndm(G4SPSRandomGenerator* a) {eneRndm = a; };
178 // method to re-set the histograms
179 void ReSetHist(G4String);
180 // Set the verbosity level.
181 void SetVerbosity(G4int a) {verbosityLevel = a; } ;
182 //x
183 G4double GenerateOne(G4ParticleDefinition*);
184
185private:
186 void LinearInterpolation();
187 void LogInterpolation();
188 void ExpInterpolation();
189 void SplineInterpolation();
190 void CalculateCdgSpectrum();
191 void CalculateBbodySpectrum();
192
193 // The following methods generate energies according to the spectral
194 // parameters defined above.
195 void GenerateMonoEnergetic();
196 void GenerateLinearEnergies(G4bool);
197 void GeneratePowEnergies(G4bool);
198 void GenerateExpEnergies(G4bool );
199 void GenerateGaussEnergies();
200 void GenerateBremEnergies();
201 void GenerateBbodyEnergies();
202 void GenerateCdgEnergies();
203 void GenUserHistEnergies();
204 void GenEpnHistEnergies();
205 void GenArbPointEnergies();
206 // converts energy per nucleon to energy.
207 void ConvertEPNToEnergy();
208
209private:
210
211 G4String EnergyDisType; // energy dis type Variable - Mono,Lin,Exp,etc
212 G4double MonoEnergy; //Mono-energteic energy
213 G4double SE ; // Standard deviation for Gaussion distrbution in energy
214 G4double Emin, Emax; // emin and emax
215 G4double alpha, Ezero, Temp; // alpha (pow), E0 (exp) and Temp (bbody,brem)
216 G4double grad, cept; // gradient and intercept for linear spectra
217 G4bool EnergySpec; // true - energy spectra, false - momentum spectra
218 G4bool DiffSpec; // true - differential spec, false integral spec
219 G4bool ApplyRig; // false no rigidity cutoff, true then apply one
220 G4double ERig; // energy of rigidity cutoff
221 G4PhysicsOrderedFreeVector UDefEnergyH; // energy hist data
222 G4PhysicsOrderedFreeVector IPDFEnergyH;
223 G4bool IPDFEnergyExist, IPDFArbExist, Epnflag;
224 G4PhysicsOrderedFreeVector ArbEnergyH; // Arb x,y histogram
225 G4PhysicsOrderedFreeVector IPDFArbEnergyH; // IPDF for Arb
226 G4PhysicsOrderedFreeVector EpnEnergyH;
227 G4double CDGhist[3]; // cumulative histo for cdg
228 G4double BBHist[10001], Bbody_x[10001];
229 G4String IntType; // Interpolation type
230 G4double Arb_grad[1024], Arb_cept[1024]; // grad and cept for 1024 segments
231 G4double Arb_alpha[1024], Arb_Const[1024]; // alpha and constants
232 G4double Arb_ezero[1024]; // ezero
233 G4double ArbEmin, ArbEmax; // Emin and Emax for the whole arb distribution used primarily for debug.
234
235 G4double particle_energy;
236 G4ParticleDefinition* particle_definition;
237
238 G4SPSRandomGenerator* eneRndm;
239
240 // Verbosity
241 G4int verbosityLevel;
242
243 G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
244
245 G4DataInterpolation *SplineInt; // holds Spline stuff
246
247};
248
249
250#endif
251
252
253
254
Note: See TracBrowser for help on using the repository browser.