#include <G4NeutronHPDeExGammas.hh>
Public Member Functions | |
G4NeutronHPDeExGammas () | |
~G4NeutronHPDeExGammas () | |
void | Init (std::ifstream &aDataFile) |
G4ReactionProductVector * | GetDecayGammas (G4int aLevel) |
G4NeutronHPLevel * | GetLevel (G4int i) |
G4int | GetNumberOfLevels () |
G4double | GetLevelEnergy (G4int aLevel) |
Definition at line 43 of file G4NeutronHPDeExGammas.hh.
G4NeutronHPDeExGammas::G4NeutronHPDeExGammas | ( | ) | [inline] |
G4NeutronHPDeExGammas::~G4NeutronHPDeExGammas | ( | ) | [inline] |
Definition at line 54 of file G4NeutronHPDeExGammas.hh.
00055 { 00056 if(levelStart!=0) delete [] levelStart; 00057 if(levelSize!=0) delete [] levelSize; 00058 if(theLevels!=0) delete [] theLevels; 00059 }
G4ReactionProductVector* G4NeutronHPDeExGammas::GetDecayGammas | ( | G4int | aLevel | ) | [inline] |
Definition at line 63 of file G4NeutronHPDeExGammas.hh.
References G4UniformRand, G4ReactionProduct::GetTotalMomentum(), and G4ReactionProduct::SetMomentum().
Referenced by G4NeutronHPInelasticBaseFS::BaseApply(), and G4NeutronHPInelasticCompFS::CompositeApply().
00064 { 00065 if(aLevel>nLevels-1 || aLevel<0) return 0; 00066 if(nLevels==0) return new G4ReactionProductVector(); 00067 G4ReactionProductVector * result = new G4ReactionProductVector; 00068 G4DynamicParticleVector * theResult; 00069 00070 theResult = theLevels[aLevel]. GetDecayGammas(); 00071 G4ReactionProduct * theCurrent; 00072 unsigned int i; 00073 for(i=0; i<theResult->size(); i++) 00074 { 00075 theCurrent = new G4ReactionProduct; 00076 *theCurrent = *(theResult->operator[](i)); 00077 delete theResult->operator[](i); 00078 G4double costheta = 2.*G4UniformRand()-1; 00079 G4double theta = std::acos(costheta); 00080 G4double phi = CLHEP::twopi*G4UniformRand(); 00081 G4double sinth = std::sin(theta); 00082 G4double en = theCurrent->GetTotalMomentum(); 00083 G4ThreeVector temp(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*costheta ); 00084 theCurrent->SetMomentum( temp ) ; 00085 result->push_back(theCurrent); 00086 } 00087 delete theResult; 00088 return result; 00089 }
G4NeutronHPLevel* G4NeutronHPDeExGammas::GetLevel | ( | G4int | i | ) | [inline] |
Definition at line 91 of file G4NeutronHPDeExGammas.hh.
Referenced by G4NeutronHPInelasticCompFS::CompositeApply().
Definition at line 99 of file G4NeutronHPDeExGammas.hh.
References G4NeutronHPLevel::GetLevelEnergy().
Referenced by G4NeutronHPInelasticBaseFS::BaseApply(), G4NeutronHPInelasticCompFS::CompositeApply(), and Init().
00100 { 00101 if(aLevel>nLevels-1 || aLevel<0) return 0; 00102 G4double result = theLevels[aLevel].GetLevelEnergy(); 00103 return result; 00104 }
G4int G4NeutronHPDeExGammas::GetNumberOfLevels | ( | ) | [inline] |
Definition at line 97 of file G4NeutronHPDeExGammas.hh.
Referenced by G4NeutronHPInelasticBaseFS::BaseApply(), and G4NeutronHPInelasticCompFS::CompositeApply().
void G4NeutronHPDeExGammas::Init | ( | std::ifstream & | aDataFile | ) |
Definition at line 35 of file G4NeutronHPDeExGammas.cc.
References buffer, G4NeutronHPGamma::GetGammaEnergy(), G4NeutronHPGamma::GetLevelEnergy(), and GetLevelEnergy().
Referenced by G4NeutronHPInelasticCompFS::InitGammas(), and G4NeutronHPInelasticBaseFS::InitGammas().
00036 { 00037 G4NeutronHPGamma ** theGammas = new G4NeutronHPGamma * [50]; 00038 G4int nGammas = 0; 00039 G4int nBuff = 50; 00040 for(;;) 00041 { 00042 G4NeutronHPGamma * theNew = new G4NeutronHPGamma; 00043 if(!theNew->Init(aDataFile)) 00044 { 00045 delete theNew; 00046 break; 00047 } 00048 else 00049 { 00050 if(nGammas==nBuff) 00051 { 00052 nBuff+=50; 00053 G4NeutronHPGamma ** buffer = new G4NeutronHPGamma * [nBuff]; 00054 for(G4int i=0;i<nGammas;i++) buffer[i] = theGammas[i]; 00055 delete [] theGammas; 00056 theGammas = buffer; 00057 } 00058 theGammas[nGammas] = theNew; 00059 nGammas++; 00060 } 00061 } 00062 // all gammas are in. Now sort them into levels. 00063 00064 // count the levels 00065 00066 G4double currentE = 0; 00067 G4double nextE = 0; 00068 G4int i; 00069 G4double epsilon = 0.01*keV; 00070 for(i=0; i<nGammas; i++) 00071 { 00072 nextE = theGammas[i]->GetLevelEnergy(); 00073 if(std::abs(currentE-nextE)>epsilon) nLevels++; 00074 currentE = nextE; 00075 } 00076 00077 // Build the levels 00078 00079 theLevels = new G4NeutronHPLevel[nLevels]; 00080 levelStart = new G4int [nLevels]; 00081 levelSize = new G4int [nLevels]; 00082 00083 // fill the levels 00084 00085 currentE = 0; 00086 nextE = 0; 00087 G4int levelCounter=-1; 00088 for(i=0; i<nGammas; i++) 00089 { 00090 nextE = theGammas[i]->GetLevelEnergy(); 00091 if(std::abs(currentE-nextE)>epsilon) 00092 { 00093 levelCounter++; 00094 levelStart[levelCounter] = i; 00095 levelSize[levelCounter] = 0; 00096 } 00097 levelSize[levelCounter]++; 00098 currentE = nextE; 00099 } 00100 00101 for(i=0; i<nLevels; i++) 00102 { 00103 theLevels[i].SetNumberOfGammas(levelSize[i]); 00104 for(G4int ii=levelStart[i]; ii<levelStart[i]+levelSize[i]; ii++) 00105 { 00106 theLevels[i].SetGamma(ii-levelStart[i], theGammas[ii]); 00107 } 00108 } 00109 00110 // set the next relation in the gammas. 00111 G4double levelE, gammaE, currentLevelE; 00112 G4double min; 00113 for(i=0; i<nGammas; i++) 00114 { 00115 G4int it=-1; 00116 gammaE = theGammas[i]->GetGammaEnergy(); 00117 currentLevelE = theGammas[i]->GetLevelEnergy(); 00118 min = currentLevelE-gammaE-epsilon; 00119 for(G4int ii=0; ii<nLevels; ii++) 00120 { 00121 levelE = theLevels[ii].GetLevelEnergy(); 00122 if(std::abs(currentLevelE-(levelE+gammaE))<min) 00123 { 00124 min = std::abs(currentLevelE-(levelE+gammaE)); 00125 it = ii; 00126 } 00127 } 00128 //080728 00129 if ( it != -1 && currentLevelE == theLevels[it].GetLevelEnergy() ) 00130 { 00131 //TK Comment; Some data file in /Inelastic/Gammas has inconsistent level data (no level to transit) 00132 //G4cout << "DeExGammas Transition level error: it " << it << " " << currentLevelE << " " << gammaE << " " << theLevels[it-1].GetLevelEnergy() << " " << currentLevelE - theLevels[it-1].GetLevelEnergy() << G4endl; 00133 // Forced to connect the next(previous) level 00134 it +=-1; 00135 } 00136 //080728 00137 if(it!=-1) theGammas[i]->SetNext(&theLevels[it]); 00138 } 00139 // some garbage collection 00140 00141 delete [] theGammas; 00142 00143 // and we are Done. 00144 }