Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4HadPhaseSpaceKopylov Class Reference

#include <G4HadPhaseSpaceKopylov.hh>

+ Inheritance diagram for G4HadPhaseSpaceKopylov:

Public Member Functions

 G4HadPhaseSpaceKopylov (G4int verbose=0)
 
virtual ~G4HadPhaseSpaceKopylov ()
 
- Public Member Functions inherited from G4VHadPhaseSpaceAlgorithm
 G4VHadPhaseSpaceAlgorithm (const G4String &algName, G4int verbose=0)
 
virtual ~G4VHadPhaseSpaceAlgorithm ()
 
- Public Member Functions inherited from G4VHadDecayAlgorithm
 G4VHadDecayAlgorithm (const G4String &algName, G4int verbose=0)
 
virtual ~G4VHadDecayAlgorithm ()
 
void Generate (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
virtual void SetVerboseLevel (G4int verbose)
 
G4int GetVerboseLevel () const
 
const G4StringGetName () const
 

Protected Member Functions

virtual void GenerateMultiBody (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
G4double BetaKopylov (G4int K) const
 
- Protected Member Functions inherited from G4VHadPhaseSpaceAlgorithm
virtual void GenerateTwoBody (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
G4ThreeVector UniformVector (G4double mag=1.) const
 
- Protected Member Functions inherited from G4VHadDecayAlgorithm
virtual G4bool IsDecayAllowed (G4double initialMass, const std::vector< G4double > &masses) const
 
G4double TwoBodyMomentum (G4double M0, G4double M1, G4double M2) const
 
G4double UniformTheta () const
 
G4double UniformPhi () const
 
void PrintVector (const std::vector< G4double > &v, const G4String &name, std::ostream &os) const
 

Detailed Description

Definition at line 37 of file G4HadPhaseSpaceKopylov.hh.

Constructor & Destructor Documentation

◆ G4HadPhaseSpaceKopylov()

G4HadPhaseSpaceKopylov::G4HadPhaseSpaceKopylov ( G4int verbose = 0)
inline

Definition at line 39 of file G4HadPhaseSpaceKopylov.hh.

40 : G4VHadPhaseSpaceAlgorithm("G4HadPhaseSpaceKopylov",verbose) {;}
G4VHadPhaseSpaceAlgorithm(const G4String &algName, G4int verbose=0)

◆ ~G4HadPhaseSpaceKopylov()

virtual G4HadPhaseSpaceKopylov::~G4HadPhaseSpaceKopylov ( )
inlinevirtual

Definition at line 41 of file G4HadPhaseSpaceKopylov.hh.

41{;}

Member Function Documentation

◆ BetaKopylov()

G4double G4HadPhaseSpaceKopylov::BetaKopylov ( G4int K) const
protected

Definition at line 92 of file G4HadPhaseSpaceKopylov.cc.

92 {
93 G4Pow* g4pow = G4Pow::GetInstance();
94
95 G4int N = 3*K - 5;
96 G4double xN = G4double(N);
97 G4double Fmax = std::sqrt(g4pow->powN(xN/(xN+1.),N)/(xN+1.));
98
99 G4double F, chi;
100 const G4int maxNumberOfLoops = 10000;
101 G4int loopCounter = 0;
102 do {
103 chi = G4UniformRand();
104 F = std::sqrt(g4pow->powN(chi,N)*(1.-chi));
105 } while ( ( Fmax*G4UniformRand() > F ) && ++loopCounter < maxNumberOfLoops ); /* Loop checking, 02.11.2015, A.Ribon */
106 if ( loopCounter >= maxNumberOfLoops ) {
108 ed << " Failed sampling after maxNumberOfLoops attempts : forced exit" << G4endl;
109 G4Exception( " G4HadPhaseSpaceKopylov::BetaKopylov ", "HAD_KOPYLOV_001", JustWarning, ed );
110 }
111
112 return chi;
113}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
#define G4UniformRand()
Definition Randomize.hh:52
Definition G4Pow.hh:49
static G4Pow * GetInstance()
Definition G4Pow.cc:41
G4double powN(G4double x, G4int n) const
Definition G4Pow.cc:162
#define N
Definition crc32.c:57

Referenced by GenerateMultiBody().

◆ GenerateMultiBody()

void G4HadPhaseSpaceKopylov::GenerateMultiBody ( G4double initialMass,
const std::vector< G4double > & masses,
std::vector< G4LorentzVector > & finalState )
protectedvirtual

Implements G4VHadDecayAlgorithm.

Definition at line 43 of file G4HadPhaseSpaceKopylov.cc.

46 {
47 if (GetVerboseLevel()) G4cout << GetName() << "::GenerateMultiBody" << G4endl;
48
49 finalState.clear();
50
51 G4int N = (G4int)masses.size();
52 finalState.resize(N);
53
54 G4double mtot = std::accumulate(masses.begin(), masses.end(), 0.0);
55 G4double mu = mtot;
56 G4double PFragMagCM = 0.0;
57 G4double Mass = initialMass;
58 G4double T = Mass-mtot;
59 G4LorentzVector PFragCM(0.0,0.0,0.0,0.0);
60 G4LorentzVector PRestCM(0.0,0.0,0.0,0.0);
61 G4LorentzVector PRestLab(0.0,0.0,0.0,Mass);
62
63 for (G4int k=N-1; k>0; --k) {
64 mu -= masses[k];
65 T *= (k>1) ? BetaKopylov(k) : 0.;
66
67 G4double RestMass = mu + T;
68
69 PFragMagCM = TwoBodyMomentum(Mass,masses[k],RestMass);
70
71 // Create a unit vector with a random direction isotropically distributed
72 G4ThreeVector RandVector = UniformVector(PFragMagCM);
73
74 PFragCM.setVectM(RandVector,masses[k]);
75 PRestCM.setVectM(-RandVector,RestMass);
76
77 G4ThreeVector BoostV = PRestLab.boostVector();
78
79 PFragCM.boost(BoostV);
80 PRestCM.boost(BoostV);
81 PRestLab = PRestCM;
82 Mass = RestMass;
83 finalState[k] = PFragCM;
84 }
85
86 finalState[0] = PRestLab;
87}
G4GLOB_DLL std::ostream G4cout
G4double BetaKopylov(G4int K) const
const G4String & GetName() const
G4double TwoBodyMomentum(G4double M0, G4double M1, G4double M2) const
G4ThreeVector UniformVector(G4double mag=1.) const

The documentation for this class was generated from the following files: