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 | // Hadronic Process: Nuclear De-excitations |
---|
27 | // by V. Lara |
---|
28 | |
---|
29 | #ifndef G4FermiPhaseSpaceDecay_hh |
---|
30 | #define G4FermiPhaseSpaceDecay_hh |
---|
31 | |
---|
32 | |
---|
33 | #include "G4LorentzVector.hh" |
---|
34 | #include "G4ParticleMomentum.hh" |
---|
35 | #include "Randomize.hh" |
---|
36 | #include "G4Pow.hh" |
---|
37 | #include <CLHEP/Random/RandGamma.h> |
---|
38 | |
---|
39 | #include <vector> |
---|
40 | #include <cmath> |
---|
41 | |
---|
42 | class G4FermiPhaseSpaceDecay |
---|
43 | { |
---|
44 | public: |
---|
45 | |
---|
46 | G4FermiPhaseSpaceDecay(); |
---|
47 | ~G4FermiPhaseSpaceDecay(); |
---|
48 | |
---|
49 | inline std::vector<G4LorentzVector*> * |
---|
50 | Decay(const G4double, const std::vector<G4double>&) const; |
---|
51 | |
---|
52 | private: |
---|
53 | |
---|
54 | G4FermiPhaseSpaceDecay(const G4FermiPhaseSpaceDecay&); |
---|
55 | const G4FermiPhaseSpaceDecay & operator=(const G4FermiPhaseSpaceDecay &); |
---|
56 | G4bool operator==(const G4FermiPhaseSpaceDecay&); |
---|
57 | G4bool operator!=(const G4FermiPhaseSpaceDecay&); |
---|
58 | |
---|
59 | inline G4double PtwoBody(G4double E, G4double P1, G4double P2) const; |
---|
60 | |
---|
61 | G4ParticleMomentum IsotropicVector(const G4double Magnitude = 1.0) const; |
---|
62 | |
---|
63 | inline G4double BetaKopylov(const G4int) const; |
---|
64 | |
---|
65 | std::vector<G4LorentzVector*> * |
---|
66 | TwoBodyDecay(const G4double, const std::vector<G4double>&) const; |
---|
67 | |
---|
68 | std::vector<G4LorentzVector*> * |
---|
69 | NBodyDecay(const G4double, const std::vector<G4double>&) const; |
---|
70 | |
---|
71 | std::vector<G4LorentzVector*> * |
---|
72 | KopylovNBodyDecay(const G4double, const std::vector<G4double>&) const; |
---|
73 | }; |
---|
74 | |
---|
75 | inline G4double |
---|
76 | G4FermiPhaseSpaceDecay::PtwoBody(G4double E, G4double P1, G4double P2) const |
---|
77 | { |
---|
78 | G4double res = -1.0; |
---|
79 | G4double P = (E+P1+P2)*(E+P1-P2)*(E-P1+P2)*(E-P1-P2)/(4.0*E*E); |
---|
80 | if (P>0.0) { res = std::sqrt(P); } |
---|
81 | return res; |
---|
82 | } |
---|
83 | |
---|
84 | inline std::vector<G4LorentzVector*> * G4FermiPhaseSpaceDecay:: |
---|
85 | Decay(const G4double parent_mass, const std::vector<G4double>& fragment_masses) const |
---|
86 | { |
---|
87 | return KopylovNBodyDecay(parent_mass,fragment_masses); |
---|
88 | } |
---|
89 | |
---|
90 | inline G4double |
---|
91 | G4FermiPhaseSpaceDecay::BetaKopylov(const G4int K) const |
---|
92 | { |
---|
93 | //JMQ 250410 old algorithm has been commented |
---|
94 | // Notice that alpha > beta always |
---|
95 | // const G4double beta = 1.5; |
---|
96 | // G4double alpha = 1.5*(K-1); |
---|
97 | // G4double Y1 = CLHEP::RandGamma::shoot(alpha,1); |
---|
98 | // G4double Y2 = CLHEP::RandGamma::shoot(beta,1); |
---|
99 | |
---|
100 | // return Y1/(Y1+Y2); |
---|
101 | |
---|
102 | G4Pow* g4pow = G4Pow::GetInstance(); |
---|
103 | G4int N = 3*K - 5; |
---|
104 | G4double xN = G4double(N); |
---|
105 | G4double F; |
---|
106 | //G4double Fmax = std::pow((3.*K-5.)/(3.*K-4.),(3.*K-5.)/2.)*std::sqrt(1-((3.*K-5.)/(3.*K-4.))); |
---|
107 | // VI variant |
---|
108 | G4double Fmax = std::sqrt(g4pow->powZ(N, xN/(xN + 1))/(xN + 1)); |
---|
109 | G4double chi; |
---|
110 | do |
---|
111 | { |
---|
112 | chi = G4UniformRand(); |
---|
113 | F = std::sqrt(g4pow->powZ(N, chi)*(1-chi)); |
---|
114 | } while ( Fmax*G4UniformRand() > F); |
---|
115 | return chi; |
---|
116 | |
---|
117 | } |
---|
118 | |
---|
119 | #endif |
---|