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 // Class Description 26 // Class Description 27 // Final state production model for a LEND (Lo 27 // Final state production model for a LEND (Low Energy Nuclear Data) 28 // LEND is Geant4 interface for GIDI (General 28 // LEND is Geant4 interface for GIDI (General Interaction Data Interface) 29 // which gives a discription of nuclear and at 29 // which gives a discription of nuclear and atomic reactions, such as 30 // Binary collision cross sections 30 // Binary collision cross sections 31 // Particle number multiplicity distributio 31 // Particle number multiplicity distributions of reaction products 32 // Energy and angular distributions of reac 32 // Energy and angular distributions of reaction products 33 // Derived calculational constants 33 // Derived calculational constants 34 // GIDI is developped at Lawrence Livermore Na 34 // GIDI is developped at Lawrence Livermore National Laboratory 35 // Class Description - End 35 // Class Description - End 36 36 37 // 071025 First implementation done by T. Koi 37 // 071025 First implementation done by T. Koi (SLAC/SCCS) 38 // 101118 Name modifications for release T. Ko 38 // 101118 Name modifications for release T. Koi (SLAC/PPA) 39 39 40 #include "G4LENDModel.hh" 40 #include "G4LENDModel.hh" 41 #include "G4PhysicalConstants.hh" 41 #include "G4PhysicalConstants.hh" 42 #include "G4SystemOfUnits.hh" 42 #include "G4SystemOfUnits.hh" 43 #include "G4NistManager.hh" 43 #include "G4NistManager.hh" 44 #include "G4PhysicsModelCatalog.hh" << 45 << 46 double MyRNG(void*) { return G4Random::getThe << 47 44 48 G4LENDModel::G4LENDModel( G4String name ) 45 G4LENDModel::G4LENDModel( G4String name ) 49 :G4HadronicInteraction( name ), secID(-1) << 46 :G4HadronicInteraction( name ) 50 { 47 { 51 48 52 proj = NULL; //will be set in an inherited 49 proj = NULL; //will be set in an inherited class 53 50 54 SetMinEnergy( 0.*eV ); 51 SetMinEnergy( 0.*eV ); 55 SetMaxEnergy( 20.*MeV ); 52 SetMaxEnergy( 20.*MeV ); 56 53 57 //default_evaluation = "endl99"; 54 //default_evaluation = "endl99"; 58 //default_evaluation = "ENDF.B-VII.0"; << 55 default_evaluation = "ENDF.B-VII.0"; 59 default_evaluation = "ENDF/BVII.1"; << 60 56 61 allow_nat = false; 57 allow_nat = false; 62 allow_any = false; 58 allow_any = false; 63 59 64 lend_manager = G4LENDManager::GetInstance() 60 lend_manager = G4LENDManager::GetInstance(); 65 61 66 secID = G4PhysicsModelCatalog::GetModelID( << 67 } 62 } 68 63 69 G4LENDModel::~G4LENDModel() 64 G4LENDModel::~G4LENDModel() 70 { 65 { 71 for ( std::map< G4int , G4LENDUsedTarget* > 66 for ( std::map< G4int , G4LENDUsedTarget* >::iterator 72 it = usedTarget_map.begin() ; it != u 67 it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ ) 73 { 68 { 74 delete it->second; 69 delete it->second; 75 } 70 } 76 } 71 } 77 72 78 73 79 void G4LENDModel::recreate_used_target_map() 74 void G4LENDModel::recreate_used_target_map() 80 { 75 { 81 76 82 for ( std::map< G4int , G4LENDUsedTarget* > 77 for ( std::map< G4int , G4LENDUsedTarget* >::iterator 83 it = usedTarget_map.begin() ; it != u 78 it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ ) 84 { 79 { 85 delete it->second; 80 delete it->second; 86 } 81 } 87 usedTarget_map.clear(); 82 usedTarget_map.clear(); 88 83 89 create_used_target_map(); 84 create_used_target_map(); 90 85 91 } 86 } 92 87 93 88 94 89 95 void G4LENDModel::create_used_target_map() 90 void G4LENDModel::create_used_target_map() 96 { 91 { 97 92 98 lend_manager->RequestChangeOfVerboseLevel( 93 lend_manager->RequestChangeOfVerboseLevel( verboseLevel ); 99 94 100 std::size_t numberOfElements = G4Element::G << 95 size_t numberOfElements = G4Element::GetNumberOfElements(); 101 static const G4ElementTable* theElementTabl 96 static const G4ElementTable* theElementTable = G4Element::GetElementTable(); 102 97 103 for ( std::size_t i = 0 ; i < numberOfEleme << 98 for ( size_t i = 0 ; i < numberOfElements ; ++i ) 104 { 99 { 105 100 106 const G4Element* anElement = (*theElemen 101 const G4Element* anElement = (*theElementTable)[i]; 107 G4int numberOfIsotope = (G4int)anElement << 102 G4int numberOfIsotope = anElement->GetNumberOfIsotopes(); 108 103 109 if ( numberOfIsotope > 0 ) 104 if ( numberOfIsotope > 0 ) 110 { 105 { 111 // User Defined Abundances 106 // User Defined Abundances 112 for ( G4int i_iso = 0 ; i_iso < numbe << 107 for ( G4int i_iso = 0 ; i_iso < numberOfIsotope ; i_iso++ ) 113 { 108 { 114 G4int iZ = anElement->GetIsotope( 109 G4int iZ = anElement->GetIsotope( i_iso )->GetZ(); 115 G4int iA = anElement->GetIsotope( 110 G4int iA = anElement->GetIsotope( i_iso )->GetN(); 116 G4int iIsomer = anElement->GetIsot 111 G4int iIsomer = anElement->GetIsotope( i_iso )->Getm(); 117 112 118 G4LENDUsedTarget* aTarget = new G4 << 113 G4LENDUsedTarget* aTarget = new G4LENDUsedTarget ( proj , default_evaluation , iZ , iA ); 119 if ( allow_nat == true ) aTarget-> 114 if ( allow_nat == true ) aTarget->AllowNat(); 120 if ( allow_any == true ) aTarget-> 115 if ( allow_any == true ) aTarget->AllowAny(); 121 usedTarget_map.insert( std::pair< 116 usedTarget_map.insert( std::pair< G4int , G4LENDUsedTarget* > ( lend_manager->GetNucleusEncoding( iZ , iA , iIsomer ) , aTarget ) ); 122 } 117 } 123 } 118 } 124 else 119 else 125 { 120 { 126 // Natural Abundances 121 // Natural Abundances 127 G4NistElementBuilder* nistElementBuil 122 G4NistElementBuilder* nistElementBuild = lend_manager->GetNistElementBuilder(); 128 G4int iZ = int ( anElement->GetZ() ); 123 G4int iZ = int ( anElement->GetZ() ); 129 //G4cout << nistElementBuild->GetNumb 124 //G4cout << nistElementBuild->GetNumberOfNistIsotopes( int ( anElement->GetZ() ) ) << G4endl; 130 G4int numberOfNistIso = nistElementBu 125 G4int numberOfNistIso = nistElementBuild->GetNumberOfNistIsotopes( int ( anElement->GetZ() ) ); 131 126 132 for ( G4int ii = 0 ; ii < numberOfNis 127 for ( G4int ii = 0 ; ii < numberOfNistIso ; ii++ ) 133 { 128 { 134 //G4cout << nistElementBuild->GetI 129 //G4cout << nistElementBuild->GetIsotopeAbundance( iZ , nistElementBuild->GetNistFirstIsotopeN( iZ ) + i ) << G4endl; 135 if ( nistElementBuild->GetIsotopeA 130 if ( nistElementBuild->GetIsotopeAbundance( iZ , nistElementBuild->GetNistFirstIsotopeN( iZ ) + ii ) > 0 ) 136 { 131 { 137 G4int iMass = nistElementBuild- 132 G4int iMass = nistElementBuild->GetNistFirstIsotopeN( iZ ) + ii; 138 //G4cout << iZ << " " << nistEl 133 //G4cout << iZ << " " << nistElementBuild->GetNistFirstIsotopeN( iZ ) + i << " " << nistElementBuild->GetIsotopeAbundance ( iZ , iMass ) << G4endl; 139 G4int iIsomer = 0; 134 G4int iIsomer = 0; 140 135 141 G4LENDUsedTarget* aTarget = new 136 G4LENDUsedTarget* aTarget = new G4LENDUsedTarget ( proj , default_evaluation , iZ , iMass ); 142 if ( allow_nat == true ) aTarge 137 if ( allow_nat == true ) aTarget->AllowNat(); 143 if ( allow_any == true ) aTarge 138 if ( allow_any == true ) aTarget->AllowAny(); 144 usedTarget_map.insert( std::pai 139 usedTarget_map.insert( std::pair< G4int , G4LENDUsedTarget* > ( lend_manager->GetNucleusEncoding( iZ , iMass , iIsomer ) , aTarget ) ); 145 140 146 } 141 } 147 142 148 } 143 } 149 144 150 } 145 } 151 } 146 } 152 147 153 DumpLENDTargetInfo(); << 148 >> 149 >> 150 G4cout << "Dump UsedTarget for " << GetModelName() << G4endl; >> 151 G4cout << "Requested Evaluation, Z , A -> Actual Evaluation, Z , A(0=Nat) , Pointer of Target" << G4endl; >> 152 for ( std::map< G4int , G4LENDUsedTarget* >::iterator >> 153 it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ ) >> 154 { >> 155 G4cout >> 156 << " " << it->second->GetWantedEvaluation() >> 157 << ", " << it->second->GetWantedZ() >> 158 << ", " << it->second->GetWantedA() >> 159 << " -> " << it->second->GetActualEvaluation() >> 160 << ", " << it->second->GetActualZ() >> 161 << ", " << it->second->GetActualA() >> 162 << ", " << it->second->GetTarget() >> 163 << G4endl; >> 164 } >> 165 154 } 166 } 155 167 156 168 157 169 158 #include "G4IonTable.hh" 170 #include "G4IonTable.hh" 159 171 160 G4HadFinalState * G4LENDModel::ApplyYourself(c 172 G4HadFinalState * G4LENDModel::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aTarg ) 161 { 173 { 162 174 163 G4double temp = aTrack.GetMaterial()->GetTe 175 G4double temp = aTrack.GetMaterial()->GetTemperature(); 164 176 165 //G4int iZ = int ( aTarg.GetZ() ); 177 //G4int iZ = int ( aTarg.GetZ() ); 166 //G4int iA = int ( aTarg.GetN() ); 178 //G4int iA = int ( aTarg.GetN() ); 167 //migrate to integer A and Z (GetN_asInt re 179 //migrate to integer A and Z (GetN_asInt returns number of neutrons in the nucleus since this) 168 G4int iZ = aTarg.GetZ_asInt(); 180 G4int iZ = aTarg.GetZ_asInt(); 169 G4int iA = aTarg.GetA_asInt(); 181 G4int iA = aTarg.GetA_asInt(); 170 G4int iM = 0; 182 G4int iM = 0; 171 if ( aTarg.GetIsotope() != NULL ) { 183 if ( aTarg.GetIsotope() != NULL ) { 172 iM = aTarg.GetIsotope()->Getm(); 184 iM = aTarg.GetIsotope()->Getm(); 173 } 185 } 174 186 175 G4double ke = aTrack.GetKineticEnergy(); 187 G4double ke = aTrack.GetKineticEnergy(); 176 188 177 G4HadFinalState* theResult = new G4HadFinal 189 G4HadFinalState* theResult = new G4HadFinalState(); 178 190 179 G4GIDI_target* aTarget = usedTarget_map.fin 191 G4GIDI_target* aTarget = usedTarget_map.find( lend_manager->GetNucleusEncoding( iZ , iA , iM ) )->second->GetTarget(); 180 192 181 G4double aMu = aTarget->getElasticFinalStat 193 G4double aMu = aTarget->getElasticFinalState( ke*MeV, temp, NULL, NULL ); 182 194 183 G4double phi = twopi*G4UniformRand(); 195 G4double phi = twopi*G4UniformRand(); 184 G4double theta = std::acos( aMu ); 196 G4double theta = std::acos( aMu ); 185 //G4double sinth = std::sin( theta ); 197 //G4double sinth = std::sin( theta ); 186 198 187 G4ReactionProduct theNeutron( aTrack.GetDef << 199 G4ReactionProduct theNeutron( const_cast<G4ParticleDefinition *>( aTrack.GetDefinition() ) ); 188 theNeutron.SetMomentum( aTrack.Get4Momentum 200 theNeutron.SetMomentum( aTrack.Get4Momentum().vect() ); 189 theNeutron.SetKineticEnergy( ke ); 201 theNeutron.SetKineticEnergy( ke ); 190 202 191 G4ParticleDefinition* pd = G4IonTable::GetI << 203 G4ReactionProduct theTarget( G4IonTable::GetIonTable()->FindIon( iZ , iA , iM ) ); 192 G4ReactionProduct theTarget( pd ); << 193 204 194 G4double mass = pd->GetPDGMass(); << 205 G4double mass = G4IonTable::GetIonTable()->FindIon( iZ , iA , iM )->GetPDGMass(); 195 206 196 // add Thermal motion 207 // add Thermal motion 197 G4double kT = k_Boltzmann*temp; 208 G4double kT = k_Boltzmann*temp; 198 G4ThreeVector v ( G4RandGauss::shoot() * st 209 G4ThreeVector v ( G4RandGauss::shoot() * std::sqrt( kT*mass ) 199 , G4RandGauss::shoot() * st 210 , G4RandGauss::shoot() * std::sqrt( kT*mass ) 200 , G4RandGauss::shoot() * st 211 , G4RandGauss::shoot() * std::sqrt( kT*mass ) ); 201 212 202 theTarget.SetMomentum( v ); 213 theTarget.SetMomentum( v ); 203 214 204 215 205 G4ThreeVector the3Neutron = theNeutron.Ge 216 G4ThreeVector the3Neutron = theNeutron.GetMomentum(); 206 G4double nEnergy = theNeutron.GetTotalEne 217 G4double nEnergy = theNeutron.GetTotalEnergy(); 207 G4ThreeVector the3Target = theTarget.GetM 218 G4ThreeVector the3Target = theTarget.GetMomentum(); 208 G4double tEnergy = theTarget.GetTotalEner 219 G4double tEnergy = theTarget.GetTotalEnergy(); 209 G4ReactionProduct theCMS; 220 G4ReactionProduct theCMS; 210 G4double totE = nEnergy+tEnergy; 221 G4double totE = nEnergy+tEnergy; 211 G4ThreeVector the3CMS = the3Target+the3Ne 222 G4ThreeVector the3CMS = the3Target+the3Neutron; 212 theCMS.SetMomentum(the3CMS); 223 theCMS.SetMomentum(the3CMS); 213 G4double cmsMom = std::sqrt(the3CMS*the3C 224 G4double cmsMom = std::sqrt(the3CMS*the3CMS); 214 G4double sqrts = std::sqrt((totE-cmsMom)* 225 G4double sqrts = std::sqrt((totE-cmsMom)*(totE+cmsMom)); 215 theCMS.SetMass(sqrts); 226 theCMS.SetMass(sqrts); 216 theCMS.SetTotalEnergy(totE); 227 theCMS.SetTotalEnergy(totE); 217 228 218 theNeutron.Lorentz(theNeutron, theCMS); 229 theNeutron.Lorentz(theNeutron, theCMS); 219 theTarget.Lorentz(theTarget, theCMS); 230 theTarget.Lorentz(theTarget, theCMS); 220 G4double en = theNeutron.GetTotalMoment 231 G4double en = theNeutron.GetTotalMomentum(); // already in CMS. 221 G4ThreeVector cms3Mom=theNeutron.GetMom 232 G4ThreeVector cms3Mom=theNeutron.GetMomentum(); // for neutron direction in CMS 222 G4double cms_theta=cms3Mom.theta(); 233 G4double cms_theta=cms3Mom.theta(); 223 G4double cms_phi=cms3Mom.phi(); 234 G4double cms_phi=cms3Mom.phi(); 224 G4ThreeVector tempVector; 235 G4ThreeVector tempVector; 225 tempVector.setX(std::cos(theta)*std::si 236 tempVector.setX(std::cos(theta)*std::sin(cms_theta)*std::cos(cms_phi) 226 +std::sin(theta)*std::c 237 +std::sin(theta)*std::cos(phi)*std::cos(cms_theta)*std::cos(cms_phi) 227 -std::sin(theta)*std::s 238 -std::sin(theta)*std::sin(phi)*std::sin(cms_phi) ); 228 tempVector.setY(std::cos(theta)*std::si 239 tempVector.setY(std::cos(theta)*std::sin(cms_theta)*std::sin(cms_phi) 229 +std::sin(theta)*std::c 240 +std::sin(theta)*std::cos(phi)*std::cos(cms_theta)*std::sin(cms_phi) 230 +std::sin(theta)*std::s 241 +std::sin(theta)*std::sin(phi)*std::cos(cms_phi) ); 231 tempVector.setZ(std::cos(theta)*std::co 242 tempVector.setZ(std::cos(theta)*std::cos(cms_theta) 232 -std::sin(theta)*std::c 243 -std::sin(theta)*std::cos(phi)*std::sin(cms_theta) ); 233 tempVector *= en; 244 tempVector *= en; 234 theNeutron.SetMomentum(tempVector); 245 theNeutron.SetMomentum(tempVector); 235 theTarget.SetMomentum(-tempVector); 246 theTarget.SetMomentum(-tempVector); 236 G4double tP = theTarget.GetTotalMomentu 247 G4double tP = theTarget.GetTotalMomentum(); 237 G4double tM = theTarget.GetMass(); 248 G4double tM = theTarget.GetMass(); 238 theTarget.SetTotalEnergy(std::sqrt((tP+ 249 theTarget.SetTotalEnergy(std::sqrt((tP+tM)*(tP+tM)-2.*tP*tM)); 239 theNeutron.Lorentz(theNeutron, -1.*theC 250 theNeutron.Lorentz(theNeutron, -1.*theCMS); 240 theTarget.Lorentz(theTarget, -1.*theCMS 251 theTarget.Lorentz(theTarget, -1.*theCMS); 241 252 242 theResult->SetEnergyChange(theNeutron.Get 253 theResult->SetEnergyChange(theNeutron.GetKineticEnergy()); 243 theResult->SetMomentumChange(theNeutron.G 254 theResult->SetMomentumChange(theNeutron.GetMomentum().unit()); 244 G4DynamicParticle* theRecoil = new G4Dyna 255 G4DynamicParticle* theRecoil = new G4DynamicParticle; 245 256 246 theRecoil->SetDefinition( G4IonTable::Get << 257 theRecoil->SetDefinition( G4IonTable::GetIonTable()->FindIon( iZ , iA , iM , iZ ) ); 247 theRecoil->SetMomentum( theTarget.GetMome 258 theRecoil->SetMomentum( theTarget.GetMomentum() ); 248 259 249 theResult->AddSecondary( theRecoil ); 260 theResult->AddSecondary( theRecoil ); 250 261 251 return theResult; 262 return theResult; 252 263 253 } << 254 << 255 G4HadFinalState* G4LENDModel::returnUnchanged( << 256 if ( lend_manager->GetVerboseLevel() >= 1 ) << 257 G4String message; << 258 message = "Produce unchanged final state << 259 message += this->GetModelName(); << 260 message += ". Cross section and model li << 261 G4Exception( "G4LENDModel::returnUnchang << 262 message ); << 263 } << 264 theResult->SetEnergyChange( aTrack.GetKinet << 265 theResult->SetMomentumChange( aTrack.Get4Mo << 266 return theResult; << 267 } << 268 << 269 G4GIDI_target* G4LENDModel::get_target_from_ma << 270 G4GIDI_target* target = NULL; << 271 if ( usedTarget_map.find( nuclear_code ) != << 272 target = usedTarget_map.find( nuclear_co << 273 } << 274 return target; << 275 } << 276 << 277 void G4LENDModel::DumpLENDTargetInfo( G4bool f << 278 << 279 if ( lend_manager->GetVerboseLevel() >= 1 | << 280 if ( usedTarget_map.size() == 0 ) create << 281 G4cout << "Dumping UsedTarget of " << Ge << 282 G4cout << "Requested Evaluation, Z , A - << 283 for ( std::map< G4int , G4LENDUsedTarget << 284 it = usedTarget_map.begin() ; it != u << 285 G4cout << 286 << " " << it->second->GetWantedEvalua << 287 << ", " << it->second->GetWantedZ() << 288 << ", " << it->second->GetWantedA() << 289 << " -> " << it->second->GetActualEva << 290 << ", " << it->second->GetActualZ() << 291 << ", " << it->second->GetActualA() << 292 << G4endl; << 293 } << 294 } << 295 } 264 } 296 265