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

Last change on this file since 1315 was 1315, checked in by garnier, 14 years ago

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 9.3 KB
Line 
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
184  G4double GetMonoEnergy () {return MonoEnergy; }; //Mono-energteic energy
185  G4double GetSE() {return SE;}; // Standard deviation for Gaussion distrbution in energy
186  G4double Getalpha () {return alpha;}; // alpha (pow)
187  G4double GetEzero() {return Ezero;}; // E0 (exp)
188  G4double GetTemp() {return Temp;}; // Temp (bbody,brem)
189  G4double Getgrad() {return grad;}; // gradient and intercept for linear spectra
190  G4double Getcept() {return cept;};
191
192  inline G4PhysicsOrderedFreeVector  GetUserDefinedEnergyHisto(){return UDefEnergyH;};
193  inline G4PhysicsOrderedFreeVector  GetArbEnergyHisto(){return ArbEnergyH;};
194
195  G4double GenerateOne(G4ParticleDefinition*);
196 
197private:
198  void LinearInterpolation();
199  void LogInterpolation();
200  void ExpInterpolation();
201  void SplineInterpolation();
202  void CalculateCdgSpectrum(); 
203  void CalculateBbodySpectrum();
204
205  // The following methods generate energies according to the spectral
206  // parameters defined above.
207  void GenerateMonoEnergetic();
208  void GenerateLinearEnergies(G4bool);
209  void GeneratePowEnergies(G4bool);
210  void GenerateExpEnergies(G4bool );
211  void GenerateGaussEnergies();
212  void GenerateBremEnergies();
213  void GenerateBbodyEnergies();
214  void GenerateCdgEnergies();
215  void GenUserHistEnergies();
216  void GenEpnHistEnergies();
217  void GenArbPointEnergies();
218  // converts energy per nucleon to energy.
219  void ConvertEPNToEnergy();
220
221private:
222
223  G4String EnergyDisType; // energy dis type Variable  - Mono,Lin,Exp,etc
224  G4double MonoEnergy; //Mono-energteic energy
225  G4double SE ; // Standard deviation for Gaussion distrbution in energy
226  G4double Emin, Emax; // emin and emax
227  G4double alpha, Ezero, Temp; // alpha (pow), E0 (exp) and Temp (bbody,brem)
228  G4double grad, cept; // gradient and intercept for linear spectra
229  G4bool EnergySpec; // true - energy spectra, false - momentum spectra
230  G4bool DiffSpec;  // true - differential spec, false integral spec
231  G4bool ApplyRig; // false no rigidity cutoff, true then apply one
232  G4double ERig; // energy of rigidity cutoff
233  G4PhysicsOrderedFreeVector UDefEnergyH; // energy hist data
234  G4PhysicsOrderedFreeVector IPDFEnergyH; 
235  G4bool IPDFEnergyExist, IPDFArbExist, Epnflag;
236  G4PhysicsOrderedFreeVector ArbEnergyH; // Arb x,y histogram
237  G4PhysicsOrderedFreeVector IPDFArbEnergyH; // IPDF for Arb
238  G4PhysicsOrderedFreeVector EpnEnergyH; 
239  G4double CDGhist[3]; // cumulative histo for cdg
240  G4double BBHist[10001], Bbody_x[10001];
241  G4String IntType; // Interpolation type
242  G4double Arb_grad[1024], Arb_cept[1024]; // grad and cept for 1024 segments
243  G4double Arb_alpha[1024], Arb_Const[1024]; // alpha and constants
244  G4double Arb_ezero[1024]; // ezero
245  G4double ArbEmin, ArbEmax; // Emin and Emax for the whole arb distribution used primarily for debug.
246
247  G4double               particle_energy;
248  G4ParticleDefinition*  particle_definition;
249
250  G4SPSRandomGenerator* eneRndm;
251
252  // Verbosity
253  G4int verbosityLevel;
254
255  G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
256
257  G4DataInterpolation *SplineInt; // holds Spline stuff
258
259};
260
261
262#endif
263
264
265
266
Note: See TracBrowser for help on using the repository browser.