Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EMDataSet.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 // $Id: G4EMDataSet.hh 66241 2012-12-13 18:34:42Z gunter $
28 //
29 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
30 //
31 // History:
32 // -----------
33 // 31 Jul 2001 MGP Created
34 //
35 // 15 Jul 2009 N.A.Karakatsanis New methods added for loading logarithmic data
36 // to enhance computing performance of interpolation
37 //
38 // -------------------------------------------------------------------
39 
40 // Class description:
41 // Low Energy Electromagnetic Physics
42 // Data set for an electromagnetic physics process
43 // A strategy pattern is used to encapsulate algorithms for data interpolation
44 // Further documentation available from http://www.ge.infn.it/geant4/lowE
45 
46 // -------------------------------------------------------------------
47 
48 #ifndef G4EMDATASET_HH
49 #define G4EMDATASET_HH 1
50 
52 
53 #include "globals.hh"
54 #include "G4VEMDataSet.hh"
55 
57 
58 class G4EMDataSet : public G4VEMDataSet
59 {
60 public:
61  G4EMDataSet(G4int argZ,
62  G4VDataSetAlgorithm* algo,
63  G4double xUnit=CLHEP::MeV,
64  G4double yUnit=CLHEP::barn,
65  G4bool random=false);
66 
67  G4EMDataSet(G4int argZ,
68  G4DataVector* xData,
70  G4VDataSetAlgorithm* algo,
71  G4double xUnit=CLHEP::MeV,
72  G4double yUnit=CLHEP::barn,
73  G4bool random=false);
74 
75  G4EMDataSet(G4int argZ,
76  G4DataVector* xData,
77  G4DataVector* data,
78  G4DataVector* xLogData,
79  G4DataVector* Logdata,
80  G4VDataSetAlgorithm* algo,
81  G4double xUnit=CLHEP::MeV,
82  G4double yUnit=CLHEP::barn,
83  G4bool random=false);
84 
85  virtual ~G4EMDataSet();
86 
87  virtual G4double FindValue(G4double x, G4int componentId=0) const;
88 
89  virtual void PrintData(void) const;
90 
91  virtual const G4VEMDataSet* GetComponent(G4int /* componentId */) const { return 0; }
92 
93  virtual void AddComponent(G4VEMDataSet* /* dataSet */) {}
94 
95  virtual size_t NumberOfComponents(void) const { return 0; }
96 
97  virtual const G4DataVector& GetEnergies(G4int /* componentId */) const { return *energies; }
98  virtual const G4DataVector& GetData(G4int /* componentId */) const { return *data; }
99  virtual const G4DataVector& GetLogEnergies(G4int /* componentId */) const { return *log_energies; }
100  virtual const G4DataVector& GetLogData(G4int /* componentId */) const { return *log_data; }
101 
102  virtual void SetEnergiesData(G4DataVector* xData, G4DataVector* data, G4int componentId);
103  virtual void SetLogEnergiesData(G4DataVector* xData,
104  G4DataVector* data,
105  G4DataVector* xLogData,
106  G4DataVector* Logdata,
107  G4int componentId);
108 
109 
110  virtual G4bool LoadData(const G4String& fileName);
111  virtual G4bool LoadNonLogData(const G4String& fileName);
112 
113  virtual G4bool SaveData(const G4String& fileName) const;
114 
115  virtual G4double RandomSelect(G4int componentId = 0) const;
116 
117 
118 private:
119 
120  size_t FindLowerBound(G4double energy) const;
121  size_t FindLowerBound(G4double x, G4DataVector* values) const;
122 
123  G4double IntegrationFunction(G4double x);
124 
125  virtual void BuildPdf();
126 
127  G4String FullFileName(const G4String& fileName) const;
128 
129  // Hide copy constructor and assignment operator
130  G4EMDataSet();
131  G4EMDataSet(const G4EMDataSet& copy);
132  G4EMDataSet& operator=(const G4EMDataSet& right);
133 
134  G4int z;
135 
136  G4DataVector* energies; // Owned pointer
137  G4DataVector* data; // Owned pointer
138  G4DataVector* log_energies; // Owned pointer
139  G4DataVector* log_data; // Owned pointer
140 
141  G4VDataSetAlgorithm* algorithm; // Owned pointer
142 
143  G4double unitEnergies;
144  G4double unitData;
145 
146  G4DataVector* pdf;
147  G4bool randomSet;
148 };
149 #endif /* G4EMDATASET_HH */
virtual void SetEnergiesData(G4DataVector *xData, G4DataVector *data, G4int componentId)
Definition: G4EMDataSet.cc:190
tuple x
Definition: test.py:50
int G4int
Definition: G4Types.hh:78
virtual ~G4EMDataSet()
Definition: G4EMDataSet.cc:150
virtual const G4DataVector & GetLogData(G4int) const
Definition: G4EMDataSet.hh:100
const XML_Char const XML_Char * data
Definition: expat.h:268
virtual void AddComponent(G4VEMDataSet *)
Definition: G4EMDataSet.hh:93
virtual const G4VEMDataSet * GetComponent(G4int) const
Definition: G4EMDataSet.hh:91
static constexpr double barn
Definition: SystemOfUnits.h:85
bool G4bool
Definition: G4Types.hh:79
static constexpr double MeV
virtual G4double FindValue(G4double x, G4int componentId=0) const
Definition: G4EMDataSet.cc:160
virtual G4bool SaveData(const G4String &fileName) const
Definition: G4EMDataSet.cc:360
virtual void PrintData(void) const
Definition: G4EMDataSet.cc:178
virtual size_t NumberOfComponents(void) const
Definition: G4EMDataSet.hh:95
virtual G4bool LoadData(const G4String &fileName)
Definition: G4EMDataSet.cc:248
G4double energy(const ThreeVector &p, const G4double m)
virtual G4double RandomSelect(G4int componentId=0) const
Definition: G4EMDataSet.cc:511
virtual const G4DataVector & GetData(G4int) const
Definition: G4EMDataSet.hh:98
virtual const G4DataVector & GetEnergies(G4int) const
Definition: G4EMDataSet.hh:97
virtual const G4DataVector & GetLogEnergies(G4int) const
Definition: G4EMDataSet.hh:99
double G4double
Definition: G4Types.hh:76
virtual void SetLogEnergiesData(G4DataVector *xData, G4DataVector *data, G4DataVector *xLogData, G4DataVector *Logdata, G4int componentId)
Definition: G4EMDataSet.cc:214
virtual G4bool LoadNonLogData(const G4String &fileName)
Definition: G4EMDataSet.cc:306