80 theStateToNucleus(undefined),
81 theProjectilePotential(0)
106 theFermi3Momentum = right.theFermi3Momentum;
107 theTotal4Momentum = right.theTotal4Momentum;
108 theNucleon=right.theNucleon;
111 theActualWidth =
new G4double[nChannels];
112 for (
G4int i = 0; i < nChannels; i++)
114 theActualWidth[i] = right.theActualWidth[i];
117 theDaughterWidth = 0;
118 theStateToNucleus=right.theStateToNucleus;
119 theProjectilePotential=right.theProjectilePotential;
141 theDefinition(aDefinition),
142 theFormationTime(aFormationTime),
143 thePosition(aPosition),
144 the4Momentum(a4Momentum),
145 theFermi3Momentum(0),
146 theTotal4Momentum(a4Momentum),
148 theStateToNucleus(undefined),
149 theProjectilePotential(0)
169 if (theDecayTable != 0)
171 nChannels = theDecayTable->
entries();
191 theDaughterWidth = 0;
193 G4bool * theDaughterIsShortLived = 0;
195 if(nChannels!=0) theActualWidth =
new G4double[nChannels];
199 for (index = nChannels - 1; index >= 0; --index)
204 if (nDaughters == 2 || nDaughters == 3)
210 theDaughterMass =
new G4double[nDaughters];
211 theDaughterWidth =
new G4double[nDaughters];
212 theDaughterIsShortLived =
new G4bool[nDaughters];
213 for (
G4int n = 0; n < nDaughters; ++n)
230 if ( !theDaughterIsShortLived[0] && !theDaughterIsShortLived[1] )
240 theActualMom = EvaluateCMMomentum(theActualMass,
242 thePoleMom = EvaluateCMMomentum(thePoleMass,
250 else if ( !theDaughterIsShortLived[0] && theDaughterIsShortLived[1] )
261 theActualMom = IntegrateCMMomentum(lowerLimit);
262 thePoleMom = IntegrateCMMomentum(lowerLimit, thePoleMass);
272 else if ( theDaughterIsShortLived[0] && !theDaughterIsShortLived[1] )
286 G4SwapObj(theDaughterMass, theDaughterMass + 1);
287 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
291 theActualMom = IntegrateCMMomentum(lowerLimit);
292 thePoleMom = IntegrateCMMomentum(lowerLimit, thePoleMass);
302 else if ( theDaughterIsShortLived[0] && theDaughterIsShortLived[1] )
313 G4KineticTrack_Gmass = theActualMass;
314 theActualMom = IntegrateCMMomentum2();
315 G4KineticTrack_Gmass = thePoleMass;
316 thePoleMom = IntegrateCMMomentum2();
329 G4int nShortLived = 0;
330 if ( theDaughterIsShortLived[0] )
334 if ( theDaughterIsShortLived[1] )
337 G4SwapObj(theDaughterMass, theDaughterMass + 1);
338 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
340 if ( theDaughterIsShortLived[2] )
343 G4SwapObj(theDaughterMass, theDaughterMass + 2);
344 G4SwapObj(theDaughterWidth, theDaughterWidth + 2);
346 if ( nShortLived == 0 )
348 theDaughterMass[1]+=theDaughterMass[2];
349 theActualMom = EvaluateCMMomentum(theActualMass,
351 thePoleMom = EvaluateCMMomentum(thePoleMass,
355 else if ( nShortLived >= 1 )
358 G4SwapObj(theDaughterMass, theDaughterMass + 1);
359 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
360 theDaughterMass[0] += theDaughterMass[2];
361 theActualMom = IntegrateCMMomentum(0.0);
362 thePoleMom = IntegrateCMMomentum(0.0, thePoleMass);
372 G4double theMassRatio = thePoleMass / theActualMass;
373 G4double theMomRatio = theActualMom / thePoleMom;
379 theActualWidth[index] = thePoleWidth * theMassRatio *
381 delete [] theDaughterMass;
383 delete [] theDaughterWidth;
384 theDaughterWidth = 0;
385 delete [] theDaughterIsShortLived;
386 theDaughterIsShortLived = 0;
392 theActualWidth[index] = theChannel->
GetBR()*theMotherWidth;
417 : theDefinition(nucleon->GetDefinition()),
419 thePosition(aPosition),
420 the4Momentum(a4Momentum),
421 theFermi3Momentum(nucleon->GetMomentum()),
424 theActualMass(nucleon->GetDefinition()->GetPDGMass()),
428 theStateToNucleus(undefined),
429 theProjectilePotential(0)
431 theFermi3Momentum.
setE(0);
438 if (theActualWidth != 0)
delete [] theActualWidth;
439 if (theDaughterMass != 0)
delete [] theDaughterMass;
440 if (theDaughterWidth != 0)
delete [] theDaughterWidth;
451 the4Momentum = right.the4Momentum;
453 theFermi3Momentum = right.theFermi3Momentum;
454 theTotal4Momentum = right.theTotal4Momentum;
455 theNucleon=right.theNucleon;
456 theStateToNucleus=right.theStateToNucleus;
457 if (theActualWidth != 0)
delete [] theActualWidth;
459 theActualWidth =
new G4double[nChannels];
460 for (
G4int i = 0; i < nChannels; ++i) theActualWidth[i] = right.theActualWidth[i];
469 return (
this == & right);
476 return (
this != & right);
495 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
496 G4cerr <<
" track has no particle definition associated."<<
G4endl;
502 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
503 G4cerr <<
" particle definition has no decay table associated."<<
G4endl;
511 G4double theTotalActualWidth = this->EvaluateTotalActualWidth();
512 if (theTotalActualWidth !=0)
517 G4bool isChannelBelowThreshold =
true;
518 const G4int maxNumberOfLoops = 10000;
519 G4int loopCounter = 0;
525 G4int theNumberOfDaughters;
536 for (
G4int index = nChannels - 1; index >= 0; --index)
538 theSumActualWidth += theActualWidth[index];
539 theCumActualWidth[index] = theSumActualWidth;
547 for (
G4int index = nChannels - 1; index >= 0; --index)
549 if (r < theCumActualWidth[index])
558 delete [] theCumActualWidth;
562 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
563 G4cerr <<
" decay channel has 0x0 channel associated."<<
G4endl;
565 G4cerr <<
" channel index "<< chosench <<
"of "<<nChannels<<
"channels"<<
G4endl;
570 theBR = theActualWidth[chosench];
573 theDaughtersName1 =
"";
574 theDaughtersName2 =
"";
575 theDaughtersName3 =
"";
576 theDaughtersName4 =
"";
578 for (
G4int i=0; i < 4; ++i) masses[i]=0.;
579 G4int shortlivedDaughters[4];
580 G4int numberOfShortliveds(0);
582 for (
G4int aD=0; aD < theNumberOfDaughters ; ++aD)
588 shortlivedDaughters[numberOfShortliveds]=aD;
589 ++numberOfShortliveds;
595 switch (theNumberOfDaughters)
601 theDaughtersName2 =
"";
602 theDaughtersName3 =
"";
603 theDaughtersName4 =
"";
608 theDaughtersName3 =
"";
609 theDaughtersName4 =
"";
610 if ( numberOfShortliveds == 1)
612 G4double massmax=theParentMass - SumLongLivedMass;
614 masses[shortlivedDaughters[0]]= aSampler.
SampleMass(aDaughter,massmax);
615 }
else if ( numberOfShortliveds == 2) {
622 masses[shortlivedDaughters[zero]]=aSampler.
SampleMass(aDaughter,massmax);
623 massmax=theParentMass - masses[shortlivedDaughters[zero]];
624 aDaughter=theDecayChannel->
GetDaughter(shortlivedDaughters[one]);
625 masses[shortlivedDaughters[one]]=aSampler.
SampleMass(aDaughter,massmax);
632 theDaughtersName4 =
"";
633 if ( numberOfShortliveds == 1)
635 G4double massmax=theParentMass - SumLongLivedMass;
637 masses[shortlivedDaughters[0]]= aSampler.
SampleMass(aDaughter,massmax);
645 if ( numberOfShortliveds == 1)
647 G4double massmax=theParentMass - SumLongLivedMass;
649 masses[shortlivedDaughters[0]]= aSampler.
SampleMass(aDaughter,massmax);
651 if ( theNumberOfDaughters > 4 ) {
653 ed <<
"More than 4 decay daughters: kept only the first 4" <<
G4endl;
663 for (
G4int i=0; i < 4; ++i) sumDaughterMasses += masses[i];
664 if ( theParentMass - sumDaughterMasses > 0.0 ) isChannelBelowThreshold =
false;
666 }
while ( isChannelBelowThreshold && ++loopCounter < maxNumberOfLoops );
675 theNumberOfDaughters,
682 if(!theDecayProducts)
685 ed <<
"Error condition encountered: phase-space decay failed." <<
G4endl
687 <<
"\t the channel index is: "<< chosench <<
" of "<< nChannels <<
"channels" <<
G4endl
688 <<
"\t " << theNumberOfDaughters <<
" daughter particles: "
689 << theDaughtersName1 <<
" " << theDaughtersName2 <<
" " << theDaughtersName3 <<
" "
690 << theDaughtersName4 <<
G4endl;
707 for (
G4int i=dEntries; i > 0; --i)
709 theDynamicParticle = theDecayProducts->
PopProducts();
713 momentumBalanceCMS += theDynamicParticle->
Get4Momentum();
715 energyMomentumBalance -= momentum;
720 delete theDynamicParticle;
722 delete theDecayProducts;
723 if(std::getenv(
"DecayEnergyBalanceCheck"))
724 std::cout <<
"DEBUGGING energy balance in cms and lab, charge baryon balance : "
725 << momentumBalanceCMS <<
" "
726 <<energyMomentumBalance <<
" "
730 return theDecayProductList;
741 G4double mass1 = theDaughterMass[0];
742 G4double mass2 = theDaughterMass[1];
743 G4double gamma2 = theDaughterWidth[1];
745 G4double result = (1. / (2 * mass)) *
746 std::sqrt(std::max((((mass * mass) - (mass1 + xmass) * (mass1 + xmass)) *
747 ((mass * mass) - (mass1 - xmass) * (mass1 - xmass))),0.0)) *
748 BrWig(gamma2, mass2, xmass);
755 G4double mass1 = theDaughterMass[0];
756 G4double mass2 = theDaughterMass[1];
757 G4double gamma2 = theDaughterWidth[1];
758 G4double result = (1. / (2 * mass)) *
759 std::sqrt(std::max((((mass * mass) - (mass1 + xmass) * (mass1 + xmass)) *
760 ((mass * mass) - (mass1 - xmass) * (mass1 - xmass))),0.0)) *
761 BrWig(gamma2, mass2, xmass);
767 const G4double mass = G4KineticTrack_Gmass;
769 const G4double mass2 = theDaughterMass[1];
770 const G4double gamma2 = theDaughterWidth[1];
772 const G4double result = (1. / (2 * mass)) *
773 std::sqrt(((mass * mass) - (G4KineticTrack_xmass1 + xmass) * (G4KineticTrack_xmass1 + xmass)) *
774 ((mass * mass) - (G4KineticTrack_xmass1 - xmass) * (G4KineticTrack_xmass1 - xmass))) *
775 BrWig(gamma2, mass2, xmass);
781 const G4double mass = G4KineticTrack_Gmass;
782 const G4double mass1 = theDaughterMass[0];
783 const G4double gamma1 = theDaughterWidth[0];
786 G4KineticTrack_xmass1 = xmass;
789 const G4double theUpperLimit = mass - xmass;
790 const G4int nIterations = 100;
794 integral.Simpson(
this, &G4KineticTrack::IntegrandFunction3, theLowerLimit, theUpperLimit, nIterations);
799G4double G4KineticTrack::IntegrateCMMomentum(
const G4double theLowerLimit)
const
801 const G4double theUpperLimit = theActualMass - theDaughterMass[0];
802 const G4int nIterations = 100;
804 if (theLowerLimit>=theUpperLimit)
return 0.0;
807 G4double theIntegralOverMass2 = integral.Simpson(
this, &G4KineticTrack::IntegrandFunction1,
808 theLowerLimit, theUpperLimit, nIterations);
809 return theIntegralOverMass2;
814 const G4double theUpperLimit = poleMass - theDaughterMass[0];
815 const G4int nIterations = 100;
817 if (theLowerLimit>=theUpperLimit)
return 0.0;
820 const G4double theIntegralOverMass2 = integral.Simpson(
this, &G4KineticTrack::IntegrandFunction2,
821 theLowerLimit, theUpperLimit, nIterations);
822 return theIntegralOverMass2;
826G4double G4KineticTrack::IntegrateCMMomentum2()
const
829 const G4double theUpperLimit = theActualMass;
830 const G4int nIterations = 100;
832 if (theLowerLimit>=theUpperLimit)
return 0.0;
835 G4double theIntegralOverMass2 = integral.Simpson(
this, &G4KineticTrack::IntegrandFunction4,
836 theLowerLimit, theUpperLimit, nIterations);
837 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
G4KineticTrackVector * Decay()
G4KineticTrack & operator=(const G4KineticTrack &right)
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
G4double BrWig(const G4double Gamma, const G4double rmass, const G4double mass) const
const G4LorentzVector & Get4Momentum() const
G4double GetActualMass() const
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)