Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4NeutronHPContEnergyAngular.cc
Go to the documentation of this file.
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 // 080721 To be "ClearHistories" effective, the selection scheme of angular distribution is modified by T. Koi
31 //
32 //
34 
36 {
37  G4ReactionProduct * result;
38  G4int i(0);
39  G4int it(0);
40  for(i=0;i<nEnergy;i++)
41  {
42  it = i;
43  if(theAngular[i].GetEnergy()>anEnergy) break;
44  }
45  G4double targetMass = GetTarget()->GetMass();
46  if(it==0)
47  {
48  theAngular[0].SetTarget(GetTarget());
49  theAngular[0].SetTargetCode(theTargetCode);
50  theAngular[0].SetPrimary(GetNeutron());
51  result = theAngular[0].Sample(anEnergy, massCode, targetMass,
52  theAngularRep, theInterpolation);
53  currentMeanEnergy = theAngular[0].MeanEnergyOfThisInteraction();
54  }
55  else
56  {
57  // interpolation through alternating sampling. This needs improvement @@@
58  // This is the cause of the He3 problem !!!!!!!!
59  // See to it, if you can improve this.
60  //080714 TK commnet Randomizing use angular distribution
61  //080714 TK Always use the upper side distribution. enabling ClearHistories method.
62  //G4double random = G4UniformRand();
63  //G4double deltaE = theAngular[it].GetEnergy()-theAngular[it-1].GetEnergy();
64  //G4double offset = theAngular[it].GetEnergy()-anEnergy;
65  //if(random<offset/deltaE) it--;
66  theAngular[it].SetTarget(GetTarget());
67  theAngular[it].SetTargetCode(theTargetCode);
68  theAngular[it].SetPrimary(GetNeutron());
69  result = theAngular[it].Sample(anEnergy, massCode, targetMass,
70  theAngularRep, theInterpolation);
71  currentMeanEnergy = theAngular[it].MeanEnergyOfThisInteraction();
72  }
73  return result;
74 }
75 
78 {
79  G4double result(0);
80  if(currentMeanEnergy<-1)
81  {
82  throw G4HadronicException(__FILE__, __LINE__, "G4NeutronHPContEnergyAngular: Logical error in Product class");
83  }
84  else
85  {
86  result = currentMeanEnergy;
87  }
88  currentMeanEnergy = -2;
89  return result;
90 }
91 
92 
93 
95 {
96  if ( theAngular!= NULL )
97  {
98  for ( G4int i = 0 ; i< nEnergy ; i++ )
99  theAngular[i].ClearHistories();
100  }
101 }