Geant4  10.02.p03
G4ParticleHPPhotonDist Class Reference

#include <G4ParticleHPPhotonDist.hh>

Collaboration diagram for G4ParticleHPPhotonDist:

Public Member Functions

 G4ParticleHPPhotonDist ()
 
 ~G4ParticleHPPhotonDist ()
 
G4bool InitMean (std::istream &aDataFile)
 
void InitAngular (std::istream &aDataFile)
 
void InitEnergies (std::istream &aDataFile)
 
void InitPartials (std::istream &aDataFile)
 
G4ReactionProductVectorGetPhotons (G4double anEnergy)
 
G4double GetTargetMass ()
 
G4bool NeedsCascade ()
 
G4double GetLevelEnergy ()
 

Private Attributes

G4int repFlag
 
G4double targetMass
 
G4int nDiscrete
 
G4intdisType
 
G4doubleenergy
 
G4ParticleHPVectortheYield
 
G4ParticleHPVector theTotalXsec
 
G4ParticleHPVectorthePartialXsec
 
G4intisPrimary
 
G4int isoFlag
 
G4int tabulationType
 
G4int nDiscrete2
 
G4int nIso
 
G4doubletheShells
 
G4doubletheGammas
 
G4intnNeu
 
G4InterpolationManager theLegendreManager
 
G4ParticleHPLegendreTable ** theLegendre
 
G4ParticleHPAngularP ** theAngular
 
G4intdistribution
 
G4int nPartials
 
G4ParticleHPVectorprobs
 
G4ParticleHPPartial ** partials
 
G4Cache< std::vector< G4int > *> actualMult
 
G4int theInternalConversionFlag
 
G4int nGammaEnergies
 
G4double theBaseEnergy
 
G4doubletheLevelEnergies
 
G4doubletheTransitionProbabilities
 
G4doublethePhotonTransitionFraction
 
G4ParticleHPFastLegendre theLegend
 
G4ParticleHPInterpolator theInt
 

Detailed Description

Definition at line 55 of file G4ParticleHPPhotonDist.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPPhotonDist()

G4ParticleHPPhotonDist::G4ParticleHPPhotonDist ( )
inline

Definition at line 59 of file G4ParticleHPPhotonDist.hh.

60  : repFlag( 0 )
61  , targetMass( 0.0 )
62  , nDiscrete( 0 )
63  , isoFlag( 0 )
64  , tabulationType( 0 )
65  , nDiscrete2( 0 )
66  , nIso( 0 )
67  , nPartials( 0 )
69  , nGammaEnergies( 0 )
70  , theBaseEnergy( 0.0 )
71  {
72 
73  disType = 0;
74  energy = 0;
75  theYield = 0;
76  thePartialXsec = 0;
77  isPrimary = 0;
78  theShells = 0;
79  theGammas = 0;
80  nNeu = 0;
81  theLegendre = 0;
82  theAngular = 0;
83  distribution = 0;
84  probs = 0;
85  partials = 0;
86  //actualMult = 0;
87  actualMult.Put( NULL );
88 
89  theLevelEnergies = 0;
92 
93  }
void Put(const value_type &val) const
Definition: G4Cache.hh:286
G4ParticleHPLegendreTable ** theLegendre
G4ParticleHPPartial ** partials
G4ParticleHPAngularP ** theAngular
G4ParticleHPVector * thePartialXsec
G4Cache< std::vector< G4int > *> actualMult
G4ParticleHPVector * theYield
Here is the call graph for this function:

◆ ~G4ParticleHPPhotonDist()

G4ParticleHPPhotonDist::~G4ParticleHPPhotonDist ( )
inline

Definition at line 95 of file G4ParticleHPPhotonDist.hh.

96  {
97  delete [] disType;
98  delete [] energy;
99  delete [] theYield;
100  delete [] thePartialXsec;
101  delete [] isPrimary;
102  delete [] theShells;
103  delete [] theGammas;
104  delete [] nNeu;
105  delete [] theAngular;
106  delete [] distribution;
107  delete [] probs;
108 
109  if ( theLegendre != NULL )
110  {
111  for ( G4int i = 0 ; i < (nDiscrete2-nIso) ; i++ )
112  if ( theLegendre[i] != NULL ) delete[] theLegendre[i];
113 
114  delete [] theLegendre;
115  }
116 
117  if ( partials != 0 )
118  {
119  for ( G4int i = 0 ; i < nPartials ; i++ )
120  { delete partials[i]; }
121 
122  delete [] partials;
123  }
124 
125  //delete [] actualMult;
126 
127  // delete theLevelEnergies;
128  // delete theTransitionProbabilities;
129  // delete thePhotonTransitionFraction;
130 // TKDB
131  delete [] theLevelEnergies;
132  delete [] theTransitionProbabilities;
133  delete [] thePhotonTransitionFraction;
134  }
G4ParticleHPLegendreTable ** theLegendre
G4ParticleHPPartial ** partials
G4ParticleHPAngularP ** theAngular
G4ParticleHPVector * thePartialXsec
int G4int
Definition: G4Types.hh:78
G4ParticleHPVector * theYield
Here is the call graph for this function:

Member Function Documentation

◆ GetLevelEnergy()

G4double G4ParticleHPPhotonDist::GetLevelEnergy ( )
inline

Definition at line 150 of file G4ParticleHPPhotonDist.hh.

◆ GetPhotons()

G4ReactionProductVector * G4ParticleHPPhotonDist::GetPhotons ( G4double  anEnergy)

Definition at line 282 of file G4ParticleHPPhotonDist.cc.

283 {
284 
285  //G4cout << "G4ParticleHPPhotonDist::GetPhotons repFlag " << repFlag << G4endl;
286  // the partial cross-section case is not in this yet. @@@@ << 070601 TK add partial
287  if ( actualMult.Get() == NULL ) {
288  actualMult.Get() = new std::vector<G4int>( nDiscrete );
289  }
290  G4int i, ii, iii;
291  G4int nSecondaries = 0;
293  if(repFlag==1)
294  {
295  G4double current=0;
296  for(i=0; i<nDiscrete; i++)
297  {
298  current = theYield[i].GetY(anEnergy);
299  actualMult.Get()->at(i) = G4Poisson(current); // max cut-off still missing @@@
300  if(nDiscrete==1&&current<1.0001)
301  {
302  actualMult.Get()->at(i) = static_cast<G4int>(current);
303  if(current<1)
304  {
305  actualMult.Get()->at(i) = 0;
306  if(G4UniformRand()<current) actualMult.Get()->at(i) = 1;
307  }
308  }
309  nSecondaries += actualMult.Get()->at(i);
310  }
311  //G4cout << "nSecondaries " << nSecondaries << " anEnergy " << anEnergy/eV << G4endl;
312  for(i=0;i<nSecondaries;i++)
313  {
314  G4ReactionProduct * theOne = new G4ReactionProduct;
315  theOne->SetDefinition(G4Gamma::Gamma());
316  thePhotons->push_back(theOne);
317  }
318  G4int count=0;
319 
320 /*
321 G4double totalCascadeEnergy = 0.;
322 G4double lastCascadeEnergy = 0.;
323 G4double eGamm = 0;
324 G4int maxEnergyIndex = 0;
325 */
326  //Gcout << "nDiscrete " << nDiscrete << " nPartials " << nPartials << G4endl;
327 //3456
328  if ( nDiscrete == 1 && nPartials == 1 )
329  {
330  if ( actualMult.Get()->at(0) > 0 )
331  {
332  if ( disType[0] == 1 ) // continuum
333  {
334 
335 /*
336  for(ii=0; ii< actualMult[0]; ii++)
337  {
338 
339  G4double sum=0, run=0;
340  for(iii=0; iii<nPartials; iii++) sum+=probs[iii].GetY(anEnergy);
341  G4double random = G4UniformRand();
342  G4int theP = 0;
343  for(iii=0; iii<nPartials; iii++)
344  {
345  run+=probs[iii].GetY(anEnergy);
346  theP = iii;
347  if(random<run/sum) break;
348  }
349  if(theP==nPartials) theP=nPartials-1; // das sortiert J aus.
350  sum=0;
351  G4ParticleHPVector * temp;
352  temp = partials[theP]->GetY(anEnergy); //@@@ look at, seems fishy
353  // Looking for TotalCascdeEnergy or LastMaxEnergy
354  if (ii == 0)
355  {
356  maxEnergyIndex = temp->GetVectorLength()-1;
357  totalCascadeEnergy = temp->GetX(maxEnergyIndex);
358  lastCascadeEnergy = totalCascadeEnergy;
359  }
360  lastCascadeEnergy -= eGamm;
361  if (ii != actualMult[i]-1) eGamm = temp->SampleWithMax(lastCascadeEnergy);
362  else eGamm = lastCascadeEnergy;
363  thePhotons->operator[](count)->SetKineticEnergy(eGamm);
364  delete temp;
365 
366  }
367 */
368  G4ParticleHPVector * temp;
369  temp = partials[ 0 ]->GetY(anEnergy); //@@@ look at, seems fishy
370  G4double maximumE = temp->GetX( temp->GetVectorLength()-1 ); // This is an assumption.
371 
372  //G4cout << "start " << actualMult[ 0 ] << " maximumE " << maximumE/eV << G4endl;
373 
374  std::vector< G4double > photons_e_best( actualMult.Get()->at(0) , 0.0 );
375  G4double best = DBL_MAX;
376  G4int maxTry = 1000;
377  for ( G4int j = 0 ; j < maxTry ; j++ )
378  {
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++ )
382  {
383  *it = temp->Sample();
384  }
385  if ( std::accumulate( photons_e.begin() , photons_e.end() , 0.0 ) > maximumE )
386  {
387  if ( std::accumulate( photons_e.begin() , photons_e.end() , 0.0 ) < best )
388  photons_e_best = photons_e;
389  continue;
390  }
391  else
392  {
393  for ( std::vector< G4double >::iterator
394  it = photons_e.begin() ; it < photons_e.end() ; it++ )
395  {
396  thePhotons->operator[](count)->SetKineticEnergy( *it );
397  }
398  //G4cout << "OK " << actualMult[0] << " j " << j << " total photons E "
399  // << std::accumulate( photons_e.begin() , photons_e.end() , 0.0 )/eV << " ratio " << std::accumulate( photons_e.begin() , photons_e.end() , 0.0 ) / maximumE
400  // << G4endl;
401 
402  break;
403  }
404  G4cout << "NeutronHPPhotonDist could not find fitted energy set for multiplicity of " << actualMult.Get()->at(0) << "." << G4endl;
405  G4cout << "NeutronHPPhotonDist will use the best set." << G4endl;
406  for ( std::vector< G4double >::iterator
407  it = photons_e_best.begin() ; it < photons_e_best.end() ; it++ )
408  {
409  thePhotons->operator[](count)->SetKineticEnergy( *it );
410  }
411  //G4cout << "Not Good " << actualMult[0] << " j " << j << " total photons E "
412  // << best/eV << " ratio " << best / maximumE
413  // << G4endl;
414  }
415  // TKDB
416  delete temp;
417  }
418  else // discrete
419  {
420  thePhotons->operator[](count)->SetKineticEnergy(energy[i]);
421  }
422  count++;
423  if(count > nSecondaries) throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPPhotonDist::GetPhotons inconsistancy");
424  }
425 
426  }
427  else
428  {
429  for(i=0; i<nDiscrete; i++)
430  {
431  for(ii=0; ii< actualMult.Get()->at(i); ii++)
432  {
433  if(disType[i]==1) // continuum
434  {
435  G4double sum=0, run=0;
436  for(iii=0; iii<nPartials; iii++) sum+=probs[iii].GetY(anEnergy);
437  G4double random = G4UniformRand();
438  G4int theP = 0;
439  for(iii=0; iii<nPartials; iii++)
440  {
441  run+=probs[iii].GetY(anEnergy);
442  theP = iii;
443  if(random<run/sum) break;
444  }
445  if(theP==nPartials) theP=nPartials-1; // das sortiert J aus.
446  sum=0;
447  G4ParticleHPVector * temp;
448  temp = partials[theP]->GetY(anEnergy); //@@@ look at, seems fishy
449  G4double eGamm = temp->Sample();
450  thePhotons->operator[](count)->SetKineticEnergy(eGamm);
451  delete temp;
452  }
453  else // discrete
454  {
455  thePhotons->operator[](count)->SetKineticEnergy(energy[i]);
456  }
457  count++;
458  if(count > nSecondaries) throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPPhotonDist::GetPhotons inconsistancy");
459  }
460  }
461  }
462  // now do the angular distributions...
463  if( isoFlag == 1)
464  {
465  for (i=0; i< nSecondaries; i++)
466  {
467  G4double costheta = 2.*G4UniformRand()-1;
468  G4double theta = std::acos(costheta);
469  G4double phi = twopi*G4UniformRand();
470  G4double sinth = std::sin(theta);
471  G4double en = thePhotons->operator[](i)->GetTotalEnergy();
472  G4ThreeVector temp(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
473  thePhotons->operator[](i)->SetMomentum( temp ) ;
474  // G4cout << "Isotropic distribution in PhotonDist"<<temp<<G4endl;
475  }
476  }
477  else
478  {
479  for(i=0; i<nSecondaries; i++)
480  {
481  G4double currentEnergy = thePhotons->operator[](i)->GetTotalEnergy();
482  for(ii=0; ii<nDiscrete2; ii++)
483  {
484  if (std::abs(currentEnergy-theGammas[ii])<0.1*keV) break;
485  }
486  if(ii==nDiscrete2) ii--; // fix for what seems an (file12 vs file 14) inconsistancy found in the ENDF 7N14 data. @@
487  if(ii<nIso)
488  {
489  // isotropic distribution
490  //
491  //Fix Bugzilla report #1745
492  //G4double theta = pi*G4UniformRand();
493  G4double costheta = 2.*G4UniformRand()-1;
494  G4double theta = std::acos(costheta);
495  G4double phi = twopi*G4UniformRand();
496  G4double sinth = std::sin(theta);
497  G4double en = thePhotons->operator[](i)->GetTotalEnergy();
498  G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
499  thePhotons->operator[](i)->SetMomentum( tempVector ) ;
500  }
501  else if(tabulationType==1)
502  {
503  // legendre polynomials
504  G4int it(0);
505  for (iii=0; iii<nNeu[ii-nIso]; iii++) // find the neutron energy
506  {
507  it = iii;
508  if(theLegendre[ii-nIso][iii].GetEnergy()>anEnergy)
509  break;
510  }
511  G4ParticleHPLegendreStore aStore(2);
512  aStore.SetCoeff(1, &(theLegendre[ii-nIso][it]));
513  //aStore.SetCoeff(0, &(theLegendre[ii-nIso][it-1]));
514  //TKDB 110512
515  if ( it > 0 )
516  {
517  aStore.SetCoeff(0, &(theLegendre[ii-nIso][it-1]));
518  }
519  else
520  {
521  aStore.SetCoeff(0, &(theLegendre[ii-nIso][it]));
522  }
523  G4double cosTh = aStore.SampleMax(anEnergy);
524  G4double theta = std::acos(cosTh);
525  G4double phi = twopi*G4UniformRand();
526  G4double sinth = std::sin(theta);
527  G4double en = thePhotons->operator[](i)->GetTotalEnergy();
528  G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
529  thePhotons->operator[](i)->SetMomentum( tempVector ) ;
530  }
531  else
532  {
533  // tabulation of probabilities.
534  G4int it(0);
535  for (iii=0; iii<nNeu[ii-nIso]; iii++) // find the neutron energy
536  {
537  it = iii;
538  if(theAngular[ii-nIso][iii].GetEnergy()>anEnergy)
539  break;
540  }
541  G4double costh = theAngular[ii-nIso][it].GetCosTh(); // no interpolation yet @@
542  G4double theta = std::acos(costh);
543  G4double phi = twopi*G4UniformRand();
544  G4double sinth = std::sin(theta);
545  G4double en = thePhotons->operator[](i)->GetTotalEnergy();
546  G4ThreeVector tmpVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*costh );
547  thePhotons->operator[](i)->SetMomentum( tmpVector ) ;
548  }
549  }
550  }
551  }
552  else if(repFlag == 2)
553  {
554  G4double * running = new G4double[nGammaEnergies];
555  running[0]=theTransitionProbabilities[0];
556  //G4int i; //declaration at 284th
557  for(i=1; i<nGammaEnergies; i++)
558  {
559  running[i]=running[i-1]+theTransitionProbabilities[i];
560  }
561  G4double random = G4UniformRand();
562  G4int it=0;
563  for(i=0; i<nGammaEnergies; i++)
564  {
565  it = i;
566  if(random < running[i]/running[nGammaEnergies-1]) break;
567  }
568  delete [] running;
569  G4double totalEnergy = theBaseEnergy - theLevelEnergies[it];
570  G4ReactionProduct * theOne = new G4ReactionProduct;
571  theOne->SetDefinition(G4Gamma::Gamma());
572  random = G4UniformRand();
574  {
576  //Bug reported Chao Zhang (Chao.Zhang@usd.edu), Dongming Mei(Dongming.Mei@usd.edu) Feb. 25, 2009
577  //But never enter at least with G4NDL3.13
578  totalEnergy += G4Electron::Electron()->GetPDGMass(); //proposed correction: add this line for electron
579  }
580  theOne->SetTotalEnergy(totalEnergy);
581  if( isoFlag == 1 )
582  {
583  G4double costheta = 2.*G4UniformRand()-1;
584  G4double theta = std::acos(costheta);
585  G4double phi = twopi*G4UniformRand();
586  G4double sinth = std::sin(theta);
587  //Bug reported Chao Zhang (Chao.Zhang@usd.edu), Dongming Mei(Dongming.Mei@usd.edu) Feb. 25, 2009
588  //G4double en = theOne->GetTotalEnergy();
589  G4double en = theOne->GetTotalMomentum();
590  //But never cause real effect at least with G4NDL3.13 TK
591  G4ThreeVector temp(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
592  theOne->SetMomentum( temp ) ;
593  }
594  else
595  {
596  G4double currentEnergy = theOne->GetTotalEnergy();
597  for(ii=0; ii<nDiscrete2; ii++)
598  {
599  if (std::abs(currentEnergy-theGammas[ii])<0.1*keV) break;
600  }
601  if(ii==nDiscrete2) ii--; // fix for what seems an (file12 vs file 14) inconsistancy found in the ENDF 7N14 data. @@
602  if(ii<nIso)
603  {
604  //Bug reported Chao Zhang (Chao.Zhang@usd.edu), Dongming Mei(Dongming.Mei@usd.edu) Feb. 25, 2009
605  // isotropic distribution
606  //G4double theta = pi*G4UniformRand();
607  G4double theta = std::acos(2.*G4UniformRand()-1.);
608  //But this is alos never cause real effect at least with G4NDL3.13 TK not repFlag == 2 AND isoFlag != 1
609  G4double phi = twopi*G4UniformRand();
610  G4double sinth = std::sin(theta);
611  //Bug reported Chao Zhang (Chao.Zhang@usd.edu), Dongming Mei(Dongming.Mei@usd.edu) Feb. 25, 2009
612  //G4double en = theOne->GetTotalEnergy();
613  G4double en = theOne->GetTotalMomentum();
614  //But never cause real effect at least with G4NDL3.13 TK
615  G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
616  theOne->SetMomentum( tempVector ) ;
617  }
618  else if(tabulationType==1)
619  {
620  // legendre polynomials
621  G4int itt(0);
622  for (iii=0; iii<nNeu[ii-nIso]; iii++) // find the neutron energy
623  {
624  itt = iii;
625  if(theLegendre[ii-nIso][iii].GetEnergy()>anEnergy)
626  break;
627  }
628  G4ParticleHPLegendreStore aStore(2);
629  aStore.SetCoeff(1, &(theLegendre[ii-nIso][itt]));
630  //aStore.SetCoeff(0, &(theLegendre[ii-nIso][it-1]));
631  //TKDB 110512
632  if ( itt > 0 )
633  {
634  aStore.SetCoeff(0, &(theLegendre[ii-nIso][itt-1]));
635  }
636  else
637  {
638  aStore.SetCoeff(0, &(theLegendre[ii-nIso][itt]));
639  }
640  G4double cosTh = aStore.SampleMax(anEnergy);
641  G4double theta = std::acos(cosTh);
642  G4double phi = twopi*G4UniformRand();
643  G4double sinth = std::sin(theta);
644  //Bug reported Chao Zhang (Chao.Zhang@usd.edu), Dongming Mei(Dongming.Mei@usd.edu) Feb. 25, 2009
645  //G4double en = theOne->GetTotalEnergy();
646  G4double en = theOne->GetTotalMomentum();
647  //But never cause real effect at least with G4NDL3.13 TK
648  G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
649  theOne->SetMomentum( tempVector ) ;
650  }
651  else
652  {
653  // tabulation of probabilities.
654  G4int itt(0);
655  for (iii=0; iii<nNeu[ii-nIso]; iii++) // find the neutron energy
656  {
657  itt = iii;
658  if(theAngular[ii-nIso][iii].GetEnergy()>anEnergy)
659  break;
660  }
661  G4double costh = theAngular[ii-nIso][itt].GetCosTh(); // no interpolation yet @@
662  G4double theta = std::acos(costh);
663  G4double phi = twopi*G4UniformRand();
664  G4double sinth = std::sin(theta);
665  //Bug reported Chao Zhang (Chao.Zhang@usd.edu), Dongming Mei(Dongming.Mei@usd.edu) Feb. 25, 2009
666  //G4double en = theOne->GetTotalEnergy();
667  G4double en = theOne->GetTotalMomentum();
668  //But never cause real effect at least with G4NDL3.13 TK
669  G4ThreeVector tmpVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*costh );
670  theOne->SetMomentum( tmpVector ) ;
671  }
672  }
673  thePhotons->push_back(theOne);
674  }
675  else if( repFlag==0 )
676  {
677 
678 // TK add
679  if ( thePartialXsec == 0 )
680  {
681  //G4cout << "repFlag is 0, but no PartialXsec data" << G4endl;
682  //G4cout << "This is not support yet." << G4endl;
683  return thePhotons;
684  }
685 
686 // Partial Case
687 
688  G4ReactionProduct * theOne = new G4ReactionProduct;
689  theOne->SetDefinition( G4Gamma::Gamma() );
690  thePhotons->push_back( theOne );
691 
692 // Energy
693 
694  //G4cout << "Partial Case nDiscrete " << nDiscrete << G4endl;
695  G4double sum = 0.0;
696  std::vector < G4double > dif( nDiscrete , 0.0 );
697  for ( G4int j = 0 ; j < nDiscrete ; j++ )
698  {
699  G4double x = thePartialXsec[ j ].GetXsec( anEnergy ); // x in barn
700  if ( x > 0 )
701  {
702  sum += x;
703  }
704  dif [ j ] = sum;
705  //G4cout << "j " << j << ", x " << x << ", dif " << dif [ j ] << G4endl;
706  }
707 
708  G4double rand = G4UniformRand();
709 
710  G4int iphoton = 0;
711  for ( G4int j = 0 ; j < nDiscrete ; j++ )
712  {
713  G4double y = rand*sum;
714  if ( dif [ j ] > y )
715  {
716  iphoton = j;
717  break;
718  }
719  }
720  //G4cout << "iphoton " << iphoton << G4endl;
721  //G4cout << "photon energy " << theGammas[ iphoton ] /eV << G4endl;
722 
723 // Angle
724  G4double cosTheta = 0.0; // mu
725 
726  if ( isoFlag == 1 )
727  {
728 
729 // Isotropic Case
730 
731  cosTheta = 2.*G4UniformRand()-1;
732 
733  }
734  else
735  {
736 
737  if ( iphoton < nIso )
738  {
739 
740 // still Isotropic
741 
742  cosTheta = 2.*G4UniformRand()-1;
743 
744  }
745  else
746  {
747 
748  //G4cout << "Not Isotropic and isoFlag " << isoFlag << G4endl;
749  //G4cout << "tabulationType " << tabulationType << G4endl;
750  //G4cout << "nDiscrete2 " << nDiscrete2 << G4endl;
751  //G4cout << "nIso " << nIso << G4endl;
752  //G4cout << "size of nNeu " << nDiscrete2-nIso << G4endl;
753  //G4cout << "nNeu[iphoton-nIso] " << nNeu[iphoton-nIso] << G4endl;
754 
755  if ( tabulationType == 1 )
756  {
757 // legendre polynomials
758 
759  G4int iangle = 0;
760  for ( G4int j = 0 ; j < nNeu [ iphoton - nIso ] ; j++ )
761  {
762  iangle = j;
763  if ( theLegendre[ iphoton - nIso ][ j ].GetEnergy() > anEnergy ) break;
764  }
765 
766  G4ParticleHPLegendreStore aStore( 2 );
767  aStore.SetCoeff( 1 , &( theLegendre[ iphoton - nIso ][ iangle ] ) );
768  aStore.SetCoeff( 0 , &( theLegendre[ iphoton - nIso ][ iangle - 1 ] ) );
769 
770  cosTheta = aStore.SampleMax( anEnergy );
771 
772  }
773  else if ( tabulationType == 2 )
774  {
775 
776 // tabulation of probabilities.
777 
778  G4int iangle = 0;
779  for ( G4int j = 0 ; j < nNeu [ iphoton - nIso ] ; j++ )
780  {
781  iangle = j;
782  if ( theAngular[ iphoton - nIso ][ j ].GetEnergy() > anEnergy ) break;
783  }
784 
785  cosTheta = theAngular[iphoton-nIso][ iangle ].GetCosTh(); // no interpolation yet @@
786 
787  }
788  }
789  }
790 
791 // Set
792  G4double phi = twopi*G4UniformRand();
793  G4double theta = std::acos( cosTheta );
794  G4double sinTheta = std::sin( theta );
795 
796  G4double photonE = theGammas[ iphoton ];
797  G4ThreeVector direction ( sinTheta*std::cos( phi ) , sinTheta * std::sin( phi ) , cosTheta );
798  G4ThreeVector photonP = photonE * direction;
799  thePhotons->operator[]( 0 )->SetMomentum( photonP ) ;
800 
801  }
802  else
803  {
804  delete thePhotons;
805  thePhotons = 0; // no gamma data available; some work needed @@@@@@@
806  }
807  return thePhotons;
808 }
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:51
G4ParticleHPLegendreTable ** theLegendre
G4ParticleHPPartial ** partials
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4ParticleHPAngularP ** theAngular
value_type & Get() const
Definition: G4Cache.hh:282
G4ParticleHPVector * thePartialXsec
G4double GetCosTh(G4int l)
G4Cache< std::vector< G4int > *> actualMult
int G4int
Definition: G4Types.hh:78
G4double GetXsec(G4int i)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
std::vector< G4ReactionProduct * > G4ReactionProductVector
Double_t y
G4ParticleHPVector * theYield
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
void SetTotalEnergy(const G4double en)
static const double twopi
Definition: G4SIunits.hh:75
G4double GetY(G4double x)
G4int GetVectorLength() const
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
G4double GetTotalMomentum() const
G4double GetX(G4int i) const
G4double GetTotalEnergy() const
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
static const double keV
Definition: G4SIunits.hh:213
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83
G4double GetY(G4int i, G4int j)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTargetMass()

G4double G4ParticleHPPhotonDist::GetTargetMass ( )
inline

Definition at line 146 of file G4ParticleHPPhotonDist.hh.

Here is the caller graph for this function:

◆ InitAngular()

void G4ParticleHPPhotonDist::InitAngular ( std::istream &  aDataFile)

Definition at line 122 of file G4ParticleHPPhotonDist.cc.

123 {
124 
125  G4int i, ii;
126  //angular distributions
127  aDataFile >> isoFlag;
128  if (isoFlag != 1)
129  {
130 if ( repFlag == 2 ) G4cout << "G4ParticleHPPhotonDist: repFlag == 2 && isoFlag != 1 is unexpected! If you use G4ND3.x, then please report to Geant4 Hyper News. Thanks." << G4endl;
131  aDataFile >> tabulationType >> nDiscrete2 >> nIso;
132 //080731
133  if ( theGammas != NULL && nDiscrete2 != nDiscrete ) G4cout << "080731c G4ParticleHPPhotonDist nDiscrete2 != nDiscrete, It looks like something wrong in your NDL files. Please update the latest. If you still have this messages after the update, then please report to Geant4 Hyper News." << G4endl;
134 
135  // The order of cross section (InitPartials) and distribution (InitAngular here) data are different, we have to re-coordinate consistent data order.
136  std::vector < G4double > vct_gammas_par;
137  std::vector < G4double > vct_shells_par;
138  std::vector < G4int > vct_primary_par;
139  std::vector < G4int > vct_distype_par;
140  std::vector < G4ParticleHPVector* > vct_pXS_par;
141  if ( theGammas != NULL )
142  {
143  //copy the cross section data
144  for ( i = 0 ; i < nDiscrete ; i++ )
145  {
146  vct_gammas_par.push_back( theGammas[ i ] );
147  vct_shells_par.push_back( theShells[ i ] );
148  vct_primary_par.push_back( isPrimary[ i ] );
149  vct_distype_par.push_back( disType[ i ] );
151  *hpv = thePartialXsec[ i ];
152  vct_pXS_par.push_back( hpv );
153  }
154  }
155  if ( theGammas == NULL ) theGammas = new G4double[nDiscrete2];
156  if ( theShells == NULL ) theShells = new G4double[nDiscrete2];
157 //080731
158 
159  for (i=0; i< nIso; i++) // isotropic photons
160  {
161  aDataFile >> theGammas[i] >> theShells[i];
162  theGammas[i]*=eV;
163  theShells[i]*=eV;
164  }
165  nNeu = new G4int [nDiscrete2-nIso];
168  for(i=nIso; i< nDiscrete2; i++)
169  {
170  if(tabulationType==1)
171  {
172  aDataFile >> theGammas[i] >> theShells[i] >> nNeu[i-nIso];
173  theGammas[i]*=eV;
174  theShells[i]*=eV;
176  theLegendreManager.Init(aDataFile);
177  for (ii=0; ii<nNeu[i-nIso]; ii++)
178  {
179  theLegendre[i-nIso][ii].Init(aDataFile);
180  }
181  }
182  else if(tabulationType==2)
183  {
184  aDataFile >> theGammas[i] >> theShells[i] >> nNeu[i-nIso];
185  theGammas[i]*=eV;
186  theShells[i]*=eV;
187  theAngular[i-nIso]=new G4ParticleHPAngularP[nNeu[i-nIso]];
188  for (ii=0; ii<nNeu[i-nIso]; ii++)
189  {
190  theAngular[i-nIso][ii].Init(aDataFile);
191  }
192  }
193  else
194  {
195  G4cout << "tabulation type: tabulationType"<<G4endl;
196  throw G4HadronicException(__FILE__, __LINE__, "cannot deal with this tabulation type for angular distributions.");
197  }
198  }
199 //080731
200  if ( vct_gammas_par.size() > 0 )
201  {
202  //Reordering cross section data to corrsponding distribution data
203  for ( i = 0 ; i < nDiscrete ; i++ )
204  {
205  for ( G4int j = 0 ; j < nDiscrete ; j++ )
206  {
207  // Checking gamma and shell to identification
208  if ( theGammas[ i ] == vct_gammas_par [ j ] && theShells [ i ] == vct_shells_par[ j ] )
209  {
210  isPrimary [ i ] = vct_primary_par [ j ];
211  disType [ i ] = vct_distype_par [ j ];
212  thePartialXsec[ i ] = ( *( vct_pXS_par[ j ] ) );
213  }
214  }
215  }
216  //Garbage collection
217  for ( std::vector < G4ParticleHPVector* >::iterator
218  it = vct_pXS_par.begin() ; it != vct_pXS_par.end() ; it++ )
219  {
220  delete *it;
221  }
222  }
223 //080731
224  }
225 }
G4ParticleHPLegendreTable ** theLegendre
void Init(std::istream &aDataFile)
void Init(G4int aScheme, G4int aRange)
G4InterpolationManager theLegendreManager
G4ParticleHPAngularP ** theAngular
G4ParticleHPVector * thePartialXsec
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
static const double eV
Definition: G4SIunits.hh:212
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void Init(std::istream &aDataFile)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitEnergies()

void G4ParticleHPPhotonDist::InitEnergies ( std::istream &  aDataFile)

Definition at line 228 of file G4ParticleHPPhotonDist.cc.

229 {
230  G4int i, energyDistributionsNeeded = 0;
231  for (i=0; i<nDiscrete; i++)
232  {
233  if( disType[i]==1) energyDistributionsNeeded =1;
234  }
235  if(!energyDistributionsNeeded) return;
236  aDataFile >> nPartials;
240  G4int nen;
241  G4int dummy;
242  for (i=0; i<nPartials; i++)
243  {
244  aDataFile >> dummy;
245  probs[i].Init(aDataFile, eV);
246  aDataFile >> nen;
247  partials[i] = new G4ParticleHPPartial(nen);
248  partials[i]->InitInterpolation(aDataFile);
249  partials[i]->Init(aDataFile);
250  }
251 }
void InitInterpolation(G4int i, std::istream &aDataFile)
G4ParticleHPPartial ** partials
void Init(std::istream &aDataFile)
int G4int
Definition: G4Types.hh:78
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
static const double eV
Definition: G4SIunits.hh:212
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitMean()

G4bool G4ParticleHPPhotonDist::InitMean ( std::istream &  aDataFile)

Definition at line 55 of file G4ParticleHPPhotonDist.cc.

56 {
57 
58  G4bool result = true;
59  if(aDataFile >> repFlag)
60  {
61 
62  aDataFile >> targetMass;
63  if(repFlag==1)
64  {
65  // multiplicities
66  aDataFile >> nDiscrete;
67  disType = new G4int[nDiscrete];
68  energy = new G4double[nDiscrete];
69  //actualMult = new G4int[nDiscrete];
71  for (G4int i=0; i<nDiscrete; i++)
72  {
73  aDataFile >> disType[i]>>energy[i];
74  energy[i]*=eV;
75  theYield[i].Init(aDataFile, eV);
76  }
77  }
78  else if(repFlag == 2)
79  {
80  aDataFile >> theInternalConversionFlag;
81  aDataFile >> theBaseEnergy;
82  theBaseEnergy*=eV;
83  aDataFile >> theInternalConversionFlag;
84  // theInternalConversionFlag == 1 No IC, theInternalConversionFlag == 2 with IC
85  aDataFile >> nGammaEnergies;
88  if(theInternalConversionFlag == 2) thePhotonTransitionFraction = new G4double[nGammaEnergies];
89  for(G4int ii=0; ii<nGammaEnergies; ii++)
90  {
91  if(theInternalConversionFlag == 1)
92  {
93  aDataFile >> theLevelEnergies[ii] >> theTransitionProbabilities[ii];
94  theLevelEnergies[ii]*=eV;
95  }
96  else if(theInternalConversionFlag == 2)
97  {
99  theLevelEnergies[ii]*=eV;
100  }
101  else
102  {
103  throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPPhotonDist: Unknown conversion flag");
104  }
105  }
106  // Note, that this is equivalent to using the 'Gamma' classes.
107  // throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPPhotonDist: Transition probability array not sampled for the moment.");
108  }
109  else
110  {
111  G4cout << "Data representation in G4ParticleHPPhotonDist: "<<repFlag<<G4endl;
112  throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPPhotonDist: This data representation is not implemented.");
113  }
114  }
115  else
116  {
117  result = false;
118  }
119  return result;
120 }
int G4int
Definition: G4Types.hh:78
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
G4ParticleHPVector * theYield
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
static const double eV
Definition: G4SIunits.hh:212
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitPartials()

void G4ParticleHPPhotonDist::InitPartials ( std::istream &  aDataFile)

Definition at line 253 of file G4ParticleHPPhotonDist.cc.

254 {
255 
256  //G4cout << "G4ParticleHPPhotonDist::InitPartials " << G4endl;
257  aDataFile >> nDiscrete >> targetMass;
258  if(nDiscrete != 1)
259  {
260  theTotalXsec.Init(aDataFile, eV);
261  }
262  G4int i;
265  isPrimary = new G4int[nDiscrete];
266  disType = new G4int[nDiscrete];
268  for(i=0; i<nDiscrete; i++)
269  {
270  aDataFile>>theGammas[i]>>theShells[i]>>isPrimary[i]>>disType[i];
271  theGammas[i]*=eV;
272  theShells[i]*=eV;
273  thePartialXsec[i].Init(aDataFile, eV);
274  }
275 
276  //G4cout << "G4ParticleHPPhotonDist::InitPartials Test " << G4endl;
277  //G4cout << "G4ParticleHPPhotonDist::InitPartials nDiscrete " << nDiscrete << G4endl;
278  //G4ParticleHPVector* aHP = new G4ParticleHPVector;
279  //aHP->Check(1);
280 }
G4ParticleHPVector * thePartialXsec
int G4int
Definition: G4Types.hh:78
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
static const double eV
Definition: G4SIunits.hh:212
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NeedsCascade()

G4bool G4ParticleHPPhotonDist::NeedsCascade ( )
inline

Definition at line 148 of file G4ParticleHPPhotonDist.hh.

148 {return repFlag==2;}

Member Data Documentation

◆ actualMult

G4Cache< std::vector<G4int>* > G4ParticleHPPhotonDist::actualMult
private

Definition at line 182 of file G4ParticleHPPhotonDist.hh.

◆ distribution

G4int* G4ParticleHPPhotonDist::distribution
private

Definition at line 176 of file G4ParticleHPPhotonDist.hh.

◆ disType

G4int* G4ParticleHPPhotonDist::disType
private

Definition at line 158 of file G4ParticleHPPhotonDist.hh.

◆ energy

G4double* G4ParticleHPPhotonDist::energy
private

Definition at line 159 of file G4ParticleHPPhotonDist.hh.

◆ isoFlag

G4int G4ParticleHPPhotonDist::isoFlag
private

Definition at line 165 of file G4ParticleHPPhotonDist.hh.

◆ isPrimary

G4int* G4ParticleHPPhotonDist::isPrimary
private

Definition at line 163 of file G4ParticleHPPhotonDist.hh.

◆ nDiscrete

G4int G4ParticleHPPhotonDist::nDiscrete
private

Definition at line 157 of file G4ParticleHPPhotonDist.hh.

◆ nDiscrete2

G4int G4ParticleHPPhotonDist::nDiscrete2
private

Definition at line 167 of file G4ParticleHPPhotonDist.hh.

◆ nGammaEnergies

G4int G4ParticleHPPhotonDist::nGammaEnergies
private

Definition at line 186 of file G4ParticleHPPhotonDist.hh.

◆ nIso

G4int G4ParticleHPPhotonDist::nIso
private

Definition at line 168 of file G4ParticleHPPhotonDist.hh.

◆ nNeu

G4int* G4ParticleHPPhotonDist::nNeu
private

Definition at line 171 of file G4ParticleHPPhotonDist.hh.

◆ nPartials

G4int G4ParticleHPPhotonDist::nPartials
private

Definition at line 177 of file G4ParticleHPPhotonDist.hh.

◆ partials

G4ParticleHPPartial** G4ParticleHPPhotonDist::partials
private

Definition at line 179 of file G4ParticleHPPhotonDist.hh.

◆ probs

G4ParticleHPVector* G4ParticleHPPhotonDist::probs
private

Definition at line 178 of file G4ParticleHPPhotonDist.hh.

◆ repFlag

G4int G4ParticleHPPhotonDist::repFlag
private

Definition at line 154 of file G4ParticleHPPhotonDist.hh.

◆ tabulationType

G4int G4ParticleHPPhotonDist::tabulationType
private

Definition at line 166 of file G4ParticleHPPhotonDist.hh.

◆ targetMass

G4double G4ParticleHPPhotonDist::targetMass
private

Definition at line 155 of file G4ParticleHPPhotonDist.hh.

◆ theAngular

G4ParticleHPAngularP** G4ParticleHPPhotonDist::theAngular
private

Definition at line 174 of file G4ParticleHPPhotonDist.hh.

◆ theBaseEnergy

G4double G4ParticleHPPhotonDist::theBaseEnergy
private

Definition at line 187 of file G4ParticleHPPhotonDist.hh.

◆ theGammas

G4double* G4ParticleHPPhotonDist::theGammas
private

Definition at line 170 of file G4ParticleHPPhotonDist.hh.

◆ theInt

G4ParticleHPInterpolator G4ParticleHPPhotonDist::theInt
private

Definition at line 194 of file G4ParticleHPPhotonDist.hh.

◆ theInternalConversionFlag

G4int G4ParticleHPPhotonDist::theInternalConversionFlag
private

Definition at line 185 of file G4ParticleHPPhotonDist.hh.

◆ theLegend

G4ParticleHPFastLegendre G4ParticleHPPhotonDist::theLegend
private

Definition at line 193 of file G4ParticleHPPhotonDist.hh.

◆ theLegendre

G4ParticleHPLegendreTable** G4ParticleHPPhotonDist::theLegendre
private

Definition at line 173 of file G4ParticleHPPhotonDist.hh.

◆ theLegendreManager

G4InterpolationManager G4ParticleHPPhotonDist::theLegendreManager
private

Definition at line 172 of file G4ParticleHPPhotonDist.hh.

◆ theLevelEnergies

G4double* G4ParticleHPPhotonDist::theLevelEnergies
private

Definition at line 188 of file G4ParticleHPPhotonDist.hh.

◆ thePartialXsec

G4ParticleHPVector* G4ParticleHPPhotonDist::thePartialXsec
private

Definition at line 162 of file G4ParticleHPPhotonDist.hh.

◆ thePhotonTransitionFraction

G4double* G4ParticleHPPhotonDist::thePhotonTransitionFraction
private

Definition at line 190 of file G4ParticleHPPhotonDist.hh.

◆ theShells

G4double* G4ParticleHPPhotonDist::theShells
private

Definition at line 169 of file G4ParticleHPPhotonDist.hh.

◆ theTotalXsec

G4ParticleHPVector G4ParticleHPPhotonDist::theTotalXsec
private

Definition at line 161 of file G4ParticleHPPhotonDist.hh.

◆ theTransitionProbabilities

G4double* G4ParticleHPPhotonDist::theTransitionProbabilities
private

Definition at line 189 of file G4ParticleHPPhotonDist.hh.

◆ theYield

G4ParticleHPVector* G4ParticleHPPhotonDist::theYield
private

Definition at line 160 of file G4ParticleHPPhotonDist.hh.


The documentation for this class was generated from the following files: