287 if ( actualMult.
Get() == NULL ) {
288 actualMult.
Get() =
new std::vector<G4int>( nDiscrete );
291 G4int nSecondaries = 0;
296 for(i=0; i<nDiscrete; i++)
298 current = theYield[i].
GetY(anEnergy);
300 if(nDiscrete==1&¤t<1.0001)
302 actualMult.
Get()->at(i) =
static_cast<G4int>(current);
305 actualMult.
Get()->at(i) = 0;
309 nSecondaries += actualMult.
Get()->at(i);
312 for(i=0;i<nSecondaries;i++)
316 thePhotons->push_back(theOne);
328 if ( nDiscrete == 1 && nPartials == 1 )
330 if ( actualMult.
Get()->at(0) > 0 )
332 if ( disType[0] == 1 )
369 temp = partials[ 0 ]->
GetY(anEnergy);
374 std::vector< G4double > photons_e_best( actualMult.
Get()->at(0) , 0.0 );
377 for (
G4int j = 0 ; j < maxTry ; j++ )
379 std::vector< G4double > photons_e( actualMult.
Get()->at(0) , 0.0 );
380 for ( std::vector< G4double >::iterator
381 it = photons_e.begin() ; it < photons_e.end() ; it++ )
385 if ( std::accumulate( photons_e.begin() , photons_e.end() , 0.0 ) > maximumE )
387 if ( std::accumulate( photons_e.begin() , photons_e.end() , 0.0 ) < best )
388 photons_e_best = photons_e;
393 for ( std::vector< G4double >::iterator
394 it = photons_e.begin() ; it < photons_e.end() ; it++ )
396 thePhotons->operator[](count)->SetKineticEnergy( *it );
423 thePhotons->operator[](count)->SetKineticEnergy(energy[i]);
426 if(count > nSecondaries)
throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPPhotonDist::GetPhotons inconsistancy");
432 for(i=0; i<nDiscrete; i++)
434 for(ii=0; ii< actualMult.
Get()->at(i); ii++)
439 for(iii=0; iii<nPartials; iii++) sum+=probs[iii].GetY(anEnergy);
442 for(iii=0; iii<nPartials; iii++)
444 run+=probs[iii].
GetY(anEnergy);
446 if(random<run/sum)
break;
448 if(theP==nPartials) theP=nPartials-1;
451 temp = partials[theP]->
GetY(anEnergy);
453 thePhotons->operator[](count)->SetKineticEnergy(eGamm);
458 thePhotons->operator[](count)->SetKineticEnergy(energy[i]);
461 if(count > nSecondaries)
throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPPhotonDist::GetPhotons inconsistancy");
468 for (i=0; i< nSecondaries; i++)
471 G4double theta = std::acos(costheta);
474 G4double en = thePhotons->operator[](i)->GetTotalEnergy();
475 G4ThreeVector temp(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
476 thePhotons->operator[](i)->SetMomentum( temp ) ;
482 for(i=0; i<nSecondaries; i++)
484 G4double currentEnergy = thePhotons->operator[](i)->GetTotalEnergy();
485 for(ii=0; ii<nDiscrete2; ii++)
487 if (std::abs(currentEnergy-theGammas[ii])<0.1*
keV)
break;
489 if(ii==nDiscrete2) ii--;
497 G4double theta = std::acos(costheta);
500 G4double en = thePhotons->operator[](i)->GetTotalEnergy();
501 G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
502 thePhotons->operator[](i)->SetMomentum( tempVector ) ;
504 else if(tabulationType==1)
508 for (iii=0; iii<nNeu[ii-nIso]; iii++)
511 if(theLegendre[ii-nIso][iii].GetEnergy()>anEnergy)
515 aStore.SetCoeff(1, &(theLegendre[ii-nIso][it]));
520 aStore.SetCoeff(0, &(theLegendre[ii-nIso][it-1]));
524 aStore.SetCoeff(0, &(theLegendre[ii-nIso][it]));
526 G4double cosTh = aStore.SampleMax(anEnergy);
530 G4double en = thePhotons->operator[](i)->GetTotalEnergy();
531 G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
532 thePhotons->operator[](i)->SetMomentum( tempVector ) ;
538 for (iii=0; iii<nNeu[ii-nIso]; iii++)
541 if(theAngular[ii-nIso][iii].GetEnergy()>anEnergy)
548 G4double en = thePhotons->operator[](i)->GetTotalEnergy();
549 G4ThreeVector tmpVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*costh );
550 thePhotons->operator[](i)->SetMomentum( tmpVector ) ;
555 else if(repFlag == 2)
558 running[0]=theTransitionProbabilities[0];
560 for(i=1; i<nGammaEnergies; i++)
562 running[i]=running[i-1]+theTransitionProbabilities[i];
566 for(i=0; i<nGammaEnergies; i++)
569 if(random < running[i]/running[nGammaEnergies-1])
break;
572 G4double totalEnergy = theBaseEnergy - theLevelEnergies[it];
576 if(theInternalConversionFlag==2 && random>thePhotonTransitionFraction[it])
587 G4double theta = std::acos(costheta);
594 G4ThreeVector temp(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
600 for(ii=0; ii<nDiscrete2; ii++)
602 if (std::abs(currentEnergy-theGammas[ii])<0.1*
keV)
break;
604 if(ii==nDiscrete2) ii--;
618 G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
621 else if(tabulationType==1)
625 for (iii=0; iii<nNeu[ii-nIso]; iii++)
628 if(theLegendre[ii-nIso][iii].GetEnergy()>anEnergy)
632 aStore.SetCoeff(1, &(theLegendre[ii-nIso][itt]));
637 aStore.SetCoeff(0, &(theLegendre[ii-nIso][itt-1]));
641 aStore.SetCoeff(0, &(theLegendre[ii-nIso][itt]));
643 G4double cosTh = aStore.SampleMax(anEnergy);
651 G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
658 for (iii=0; iii<nNeu[ii-nIso]; iii++)
661 if(theAngular[ii-nIso][iii].GetEnergy()>anEnergy)
672 G4ThreeVector tmpVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*costh );
676 thePhotons->push_back(theOne);
678 else if( repFlag==0 )
682 if ( thePartialXsec == 0 )
693 thePhotons->push_back( theOne );
699 std::vector < G4double > dif( nDiscrete , 0.0 );
700 for (
G4int j = 0 ; j < nDiscrete ; j++ )
714 for (
G4int j = 0 ; j < nDiscrete ; j++ )
740 if ( iphoton < nIso )
758 if ( tabulationType == 1 )
763 for (
G4int j = 0 ; j < nNeu [ iphoton - nIso ] ; j++ )
766 if ( theLegendre[ iphoton - nIso ][ j ].GetEnergy() > anEnergy )
break;
770 aStore.SetCoeff( 1 , &( theLegendre[ iphoton - nIso ][ iangle ] ) );
771 aStore.SetCoeff( 0 , &( theLegendre[ iphoton - nIso ][ iangle - 1 ] ) );
773 cosTheta = aStore.SampleMax( anEnergy );
776 else if ( tabulationType == 2 )
782 for (
G4int j = 0 ; j < nNeu [ iphoton - nIso ] ; j++ )
785 if ( theAngular[ iphoton - nIso ][ j ].GetEnergy() > anEnergy )
break;
788 cosTheta = theAngular[iphoton-nIso][ iangle ].
GetCosTh();
796 G4double theta = std::acos( cosTheta );
797 G4double sinTheta = std::sin( theta );
799 G4double photonE = theGammas[ iphoton ];
800 G4ThreeVector direction ( sinTheta*std::cos( phi ) , sinTheta * std::sin( phi ) , cosTheta );
802 thePhotons->operator[]( 0 )->SetMomentum( photonP ) ;
G4long G4Poisson(G4double mean)
G4int GetVectorLength() const
G4double GetTotalMomentum() const
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4double GetCosTh(G4int l)
G4double GetXsec(G4int i)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
static constexpr double twopi
std::vector< G4ReactionProduct * > G4ReactionProductVector
void SetTotalEnergy(const G4double en)
G4double GetX(G4int i) const
G4double GetY(G4double x)
G4double GetTotalEnergy() const
G4double GetPDGMass() const
static G4Electron * Electron()
static constexpr double keV
G4double GetY(G4int i, G4int j)