Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4NeutronHPContAngularPar.hh
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 //
27 // $Id$
28 //
29 // 080718 Add ClearHistories method and related class member
30 //
31 #ifndef G4NeutronHPContAngularPar_h
32 #define G4NeutronHPContAngularPar_h 1
33 
34 #include "G4ios.hh"
35 #include <fstream>
36 #include "globals.hh"
37 #include "G4NeutronHPList.hh"
38 #include "G4ReactionProduct.hh"
41 
43 {
44  public:
45 
47  {
48  theAngular = 0;
49  currentMeanEnergy = -2;
50  fresh = true;
51  }
53  {
54  if(theAngular!=0) delete [] theAngular;
55  }
56 
57  void Init(std::ifstream & aDataFile);
58 
59  G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass,
60  G4int angularRep, G4int interpol);
61 
62  G4double GetEnergy() { return theEnergy; }
63 
64  void SetPrimary(G4ReactionProduct * aPrimary)
65  {
66  thePrimary = aPrimary;
67  }
68 
69  void SetTarget(G4ReactionProduct * aTarget)
70  {
71  theTarget = aTarget;
72  }
73 
74  void SetTargetCode(G4double aTargetCode) { theTargetCode = aTargetCode; }
75 
76  void SetInterpolation(G4int theInterpolation)
77  {
78  theManager.Init(theInterpolation, nEnergies); // one range only
79  }
80 
81  void Merge(G4double anEnergy, G4InterpolationScheme & aScheme,
82  G4NeutronHPContAngularPar & store1,
83  G4NeutronHPContAngularPar & store2) // hmmmm, this interpolates legendre coefficients. Dangerous @@@
84  {
85  nDiscreteEnergies = store1.nDiscreteEnergies;
86  nAngularParameters = store1.nAngularParameters;
87  nEnergies = store1.nEnergies;
88  theManager = store1.theManager;
89  theEnergy = anEnergy;
90  if(theAngular != 0) delete [] theAngular;
91  theAngular = new G4NeutronHPList[nEnergies];
92  G4int i, ii;
94  for(i=0; i<nEnergies; i++)
95  {
96  theAngular[i].SetLabel(store1.theAngular[i].GetLabel());
97  for(ii=0; ii<nAngularParameters; ii++)
98  {
99 // G4cout <<"test "<<i<<" "<<store1.theEnergy<<" "<<store2.theEnergy<<" "
100 // << store1.theAngular[i].GetValue(ii)<<" "<<
101 // store2.theAngular[i].GetValue(ii)<<G4endl;
102  value = theInt.Interpolate(aScheme, anEnergy,
103  store1.theEnergy, store2.theEnergy,
104  store1.theAngular[i].GetValue(ii),
105  store2.theAngular[i].GetValue(ii));
106  theAngular[i].SetValue(ii, value);
107  }
108  }
109  };
110 
112  {
113  G4double result;
114  if(currentMeanEnergy<-1)
115  {
116  return 0;
117  // throw G4HadronicException(__FILE__, __LINE__, "G4NeutronHPContAngularPar: Logical error in Product class");
118  }
119  else
120  {
121  result = currentMeanEnergy;
122  }
123  currentMeanEnergy = -2;
124  return result;
125  }
126 
127  private:
128 
129  // incoming particle
130  G4double theEnergy;
131 
132  // number of exit channel energies
133  G4int nEnergies;
134  // number of discrete exit channels
135  G4int nDiscreteEnergies;
136  // number of angular paramerers per channel
137  G4int nAngularParameters;
138  // knows the interpolation between List labels
139  G4InterpolationManager theManager;
140  // on per exit-channel energy
141  G4NeutronHPList * theAngular;
142 
143  private:
144 
146 
147  G4double theTargetCode;
148  G4ReactionProduct * theTarget;
149  G4ReactionProduct * thePrimary;
150 
151  G4double currentMeanEnergy;
152 
153 //080718
154  public:
155  void ClearHistories(){ fresh = true; };
156  private:
157  G4bool fresh;
158  G4double remaining_energy; // represent energy rest of cascade chain
159 };
160 #endif