Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4FermiPhaseSpaceDecay.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// $Id: G4ExcitationHandler.hh,v 1.13 2010-11-17 16:20:31 vnivanch Exp $
27// GEANT4 tag $Name: not supported by cvs2svn $
28//
29// Hadronic Process: Phase space decay for the Fermi BreakUp model
30// by V. Lara
31//
32// Modifications:
33// 01.04.2011 General cleanup by V.Ivanchenko:
34// - IsotropicVector is inlined
35// - Momentum computation return zero or positive value
36// - DumpProblem method is added providing more information
37// - Reduced usage of exotic std functions
38//
39
40#ifndef G4FermiPhaseSpaceDecay_hh
41#define G4FermiPhaseSpaceDecay_hh 1
42
43#include <vector>
45
46#include "G4LorentzVector.hh"
47#include "G4ThreeVector.hh"
48#include "Randomize.hh"
49#include "G4Pow.hh"
50
52{
53public:
54
57
58 inline std::vector<G4LorentzVector*> *
59 Decay(const G4double, const std::vector<G4double>&) const;
60
61private:
62
63 inline G4double PtwoBody(G4double E, G4double P1, G4double P2) const;
64
65 inline G4ThreeVector IsotropicVector(const G4double Magnitude = 1.0) const;
66
67 inline G4double BetaKopylov(G4int) const;
68
69 std::vector<G4LorentzVector*> *
70 TwoBodyDecay(G4double, const std::vector<G4double>&) const;
71
72 std::vector<G4LorentzVector*> *
73 NBodyDecay(G4double, const std::vector<G4double>&) const;
74
75 std::vector<G4LorentzVector*> *
76 KopylovNBodyDecay(G4double, const std::vector<G4double>&) const;
77
78 void DumpProblem(G4double E, G4double P1, G4double P2, G4double P) const;
79
81 const G4FermiPhaseSpaceDecay & operator=(const G4FermiPhaseSpaceDecay &);
82 G4bool operator==(const G4FermiPhaseSpaceDecay&);
83 G4bool operator!=(const G4FermiPhaseSpaceDecay&);
84
85 G4Pow* g4pow;
86};
87
88inline G4double
89G4FermiPhaseSpaceDecay::PtwoBody(G4double E, G4double P1, G4double P2) const
90{
91 G4double res = 0.0;
92 G4double P = (E+P1+P2)*(E+P1-P2)*(E-P1+P2)*(E-P1-P2)/(4.0*E*E);
93 if (P>0.0) { res = std::sqrt(P); }
94 else { DumpProblem(E,P1,P2,P); }
95 return res;
96}
97
98inline std::vector<G4LorentzVector*> * G4FermiPhaseSpaceDecay::
99Decay(G4double parent_mass, const std::vector<G4double>& fragment_masses) const
100{
101 return KopylovNBodyDecay(parent_mass,fragment_masses);
102}
103
104inline G4double G4FermiPhaseSpaceDecay::BetaKopylov(G4int K) const
105{
106 G4int N = 3*K - 5;
107 G4double xN = G4double(N);
108 G4double F;
109 //G4double Fmax=std::pow((3.*K-5.)/(3.*K-4.),(3.*K-5.)/2.)*std::sqrt(1-((3.*K-5.)/(3.*K-4.)));
110 // VI variant
111 G4double Fmax = std::sqrt(g4pow->powN(xN/(xN + 1),N)/(xN + 1));
112 G4double chi;
113 do {
114 chi = G4UniformRand();
115 F = std::sqrt(g4pow->powN(chi,N)*(1-chi));
116 } while ( Fmax*G4UniformRand() > F);
117 return chi;
118}
119
120inline G4ThreeVector
121G4FermiPhaseSpaceDecay::IsotropicVector(G4double Magnitude) const
122 // Samples a isotropic random vectorwith a magnitud given by Magnitude.
123 // By default Magnitude = 1.0
124{
125 G4double CosTheta = 2.0*G4UniformRand() - 1.0;
126 G4double SinTheta = std::sqrt((1. - CosTheta)*(1. + CosTheta));
127 G4double Phi = CLHEP::twopi*G4UniformRand();
128 G4ThreeVector Vector(Magnitude*std::cos(Phi)*SinTheta,
129 Magnitude*std::sin(Phi)*SinTheta,
130 Magnitude*CosTheta);
131 return Vector;
132}
133
134#endif
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4UniformRand()
Definition: Randomize.hh:53
std::vector< G4LorentzVector * > * Decay(const G4double, const std::vector< G4double > &) const
Definition: G4Pow.hh:54
G4double powN(G4double x, G4int n)
Definition: G4Pow.cc:98