Geant4 10.7.0
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 levelStart = 0;
50 levelSize = 0;
51 nLevels = 0;
52 theLevels = 0;
53 }

◆ ~G4ParticleHPDeExGammas()

G4ParticleHPDeExGammas::~G4ParticleHPDeExGammas ( )
inline

Definition at line 54 of file G4ParticleHPDeExGammas.hh.

55 {
56 if(levelStart!=0) delete [] levelStart;
57 if(levelSize!=0) delete [] levelSize;
58 if(theLevels!=0) delete [] theLevels;
59 }

Member Function Documentation

◆ GetDecayGammas()

G4ReactionProductVector * G4ParticleHPDeExGammas::GetDecayGammas ( G4int  aLevel)
inline

Definition at line 63 of file G4ParticleHPDeExGammas.hh.

64 {
65 if(aLevel>nLevels-1 || aLevel<0) return 0;
66 if(nLevels==0) return new G4ReactionProductVector();
68 G4DynamicParticleVector * theResult;
69
70 theResult = theLevels[aLevel]. GetDecayGammas();
71 G4ReactionProduct * theCurrent;
72 unsigned int i;
73 for(i=0; i<theResult->size(); i++)
74 {
75 theCurrent = new G4ReactionProduct;
76 *theCurrent = *(theResult->operator[](i));
77 delete theResult->operator[](i);
78 G4double costheta = 2.*G4UniformRand()-1;
79 G4double theta = std::acos(costheta);
80 G4double phi = CLHEP::twopi*G4UniformRand();
81 G4double sinth = std::sin(theta);
82 G4double en = theCurrent->GetTotalMomentum();
83 G4ThreeVector temp(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*costheta );
84 theCurrent->SetMomentum( temp ) ;
85 result->push_back(theCurrent);
86 }
87 delete theResult;
88 return result;
89 }
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 91 of file G4ParticleHPDeExGammas.hh.

92 {
93 if(std::getenv("G4PHPTEST")) G4cout << this << " GetLEVEL " << i << " n " << nLevels << G4endl;
94 if(i>nLevels-1) return 0;
95 return theLevels+i;
96 }
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

Referenced by G4ParticleHPInelasticCompFS::CompositeApply().

◆ GetLevelEnergy()

G4double G4ParticleHPDeExGammas::GetLevelEnergy ( G4int  aLevel)
inline

Definition at line 100 of file G4ParticleHPDeExGammas.hh.

101 {
102 if(aLevel>nLevels-1 || aLevel<0) return 0;
103 G4double result = theLevels[aLevel].GetLevelEnergy();
104 return result;
105 }

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

◆ GetNumberOfLevels()

G4int G4ParticleHPDeExGammas::GetNumberOfLevels ( )
inline

Definition at line 98 of file G4ParticleHPDeExGammas.hh.

98{ 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;
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}
double epsilon(double density, double 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
#define buffer
Definition: xmlparse.cc:628

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


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