Geant4  10.01.p03
G4ParticleHPContAngularPar.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 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
31 //
32 #ifndef G4ParticleHPContAngularPar_h
33 #define G4ParticleHPContAngularPar_h 1
34 
35 #include "G4ios.hh"
36 #include <fstream>
37 #include "globals.hh"
38 #include "G4ParticleHPList.hh"
39 #include "G4ReactionProduct.hh"
42 #include <set>
44 
46 {
47  public:
48 
50  {
51  theAngular = 0;
52  currentMeanEnergy = -2;
53  fresh = true;
56  }
57 
59 
61  {
62  if(theAngular!=0) delete [] theAngular;
63  }
64 
65  void Init(std::istream & aDataFile, G4ParticleDefinition* projectile);
66 
67  G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass,
68  G4int angularRep, G4int interpol);
69 
71  if( getenv("G4PHPTEST") ) G4cout << this << " G4ParticleHPContAngularPar::GetEnergy " << theEnergy << " nE " << nEnergies << G4endl;
72  return theEnergy; }
73 
74  void SetPrimary(G4ReactionProduct * aPrimary)
75  {
76  thePrimary = aPrimary;
77  }
78 
79  void SetTarget(G4ReactionProduct * aTarget)
80  {
81  theTarget = aTarget;
82  }
83 
84  void SetTargetCode(G4double aTargetCode) { theTargetCode = aTargetCode; }
85 
86  void SetInterpolation(G4int theInterpolation)
87  {
88  theManager.Init(theInterpolation, nEnergies); // one range only
89  }
90 
91  void BuildByInterpolation(G4double anEnergy, G4InterpolationScheme aScheme,
93  G4ParticleHPContAngularPar & store2); // hmmmm, this interpolates legendre coefficients. Dangerous @@@
94 
96 
98  {
99  G4double result;
100  if(currentMeanEnergy<-1)
101  {
102  return 0;
103  // throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPContAngularPar: Logical error in Product class");
104  }
105  else
106  {
107  result = currentMeanEnergy;
108  }
109  currentMeanEnergy = -2;
110  return result;
111  }
112 
114  {
115  return nEnergies;
116  }
118  {
119  return nDiscreteEnergies;
120  }
121  std::set<G4double> GetEnergiesTransformed() const
122  {
123  return theEnergiesTransformed;
124  }
126  {
127  return theEnergiesTransformed.size();
128  }
130  {
131  return theMinEner;
132  }
134  {
135  return theMaxEner;
136  }
137  std::map<G4double,G4int> GetDiscreteEnergiesOwn() const
138  {
139  return theDiscreteEnergiesOwn;
140  }
142  return theAngular;
143  }
144 
145 private:
146 
147  // incoming particle
149 
150  // number of exit channel energies
152  // number of discrete exit channels
154  // number of angular paramerers per channel
156  // knows the interpolation between List labels
158  // on per exit-channel energy
160 
162 
166 
168 
169 //080718
170  public:
171  void ClearHistories(){ fresh = true; };
172 
173  void Dump();
174  private:
176  G4double remaining_energy; // represent energy rest of cascade chain
177 
179 
180  G4bool adjustResult; // if not set it will not force the conservation of energy in angularRep==1, but will sample the particle energy according to the database
181 
184  std::set<G4double> theEnergiesTransformed;
185  std::set<G4double> theDiscreteEnergies;
186  std::map<G4double,G4int> theDiscreteEnergiesOwn;
187 
188 };
189 #endif
std::map< G4double, G4int > GetDiscreteEnergiesOwn() const
void SetTargetCode(G4double aTargetCode)
G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass, G4int angularRep, G4int interpol)
void BuildByInterpolation(G4double anEnergy, G4InterpolationScheme aScheme, G4ParticleHPContAngularPar &store1, G4ParticleHPContAngularPar &store2)
void Init(G4int aScheme, G4int aRange)
void SetInterpolation(G4int theInterpolation)
int G4int
Definition: G4Types.hh:78
std::map< G4double, G4int > theDiscreteEnergiesOwn
std::set< G4double > GetEnergiesTransformed() const
G4GLOB_DLL std::ostream G4cout
void Init(std::istream &aDataFile, G4ParticleDefinition *projectile)
bool G4bool
Definition: G4Types.hh:79
G4ParticleHPList * GetAngDataList() const
void SetPrimary(G4ReactionProduct *aPrimary)
G4InterpolationScheme
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void PrepareTableInterpolation(const G4ParticleHPContAngularPar *angularPrev)
#define DBL_MAX
Definition: templates.hh:83
void SetTarget(G4ReactionProduct *aTarget)