61static G4double G4KineticTrack_Gmass, G4KineticTrack_xmass1;
80 theStateToNucleus(undefined),
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),
149 theStateToNucleus(undefined),
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] )
315 G4KineticTrack_Gmass = theActualMass;
316 theActualMom = IntegrateCMMomentum2();
317 G4KineticTrack_Gmass = thePoleMass;
318 thePoleMom = IntegrateCMMomentum2();
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);
375 G4double theMassRatio = thePoleMass / theActualMass;
376 G4double theMomRatio = theActualMom / thePoleMom;
377 theActualWidth[index] = thePoleWidth * theMassRatio *
378 std::pow(theMomRatio, (2 * l + 1)) *
379 (1.2 / (1+ 0.2*std::pow(theMomRatio, (2 * l))));
380 delete [] theDaughterMass;
382 delete [] theDaughterWidth;
383 theDaughterWidth = 0;
384 delete [] theDaughterIsShortLived;
385 theDaughterIsShortLived = 0;
391 theActualWidth[index] = theChannel->
GetBR()*theMotherWidth;
416 : theDefinition(nucleon->GetDefinition()),
418 thePosition(aPosition),
419 the4Momentum(a4Momentum),
420 theFermi3Momentum(nucleon->GetMomentum()),
423 theActualMass(nucleon->GetDefinition()->GetPDGMass()),
427 theStateToNucleus(undefined),
428 theProjectilePotential(0)
430 theFermi3Momentum.
setE(0);
437 if (theActualWidth != 0)
delete [] theActualWidth;
438 if (theDaughterMass != 0)
delete [] theDaughterMass;
439 if (theDaughterWidth != 0)
delete [] theDaughterWidth;
450 the4Momentum = right.the4Momentum;
452 theFermi3Momentum = right.theFermi3Momentum;
453 theTotal4Momentum = right.theTotal4Momentum;
454 theNucleon=right.theNucleon;
455 theStateToNucleus=right.theStateToNucleus;
456 if (theActualWidth != 0)
delete [] theActualWidth;
458 theActualWidth =
new G4double[nChannels];
459 for (
G4int i = 0; i < nChannels; i++)
461 theActualWidth[i] = right.theActualWidth[i];
471 return (
this == & right);
478 return (
this != & right);
497 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
498 G4cerr <<
" track has no particle definition associated."<<
G4endl;
504 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
505 G4cerr <<
" particle definiton has no decay table associated."<<
G4endl;
513 G4double theTotalActualWidth = this->EvaluateTotalActualWidth();
514 if (theTotalActualWidth !=0)
519 for (index = nChannels - 1; index >= 0; index--)
521 theSumActualWidth += theActualWidth[index];
522 theCumActualWidth[index] = theSumActualWidth;
530 for (index = nChannels - 1; index >= 0; index--)
532 if (r < theCumActualWidth[index])
541 delete [] theCumActualWidth;
545 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
546 G4cerr <<
" decay channel has 0x0 channel associated."<<
G4endl;
548 G4cerr <<
" channel index "<< chosench <<
"of "<<nChannels<<
"channels"<<
G4endl;
553 G4double theBR = theActualWidth[index];
561 G4int shortlivedDaughters[3];
562 G4int numberOfShortliveds(0);
564 for (
G4int aD=0; aD < theNumberOfDaughters ; aD++)
570 shortlivedDaughters[numberOfShortliveds]=aD;
571 numberOfShortliveds++;
577 switch (theNumberOfDaughters)
583 theDaughtersName2 =
"";
584 theDaughtersName3 =
"";
589 theDaughtersName3 =
"";
590 if ( numberOfShortliveds == 1)
592 G4double massmax=theParentMass - SumLongLivedMass;
594 masses[shortlivedDaughters[0]]= aSampler.
SampleMass(aDaughter,massmax);
595 }
else if ( numberOfShortliveds == 2) {
602 masses[shortlivedDaughters[zero]]=aSampler.
SampleMass(aDaughter,massmax);
603 massmax=theParentMass - masses[shortlivedDaughters[zero]];
604 aDaughter=theDecayChannel->
GetDaughter(shortlivedDaughters[one]);
605 masses[shortlivedDaughters[one]]=aSampler.
SampleMass(aDaughter,massmax);
612 if ( numberOfShortliveds == 1)
614 G4double massmax=theParentMass - SumLongLivedMass;
616 masses[shortlivedDaughters[0]]= aSampler.
SampleMass(aDaughter,massmax);
628 theNumberOfDaughters,
634 if(!theDecayProducts)
636 G4cerr <<
"Error condition encountered in G4KineticTrack::Decay()"<<
G4endl;
639 G4cerr <<
" channel index "<< chosench <<
"of "<<nChannels<<
"channels"<<
G4endl;
640 G4cerr <<
" "<<theNumberOfDaughters<<
" Daughter particles: "
641 << theDaughtersName1<<
" "<<theDaughtersName2<<
" "<<theDaughtersName3<<
G4endl;
657 for (
G4int i=dEntries; i > 0; i--)
659 theDynamicParticle = theDecayProducts->
PopProducts();
663 momentumBalanceCMS += theDynamicParticle->
Get4Momentum();
665 energyMomentumBalance -= momentum;
670 delete theDynamicParticle;
672 delete theDecayProducts;
673 if(getenv(
"DecayEnergyBalanceCheck"))
674 std::cout <<
"DEBUGGING energy balance in cms and lab, charge baryon balance : "
675 << momentumBalanceCMS <<
" "
676 <<energyMomentumBalance <<
" "
680 return theDecayProductList;
691 G4double mass1 = theDaughterMass[0];
692 G4double mass2 = theDaughterMass[1];
693 G4double gamma2 = theDaughterWidth[1];
695 G4double result = (1. / (2 * mass)) *
696 std::sqrt(std::max((((mass * mass) - (mass1 + xmass) * (mass1 + xmass)) *
697 ((mass * mass) - (mass1 - xmass) * (mass1 - xmass))),0.0)) *
698 BrWig(gamma2, mass2, xmass);
705 G4double mass1 = theDaughterMass[0];
706 G4double mass2 = theDaughterMass[1];
707 G4double gamma2 = theDaughterWidth[1];
708 G4double result = (1. / (2 * mass)) *
709 std::sqrt(std::max((((mass * mass) - (mass1 + xmass) * (mass1 + xmass)) *
710 ((mass * mass) - (mass1 - xmass) * (mass1 - xmass))),0.0)) *
711 BrWig(gamma2, mass2, xmass);
717 const G4double mass = G4KineticTrack_Gmass;
719 const G4double mass2 = theDaughterMass[1];
720 const G4double gamma2 = theDaughterWidth[1];
722 const G4double result = (1. / (2 * mass)) *
723 std::sqrt(((mass * mass) - (G4KineticTrack_xmass1 + xmass) * (G4KineticTrack_xmass1 + xmass)) *
724 ((mass * mass) - (G4KineticTrack_xmass1 - xmass) * (G4KineticTrack_xmass1 - xmass))) *
725 BrWig(gamma2, mass2, xmass);
731 const G4double mass = G4KineticTrack_Gmass;
732 const G4double mass1 = theDaughterMass[0];
733 const G4double gamma1 = theDaughterWidth[0];
736 G4KineticTrack_xmass1 = xmass;
739 const G4double theUpperLimit = mass - xmass;
740 const G4int nIterations = 100;
744 integral.Simpson(
this, &G4KineticTrack::IntegrandFunction3, theLowerLimit, theUpperLimit, nIterations);
749G4double G4KineticTrack::IntegrateCMMomentum(
const G4double theLowerLimit)
const
751 const G4double theUpperLimit = theActualMass - theDaughterMass[0];
752 const G4int nIterations = 100;
754 if (theLowerLimit>=theUpperLimit)
return 0.0;
757 G4double theIntegralOverMass2 = integral.Simpson(
this, &G4KineticTrack::IntegrandFunction1,
758 theLowerLimit, theUpperLimit, nIterations);
759 return theIntegralOverMass2;
764 const G4double theUpperLimit = poleMass - theDaughterMass[0];
765 const G4int nIterations = 100;
767 if (theLowerLimit>=theUpperLimit)
return 0.0;
770 const G4double theIntegralOverMass2 = integral.Simpson(
this, &G4KineticTrack::IntegrandFunction2,
771 theLowerLimit, theUpperLimit, nIterations);
772 return theIntegralOverMass2;
776G4double G4KineticTrack::IntegrateCMMomentum2()
const
779 const G4double theUpperLimit = theActualMass;
780 const G4int nIterations = 100;
782 if (theLowerLimit>=theUpperLimit)
return 0.0;
785 G4double theIntegralOverMass2 = integral.Simpson(
this, &G4KineticTrack::IntegrandFunction4,
786 theLowerLimit, theUpperLimit, nIterations);
787 return theIntegralOverMass2;
G4DLLIMPORT 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)
void Set4Momentum(const G4LorentzVector &a4Momentum)
G4int GetnChannels() const
const G4ThreeVector & GetPosition() const
G4int operator!=(const G4KineticTrack &right) const
G4int operator==(const G4KineticTrack &right) const
G4ParticleDefinition * GetDefinition() 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)