Geant4  10.02.p03
G4GDecay3 Class Reference

#include <G4GDecay3.hh>

Collaboration diagram for G4GDecay3:

Public Member Functions

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

Private Member Functions

G4bool CalculateMomentumMagnitudes ()
 

Private Attributes

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

Detailed Description

Definition at line 43 of file G4GDecay3.hh.

Constructor & Destructor Documentation

◆ G4GDecay3() [1/2]

G4GDecay3::G4GDecay3 ( )
inline

Definition at line 46 of file G4GDecay3.hh.

46 {;}

◆ G4GDecay3() [2/2]

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

Definition at line 43 of file G4GDecay3.cc.

45  : loopMax(100), parentMass(pMass), mDaughter0(dMass0), mDaughter1(dMass1),
46  mDaughter2(dMass2), pDaughter0(0.), pDaughter1(0.), pDaughter2(0.) {;}
G4double mDaughter0
Definition: G4GDecay3.hh:59
G4double pDaughter2
Definition: G4GDecay3.hh:65
G4double mDaughter1
Definition: G4GDecay3.hh:60
G4double parentMass
Definition: G4GDecay3.hh:58
G4double pDaughter0
Definition: G4GDecay3.hh:63
G4int loopMax
Definition: G4GDecay3.hh:56
G4double mDaughter2
Definition: G4GDecay3.hh:61
G4double pDaughter1
Definition: G4GDecay3.hh:64

◆ ~G4GDecay3()

G4GDecay3::~G4GDecay3 ( )
inline

Definition at line 49 of file G4GDecay3.hh.

49 {;}
Here is the call graph for this function:

Member Function Documentation

◆ CalculateMomentumMagnitudes()

G4bool G4GDecay3::CalculateMomentumMagnitudes ( )
private

Definition at line 49 of file G4GDecay3.cc.

50 {
51  G4int looper = 0;
52  G4bool status;
53 
54  G4double rndm;
55  G4double rndm1;
56  G4double rndm2;
57 
58  G4double momentummax;
59  G4double momentumsum;
61 
63  do { /* Loop checking 08.06.2015 MHK */
64  rndm1 = G4UniformRand();
65  rndm2 = G4UniformRand();
66  if (rndm2 > rndm1) {
67  // keep randoms in descending order
68  rndm = rndm1;
69  rndm1 = rndm2;
70  rndm2 = rndm;
71  }
72  momentummax = 0.0;
73  momentumsum = 0.0;
74 
75  // daughter 0
76  energy = rndm2*availableE;
77  pDaughter0 = std::sqrt(energy*energy + 2.0*energy*mDaughter0);
78  if (pDaughter0 > momentummax) momentummax = pDaughter0;
79  momentumsum += pDaughter0;
80 
81  // daughter 1
82  energy = (1.-rndm1)*availableE;
83  pDaughter1 = std::sqrt(energy*energy + 2.0*energy*mDaughter1);
84  if (pDaughter1 > momentummax) momentummax = pDaughter1;
85  momentumsum += pDaughter1;
86 
87  // daughter 2
88  energy = (rndm1-rndm2)*availableE;
89  pDaughter2 = std::sqrt(energy*energy + 2.0*energy*mDaughter2);
90  if (pDaughter2 > momentummax) momentummax = pDaughter2;
91  momentumsum += pDaughter2;
92  looper++;
93  status = looper < loopMax;
94  } while ((momentummax > momentumsum - momentummax) && status);
95 
96  return status;
97 }
G4double mDaughter0
Definition: G4GDecay3.hh:59
int G4int
Definition: G4Types.hh:78
G4double pDaughter2
Definition: G4GDecay3.hh:65
G4double mDaughter1
Definition: G4GDecay3.hh:60
G4double parentMass
Definition: G4GDecay3.hh:58
#define G4UniformRand()
Definition: Randomize.hh:97
double energy
Definition: plottest35.C:25
bool G4bool
Definition: G4Types.hh:79
G4double pDaughter0
Definition: G4GDecay3.hh:63
double G4double
Definition: G4Types.hh:76
G4int loopMax
Definition: G4GDecay3.hh:56
G4double mDaughter2
Definition: G4GDecay3.hh:61
G4double pDaughter1
Definition: G4GDecay3.hh:64
Here is the caller graph for this function:

◆ GetThreeBodyMomenta()

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

Definition at line 100 of file G4GDecay3.cc.

101 {
102 
103  std::vector<G4ThreeVector> pVect;
104 
106 
107  // Calculate directions
108  G4double costheta = 2.*G4UniformRand()-1.;
109  G4double sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
110  G4double phi = twopi*G4UniformRand();
111  G4double sinphi = std::sin(phi);
112  G4double cosphi = std::cos(phi);
113  G4ThreeVector direction0(sintheta*cosphi, sintheta*sinphi, costheta);
114 
117  G4double sinthetan = std::sqrt((1.0-costhetan)*(1.0+costhetan));
118  G4double phin = twopi*G4UniformRand();
119  G4double sinphin = std::sin(phin);
120  G4double cosphin = std::cos(phin);
121  G4ThreeVector direction2;
122  direction2.setX(sinthetan*cosphin*costheta*cosphi -
123  sinthetan*sinphin*sinphi + costhetan*sintheta*cosphi);
124  direction2.setY(sinthetan*cosphin*costheta*sinphi +
125  sinthetan*sinphin*cosphi + costhetan*sintheta*sinphi);
126  direction2.setZ(-sinthetan*cosphin*sintheta + costhetan*costheta);
127 
128  // Return momentum vectors
129  pVect.push_back(pDaughter0*direction0);
130  pVect.push_back(-direction0*pDaughter0 - direction2*pDaughter2);
131  pVect.push_back(pDaughter2*direction2);
132 
133  } else {
134  G4cerr << "G4GDecay3::GetThreeBodyMomenta: " << loopMax
135  << " or more loops in momentum magnitude calculation " << G4endl;
136  }
137 
138  return pVect;
139 }
void setY(double)
G4double pDaughter2
Definition: G4GDecay3.hh:65
void setZ(double)
void setX(double)
G4bool CalculateMomentumMagnitudes()
Definition: G4GDecay3.cc:49
#define G4UniformRand()
Definition: Randomize.hh:97
static const double twopi
Definition: G4SIunits.hh:75
G4double pDaughter0
Definition: G4GDecay3.hh:63
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4int loopMax
Definition: G4GDecay3.hh:56
G4GLOB_DLL std::ostream G4cerr
G4double pDaughter1
Definition: G4GDecay3.hh:64
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ loopMax

G4int G4GDecay3::loopMax
private

Definition at line 56 of file G4GDecay3.hh.

◆ mDaughter0

G4double G4GDecay3::mDaughter0
private

Definition at line 59 of file G4GDecay3.hh.

◆ mDaughter1

G4double G4GDecay3::mDaughter1
private

Definition at line 60 of file G4GDecay3.hh.

◆ mDaughter2

G4double G4GDecay3::mDaughter2
private

Definition at line 61 of file G4GDecay3.hh.

◆ parentMass

G4double G4GDecay3::parentMass
private

Definition at line 58 of file G4GDecay3.hh.

◆ pDaughter0

G4double G4GDecay3::pDaughter0
private

Definition at line 63 of file G4GDecay3.hh.

◆ pDaughter1

G4double G4GDecay3::pDaughter1
private

Definition at line 64 of file G4GDecay3.hh.

◆ pDaughter2

G4double G4GDecay3::pDaughter2
private

Definition at line 65 of file G4GDecay3.hh.


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