Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPDeExGammas Class Reference

#include <G4ParticleHPDeExGammas.hh>

Public Member Functions

 G4ParticleHPDeExGammas ()
 
 ~G4ParticleHPDeExGammas ()
 
void Init (std::istream &aDataFile)
 
G4ReactionProductVectorGetDecayGammas (G4int aLevel)
 
G4ParticleHPLevelGetLevel (G4int i)
 
G4int GetNumberOfLevels ()
 
G4double GetLevelEnergy (G4int aLevel)
 

Detailed Description

Definition at line 43 of file G4ParticleHPDeExGammas.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPDeExGammas()

G4ParticleHPDeExGammas::G4ParticleHPDeExGammas ( )
inline

Definition at line 47 of file G4ParticleHPDeExGammas.hh.

48 {
49 }

◆ ~G4ParticleHPDeExGammas()

G4ParticleHPDeExGammas::~G4ParticleHPDeExGammas ( )
inline

Definition at line 50 of file G4ParticleHPDeExGammas.hh.

51 {
52 delete [] levelStart;
53 delete [] levelSize;
54 delete [] theLevels;
55 }

Member Function Documentation

◆ GetDecayGammas()

G4ReactionProductVector * G4ParticleHPDeExGammas::GetDecayGammas ( G4int  aLevel)
inline

Definition at line 59 of file G4ParticleHPDeExGammas.hh.

60 {
61 if(aLevel>nLevels-1 || aLevel<0) return nullptr;
62 if(nLevels==0) return new G4ReactionProductVector();
64 G4DynamicParticleVector * theResult;
65
66 theResult = theLevels[aLevel]. GetDecayGammas();
67 G4ReactionProduct * theCurrent;
68 for(unsigned int i=0; i<theResult->size(); ++i)
69 {
70 theCurrent = new G4ReactionProduct;
71 *theCurrent = *(theResult->operator[](i));
72 delete theResult->operator[](i);
73 G4double costheta = 2.*G4UniformRand()-1;
74 G4double theta = std::acos(costheta);
75 G4double phi = CLHEP::twopi*G4UniformRand();
76 G4double sinth = std::sin(theta);
77 G4double en = theCurrent->GetTotalMomentum();
78 G4ThreeVector temp(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*costheta );
79 theCurrent->SetMomentum( temp ) ;
80 result->push_back(theCurrent);
81 }
82 delete theResult;
83 return result;
84 }
std::vector< G4DynamicParticle * > G4DynamicParticleVector
std::vector< G4ReactionProduct * > G4ReactionProductVector
double G4double
Definition: G4Types.hh:83
#define G4UniformRand()
Definition: Randomize.hh:52
G4ReactionProductVector * GetDecayGammas(G4int aLevel)
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4double GetTotalMomentum() const

Referenced by G4ParticleHPInelasticBaseFS::BaseApply(), G4ParticleHPInelasticCompFS::CompositeApply(), and GetDecayGammas().

◆ GetLevel()

G4ParticleHPLevel * G4ParticleHPDeExGammas::GetLevel ( G4int  i)
inline

Definition at line 86 of file G4ParticleHPDeExGammas.hh.

87 {
88 if(i>nLevels-1) return nullptr;
89 return theLevels+i;
90 }

Referenced by G4ParticleHPInelasticCompFS::CompositeApply().

◆ GetLevelEnergy()

G4double G4ParticleHPDeExGammas::GetLevelEnergy ( G4int  aLevel)
inline

Definition at line 94 of file G4ParticleHPDeExGammas.hh.

95 {
96 if(aLevel>nLevels-1 || aLevel<0) return 0;
97 G4double result = theLevels[aLevel].GetLevelEnergy();
98 return result;
99 }

Referenced by G4ParticleHPInelasticBaseFS::BaseApply(), G4ParticleHPInelasticCompFS::CompositeApply(), and Init().

◆ GetNumberOfLevels()

G4int G4ParticleHPDeExGammas::GetNumberOfLevels ( )
inline

Definition at line 92 of file G4ParticleHPDeExGammas.hh.

92{ return nLevels; }

Referenced by G4ParticleHPInelasticBaseFS::BaseApply(), and G4ParticleHPInelasticCompFS::CompositeApply().

◆ Init()

void G4ParticleHPDeExGammas::Init ( std::istream &  aDataFile)

Definition at line 37 of file G4ParticleHPDeExGammas.cc.

38{
39 // G4cout << this << "ExGammas Init LEVEL " << G4endl; //GDEB
40 G4ParticleHPGamma ** theGammas = new G4ParticleHPGamma * [50];
41 G4int nGammas = 0;
42 G4int nBuff = 50;
43 for(;;)
44 {
46 if(!theNew->Init(aDataFile))
47 {
48 delete theNew;
49 break;
50 }
51 else
52 {
53 if(nGammas==nBuff)
54 {
55 nBuff+=50;
56 G4ParticleHPGamma ** buffer = new G4ParticleHPGamma * [nBuff];
57 for(G4int i=0;i<nGammas;i++) buffer[i] = theGammas[i];
58 delete [] theGammas;
59 theGammas = buffer;
60 }
61 theGammas[nGammas] = theNew;
62 nGammas++;
63 }
64 }
65 // all gammas are in. Now sort them into levels.
66
67 // count the levels
68
69 G4double currentE = 0;
70 G4double nextE = 0;
71 G4int i;
72 G4double epsilon = 0.01*keV;
73 for(i=0; i<nGammas; i++)
74 {
75 nextE = theGammas[i]->GetLevelEnergy();
76 if(std::abs(currentE-nextE)>epsilon) nLevels++;
77 currentE = nextE;
78 }
79
80 // G4cout << this << "LEVEL " << nLevels << G4endl; //GDEB
81 // Build the levels
82
83 theLevels = new G4ParticleHPLevel[nLevels];
84 levelStart = new G4int [nLevels];
85 levelSize = new G4int [nLevels];
86
87 // fill the levels
88
89 currentE = 0;
90 nextE = 0;
91 G4int levelCounter=-1;
92 for(i=0; i<nGammas; i++)
93 {
94 nextE = theGammas[i]->GetLevelEnergy();
95 if(std::abs(currentE-nextE)>epsilon)
96 {
97 levelCounter++;
98 levelStart[levelCounter] = i;
99 levelSize[levelCounter] = 0;
100 }
101 levelSize[levelCounter]++;
102 currentE = nextE;
103 }
104
105 for(i=0; i<nLevels; i++)
106 {
107 theLevels[i].SetNumberOfGammas(levelSize[i]);
108 for(G4int ii=levelStart[i]; ii<levelStart[i]+levelSize[i]; ii++)
109 {
110 theLevels[i].SetGamma(ii-levelStart[i], theGammas[ii]);
111 }
112 }
113
114// set the next relation in the gammas.
115 G4double levelE, gammaE, currentLevelE;
116 G4double min;
117 for(i=0; i<nGammas; i++)
118 {
119 G4int it=-1;
120 gammaE = theGammas[i]->GetGammaEnergy();
121 currentLevelE = theGammas[i]->GetLevelEnergy();
122 min = currentLevelE-gammaE-epsilon;
123 for(G4int ii=0; ii<nLevels; ii++)
124 {
125 levelE = theLevels[ii].GetLevelEnergy();
126 if(std::abs(currentLevelE-(levelE+gammaE))<min)
127 {
128 min = std::abs(currentLevelE-(levelE+gammaE));
129 it = ii;
130 }
131 }
132//080728
133 if ( it != -1 && currentLevelE == theLevels[it].GetLevelEnergy() )
134 {
135 //TK Comment; Some data file in /Inelastic/Gammas has inconsistent level data (no level to transit)
136 //G4cout << "DeExGammas Transition level error: it " << it << " " << currentLevelE << " " << gammaE << " " << theLevels[it-1].GetLevelEnergy() << " " << currentLevelE - theLevels[it-1].GetLevelEnergy() << G4endl;
137 // Forced to connect the next(previous) level
138 it +=-1;
139 }
140//080728
141 if(it!=-1) theGammas[i]->SetNext(&theLevels[it]);
142 }
143 // some garbage collection
144
145 delete [] theGammas;
146
147 // and we are Done.
148}
G4double epsilon(G4double density, G4double temperature)
int G4int
Definition: G4Types.hh:85
G4double GetLevelEnergy(G4int aLevel)
G4bool Init(std::istream &aDataFile)
void SetNext(G4ParticleHPLevel *aLevel)
void SetGamma(G4int i, G4ParticleHPGamma *aGamma)
void SetNumberOfGammas(G4int aGammas)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments

Referenced by G4ParticleHPInelasticBaseFS::InitGammas(), and G4ParticleHPInelasticCompFS::InitGammas().


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