80 theStateToNucleus(undefined),
81 theProjectilePotential(0),
83 theParentResonanceDef(nullptr),
84 theParentResonanceID(0)
109 theFermi3Momentum = right.theFermi3Momentum;
110 theTotal4Momentum = right.theTotal4Momentum;
111 theNucleon=right.theNucleon;
114 theActualWidth =
new G4double[nChannels];
115 for (
G4int i = 0; i < nChannels; i++)
117 theActualWidth[i] = right.theActualWidth[i];
120 theDaughterWidth = 0;
121 theStateToNucleus = right.theStateToNucleus;
122 theProjectilePotential = right.theProjectilePotential;
147 theDefinition(aDefinition),
148 theFormationTime(aFormationTime),
149 thePosition(aPosition),
150 the4Momentum(a4Momentum),
151 theFermi3Momentum(0),
152 theTotal4Momentum(a4Momentum),
154 theStateToNucleus(undefined),
155 theProjectilePotential(0),
157 theParentResonanceDef(nullptr),
158 theParentResonanceID(0)
178 if (theDecayTable != 0)
180 nChannels = theDecayTable->
entries();
200 theDaughterWidth = 0;
202 G4bool * theDaughterIsShortLived = 0;
204 if(nChannels!=0) theActualWidth =
new G4double[nChannels];
208 for (index = nChannels - 1; index >= 0; --index)
213 if (nDaughters == 2 || nDaughters == 3)
219 theDaughterMass =
new G4double[nDaughters];
220 theDaughterWidth =
new G4double[nDaughters];
221 theDaughterIsShortLived =
new G4bool[nDaughters];
222 for (
G4int n = 0; n < nDaughters; ++n)
239 if ( !theDaughterIsShortLived[0] && !theDaughterIsShortLived[1] )
249 theActualMom = EvaluateCMMomentum(theActualMass,
251 thePoleMom = EvaluateCMMomentum(thePoleMass,
259 else if ( !theDaughterIsShortLived[0] && theDaughterIsShortLived[1] )
270 theActualMom = IntegrateCMMomentum(lowerLimit);
271 thePoleMom = IntegrateCMMomentum(lowerLimit, thePoleMass);
281 else if ( theDaughterIsShortLived[0] && !theDaughterIsShortLived[1] )
295 G4SwapObj(theDaughterMass, theDaughterMass + 1);
296 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
300 theActualMom = IntegrateCMMomentum(lowerLimit);
301 thePoleMom = IntegrateCMMomentum(lowerLimit, thePoleMass);
311 else if ( theDaughterIsShortLived[0] && theDaughterIsShortLived[1] )
322 G4KineticTrack_Gmass = theActualMass;
323 theActualMom = IntegrateCMMomentum2();
324 G4KineticTrack_Gmass = thePoleMass;
325 thePoleMom = IntegrateCMMomentum2();
338 G4int nShortLived = 0;
339 if ( theDaughterIsShortLived[0] )
343 if ( theDaughterIsShortLived[1] )
346 G4SwapObj(theDaughterMass, theDaughterMass + 1);
347 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
349 if ( theDaughterIsShortLived[2] )
352 G4SwapObj(theDaughterMass, theDaughterMass + 2);
353 G4SwapObj(theDaughterWidth, theDaughterWidth + 2);
355 if ( nShortLived == 0 )
357 theDaughterMass[1]+=theDaughterMass[2];
358 theActualMom = EvaluateCMMomentum(theActualMass,
360 thePoleMom = EvaluateCMMomentum(thePoleMass,
364 else if ( nShortLived >= 1 )
367 G4SwapObj(theDaughterMass, theDaughterMass + 1);
368 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
369 theDaughterMass[0] += theDaughterMass[2];
370 theActualMom = IntegrateCMMomentum(0.0);
371 thePoleMom = IntegrateCMMomentum(0.0, thePoleMass);
381 G4double theMassRatio = thePoleMass / theActualMass;
382 G4double theMomRatio = theActualMom / thePoleMom;
388 theActualWidth[index] = thePoleWidth * theMassRatio *
390 delete [] theDaughterMass;
392 delete [] theDaughterWidth;
393 theDaughterWidth = 0;
394 delete [] theDaughterIsShortLived;
395 theDaughterIsShortLived = 0;
401 theActualWidth[index] = theChannel->
GetBR()*theMotherWidth;
426 : theDefinition(nucleon->GetDefinition()),
428 thePosition(aPosition),
429 the4Momentum(a4Momentum),
430 theFermi3Momentum(nucleon->GetMomentum()),
433 theActualMass(nucleon->GetDefinition()->GetPDGMass()),
437 theStateToNucleus(undefined),
438 theProjectilePotential(0),
440 theParentResonanceDef(nullptr),
441 theParentResonanceID(0)
443 theFermi3Momentum.
setE(0);
450 if (theActualWidth != 0)
delete [] theActualWidth;
451 if (theDaughterMass != 0)
delete [] theDaughterMass;
452 if (theDaughterWidth != 0)
delete [] theDaughterWidth;
463 the4Momentum = right.the4Momentum;
465 theFermi3Momentum = right.theFermi3Momentum;
466 theTotal4Momentum = right.theTotal4Momentum;
467 theNucleon = right.theNucleon;
468 theStateToNucleus = right.theStateToNucleus;
469 if (theActualWidth != 0)
delete [] theActualWidth;
471 theActualWidth =
new G4double[nChannels];
472 for (
G4int i = 0; i < nChannels; ++i) theActualWidth[i] = right.theActualWidth[i];
484 return (
this == & right);
491 return (
this != & right);
510 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
511 G4cerr <<
" track has no particle definition associated."<<
G4endl;
517 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
518 G4cerr <<
" particle definition has no decay table associated."<<
G4endl;
526 G4double theTotalActualWidth = this->EvaluateTotalActualWidth();
527 if (theTotalActualWidth !=0)
532 G4bool isChannelBelowThreshold =
true;
533 const G4int maxNumberOfLoops = 10000;
534 G4int loopCounter = 0;
540 G4int theNumberOfDaughters;
551 for (
G4int index = nChannels - 1; index >= 0; --index)
553 theSumActualWidth += theActualWidth[index];
554 theCumActualWidth[index] = theSumActualWidth;
562 for (
G4int index = nChannels - 1; index >= 0; --index)
564 if (r < theCumActualWidth[index])
573 delete [] theCumActualWidth;
577 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
578 G4cerr <<
" decay channel has 0x0 channel associated."<<
G4endl;
580 G4cerr <<
" channel index "<< chosench <<
"of "<<nChannels<<
"channels"<<
G4endl;
585 theBR = theActualWidth[chosench];
588 theDaughtersName1 =
"";
589 theDaughtersName2 =
"";
590 theDaughtersName3 =
"";
591 theDaughtersName4 =
"";
593 for (
G4int i=0; i < 4; ++i) masses[i]=0.;
594 G4int shortlivedDaughters[4];
595 G4int numberOfShortliveds(0);
597 for (
G4int aD=0; aD < theNumberOfDaughters ; ++aD)
603 shortlivedDaughters[numberOfShortliveds]=aD;
604 ++numberOfShortliveds;
610 switch (theNumberOfDaughters)
616 theDaughtersName2 =
"";
617 theDaughtersName3 =
"";
618 theDaughtersName4 =
"";
623 theDaughtersName3 =
"";
624 theDaughtersName4 =
"";
625 if ( numberOfShortliveds == 1)
627 G4double massmax=theParentMass - SumLongLivedMass;
629 masses[shortlivedDaughters[0]]= aSampler.
SampleMass(aDaughter,massmax);
630 }
else if ( numberOfShortliveds == 2) {
637 masses[shortlivedDaughters[zero]]=aSampler.
SampleMass(aDaughter,massmax);
638 massmax=theParentMass - masses[shortlivedDaughters[zero]];
639 aDaughter=theDecayChannel->
GetDaughter(shortlivedDaughters[one]);
640 masses[shortlivedDaughters[one]]=aSampler.
SampleMass(aDaughter,massmax);
647 theDaughtersName4 =
"";
648 if ( numberOfShortliveds == 1)
650 G4double massmax=theParentMass - SumLongLivedMass;
652 masses[shortlivedDaughters[0]]= aSampler.
SampleMass(aDaughter,massmax);
660 if ( numberOfShortliveds == 1)
662 G4double massmax=theParentMass - SumLongLivedMass;
664 masses[shortlivedDaughters[0]]= aSampler.
SampleMass(aDaughter,massmax);
666 if ( theNumberOfDaughters > 4 ) {
668 ed <<
"More than 4 decay daughters: kept only the first 4" <<
G4endl;
678 for (
G4int i=0; i < 4; ++i) sumDaughterMasses += masses[i];
679 if ( theParentMass - sumDaughterMasses > 0.0 ) isChannelBelowThreshold =
false;
681 }
while ( isChannelBelowThreshold && ++loopCounter < maxNumberOfLoops );
690 theNumberOfDaughters,
697 if(!theDecayProducts)
700 ed <<
"Error condition encountered: phase-space decay failed." <<
G4endl
702 <<
"\t the channel index is: "<< chosench <<
" of "<< nChannels <<
"channels" <<
G4endl
703 <<
"\t " << theNumberOfDaughters <<
" daughter particles: "
704 << theDaughtersName1 <<
" " << theDaughtersName2 <<
" " << theDaughtersName3 <<
" "
705 << theDaughtersName4 <<
G4endl;
726 for (
G4int i=dEntries; i > 0; --i)
728 theDynamicParticle = theDecayProducts->
PopProducts();
732 momentumBalanceCMS += theDynamicParticle->
Get4Momentum();
734 energyMomentumBalance -= momentum;
739 if (aDaughter !=
nullptr)
745 theDecayProductList->push_back(aDaughter);
746 delete theDynamicParticle;
748 delete theDecayProducts;
749 if(std::getenv(
"DecayEnergyBalanceCheck"))
750 std::cout <<
"DEBUGGING energy balance in cms and lab, charge baryon balance : "
751 << momentumBalanceCMS <<
" "
752 <<energyMomentumBalance <<
" "
756 return theDecayProductList;
767 G4double mass1 = theDaughterMass[0];
768 G4double mass2 = theDaughterMass[1];
769 G4double gamma2 = theDaughterWidth[1];
771 G4double result = (1. / (2 * mass)) *
772 std::sqrt(std::max((((mass * mass) - (mass1 + xmass) * (mass1 + xmass)) *
773 ((mass * mass) - (mass1 - xmass) * (mass1 - xmass))),0.0)) *
774 BrWig(gamma2, mass2, xmass);
781 G4double mass1 = theDaughterMass[0];
782 G4double mass2 = theDaughterMass[1];
783 G4double gamma2 = theDaughterWidth[1];
784 G4double result = (1. / (2 * mass)) *
785 std::sqrt(std::max((((mass * mass) - (mass1 + xmass) * (mass1 + xmass)) *
786 ((mass * mass) - (mass1 - xmass) * (mass1 - xmass))),0.0)) *
787 BrWig(gamma2, mass2, xmass);
793 const G4double mass = G4KineticTrack_Gmass;
795 const G4double mass2 = theDaughterMass[1];
796 const G4double gamma2 = theDaughterWidth[1];
798 const G4double result = (1. / (2 * mass)) *
799 std::sqrt(((mass * mass) - (G4KineticTrack_xmass1 + xmass) * (G4KineticTrack_xmass1 + xmass)) *
800 ((mass * mass) - (G4KineticTrack_xmass1 - xmass) * (G4KineticTrack_xmass1 - xmass))) *
801 BrWig(gamma2, mass2, xmass);
807 const G4double mass = G4KineticTrack_Gmass;
808 const G4double mass1 = theDaughterMass[0];
809 const G4double gamma1 = theDaughterWidth[0];
812 G4KineticTrack_xmass1 = xmass;
815 const G4double theUpperLimit = mass - xmass;
816 const G4int nIterations = 100;
820 integral.Simpson(
this, &G4KineticTrack::IntegrandFunction3, theLowerLimit, theUpperLimit, nIterations);
825G4double G4KineticTrack::IntegrateCMMomentum(
const G4double theLowerLimit)
const
827 const G4double theUpperLimit = theActualMass - theDaughterMass[0];
828 const G4int nIterations = 100;
830 if (theLowerLimit>=theUpperLimit)
return 0.0;
833 G4double theIntegralOverMass2 = integral.Simpson(
this, &G4KineticTrack::IntegrandFunction1,
834 theLowerLimit, theUpperLimit, nIterations);
835 return theIntegralOverMass2;
840 const G4double theUpperLimit = poleMass - theDaughterMass[0];
841 const G4int nIterations = 100;
843 if (theLowerLimit>=theUpperLimit)
return 0.0;
846 const G4double theIntegralOverMass2 = integral.Simpson(
this, &G4KineticTrack::IntegrandFunction2,
847 theLowerLimit, theUpperLimit, nIterations);
848 return theIntegralOverMass2;
852G4double G4KineticTrack::IntegrateCMMomentum2()
const
855 const G4double theUpperLimit = theActualMass;
856 const G4int nIterations = 100;
858 if (theLowerLimit>=theUpperLimit)
return 0.0;
861 G4double theIntegralOverMass2 = integral.Simpson(
this, &G4KineticTrack::IntegrandFunction4,
862 theLowerLimit, theUpperLimit, nIterations);
863 return theIntegralOverMass2;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cerr
static G4AntiKaonZero * AntiKaonZero()
G4DynamicParticle * PopProducts()
G4VDecayChannel * GetDecayChannel(G4int index) const
G4ParticleDefinition * GetDefinition() const
G4LorentzVector Get4Momentum() const
virtual G4DecayProducts * DecayIt(G4double mass=0.0)
static G4KaonZeroLong * KaonZeroLong()
static G4KaonZeroShort * KaonZeroShort()
static G4KaonZero * KaonZero()
G4double GetFormationTime() const
G4int GetParentResonanceID() const
G4KineticTrackVector * Decay()
G4KineticTrack & operator=(const G4KineticTrack &right)
void SetCreatorModelID(G4int id)
G4int GetCreatorModelID() const
G4bool operator!=(const G4KineticTrack &right) const
void Set4Momentum(const G4LorentzVector &a4Momentum)
G4int GetnChannels() const
const G4ThreeVector & GetPosition() const
const G4ParticleDefinition * GetDefinition() const
G4bool operator==(const G4KineticTrack &right) const
const G4LorentzVector & GetTrackingMomentum() const
void SetParentResonanceID(const G4int parentID)
const G4ParticleDefinition * GetParentResonanceDef() const
G4double BrWig(const G4double Gamma, const G4double rmass, const G4double mass) const
const G4LorentzVector & Get4Momentum() const
G4double GetActualMass() const
void SetParentResonanceDef(const G4ParticleDefinition *parent)
G4bool IsShortLived() const
G4double GetPDGMass() const
G4double GetPDGWidth() const
G4double GetPDGCharge() const
G4DecayTable * GetDecayTable() const
G4int GetBaryonNumber() const
const G4String & GetParticleName() const
G4double SampleMass(const G4double poleMass, const G4double gamma, const G4double minMass, const G4double maxMass) const
G4double GetMinimumMass(const G4ParticleDefinition *p) const
const G4String & GetParentName() const
G4int GetNumberOfDaughters() const
G4ParticleDefinition * GetDaughter(G4int anIndex)
const G4String & GetDaughterName(G4int anIndex) const
void G4SwapObj(T *a, T *b)