#include <G4CompositeDataSet.hh>
Inheritance diagram for G4CompositeDataSet:
Public Member Functions | |
G4CompositeDataSet (G4IInterpolator *argAlgorithm, G4double eUnit=CLHEP::MeV, G4double dataUnit=CLHEP::barn, G4int zMin=1, G4int zMax=99) | |
virtual | ~G4CompositeDataSet () |
virtual G4double | FindValue (G4double x, G4int componentId=0) const |
virtual void | PrintData (void) const |
virtual const G4IDataSet * | GetComponent (G4int componentId) const |
virtual void | AddComponent (G4IDataSet *dataSet) |
virtual size_t | NumberOfComponents () const |
virtual const G4DataVector & | GetEnergies (G4int componentId) const |
virtual const G4DataVector & | GetData (G4int componentId) const |
virtual void | SetEnergiesData (G4DataVector *x, G4DataVector *data, G4int componentId) |
virtual G4bool | LoadData (const G4String &fileName) |
virtual G4bool | SaveData (const G4String &fileName) const |
virtual G4double | RandomSelect (G4int componentId) const |
Definition at line 55 of file G4CompositeDataSet.hh.
G4CompositeDataSet::G4CompositeDataSet | ( | G4IInterpolator * | argAlgorithm, | |
G4double | eUnit = CLHEP::MeV , |
|||
G4double | dataUnit = CLHEP::barn , |
|||
G4int | zMin = 1 , |
|||
G4int | zMax = 99 | |||
) |
Definition at line 45 of file G4CompositeDataSet.cc.
References FatalException, G4CompositeDataSet(), and G4Exception().
Referenced by G4CompositeDataSet().
00050 : 00051 algorithm(algo), 00052 unitEnergies(eUnit), 00053 unitData(dataUnit), 00054 minZ(zMin), 00055 maxZ(zMax) 00056 { 00057 if (algorithm == 0) 00058 G4Exception("G4CompositeDataSet::G4CompositeDataSet", 00059 "pii00000001", 00060 FatalException, 00061 "Interpolation == 0"); 00062 }
G4CompositeDataSet::~G4CompositeDataSet | ( | ) | [virtual] |
virtual void G4CompositeDataSet::AddComponent | ( | G4IDataSet * | dataSet | ) | [inline, virtual] |
Implements G4IDataSet.
Definition at line 73 of file G4CompositeDataSet.hh.
Referenced by LoadData().
Implements G4IDataSet.
Definition at line 73 of file G4CompositeDataSet.cc.
References FatalException, G4IDataSet::FindValue(), G4Exception(), and GetComponent().
00074 { 00075 const G4IDataSet* component(GetComponent(componentId)); 00076 00077 if (component) return component->FindValue(energy); 00078 00079 std::ostringstream message; 00080 message << "G4CompositeDataSet::FindValue - component " << componentId << " not found"; 00081 00082 G4Exception("G4CompositeDataSet::FindValue", 00083 "pii00000010", 00084 FatalException, 00085 message.str().c_str()); 00086 00087 return 0.; 00088 }
virtual const G4IDataSet* G4CompositeDataSet::GetComponent | ( | G4int | componentId | ) | const [inline, virtual] |
Implements G4IDataSet.
Definition at line 70 of file G4CompositeDataSet.hh.
Referenced by FindValue(), GetData(), GetEnergies(), PrintData(), RandomSelect(), and SaveData().
virtual const G4DataVector& G4CompositeDataSet::GetData | ( | G4int | componentId | ) | const [inline, virtual] |
Implements G4IDataSet.
Definition at line 82 of file G4CompositeDataSet.hh.
References GetComponent(), and G4IDataSet::GetData().
00083 { return GetComponent(componentId)->GetData(0); }
virtual const G4DataVector& G4CompositeDataSet::GetEnergies | ( | G4int | componentId | ) | const [inline, virtual] |
Implements G4IDataSet.
Definition at line 79 of file G4CompositeDataSet.hh.
References GetComponent(), and G4IDataSet::GetEnergies().
00080 { return GetComponent(componentId)->GetEnergies(0); }
Implements G4IDataSet.
Definition at line 127 of file G4CompositeDataSet.cc.
References AddComponent(), and G4IInterpolator::Clone().
00128 { 00129 CleanUpComponents(); 00130 00131 for (G4int z(minZ); z<maxZ; z++) 00132 { 00133 G4IDataSet* component = new G4DataSet(z, algorithm->Clone(), unitEnergies, unitData); 00134 if (!component->LoadData(argFileName)) 00135 { 00136 delete component; 00137 return false; 00138 } 00139 AddComponent(component); 00140 } 00141 return true; 00142 }
virtual size_t G4CompositeDataSet::NumberOfComponents | ( | void | ) | const [inline, virtual] |
Implements G4IDataSet.
Definition at line 76 of file G4CompositeDataSet.hh.
Referenced by PrintData().
void G4CompositeDataSet::PrintData | ( | void | ) | const [virtual] |
Implements G4IDataSet.
Definition at line 90 of file G4CompositeDataSet.cc.
References G4cout, G4endl, GetComponent(), CLHEP::detail::n, NumberOfComponents(), and G4IDataSet::PrintData().
00091 { 00092 const size_t n(NumberOfComponents()); 00093 00094 G4cout << "The data set has " << n << " components" << G4endl; 00095 G4cout << G4endl; 00096 00097 size_t i(0); 00098 00099 while (i<n) 00100 { 00101 G4cout << "--- Component " << i << " ---" << G4endl; 00102 GetComponent(i)->PrintData(); 00103 i++; 00104 } 00105 }
Implements G4IDataSet.
Definition at line 180 of file G4CompositeDataSet.cc.
References GetComponent(), and G4IDataSet::RandomSelect().
00181 { 00182 G4double value = 0.; 00183 if (componentId >= 0 && componentId < (G4int)components.size()) 00184 { 00185 const G4IDataSet* dataSet = GetComponent(componentId); 00186 value = dataSet->RandomSelect(); 00187 } 00188 return value; 00189 }
Implements G4IDataSet.
Definition at line 146 of file G4CompositeDataSet.cc.
References FatalException, G4Exception(), and GetComponent().
00147 { 00148 for (G4int z=minZ; z<maxZ; z++) 00149 { 00150 const G4IDataSet* component(GetComponent(z-minZ)); 00151 00152 if (!component) 00153 { 00154 std::ostringstream message; 00155 message << "G4CompositeDataSet::SaveData - component " << (z-minZ) << " not found"; 00156 G4Exception("G4CompositeDataSet::SaveData", 00157 "pii00000030", 00158 FatalException, 00159 message.str().c_str()); 00160 } 00161 00162 if (!component->SaveData(argFileName)) 00163 return false; 00164 } 00165 00166 return true; 00167 }
void G4CompositeDataSet::SetEnergiesData | ( | G4DataVector * | x, | |
G4DataVector * | data, | |||
G4int | componentId | |||
) | [virtual] |
Implements G4IDataSet.
Definition at line 107 of file G4CompositeDataSet.cc.
References FatalException, G4Exception(), and G4IDataSet::SetEnergiesData().
00108 { 00109 G4IDataSet * component(components[componentId]); 00110 00111 if (component) 00112 { 00113 component->SetEnergiesData(energies, data, 0); 00114 return; 00115 } 00116 00117 std::ostringstream message; 00118 message << "G4CompositeDataSet::SetEnergiesData - component " << componentId << " not found"; 00119 00120 G4Exception("G4CompositeDataSet::SetEnergiesData", 00121 "pii00000020", 00122 FatalException, 00123 message.str().c_str()); 00124 00125 }