// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // this code implementation is the intellectual property of // neutron_hp -- source file // J.P. Wellisch, Nov-1996 // A prototype of the low energy neutron transport model. // // By copying, distributing or modifying the Program (or any work // based on the Program) you indicate your acceptance of this statement, // and all its terms. // // $Id: G4NeutronHPInelastic.cc,v 1.24 2008/12/03 22:28:48 tkoi Exp $ // GEANT4 tag $Name: geant4-09-03-ref-09 $ // // 070523 bug fix for G4FPE_DEBUG on by A. Howard (and T. Koi) // 081203 limit maximum trial for creating final states add protection for 1H isotope case by T. Koi // #include "G4NeutronHPInelastic.hh" G4NeutronHPInelastic::G4NeutronHPInelastic() :G4HadronicInteraction("NeutronHPInelastic") { SetMinEnergy( 0.0 ); SetMaxEnergy( 20.*MeV ); system("echo $G4NEUTRONHPDATA"); // G4cout << " entering G4NeutronHPInelastic constructor"<GetNumberOfIsotopes() == 1 ) { if ( (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetZ() == 1 && (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetN() == 1 ) exceptional = true; //1H } if ( !exceptional ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this element"); } } } G4NeutronHPInelastic::~G4NeutronHPInelastic() { delete [] theInelastic; } #include "G4NeutronHPThermalBoost.hh" G4HadFinalState * G4NeutronHPInelastic::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& ) { const G4Material * theMaterial = aTrack.GetMaterial(); G4int n = theMaterial->GetNumberOfElements(); G4int index = theMaterial->GetElement(0)->GetIndex(); G4int it=0; if(n!=1) { xSec = new G4double[n]; G4double sum=0; G4int i; const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume(); G4double rWeight; G4NeutronHPThermalBoost aThermalE; for (i=0; iGetElement(i)->GetIndex(); rWeight = NumAtomsPerVolume[i]; xSec[i] = theInelastic[index].GetXsec(aThermalE.GetThermalEnergy(aTrack, theMaterial->GetElement(i), theMaterial->GetTemperature())); xSec[i] *= rWeight; sum+=xSec[i]; } G4double random = G4UniformRand(); G4double running = 0; for (i=0; iGetElement(i)->GetIndex(); it = i; //if(random<=running/sum) break; if( sum == 0 || random<=running/sum) break; } delete [] xSec; } return theInelastic[index].ApplyYourself(theMaterial->GetElement(it), aTrack); }