Geant4-11
Public Member Functions | Private Member Functions | Private Attributes
G4GDecay3 Class Reference

#include <G4GDecay3.hh>

Public Member Functions

 G4GDecay3 ()
 
 G4GDecay3 (const G4double &pMass, const G4double &dMass0, const G4double &dMass1, const G4double &dMass2)
 
std::vector< G4ThreeVectorGetThreeBodyMomenta ()
 
 ~G4GDecay3 ()
 

Private Member Functions

G4bool CalculateMomentumMagnitudes ()
 

Private Attributes

G4int loopMax
 
G4double mDaughter0
 
G4double mDaughter1
 
G4double mDaughter2
 
G4double parentMass
 
G4double pDaughter0
 
G4double pDaughter1
 
G4double pDaughter2
 

Detailed Description

Definition at line 42 of file G4GDecay3.hh.

Constructor & Destructor Documentation

◆ G4GDecay3() [1/2]

G4GDecay3::G4GDecay3 ( )
inline

Definition at line 45 of file G4GDecay3.hh.

45{;}

◆ G4GDecay3() [2/2]

G4GDecay3::G4GDecay3 ( const G4double pMass,
const G4double dMass0,
const G4double dMass1,
const G4double dMass2 
)

Definition at line 42 of file G4GDecay3.cc.

44 : loopMax(100), mDaughter0(dMass0), mDaughter1(dMass1),
45 mDaughter2(dMass2), pDaughter0(0.), pDaughter1(0.), pDaughter2(0.)
46{
48}
G4int loopMax
Definition: G4GDecay3.hh:55
G4double mDaughter0
Definition: G4GDecay3.hh:58
G4double mDaughter1
Definition: G4GDecay3.hh:59
G4double pDaughter2
Definition: G4GDecay3.hh:64
G4double pDaughter0
Definition: G4GDecay3.hh:62
G4double pDaughter1
Definition: G4GDecay3.hh:63
G4double mDaughter2
Definition: G4GDecay3.hh:60
G4double parentMass
Definition: G4GDecay3.hh:57
static constexpr double keV
T max(const T t1, const T t2)
brief Return the largest of the two arguments

References CLHEP::keV, G4INCL::Math::max(), mDaughter0, mDaughter1, mDaughter2, and parentMass.

◆ ~G4GDecay3()

G4GDecay3::~G4GDecay3 ( )
inline

Definition at line 48 of file G4GDecay3.hh.

48{;}

Member Function Documentation

◆ CalculateMomentumMagnitudes()

G4bool G4GDecay3::CalculateMomentumMagnitudes ( )
private

Definition at line 50 of file G4GDecay3.cc.

51{
52 G4double rndm;
53 G4double rndm1;
54 G4double rndm2;
55
56 G4double momentummax;
57 G4double momentumsum;
59
61 do { /* Loop checking 08.06.2015 MHK */
62 rndm1 = G4UniformRand();
63 rndm2 = G4UniformRand();
64 if (rndm2 > rndm1) {
65 // keep randoms in descending order
66 rndm = rndm1;
67 rndm1 = rndm2;
68 rndm2 = rndm;
69 }
70 momentummax = 0.0;
71 momentumsum = 0.0;
72
73 // daughter 0
74 energy = rndm2*availableE;
75 pDaughter0 = std::sqrt(energy*energy + 2.0*energy*mDaughter0);
76 if (pDaughter0 > momentummax) momentummax = pDaughter0;
77 momentumsum += pDaughter0;
78
79 // daughter 1
80 energy = (1.-rndm1)*availableE;
81 pDaughter1 = std::sqrt(energy*energy + 2.0*energy*mDaughter1);
82 if (pDaughter1 > momentummax) momentummax = pDaughter1;
83 momentumsum += pDaughter1;
84
85 // daughter 2
86 energy = (rndm1-rndm2)*availableE;
87 pDaughter2 = std::sqrt(energy*energy + 2.0*energy*mDaughter2);
88 if (pDaughter2 > momentummax) momentummax = pDaughter2;
89 momentumsum += pDaughter2;
90 } while (momentummax > momentumsum - momentummax);
91
92 return true;
93}
double G4double
Definition: G4Types.hh:83
#define G4UniformRand()
Definition: Randomize.hh:52
G4double energy(const ThreeVector &p, const G4double m)

References G4INCL::KinematicsUtils::energy(), G4UniformRand, mDaughter0, mDaughter1, mDaughter2, parentMass, pDaughter0, pDaughter1, and pDaughter2.

Referenced by GetThreeBodyMomenta().

◆ GetThreeBodyMomenta()

std::vector< G4ThreeVector > G4GDecay3::GetThreeBodyMomenta ( )

Definition at line 96 of file G4GDecay3.cc.

97{
98
99 std::vector<G4ThreeVector> pVect;
100
102
103 // Calculate directions
104 G4double costheta = 2.*G4UniformRand()-1.;
105 G4double sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
107 G4double sinphi = std::sin(phi);
108 G4double cosphi = std::cos(phi);
109 G4ThreeVector direction0(sintheta*cosphi, sintheta*sinphi, costheta);
110
113 G4double sinthetan = std::sqrt((1.0-costhetan)*(1.0+costhetan));
115 G4double sinphin = std::sin(phin);
116 G4double cosphin = std::cos(phin);
117 G4ThreeVector direction2;
118 direction2.setX(sinthetan*cosphin*costheta*cosphi -
119 sinthetan*sinphin*sinphi + costhetan*sintheta*cosphi);
120 direction2.setY(sinthetan*cosphin*costheta*sinphi +
121 sinthetan*sinphin*cosphi + costhetan*sintheta*sinphi);
122 direction2.setZ(-sinthetan*cosphin*sintheta + costhetan*costheta);
123
124 // Return momentum vectors
125 pVect.push_back(pDaughter0*direction0);
126 pVect.push_back(-direction0*pDaughter0 - direction2*pDaughter2);
127 pVect.push_back(pDaughter2*direction2);
128
129 } else {
130 G4cerr << "G4GDecay3::GetThreeBodyMomenta: " << loopMax
131 << " or more loops in momentum magnitude calculation " << G4endl;
132 }
133
134 return pVect;
135}
static constexpr double twopi
Definition: G4SIunits.hh:56
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
void setY(double)
void setZ(double)
void setX(double)
G4bool CalculateMomentumMagnitudes()
Definition: G4GDecay3.cc:50

References CalculateMomentumMagnitudes(), G4cerr, G4endl, G4UniformRand, loopMax, pDaughter0, pDaughter1, pDaughter2, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), and twopi.

Referenced by G4ElementaryParticleCollider::generateSCMmuonAbsorption().

Field Documentation

◆ loopMax

G4int G4GDecay3::loopMax
private

Definition at line 55 of file G4GDecay3.hh.

Referenced by GetThreeBodyMomenta().

◆ mDaughter0

G4double G4GDecay3::mDaughter0
private

Definition at line 58 of file G4GDecay3.hh.

Referenced by CalculateMomentumMagnitudes(), and G4GDecay3().

◆ mDaughter1

G4double G4GDecay3::mDaughter1
private

Definition at line 59 of file G4GDecay3.hh.

Referenced by CalculateMomentumMagnitudes(), and G4GDecay3().

◆ mDaughter2

G4double G4GDecay3::mDaughter2
private

Definition at line 60 of file G4GDecay3.hh.

Referenced by CalculateMomentumMagnitudes(), and G4GDecay3().

◆ parentMass

G4double G4GDecay3::parentMass
private

Definition at line 57 of file G4GDecay3.hh.

Referenced by CalculateMomentumMagnitudes(), and G4GDecay3().

◆ pDaughter0

G4double G4GDecay3::pDaughter0
private

Definition at line 62 of file G4GDecay3.hh.

Referenced by CalculateMomentumMagnitudes(), and GetThreeBodyMomenta().

◆ pDaughter1

G4double G4GDecay3::pDaughter1
private

Definition at line 63 of file G4GDecay3.hh.

Referenced by CalculateMomentumMagnitudes(), and GetThreeBodyMomenta().

◆ pDaughter2

G4double G4GDecay3::pDaughter2
private

Definition at line 64 of file G4GDecay3.hh.

Referenced by CalculateMomentumMagnitudes(), and GetThreeBodyMomenta().


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