source: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLFission.cc @ 1055

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

import all except CVS

File size: 5.5 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//
27// 05-11-21 NeutronHP or Low Energy Parameterization Models
28//          Implemented by T. Koi (SLAC/SCCS)
29//          If NeutronHP data do not available for an element, then Low Energy
30//          Parameterization models handle the interactions of the element.
31// 080319 Compilation warnings - gcc-4.3.0 fix by T. Koi
32//
33
34// neutron_hp -- source file
35// J.P. Wellisch, Nov-1996
36// A prototype of the low energy neutron transport model.
37//
38#include "G4NeutronHPorLFission.hh"
39#include "G4NeutronHPFissionFS.hh"
40
41G4NeutronHPorLFission::G4NeutronHPorLFission()
42  :G4HadronicInteraction("NeutronHPorLFission")
43{
44   SetMinEnergy(0.*eV);
45   SetMaxEnergy(20.*MeV);
46
47   if( !getenv("G4NEUTRONHPDATA") ) 
48       throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
49
50   dirName = getenv("G4NEUTRONHPDATA");
51   G4String tString = "/Fission/";
52   dirName = dirName + tString;
53//    G4cout <<"G4NeutronHPorLFission::G4NeutronHPorLFission testit "<<dirName<<G4endl;
54   unavailable_elements.clear();
55
56   numEle = G4Element::GetNumberOfElements();
57   theFission = new G4NeutronHPChannel[numEle];
58
59   for ( G4int i = 0; i < numEle ; i++)
60   {
61      if ( (*(G4Element::GetElementTable()))[i]-> GetZ() > 89 )
62      {
63         theFission[i].Init((*(G4Element::GetElementTable()))[i], dirName);
64         try { while(!theFission[i].Register(&theFS)) ; }
65         catch ( G4HadronicException )
66         {
67             unavailable_elements.insert ( (*(G4Element::GetElementTable()))[i]->GetName() ); 
68         }
69      } 
70   }
71
72   if ( unavailable_elements.size() > 0 ) 
73   {
74      std::set< G4String>::iterator it;
75      G4cout << "HP Fission data are not available for thess  elements "<< G4endl;
76      for ( it = unavailable_elements.begin() ; it != unavailable_elements.end() ; it++ )
77      {
78            G4cout << *it << G4endl;
79      }
80      G4cout << "Low Energy Parameterization Models will be used."<< G4endl;
81   }
82
83   createXSectionDataSet();
84}
85 
86G4NeutronHPorLFission::~G4NeutronHPorLFission()
87{
88   delete [] theFission;
89   delete theDataSet; 
90}
91 
92#include "G4NeutronHPThermalBoost.hh"
93 
94G4HadFinalState * G4NeutronHPorLFission::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& )
95{
96   const G4Material * theMaterial = aTrack.GetMaterial();
97   G4int n = theMaterial->GetNumberOfElements();
98   G4int index = theMaterial->GetElement(0)->GetIndex();
99   if(n!=1)
100   {
101      G4int i;
102      xSec = new G4double[n];
103      G4double sum=0;
104      const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
105      G4double rWeight;   
106      G4NeutronHPThermalBoost aThermalE;
107      for (i=0; i<n; i++)
108      {
109        index = theMaterial->GetElement(i)->GetIndex();
110        rWeight = NumAtomsPerVolume[i];
111        G4double x = aThermalE.GetThermalEnergy(aTrack, theMaterial->GetElement(i), theMaterial->GetTemperature());
112
113        //xSec[i] = theFission[index].GetXsec(aThermalE.GetThermalEnergy(aTrack,
114        //                                                                   theMaterial->GetElement(i),
115        //                                                                   theMaterial->GetTemperature()));
116        xSec[i] = theFission[index].GetXsec(x);
117
118        xSec[i] *= rWeight;
119        sum+=xSec[i];
120      }
121      G4double random = G4UniformRand();
122      G4double running = 0;
123      for (i=0; i<n; i++)
124      {
125        running += xSec[i];
126        index = theMaterial->GetElement(i)->GetIndex();
127        if(random<=running/sum) break;
128      }
129      delete [] xSec;
130      // it is element-wise initialised.
131    }
132    return theFission[index].ApplyYourself(aTrack); 
133}
134
135
136
137G4bool G4NeutronHPorLFission::IsThisElementOK( G4String name )
138{
139   if ( unavailable_elements.find( name ) == unavailable_elements.end() ) 
140      return TRUE;
141   else 
142      return FALSE; 
143}
144
145
146
147void G4NeutronHPorLFission::createXSectionDataSet()
148{
149   theDataSet = new G4NeutronHPorLFissionData ( theFission , &unavailable_elements );
150}
Note: See TracBrowser for help on using the repository browser.