Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // neutron_hp -- source file 26 // neutron_hp -- source file 27 // J.P. Wellisch, Nov-1996 27 // J.P. Wellisch, Nov-1996 28 // A prototype of the low energy neutron trans 28 // A prototype of the low energy neutron transport model. 29 // 29 // 30 // 070523 bug fix for G4FPE_DEBUG on by A. How 30 // 070523 bug fix for G4FPE_DEBUG on by A. Howard ( and T. Koi) 31 // 08-08-06 delete unnecessary and harmed decl 31 // 08-08-06 delete unnecessary and harmed declaration; Bug Report[857] 32 // 32 // 33 // P. Arce, June-2014 Conversion neutron_hp to 33 // P. Arce, June-2014 Conversion neutron_hp to particle_hp 34 // 34 // 35 #include "G4ParticleHPFission.hh" 35 #include "G4ParticleHPFission.hh" 36 << 37 #include "G4ParticleHPFissionFS.hh" 36 #include "G4ParticleHPFissionFS.hh" 38 #include "G4ParticleHPManager.hh" << 39 #include "G4ParticleHPThermalBoost.hh" << 40 #include "G4SystemOfUnits.hh" 37 #include "G4SystemOfUnits.hh" >> 38 #include "G4ParticleHPManager.hh" 41 #include "G4Threading.hh" 39 #include "G4Threading.hh" 42 40 43 G4ParticleHPFission::G4ParticleHPFission() : G << 41 G4ParticleHPFission::G4ParticleHPFission() 44 { << 42 :G4HadronicInteraction("NeutronHPFission") 45 SetMinEnergy(0.0); << 43 ,theFission(NULL) 46 SetMaxEnergy(20. * MeV); << 44 ,numEle(0) 47 } << 45 { >> 46 SetMinEnergy( 0.0 ); >> 47 SetMaxEnergy( 20.*MeV ); >> 48 /* >> 49 if(!getenv("G4NEUTRONHPDATA")) >> 50 throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files."); >> 51 dirName = getenv("G4NEUTRONHPDATA"); >> 52 G4String tString = "/Fission"; >> 53 dirName = dirName + tString; >> 54 numEle = G4Element::GetNumberOfElements(); >> 55 //theFission = new G4ParticleHPChannel[numEle]; 48 56 49 G4ParticleHPFission::~G4ParticleHPFission() << 57 //for (G4int i=0; i<numEle; i++) 50 { << 58 //{ 51 // Vector is shared, only master deletes it << 59 //if((*(G4Element::GetElementTable()))[i]->GetZ()>89) 52 // delete [] theFission; << 60 // if((*(G4Element::GetElementTable()))[i]->GetZ()>87) //TK modified for ENDF-VII 53 if (!G4Threading::IsMasterThread()) { << 61 // { 54 if (theFission != nullptr) { << 62 // theFission[i].Init((*(G4Element::GetElementTable()))[i], dirName); 55 for (auto it = theFission->cbegin(); it << 63 // theFission[i].Register(&theFS); 56 delete *it; << 64 // } >> 65 //} >> 66 >> 67 for ( G4int i = 0 ; i < numEle ; i++ ) >> 68 { >> 69 theFission.push_back( new G4ParticleHPChannel ); >> 70 if((*(G4Element::GetElementTable()))[i]->GetZ()>87) //TK modified for ENDF-VII >> 71 { >> 72 (*theFission[i]).Init((*(G4Element::GetElementTable()))[i], dirName); >> 73 (*theFission[i]).Register(&theFS); 57 } 74 } 58 theFission->clear(); << 59 } 75 } >> 76 */ 60 } 77 } 61 } << 78 62 << 79 G4ParticleHPFission::~G4ParticleHPFission() 63 G4HadFinalState* G4ParticleHPFission::ApplyYou << 80 { 64 << 81 //delete [] theFission; 65 { << 82 if ( theFission != NULL ) { 66 G4ParticleHPManager::GetInstance()->OpenReac << 83 for ( std::vector<G4ParticleHPChannel*>::iterator 67 const G4Material* theMaterial = aTrack.GetMa << 84 it = theFission->begin() ; it != theFission->end() ; it++ ) { 68 auto n = (G4int)theMaterial->GetNumberOfElem << 85 delete *it; 69 std::size_t index = theMaterial->GetElement( << 86 } 70 if (n != 1) { << 87 theFission->clear(); 71 auto xSec = new G4double[n]; << 88 } 72 G4double sum = 0; << 89 } 73 G4int i; << 90 74 const G4double* NumAtomsPerVolume = theMat << 91 #include "G4ParticleHPThermalBoost.hh" 75 G4double rWeight; << 92 G4HadFinalState * G4ParticleHPFission::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aNucleus ) 76 G4ParticleHPThermalBoost aThermalE; << 93 { 77 for (i = 0; i < n; ++i) { << 94 78 index = theMaterial->GetElement(i)->GetI << 95 G4ParticleHPManager::GetInstance()->OpenReactionWhiteBoard(); 79 rWeight = NumAtomsPerVolume[i]; << 96 const G4Material * theMaterial = aTrack.GetMaterial(); 80 xSec[i] = ((*theFission)[index]) << 97 G4int n = theMaterial->GetNumberOfElements(); 81 ->GetXsec(aThermalE.GetTherm << 98 G4int index = theMaterial->GetElement(0)->GetIndex(); 82 << 99 if(n!=1) 83 xSec[i] *= rWeight; << 100 { 84 sum += xSec[i]; << 101 G4double* xSec = new G4double[n]; >> 102 G4double sum=0; >> 103 G4int i; >> 104 const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume(); >> 105 G4double rWeight; >> 106 G4ParticleHPThermalBoost aThermalE; >> 107 for (i=0; i<n; i++) >> 108 { >> 109 index = theMaterial->GetElement(i)->GetIndex(); >> 110 rWeight = NumAtomsPerVolume[i]; >> 111 xSec[i] = ((*theFission)[index])->GetXsec(aThermalE.GetThermalEnergy(aTrack, >> 112 theMaterial->GetElement(i), >> 113 theMaterial->GetTemperature())); >> 114 xSec[i] *= rWeight; >> 115 sum+=xSec[i]; >> 116 } >> 117 G4double random = G4UniformRand(); >> 118 G4double running = 0; >> 119 for (i=0; i<n; i++) >> 120 { >> 121 running += xSec[i]; >> 122 index = theMaterial->GetElement(i)->GetIndex(); >> 123 //if(random<=running/sum) break; >> 124 if( sum == 0 || random <= running/sum ) break; >> 125 } >> 126 delete [] xSec; 85 } 127 } 86 G4double random = G4UniformRand(); << 128 //return theFission[index].ApplyYourself(aTrack); //-2:Marker for Fission 87 G4double running = 0; << 129 G4HadFinalState* result = ((*theFission)[index])->ApplyYourself(aTrack,-2); 88 for (i = 0; i < n; ++i) { << 130 89 running += xSec[i]; << 131 //Overwrite target parameters 90 index = theMaterial->GetElement(i)->GetI << 132 aNucleus.SetParameters(G4ParticleHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA(),G4ParticleHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargZ()); 91 // if(random<=running/sum) break; << 133 const G4Element* target_element = (*G4Element::GetElementTable())[index]; 92 if (sum == 0 || random <= running / sum) << 134 const G4Isotope* target_isotope=NULL; >> 135 G4int iele = target_element->GetNumberOfIsotopes(); >> 136 for ( G4int j = 0 ; j != iele ; j++ ) { >> 137 target_isotope=target_element->GetIsotope( j ); >> 138 if ( target_isotope->GetN() == G4ParticleHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA() ) break; 93 } 139 } 94 delete[] xSec; << 140 //G4cout << "Target Material of this reaction is " << theMaterial->GetName() << G4endl; 95 } << 141 //G4cout << "Target Element of this reaction is " << target_element->GetName() << G4endl; 96 // return theFission[index].ApplyYourself(aT << 142 //G4cout << "Target Isotope of this reaction is " << target_isotope->GetName() << G4endl; 97 G4HadFinalState* result = ((*theFission)[ind << 143 aNucleus.SetIsotope( target_isotope ); 98 144 99 // Overwrite target parameters << 145 G4ParticleHPManager::GetInstance()->CloseReactionWhiteBoard(); 100 aNucleus.SetParameters(G4ParticleHPManager:: << 146 return result; 101 G4ParticleHPManager:: << 102 const G4Element* target_element = (*G4Elemen << 103 const G4Isotope* target_isotope = nullptr; << 104 auto iele = (G4int)target_element->GetNumber << 105 for (G4int j = 0; j != iele; ++j) { << 106 target_isotope = target_element->GetIsotop << 107 if (target_isotope->GetN() << 108 == G4ParticleHPManager::GetInstance()- << 109 break; << 110 } 147 } 111 aNucleus.SetIsotope(target_isotope); << 112 << 113 G4ParticleHPManager::GetInstance()->CloseRea << 114 return result; << 115 } << 116 148 117 const std::pair<G4double, G4double> G4Particle 149 const std::pair<G4double, G4double> G4ParticleHPFission::GetFatalEnergyCheckLevels() const 118 { 150 { 119 // max energy non-conservation is mass of he << 151 // max energy non-conservation is mass of heavy nucleus 120 return std::pair<G4double, G4double>(10.0 * << 152 //return std::pair<G4double, G4double>(5*perCent,250*GeV); >> 153 return std::pair<G4double, G4double>(5*perCent,DBL_MAX); >> 154 } >> 155 /* >> 156 void G4ParticleHPFission::addChannelForNewElement() >> 157 { >> 158 for ( G4int i = numEle ; i < (G4int)G4Element::GetNumberOfElements() ; i++ ) >> 159 { >> 160 theFission.push_back( new G4ParticleHPChannel ); >> 161 if ( (*(G4Element::GetElementTable()))[i]->GetZ() > 87 ) //TK modified for ENDF-VII >> 162 { >> 163 G4cout << "G4ParticleHPFission Prepairing Data for the new element of " << (*(G4Element::GetElementTable()))[i]->GetName() << G4endl; >> 164 (*theFission[i]).Init((*(G4Element::GetElementTable()))[i], dirName); >> 165 (*theFission[i]).Register(&theFS); >> 166 } >> 167 } >> 168 numEle = (G4int)G4Element::GetNumberOfElements(); 121 } 169 } >> 170 */ 122 171 123 G4int G4ParticleHPFission::GetVerboseLevel() c 172 G4int G4ParticleHPFission::GetVerboseLevel() const 124 { 173 { 125 return G4ParticleHPManager::GetInstance()->G << 174 return G4ParticleHPManager::GetInstance()->GetVerboseLevel(); 126 } 175 } 127 << 176 void G4ParticleHPFission::SetVerboseLevel( G4int newValue ) 128 void G4ParticleHPFission::SetVerboseLevel(G4in << 129 { 177 { 130 G4ParticleHPManager::GetInstance()->SetVerbo << 178 G4ParticleHPManager::GetInstance()->SetVerboseLevel(newValue); 131 } 179 } 132 << 133 void G4ParticleHPFission::BuildPhysicsTable(co 180 void G4ParticleHPFission::BuildPhysicsTable(const G4ParticleDefinition&) 134 { 181 { 135 G4ParticleHPManager* hpmanager = G4ParticleH << 136 182 137 theFission = hpmanager->GetFissionFinalState << 183 G4ParticleHPManager* hpmanager = G4ParticleHPManager::GetInstance(); 138 184 139 if (G4Threading::IsMasterThread()) { << 185 theFission = hpmanager->GetFissionFinalStates(); 140 if (theFission == nullptr) theFission = ne << 141 186 142 if (numEle == (G4int)G4Element::GetNumberO << 187 if ( G4Threading::IsMasterThread() ) { 143 188 144 if (theFission->size() == G4Element::GetNu << 189 if ( theFission == NULL ) theFission = new std::vector<G4ParticleHPChannel*>; 145 numEle = (G4int)G4Element::GetNumberOfEl << 146 return; << 147 } << 148 190 149 if (G4FindDataDir("G4NEUTRONHPDATA") == nu << 191 if ( numEle == (G4int)G4Element::GetNumberOfElements() ) return; 150 throw G4HadronicException( << 151 __FILE__, __LINE__, << 152 "Please setenv G4NEUTRONHPDATA to poin << 153 dirName = G4FindDataDir("G4NEUTRONHPDATA") << 154 G4String tString = "/Fission"; << 155 dirName = dirName + tString; << 156 192 157 for (G4int i = numEle; i < (G4int)G4Elemen << 193 if ( theFission->size() == G4Element::GetNumberOfElements() ) { 158 theFission->push_back(new G4ParticleHPCh << 194 numEle = G4Element::GetNumberOfElements(); 159 if ((*(G4Element::GetElementTable()))[i] << 195 return; 160 ((*theFission)[i])->Init((*(G4Element: << 161 ((*theFission)[i])->Register(new G4Par << 162 } 196 } 163 } << 197 164 hpmanager->RegisterFissionFinalStates(theF << 198 if ( !getenv("G4NEUTRONHPDATA") ) 165 } << 199 throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files."); 166 numEle = (G4int)G4Element::GetNumberOfElemen << 200 dirName = getenv("G4NEUTRONHPDATA"); >> 201 G4String tString = "/Fission"; >> 202 dirName = dirName + tString; >> 203 >> 204 for ( G4int i = numEle ; i < (G4int)G4Element::GetNumberOfElements() ; i++ ) { >> 205 theFission->push_back( new G4ParticleHPChannel ); >> 206 if ((*(G4Element::GetElementTable()))[i]->GetZ()>87) { //TK modified for ENDF-VII >> 207 ((*theFission)[i])->Init((*(G4Element::GetElementTable()))[i], dirName); >> 208 ((*theFission)[i])->Register( new G4ParticleHPFissionFS ); >> 209 } >> 210 } >> 211 >> 212 hpmanager->RegisterFissionFinalStates( theFission ); >> 213 >> 214 } >> 215 >> 216 numEle = G4Element::GetNumberOfElements(); 167 } 217 } 168 218 169 void G4ParticleHPFission::ModelDescription(std 219 void G4ParticleHPFission::ModelDescription(std::ostream& outFile) const 170 { 220 { 171 outFile << "High Precision model based on Ev << 221 outFile << "High Precision model based on Evaluated Nuclear Data Files (ENDF) for induced fission reaction of neutrons below 20MeV\n"; 172 << "for induced fission reaction of << 173 } 222 } 174 223