ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ParticleHPArbitaryTab.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ParticleHPArbitaryTab.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 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
29 //
30 #ifndef G4ParticleHPArbitaryTab_h
31 #define G4ParticleHPArbitaryTab_h 1
32 
33 #include <fstream>
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  nDistFunc = 0;
52  }
54  {
55  if(theDistFunc!=0) delete [] theDistFunc;
56  }
57 
58  inline void Init(std::istream & theData)
59  {
60  G4int i;
62  theData >> nDistFunc; // = number of incoming n energy points
64  theManager.Init(theData);
65  G4double currentEnergy;
66  for(i=0; i<nDistFunc; i++)
67  {
68  theData >> currentEnergy;
69  theDistFunc[i].SetLabel(currentEnergy*CLHEP::eV);
70  theDistFunc[i].Init(theData, CLHEP::eV);
72  //************************************************************************
73  //EMendoza:
74  //ThinOut() assumes that the data is linear-linear, what is false:
75  //theDistFunc[i].ThinOut(0.02); // @@@ optimization to be finished.
76  //************************************************************************
77  }
78 
79  //************************************************************************
80  //EMendoza:
81  //Here we calculate the thresholds for the 2D sampling:
82  for(i=0; i<nDistFunc; i++){
86  for(G4int j=0;j<np-1;j++){
87  if(theDistFunc[i].GetXsec(j+1)>1.e-20){
89  break;
90  }
91  }
92  for(G4int j=1;j<np;j++){
93  if(theDistFunc[i].GetXsec(j-1)>1.e-20){
95  }
96  }
97  }
98  //************************************************************************
99  }
100 
102  {
103  return theFractionalProb.GetY(anEnergy);
104  }
105 
106  G4double Sample(G4double anEnergy) ;
107 
108  private:
109 
112  G4InterpolationManager theManager; // knows the interpolation between stores
113  G4ParticleHPVector * theDistFunc; // one per incoming energy
115  //************************************************************************
116  //EMendoza:
119  //************************************************************************
120 
121 };
122 
123 #endif