Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4ParticleHPContAngularPar.hh
이 파일의 문서화 페이지로 가기
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 "G4Cache.hh"
43 #include <set>
45 
47 {
48 
49  struct toBeCached {
57  };
58 
59  public:
60 
62  {
63  theAngular = 0;
64  //currentMeanEnergy = -2;
65  //fresh = true;
66  fCache.Put(NULL);
69  theEnergy = -1;
70  nEnergies = -1;
71  nDiscreteEnergies = -1;
72  nAngularParameters = -1;
73  theProjectile = NULL;
74  adjustResult = true;
75  }
76 
78 
80  {
81  if(theAngular!=0) delete [] theAngular;
82  }
83 
84  void Init(std::istream & aDataFile, G4ParticleDefinition* projectile);
85 
86  G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass,
87  G4int angularRep, G4int interpol);
88 
90  if( getenv("G4PHPTEST") ) G4cout << this << " G4ParticleHPContAngularPar::GetEnergy " << theEnergy << " nE " << nEnergies << G4endl;
91  return theEnergy; }
92 
93  void SetPrimary(G4ReactionProduct * aPrimary)
94  {
95  fCache.Get()->thePrimary = aPrimary;
96  }
97 
98  void SetTarget(G4ReactionProduct * aTarget)
99  {
100  fCache.Get()->theTarget = aTarget;
101  }
102 
103  void SetTargetCode(G4double aTargetCode) { fCache.Get()->theTargetCode = aTargetCode; }
104 
105  void SetInterpolation(G4int theInterpolation)
106  {
107  theManager.Init(theInterpolation, nEnergies); // one range only
108  }
109 
110  void BuildByInterpolation(G4double anEnergy, G4InterpolationScheme aScheme,
111  G4ParticleHPContAngularPar & store1,
112  G4ParticleHPContAngularPar & store2); // hmmmm, this interpolates legendre coefficients. Dangerous @@@
113 
114  void PrepareTableInterpolation(const G4ParticleHPContAngularPar* angularPrev);
115 
117  {
119  if(fCache.Get()->currentMeanEnergy<-1)
120  {
121  return 0;
122  // throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPContAngularPar: Logical error in Product class");
123  }
124  else
125  {
126  result = fCache.Get()->currentMeanEnergy;
127  }
128  fCache.Get()->currentMeanEnergy = -2;
129  return result;
130  }
131 
133  {
134  return nEnergies;
135  }
137  {
138  return nDiscreteEnergies;
139  }
140  std::set<G4double> GetEnergiesTransformed() const
141  {
142  return theEnergiesTransformed;
143  }
145  {
146  return theEnergiesTransformed.size();
147  }
149  {
150  return theMinEner;
151  }
153  {
154  return theMaxEner;
155  }
156  std::map<G4double,G4int> GetDiscreteEnergiesOwn() const
157  {
158  return theDiscreteEnergiesOwn;
159  }
161  return theAngular;
162  }
163 
164 private:
165 
166  // incoming particle
168 
169  // number of exit channel energies
171  // number of discrete exit channels
173  // number of angular paramerers per channel
175  // knows the interpolation between List labels
177  // on per exit-channel energy
179 
181 
182  //G4double theTargetCode;
183  //G4ReactionProduct * theTarget;
184  //G4ReactionProduct * thePrimary;
185 
186  //G4double currentMeanEnergy;
187 
188 //080718
189  public:
190  //void ClearHistories(){ fresh = true; };
191  void ClearHistories(){
192  if ( fCache.Get() == NULL ) cacheInit();
193  fCache.Get()->fresh = true; };
194 
195  void Dump();
196  private:
198  void cacheInit() {
199  toBeCached* val = new toBeCached;
200  val->currentMeanEnergy = -2;
201  val->remaining_energy = 0;
202  val->fresh=true;
203  fCache.Put( val );
204  };
205  /*G4bool fresh;*/
206  /*G4double remaining_energy;*/ // represent energy rest of cascade chain
207 
209 
210  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
211 
214  std::set<G4double> theEnergiesTransformed;
215  std::set<G4double> theDiscreteEnergies;
216  std::map<G4double,G4int> theDiscreteEnergiesOwn;
217 
218 };
219 #endif
G4InterpolationScheme
std::map< G4double, G4int > theDiscreteEnergiesOwn
G4ParticleHPList * GetAngDataList() const
#define G4endl
Definition: G4ios.hh:61
void SetInterpolation(G4int theInterpolation)
void SetTargetCode(G4double aTargetCode)
G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass, G4int angularRep, G4int interpol)
void Init(std::istream &aDataFile, G4ParticleDefinition *projectile)
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
void SetTarget(G4ReactionProduct *aTarget)
void SetPrimary(G4ReactionProduct *aPrimary)
void Init(G4int aScheme, G4int aRange)
void BuildByInterpolation(G4double anEnergy, G4InterpolationScheme aScheme, G4ParticleHPContAngularPar &store1, G4ParticleHPContAngularPar &store2)
G4double G4ParticleHPJENDLHEData::G4double result
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void PrepareTableInterpolation(const G4ParticleHPContAngularPar *angularPrev)
std::set< G4double > GetEnergiesTransformed() const
#define DBL_MAX
Definition: templates.hh:83
std::map< G4double, G4int > GetDiscreteEnergiesOwn() const