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