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

#include <G4NeutronHPDeExGammas.hh>

Public Member Functions

 G4NeutronHPDeExGammas ()
 
 ~G4NeutronHPDeExGammas ()
 
void Init (std::ifstream &aDataFile)
 
G4ReactionProductVectorGetDecayGammas (G4int aLevel)
 
G4NeutronHPLevelGetLevel (G4int i)
 
G4int GetNumberOfLevels ()
 
G4double GetLevelEnergy (G4int aLevel)
 

Detailed Description

Definition at line 43 of file G4NeutronHPDeExGammas.hh.

Constructor & Destructor Documentation

◆ G4NeutronHPDeExGammas()

G4NeutronHPDeExGammas::G4NeutronHPDeExGammas ( )
inline

Definition at line 47 of file G4NeutronHPDeExGammas.hh.

48 {
49 levelStart = 0;
50 levelSize = 0;
51 nLevels = 0;
52 theLevels = 0;
53 }

◆ ~G4NeutronHPDeExGammas()

G4NeutronHPDeExGammas::~G4NeutronHPDeExGammas ( )
inline

Definition at line 54 of file G4NeutronHPDeExGammas.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 * G4NeutronHPDeExGammas::GetDecayGammas ( G4int  aLevel)
inline

Definition at line 63 of file G4NeutronHPDeExGammas.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:64
#define G4UniformRand()
Definition: Randomize.hh:53
G4ReactionProductVector * GetDecayGammas(G4int aLevel)
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4double GetTotalMomentum() const

Referenced by G4NeutronHPInelasticBaseFS::BaseApply(), G4NeutronHPInelasticCompFS::CompositeApply(), and GetDecayGammas().

◆ GetLevel()

G4NeutronHPLevel * G4NeutronHPDeExGammas::GetLevel ( G4int  i)
inline

Definition at line 91 of file G4NeutronHPDeExGammas.hh.

92 {
93 if(i>nLevels-1) return 0;
94 return theLevels+i;
95 }

Referenced by G4NeutronHPInelasticCompFS::CompositeApply().

◆ GetLevelEnergy()

G4double G4NeutronHPDeExGammas::GetLevelEnergy ( G4int  aLevel)
inline

Definition at line 99 of file G4NeutronHPDeExGammas.hh.

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

Referenced by G4NeutronHPInelasticBaseFS::BaseApply(), G4NeutronHPInelasticCompFS::CompositeApply(), and Init().

◆ GetNumberOfLevels()

G4int G4NeutronHPDeExGammas::GetNumberOfLevels ( )
inline

Definition at line 97 of file G4NeutronHPDeExGammas.hh.

97{ return nLevels; }

Referenced by G4NeutronHPInelasticBaseFS::BaseApply(), and G4NeutronHPInelasticCompFS::CompositeApply().

◆ Init()

void G4NeutronHPDeExGammas::Init ( std::ifstream &  aDataFile)

Definition at line 35 of file G4NeutronHPDeExGammas.cc.

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

Referenced by G4NeutronHPInelasticBaseFS::InitGammas(), and G4NeutronHPInelasticCompFS::InitGammas().


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