45 : loopMax(100), parentMass(pMass), mDaughter0(dMass0), mDaughter1(dMass1),
46 mDaughter2(dMass2), pDaughter0(0.), pDaughter1(0.), pDaughter2(0.) {;}
49 G4bool G4GDecay3::CalculateMomentumMagnitudes()
62 G4double availableE = parentMass - mDaughter0 - mDaughter1 - mDaughter2;
76 energy = rndm2*availableE;
77 pDaughter0 = std::sqrt(energy*energy + 2.0*energy*mDaughter0);
78 if (pDaughter0 > momentummax) momentummax = pDaughter0;
79 momentumsum += pDaughter0;
82 energy = (1.-rndm1)*availableE;
83 pDaughter1 = std::sqrt(energy*energy + 2.0*energy*mDaughter1);
84 if (pDaughter1 > momentummax) momentummax = pDaughter1;
85 momentumsum += pDaughter1;
88 energy = (rndm1-rndm2)*availableE;
89 pDaughter2 = std::sqrt(energy*energy + 2.0*energy*mDaughter2);
90 if (pDaughter2 > momentummax) momentummax = pDaughter2;
91 momentumsum += pDaughter2;
93 status = looper < loopMax;
94 }
while ((momentummax > momentumsum - momentummax) && status);
103 std::vector<G4ThreeVector> pVect;
105 if (CalculateMomentumMagnitudes() ) {
109 G4double sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
113 G4ThreeVector direction0(sintheta*cosphi, sintheta*sinphi, costheta);
115 G4double costhetan = (pDaughter1*pDaughter1 - pDaughter2*pDaughter2
116 - pDaughter0*pDaughter0)/(2.0*pDaughter2*pDaughter0);
117 G4double sinthetan = std::sqrt((1.0-costhetan)*(1.0+costhetan));
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);
129 pVect.push_back(pDaughter0*direction0);
130 pVect.push_back(-direction0*pDaughter0 - direction2*pDaughter2);
131 pVect.push_back(pDaughter2*direction2);
134 G4cerr <<
"G4GDecay3::GetThreeBodyMomenta: " << loopMax
135 <<
" or more loops in momentum magnitude calculation " <<
G4endl;
std::vector< G4ThreeVector > GetThreeBodyMomenta()
static constexpr double twopi
G4double energy(const ThreeVector &p, const G4double m)
G4GLOB_DLL std::ostream G4cerr