source: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPFission.cc @ 1196

Last change on this file since 1196 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 4.0 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26// neutron_hp -- source file
27// J.P. Wellisch, Nov-1996
28// A prototype of the low energy neutron transport model.
29//
30// 070523 bug fix for G4FPE_DEBUG on by A. Howard ( and T. Koi)
31// 08-08-06 delete unnecessary and harmed declaration; Bug Report[857]
32//
33#include "G4NeutronHPFission.hh"
34
35  G4NeutronHPFission::G4NeutronHPFission()
36    :G4HadronicInteraction("NeutronHPFission")
37  {
38    SetMinEnergy( 0.0 );
39    SetMaxEnergy( 20.*MeV );
40    if(!getenv("G4NEUTRONHPDATA")) 
41       throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
42    dirName = getenv("G4NEUTRONHPDATA");
43    G4String tString = "/Fission/";
44    dirName = dirName + tString;
45    numEle = G4Element::GetNumberOfElements();
46    theFission = new G4NeutronHPChannel[numEle];
47
48    for (G4int i=0; i<numEle; i++)
49    { 
50      if((*(G4Element::GetElementTable()))[i]->GetZ()>89)
51      {
52        theFission[i].Init((*(G4Element::GetElementTable()))[i], dirName);
53        theFission[i].Register(&theFS);
54      }
55    }
56  }
57 
58  G4NeutronHPFission::~G4NeutronHPFission()
59  {
60    delete [] theFission;
61  }
62 
63  #include "G4NeutronHPThermalBoost.hh"
64  G4HadFinalState * G4NeutronHPFission::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& )
65  {
66    const G4Material * theMaterial = aTrack.GetMaterial();
67    G4int n = theMaterial->GetNumberOfElements();
68    G4int index = theMaterial->GetElement(0)->GetIndex();
69    if(n!=1)
70    {
71      xSec = new G4double[n];
72      G4double sum=0;
73      G4int i;
74      const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
75      G4double rWeight;   
76      G4NeutronHPThermalBoost aThermalE;
77      for (i=0; i<n; i++)
78      {
79        index = theMaterial->GetElement(i)->GetIndex();
80        rWeight = NumAtomsPerVolume[i];
81        xSec[i] = theFission[index].GetXsec(aThermalE.GetThermalEnergy(aTrack,
82                                                                      theMaterial->GetElement(i),
83                                                                      theMaterial->GetTemperature()));
84        xSec[i] *= rWeight;
85        sum+=xSec[i];
86      }
87      G4double random = G4UniformRand();
88      G4double running = 0;
89      for (i=0; i<n; i++)
90      {
91        running += xSec[i];
92        index = theMaterial->GetElement(i)->GetIndex();
93        //if(random<=running/sum) break;
94        if( sum == 0 ||  random <= running/sum ) break;
95      }
96      delete [] xSec;
97    }
98    return theFission[index].ApplyYourself(aTrack);
99  }
100
Note: See TracBrowser for help on using the repository browser.