81 theProjectilePotential(0)
107 theFermi3Momentum = right.theFermi3Momentum;
108 theTotal4Momentum = right.theTotal4Momentum;
109 theNucleon=right.theNucleon;
112 theActualWidth =
new G4double[nChannels];
113 for (i = 0; i < nChannels; i++)
115 theActualWidth[i] = right.theActualWidth[i];
118 theDaughterWidth = 0;
119 theStateToNucleus=right.theStateToNucleus;
120 theProjectilePotential=right.theProjectilePotential;
142 theDefinition(aDefinition),
143 theFormationTime(aFormationTime),
144 thePosition(aPosition),
145 the4Momentum(a4Momentum),
146 theFermi3Momentum(0),
147 theTotal4Momentum(a4Momentum),
150 theProjectilePotential(0)
170 if (theDecayTable != 0)
172 nChannels = theDecayTable->
entries();
192 theDaughterWidth = 0;
194 G4bool * theDaughterIsShortLived = 0;
196 if(nChannels!=0) theActualWidth =
new G4double[nChannels];
200 for (index = nChannels - 1; index >= 0; index--)
205 if (nDaughters == 2 || nDaughters == 3)
211 theDaughterMass =
new G4double[nDaughters];
212 theDaughterWidth =
new G4double[nDaughters];
213 theDaughterIsShortLived =
new G4bool[nDaughters];
215 for (n = 0; n < nDaughters; n++)
232 if ( !theDaughterIsShortLived[0] && !theDaughterIsShortLived[1] )
242 theActualMom = EvaluateCMMomentum(theActualMass,
244 thePoleMom = EvaluateCMMomentum(thePoleMass,
252 else if ( !theDaughterIsShortLived[0] && theDaughterIsShortLived[1] )
263 theActualMom = IntegrateCMMomentum(lowerLimit);
264 thePoleMom = IntegrateCMMomentum(lowerLimit, thePoleMass);
274 else if ( theDaughterIsShortLived[0] && !theDaughterIsShortLived[1] )
288 G4SwapObj(theDaughterMass, theDaughterMass + 1);
289 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
293 theActualMom = IntegrateCMMomentum(lowerLimit);
294 thePoleMom = IntegrateCMMomentum(lowerLimit, thePoleMass);
304 else if ( theDaughterIsShortLived[0] && theDaughterIsShortLived[1] )
316 theActualMom = IntegrateCMMomentum2();
318 thePoleMom = IntegrateCMMomentum2();
331 G4int nShortLived = 0;
332 if ( theDaughterIsShortLived[0] )
336 if ( theDaughterIsShortLived[1] )
339 G4SwapObj(theDaughterMass, theDaughterMass + 1);
340 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
342 if ( theDaughterIsShortLived[2] )
345 G4SwapObj(theDaughterMass, theDaughterMass + 2);
346 G4SwapObj(theDaughterWidth, theDaughterWidth + 2);
348 if ( nShortLived == 0 )
350 theDaughterMass[1]+=theDaughterMass[2];
351 theActualMom = EvaluateCMMomentum(theActualMass,
353 thePoleMom = EvaluateCMMomentum(thePoleMass,
357 else if ( nShortLived >= 1 )
360 G4SwapObj(theDaughterMass, theDaughterMass + 1);
361 G4SwapObj(theDaughterWidth, theDaughterWidth + 1);
362 theDaughterMass[0] += theDaughterMass[2];
363 theActualMom = IntegrateCMMomentum(0.0);
364 thePoleMom = IntegrateCMMomentum(0.0, thePoleMass);
374 G4double theMassRatio = thePoleMass / theActualMass;
375 G4double theMomRatio = theActualMom / thePoleMom;
381 theActualWidth[index] = thePoleWidth * theMassRatio *
383 delete [] theDaughterMass;
385 delete [] theDaughterWidth;
386 theDaughterWidth = 0;
387 delete [] theDaughterIsShortLived;
388 theDaughterIsShortLived = 0;
394 theActualWidth[index] = theChannel->
GetBR()*theMotherWidth;
419 : theDefinition(nucleon->GetDefinition()),
421 thePosition(aPosition),
422 the4Momentum(a4Momentum),
423 theFermi3Momentum(nucleon->GetMomentum()),
426 theActualMass(nucleon->GetDefinition()->GetPDGMass()),
431 theProjectilePotential(0)
433 theFermi3Momentum.
setE(0);
440 if (theActualWidth != 0)
delete [] theActualWidth;
441 if (theDaughterMass != 0)
delete [] theDaughterMass;
442 if (theDaughterWidth != 0)
delete [] theDaughterWidth;
453 the4Momentum = right.the4Momentum;
455 theFermi3Momentum = right.theFermi3Momentum;
456 theTotal4Momentum = right.theTotal4Momentum;
457 theNucleon=right.theNucleon;
458 theStateToNucleus=right.theStateToNucleus;
459 if (theActualWidth != 0)
delete [] theActualWidth;
461 theActualWidth =
new G4double[nChannels];
462 for (
G4int i = 0; i < nChannels; i++)
464 theActualWidth[i] = right.theActualWidth[i];
474 return (
this == & right);
481 return (
this != & right);
500 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
501 G4cerr <<
" track has no particle definition associated."<<
G4endl;
507 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
508 G4cerr <<
" particle definiton has no decay table associated."<<
G4endl;
516 G4double theTotalActualWidth = this->EvaluateTotalActualWidth();
517 if (theTotalActualWidth !=0)
522 G4bool isChannelBelowThreshold =
true;
523 const G4int maxNumberOfLoops = 10000;
524 G4int loopCounter = 0;
530 G4int theNumberOfDaughters;
542 for (index = nChannels - 1; index >= 0; index--)
544 theSumActualWidth += theActualWidth[index];
545 theCumActualWidth[index] = theSumActualWidth;
553 for (index = nChannels - 1; index >= 0; index--)
555 if (r < theCumActualWidth[index])
564 delete [] theCumActualWidth;
568 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
569 G4cerr <<
" decay channel has 0x0 channel associated."<<
G4endl;
571 G4cerr <<
" channel index "<< chosench <<
"of "<<nChannels<<
"channels"<<
G4endl;
576 theBR = theActualWidth[index];
579 theDaughtersName1 =
"";
580 theDaughtersName2 =
"";
581 theDaughtersName3 =
"";
582 theDaughtersName4 =
"";
584 for (
G4int i=0; i < 4; i++) masses[i]=0.;
585 G4int shortlivedDaughters[4];
586 G4int numberOfShortliveds(0);
588 for (
G4int aD=0; aD < theNumberOfDaughters ; aD++)
594 shortlivedDaughters[numberOfShortliveds]=aD;
595 numberOfShortliveds++;
601 switch (theNumberOfDaughters)
607 theDaughtersName2 =
"";
608 theDaughtersName3 =
"";
609 theDaughtersName4 =
"";
614 theDaughtersName3 =
"";
615 theDaughtersName4 =
"";
616 if ( numberOfShortliveds == 1)
618 G4double massmax=theParentMass - SumLongLivedMass;
620 masses[shortlivedDaughters[0]]= aSampler.
SampleMass(aDaughter,massmax);
621 }
else if ( numberOfShortliveds == 2) {
628 masses[shortlivedDaughters[zero]]=aSampler.
SampleMass(aDaughter,massmax);
629 massmax=theParentMass - masses[shortlivedDaughters[zero]];
630 aDaughter=theDecayChannel->
GetDaughter(shortlivedDaughters[one]);
631 masses[shortlivedDaughters[one]]=aSampler.
SampleMass(aDaughter,massmax);
638 theDaughtersName4 =
"";
639 if ( numberOfShortliveds == 1)
641 G4double massmax=theParentMass - SumLongLivedMass;
643 masses[shortlivedDaughters[0]]= aSampler.
SampleMass(aDaughter,massmax);
651 if ( numberOfShortliveds == 1)
653 G4double massmax=theParentMass - SumLongLivedMass;
655 masses[shortlivedDaughters[0]]= aSampler.
SampleMass(aDaughter,massmax);
657 if ( theNumberOfDaughters > 4 ) {
659 ed <<
"More than 4 decay daughters: kept only the first 4" <<
G4endl;
669 for (
G4int i=0; i < 4; i++) sumDaughterMasses += masses[i];
670 if ( theParentMass - sumDaughterMasses > 0.0 ) isChannelBelowThreshold =
false;
672 }
while ( isChannelBelowThreshold && ++loopCounter < maxNumberOfLoops );
681 theNumberOfDaughters,
688 if(!theDecayProducts)
691 ed <<
"Error condition encountered: phase-space decay failed." <<
G4endl
693 <<
"\t the channel index is: "<< chosench <<
" of "<< nChannels <<
"channels" <<
G4endl
694 <<
"\t " << theNumberOfDaughters <<
" daughter particles: "
695 << theDaughtersName1 <<
" " << theDaughtersName2 <<
" " << theDaughtersName3 <<
" "
696 << theDaughtersName4 <<
G4endl;
713 for (
G4int i=dEntries; i > 0; i--)
715 theDynamicParticle = theDecayProducts->
PopProducts();
719 momentumBalanceCMS += theDynamicParticle->
Get4Momentum();
721 energyMomentumBalance -= momentum;
726 delete theDynamicParticle;
728 delete theDecayProducts;
729 if(getenv(
"DecayEnergyBalanceCheck"))
730 std::cout <<
"DEBUGGING energy balance in cms and lab, charge baryon balance : "
731 << momentumBalanceCMS <<
" "
732 <<energyMomentumBalance <<
" "
736 return theDecayProductList;
747 G4double mass1 = theDaughterMass[0];
748 G4double mass2 = theDaughterMass[1];
749 G4double gamma2 = theDaughterWidth[1];
752 std::sqrt(
std::max((((mass * mass) - (mass1 + xmass) * (mass1 + xmass)) *
753 ((mass * mass) - (mass1 - xmass) * (mass1 - xmass))),0.0)) *
754 BrWig(gamma2, mass2, xmass);
761 G4double mass1 = theDaughterMass[0];
762 G4double mass2 = theDaughterMass[1];
763 G4double gamma2 = theDaughterWidth[1];
764 G4double result = (1. / (2 * mass)) *
765 std::sqrt(
std::max((((mass * mass) - (mass1 + xmass) * (mass1 + xmass)) *
766 ((mass * mass) - (mass1 - xmass) * (mass1 - xmass))),0.0)) *
767 BrWig(gamma2, mass2, xmass);
775 const G4double mass2 = theDaughterMass[1];
776 const G4double gamma2 = theDaughterWidth[1];
778 const G4double result = (1. / (2 * mass)) *
781 BrWig(gamma2, mass2, xmass);
788 const G4double mass1 = theDaughterMass[0];
789 const G4double gamma1 = theDaughterWidth[0];
795 const G4double theUpperLimit = mass - xmass;
796 const G4int nIterations = 100;
800 integral.
Simpson(
this, &G4KineticTrack::IntegrandFunction3, theLowerLimit, theUpperLimit, nIterations);
805 G4double G4KineticTrack::IntegrateCMMomentum(
const G4double theLowerLimit)
const
807 const G4double theUpperLimit = theActualMass - theDaughterMass[0];
808 const G4int nIterations = 100;
810 if (theLowerLimit>=theUpperLimit)
return 0.0;
813 G4double theIntegralOverMass2 = integral.
Simpson(
this, &G4KineticTrack::IntegrandFunction1,
814 theLowerLimit, theUpperLimit, nIterations);
815 return theIntegralOverMass2;
820 const G4double theUpperLimit = poleMass - theDaughterMass[0];
821 const G4int nIterations = 100;
823 if (theLowerLimit>=theUpperLimit)
return 0.0;
826 const G4double theIntegralOverMass2 = integral.
Simpson(
this, &G4KineticTrack::IntegrandFunction2,
827 theLowerLimit, theUpperLimit, nIterations);
828 return theIntegralOverMass2;
832 G4double G4KineticTrack::IntegrateCMMomentum2()
const
835 const G4double theUpperLimit = theActualMass;
836 const G4int nIterations = 100;
838 if (theLowerLimit>=theUpperLimit)
return 0.0;
841 G4double theIntegralOverMass2 = integral.
Simpson(
this, &G4KineticTrack::IntegrandFunction4,
842 theLowerLimit, theUpperLimit, nIterations);
843 return theIntegralOverMass2;
G4double G4ParticleHPJENDLHEData::G4double result
static G4KaonZero * KaonZero()
G4double SampleMass(const G4double poleMass, const G4double gamma, const G4double minMass, const G4double maxMass) const
void G4SwapObj(T *a, T *b)
G4int operator==(const G4KineticTrack &right) const
G4int GetnChannels() const
std::ostringstream G4ExceptionDescription
const G4String & GetParentName() const
G4int GetNumberOfDaughters() const
const G4ThreeVector & GetPosition() const
G4KineticTrackVector * Decay()
G4ParticleDefinition * GetDaughter(G4int anIndex)
static G4ThreadLocal G4double G4KineticTrack_Gmass
static G4KaonZeroLong * KaonZeroLong()
G4VDecayChannel * GetDecayChannel(G4int index) const
G4double GetActualMass() const
G4ParticleDefinition * GetDefinition() const
const G4String & GetParticleName() const
G4DecayTable * GetDecayTable() const
G4int operator!=(const G4KineticTrack &right) const
G4double GetPDGWidth() const
static G4KaonZeroShort * KaonZeroShort()
G4bool nucleon(G4int ityp)
G4double GetFormationTime() const
G4KineticTrack & operator=(const G4KineticTrack &right)
static G4ThreadLocal G4double G4KineticTrack_xmass1
void Set4Momentum(const G4LorentzVector &a4Momentum)
G4LorentzVector Get4Momentum() const
const G4String & GetDaughterName(G4int anIndex) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double GetMinimumMass(const G4ParticleDefinition *p) const
virtual G4DecayProducts * DecayIt(G4double mass=0.0)
G4bool IsShortLived() const
static G4AntiKaonZero * AntiKaonZero()
G4double GetPDGMass() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
const G4LorentzVector & GetTrackingMomentum() const
G4DynamicParticle * PopProducts()
G4double Simpson(T &typeT, F f, G4double a, G4double b, G4int n)
const G4LorentzVector & Get4Momentum() const
G4double GetPDGCharge() const
const G4ParticleDefinition * GetDefinition() const
G4double BrWig(const G4double Gamma, const G4double rmass, const G4double mass) const
G4GLOB_DLL std::ostream G4cerr
G4int GetBaryonNumber() const