Geant4  10.02.p01
G4ParticleHPArbitaryTab.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 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
29 //
30 #ifndef G4ParticleHPArbitaryTab_h
31 #define G4ParticleHPArbitaryTab_h 1
32 
33 #include <fstream>
34 #include <CLHEP/Units/SystemOfUnits.h>
35 
36 #include "globals.hh"
37 #include "G4ios.hh"
38 #include "Randomize.hh"
39 #include "G4ParticleHPVector.hh"
40 #include "G4VParticleHPEDis.hh"
42 
43 // we will need a List of these .... one per term.
44 
46 {
47  public:
49  {
50  theDistFunc = 0;
51  }
53  {
54  if(theDistFunc!=0) delete [] theDistFunc;
55  }
56 
57  inline void Init(std::istream & theData)
58  {
59  G4int i;
61  theData >> nDistFunc; // = number of incoming n energy points
63  theManager.Init(theData);
64  G4double currentEnergy;
65  for(i=0; i<nDistFunc; i++)
66  {
67  theData >> currentEnergy;
68  theDistFunc[i].SetLabel(currentEnergy*CLHEP::eV);
69  theDistFunc[i].Init(theData, CLHEP::eV);
71  //************************************************************************
72  //EMendoza:
73  //ThinOut() assumes that the data is linear-linear, what is false:
74  //theDistFunc[i].ThinOut(0.02); // @@@ optimization to be finished.
75  //************************************************************************
76  }
77 
78  //************************************************************************
79  //EMendoza:
80  //Here we calculate the thresholds for the 2D sampling:
81  for(i=0; i<nDistFunc; i++){
85  for(G4int j=0;j<np-1;j++){
86  if(theDistFunc[i].GetXsec(j+1)>1.e-20){
88  break;
89  }
90  }
91  for(G4int j=1;j<np;j++){
92  if(theDistFunc[i].GetXsec(j-1)>1.e-20){
94  }
95  }
96  }
97  //************************************************************************
98  }
99 
101  {
102  return theFractionalProb.GetY(anEnergy);
103  }
104 
105  G4double Sample(G4double anEnergy) ;
106 
107  private:
108 
111  G4InterpolationManager theManager; // knows the interpolation between stores
112  G4ParticleHPVector * theDistFunc; // one per incoming energy
114  //************************************************************************
115  //EMendoza:
118  //************************************************************************
119 
120 };
121 
122 #endif
G4double GetEnergy(G4int i) const
void Init(std::istream &theData)
G4double GetFractionalProbability(G4double anEnergy)
G4int GetVectorLength() const
void Init(G4int aScheme, G4int aRange)
int G4int
Definition: G4Types.hh:78
G4ParticleHPVector * theDistFunc
G4double Sample(G4double anEnergy)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
G4ParticleHPVector theFractionalProb
G4double GetY(G4double x)
static const double eV
Definition: G4SIunits.hh:212
double G4double
Definition: G4Types.hh:76
G4InterpolationManager theManager
void SetLabel(G4double aLabel)