source: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPContEnergyAngular.cc@ 830

Last change on this file since 830 was 819, checked in by garnier, 17 years ago

import all except CVS

File size: 3.6 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#include "G4NeutronHPContEnergyAngular.hh"
31
32G4ReactionProduct * G4NeutronHPContEnergyAngular::Sample(G4double anEnergy, G4double massCode, G4double /*mass*/)
33{
34 G4ReactionProduct * result;
35 G4int i(0);
36 G4int it(0);
37 for(i=0;i<nEnergy;i++)
38 {
39 it = i;
40 if(theAngular[i].GetEnergy()>anEnergy) break;
41 }
42 G4double targetMass = GetTarget()->GetMass();
43 if(it==0)
44 {
45 theAngular[0].SetTarget(GetTarget());
46 theAngular[0].SetTargetCode(theTargetCode);
47 theAngular[0].SetPrimary(GetNeutron());
48 result = theAngular[0].Sample(anEnergy, massCode, targetMass,
49 theAngularRep, theInterpolation);
50 currentMeanEnergy = theAngular[0].MeanEnergyOfThisInteraction();
51 }
52 else
53 {
54 // interpolation through alternating sampling. This needs improvement @@@
55 // This is the cause of the He3 problem !!!!!!!!
56 // See to it, if you can improve this.
57 G4double random = G4UniformRand();
58 G4double deltaE = theAngular[it].GetEnergy()-theAngular[it-1].GetEnergy();
59 G4double offset = theAngular[it].GetEnergy()-anEnergy;
60 if(random<offset/deltaE) it--;
61 theAngular[it].SetTarget(GetTarget());
62 theAngular[it].SetTargetCode(theTargetCode);
63 theAngular[it].SetPrimary(GetNeutron());
64 result = theAngular[it].Sample(anEnergy, massCode, targetMass,
65 theAngularRep, theInterpolation);
66 currentMeanEnergy = theAngular[it].MeanEnergyOfThisInteraction();
67 }
68 return result;
69}
70
71G4double G4NeutronHPContEnergyAngular::
72MeanEnergyOfThisInteraction()
73{
74 G4double result(0);
75 if(currentMeanEnergy<-1)
76 {
77 throw G4HadronicException(__FILE__, __LINE__, "G4NeutronHPContEnergyAngular: Logical error in Product class");
78 }
79 else
80 {
81 result = currentMeanEnergy;
82 }
83 currentMeanEnergy = -2;
84 return result;
85}
Note: See TracBrowser for help on using the repository browser.