source: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLEInelasticData.cc

Last change on this file was 962, checked in by garnier, 15 years ago

update processes

File size: 7.1 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// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
32//
33
34#include "G4NeutronHPorLEInelasticData.hh"
35#include "G4Neutron.hh"
36#include "G4ElementTable.hh"
37#include "G4NeutronHPData.hh"
38
39#include "G4PhysicsVector.hh"
40
41
42
43G4NeutronHPorLEInelasticData::G4NeutronHPorLEInelasticData( G4NeutronHPChannelList* pChannel , std::set< G4String >* pSet )
44{
45   theInelasticChannel = pChannel;
46   unavailable_elements = pSet;   
47   BuildPhysicsTable(*G4Neutron::Neutron());
48}
49
50 
51
52G4bool G4NeutronHPorLEInelasticData::IsApplicable(const G4DynamicParticle*aP, const G4Element* anElement)
53{
54   G4bool result = true;
55   G4double eKin = aP->GetKineticEnergy();
56   if(eKin>20*MeV||aP->GetDefinition()!=G4Neutron::Neutron()) result = false;
57   if ( unavailable_elements->find( anElement->GetName() ) != unavailable_elements->end() ) result = false;
58   return result;
59}
60
61G4NeutronHPorLEInelasticData::G4NeutronHPorLEInelasticData()
62{
63//   BuildPhysicsTable(*G4Neutron::Neutron());
64}
65
66 
67
68G4NeutronHPorLEInelasticData::~G4NeutronHPorLEInelasticData()
69{
70//  delete theCrossSections;
71}
72
73
74#include "G4NeutronHPInelasticData.hh"
75#include "G4LPhysicsFreeVector.hh"
76//#include "G4NeutronHPElementData.hh"
77   
78void G4NeutronHPorLEInelasticData::BuildPhysicsTable( const G4ParticleDefinition& aP )
79{
80   if( &aP!=G4Neutron::Neutron() ) 
81      throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!"); 
82
83   size_t numberOfElements = G4Element::GetNumberOfElements();
84   theCrossSections = new G4PhysicsTable( numberOfElements );
85
86   static const G4ElementTable *theElementTable = G4Element::GetElementTable(); 
87   for ( size_t i=0 ; i < numberOfElements; ++i )
88   {
89      G4PhysicsVector* thePhysVec = new G4LPhysicsFreeVector(0, 0, 0);
90
91      if ( unavailable_elements->find( (*theElementTable)[i]->GetName() ) == unavailable_elements->end() ) 
92      { 
93
94         G4NeutronHPElementData* theElementData = new G4NeutronHPElementData();
95         theElementData->Init( (*theElementTable)[i] ); 
96
97         G4NeutronHPVector* theHPVector = theElementData->GetData( (G4NeutronHPInelasticData*)this ); 
98
99         G4int len = theHPVector->GetVectorLength();
100
101         if ( len!=0 ) 
102         {
103            G4double emin = theHPVector->GetX(0);
104            G4double emax = theHPVector->GetX(len-1);
105
106            G4LPhysicsFreeVector* aPhysVector= new G4LPhysicsFreeVector ( len , emin , emax );
107            for ( G4int i=0; i<len; i++ )
108            {
109               aPhysVector->PutValues( i , theHPVector->GetX(i) , theHPVector->GetY(i) );
110            }
111            delete thePhysVec;
112            thePhysVec = aPhysVector;
113         }
114
115         //G4PhysicsVector* physVec = G4NeutronHPData::
116         //Instance()->MakePhysicsVector((*theElementTable)[i], this);
117         //theCrossSections->push_back(physVec);
118      }
119
120      theCrossSections->push_back(thePhysVec);
121   }
122}
123 
124
125
126void G4NeutronHPorLEInelasticData::DumpPhysicsTable(const G4ParticleDefinition& aP)
127{
128  if(&aP!=G4Neutron::Neutron()) 
129     throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!"); 
130//  G4cout << "G4NeutronHPorLEInelasticData::DumpPhysicsTable still to be implemented"<<G4endl;
131}
132
133
134
135#include "G4Nucleus.hh"
136#include "G4NucleiProperties.hh"
137#include "G4Neutron.hh"
138#include "G4Electron.hh"
139
140G4double G4NeutronHPorLEInelasticData::
141GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE, G4double aT)
142{
143
144  // G4cout << "Choice G4NeutronHPorLEInelasticData for element " << anE->GetName() << G4endl;
145  G4double result = 0;
146  //G4bool outOfRange;
147  G4int index = anE->GetIndex();
148
149  // prepare neutron
150  G4double eKinetic = aP->GetKineticEnergy();
151  G4ReactionProduct theNeutron( aP->GetDefinition() );
152  theNeutron.SetMomentum( aP->GetMomentum() );
153  theNeutron.SetKineticEnergy( eKinetic );
154
155  // prepare thermal nucleus
156  G4Nucleus aNuc;
157  G4double eps = 0.0001;
158  G4double theA = anE->GetN();
159  G4double theZ = anE->GetZ();
160  G4double eleMass; 
161  eleMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theA+eps), static_cast<G4int>(theZ+eps))
162             ) / G4Neutron::Neutron()->GetPDGMass();
163 
164  G4ReactionProduct boosted;
165  G4double aXsection;
166 
167  // MC integration loop
168  G4int counter = 0;
169  G4double buffer = 0;
170  G4int size = G4int(std::max(10., aT/60*kelvin));
171  G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
172  G4double neutronVMag = neutronVelocity.mag();
173  while(counter == 0 || std::abs(buffer-result/std::max(1,counter)) > 0.03*buffer)
174  {
175    if(counter) buffer = result/counter;
176    while (counter<size)
177    {
178      counter ++;
179      G4ReactionProduct aThermalNuc = aNuc.GetThermalNucleus(eleMass, aT);
180      boosted.Lorentz(theNeutron, aThermalNuc);
181      G4double theEkin = boosted.GetKineticEnergy();
182      //aXsection = (*((*theCrossSections)(index))).GetValue(theEkin, outOfRange);
183      aXsection = theInelasticChannel[index].GetXsec( theEkin );
184      // velocity correction.
185      G4ThreeVector targetVelocity = 1./aThermalNuc.GetMass()*aThermalNuc.GetMomentum();
186      aXsection *= (targetVelocity-neutronVelocity).mag()/neutronVMag;
187      result += aXsection;
188    }
189    size += size;
190  }
191  result /= counter;
192  //return result;
193  return result*barn;
194}
Note: See TracBrowser for help on using the repository browser.