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