Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CompositeEMDataSet Class Reference

#include <G4CompositeEMDataSet.hh>

+ Inheritance diagram for G4CompositeEMDataSet:

Public Member Functions

 G4CompositeEMDataSet (G4VDataSetAlgorithm *argAlgorithm, G4double eUnit=CLHEP::MeV, G4double dataUnit=CLHEP::barn, G4int zMin=1, G4int zMax=99)
 
virtual ~G4CompositeEMDataSet ()
 
virtual G4double FindValue (G4double x, G4int componentId=0) const
 
virtual void PrintData (void) const
 
virtual const G4VEMDataSetGetComponent (G4int componentId) const
 
virtual void AddComponent (G4VEMDataSet *dataSet)
 
virtual size_t NumberOfComponents () const
 
virtual const G4DataVectorGetEnergies (G4int componentId) const
 
virtual const G4DataVectorGetData (G4int componentId) const
 
virtual const G4DataVectorGetLogEnergies (G4int componentId) const
 
virtual const G4DataVectorGetLogData (G4int componentId) const
 
virtual void SetEnergiesData (G4DataVector *x, G4DataVector *data, G4int componentId)
 
virtual void SetLogEnergiesData (G4DataVector *xData, G4DataVector *data, G4DataVector *xLogData, G4DataVector *Logdata, G4int componentId)
 
virtual G4bool LoadData (const G4String &fileName)
 
virtual G4bool LoadNonLogData (const G4String &fileName)
 
virtual G4bool SaveData (const G4String &fileName) const
 
virtual G4double RandomSelect (G4int componentId) const
 
- Public Member Functions inherited from G4VEMDataSet
 G4VEMDataSet ()
 
virtual ~G4VEMDataSet ()
 
virtual G4double FindValue (G4double x, G4int componentId=0) const =0
 
virtual void PrintData (void) const =0
 
virtual const G4VEMDataSetGetComponent (G4int componentId) const =0
 
virtual void AddComponent (G4VEMDataSet *dataSet)=0
 
virtual size_t NumberOfComponents (void) const =0
 
virtual const G4DataVectorGetEnergies (G4int componentId) const =0
 
virtual const G4DataVectorGetData (G4int componentId) const =0
 
virtual const G4DataVectorGetLogEnergies (G4int componentId) const =0
 
virtual const G4DataVectorGetLogData (G4int componentId) const =0
 
virtual void SetEnergiesData (G4DataVector *x, G4DataVector *data, G4int component=0)=0
 
virtual void SetLogEnergiesData (G4DataVector *x, G4DataVector *data, G4DataVector *Log_x, G4DataVector *Log_data, G4int component=0)=0
 
virtual G4bool LoadData (const G4String &fileName)=0
 
virtual G4bool LoadNonLogData (const G4String &fileName)=0
 
virtual G4bool SaveData (const G4String &fileName) const =0
 
virtual G4double RandomSelect (G4int componentId=0) const =0
 

Detailed Description

Definition at line 59 of file G4CompositeEMDataSet.hh.

Constructor & Destructor Documentation

◆ G4CompositeEMDataSet()

G4CompositeEMDataSet::G4CompositeEMDataSet ( G4VDataSetAlgorithm argAlgorithm,
G4double  eUnit = CLHEP::MeV,
G4double  dataUnit = CLHEP::barn,
G4int  zMin = 1,
G4int  zMax = 99 
)

Definition at line 57 of file G4CompositeEMDataSet.cc.

62 :
63 algorithm(argAlgorithm),
64 unitEnergies(argUnitEnergies),
65 unitData(argUnitData),
66 minZ(argMinZ),
67 maxZ(argMaxZ)
68{
69 if (algorithm == 0)
70 G4Exception("G4CompositeEMDataSet::G4CompositeEMDataSet",
71 "em1003",FatalException,"interpolation == 0");
72
73}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Referenced by G4CompositeEMDataSet().

◆ ~G4CompositeEMDataSet()

G4CompositeEMDataSet::~G4CompositeEMDataSet ( )
virtual

Definition at line 77 of file G4CompositeEMDataSet.cc.

78{
79 CleanUpComponents();
80 if (algorithm) delete algorithm;
81}

Member Function Documentation

◆ AddComponent()

virtual void G4CompositeEMDataSet::AddComponent ( G4VEMDataSet dataSet)
inlinevirtual

Implements G4VEMDataSet.

Definition at line 75 of file G4CompositeEMDataSet.hh.

75{ components.push_back(dataSet); }

Referenced by LoadData(), and LoadNonLogData().

◆ FindValue()

G4double G4CompositeEMDataSet::FindValue ( G4double  x,
G4int  componentId = 0 
) const
virtual

Implements G4VEMDataSet.

Definition at line 84 of file G4CompositeEMDataSet.cc.

85{
86 const G4VEMDataSet* component(GetComponent(argComponentId));
87
88 if (component) return component->FindValue(argEnergy);
89
90 std::ostringstream message;
91 message << "G4CompositeEMDataSet::FindValue - component " << argComponentId << " not found";
92
93 G4Exception("G4CompositeEMDataSet::FindValue",
94 "em1004",FatalException,message.str().c_str());
95
96 return 0.;
97}
virtual const G4VEMDataSet * GetComponent(G4int componentId) const

◆ GetComponent()

virtual const G4VEMDataSet * G4CompositeEMDataSet::GetComponent ( G4int  componentId) const
inlinevirtual

Implements G4VEMDataSet.

Definition at line 74 of file G4CompositeEMDataSet.hh.

74{ return components[componentId]; }

Referenced by FindValue(), GetData(), GetEnergies(), GetLogData(), GetLogEnergies(), PrintData(), RandomSelect(), and SaveData().

◆ GetData()

virtual const G4DataVector & G4CompositeEMDataSet::GetData ( G4int  componentId) const
inlinevirtual

Implements G4VEMDataSet.

Definition at line 79 of file G4CompositeEMDataSet.hh.

79{ return GetComponent(componentId)->GetData(0); }
virtual const G4DataVector & GetData(G4int componentId) const =0

◆ GetEnergies()

virtual const G4DataVector & G4CompositeEMDataSet::GetEnergies ( G4int  componentId) const
inlinevirtual

Implements G4VEMDataSet.

Definition at line 78 of file G4CompositeEMDataSet.hh.

78{ return GetComponent(componentId)->GetEnergies(0); }
virtual const G4DataVector & GetEnergies(G4int componentId) const =0

◆ GetLogData()

virtual const G4DataVector & G4CompositeEMDataSet::GetLogData ( G4int  componentId) const
inlinevirtual

Implements G4VEMDataSet.

Definition at line 81 of file G4CompositeEMDataSet.hh.

81{ return GetComponent(componentId)->GetLogData(0); }
virtual const G4DataVector & GetLogData(G4int componentId) const =0

◆ GetLogEnergies()

virtual const G4DataVector & G4CompositeEMDataSet::GetLogEnergies ( G4int  componentId) const
inlinevirtual

Implements G4VEMDataSet.

Definition at line 80 of file G4CompositeEMDataSet.hh.

80{ return GetComponent(componentId)->GetLogEnergies(0); }
virtual const G4DataVector & GetLogEnergies(G4int componentId) const =0

◆ LoadData()

G4bool G4CompositeEMDataSet::LoadData ( const G4String fileName)
virtual

Implements G4VEMDataSet.

Definition at line 155 of file G4CompositeEMDataSet.cc.

156{
157 CleanUpComponents();
158
159 for (G4int z(minZ); z<maxZ; z++)
160 {
161 G4VEMDataSet* component = new G4EMDataSet(z, algorithm->Clone(), unitEnergies, unitData);
162 if (!component->LoadData(argFileName))
163 {
164 delete component;
165 return false;
166 }
167 AddComponent(component);
168 }
169 return true;
170}
int G4int
Definition: G4Types.hh:66
virtual void AddComponent(G4VEMDataSet *dataSet)
virtual G4VDataSetAlgorithm * Clone() const =0
virtual G4bool LoadData(const G4String &fileName)=0

◆ LoadNonLogData()

G4bool G4CompositeEMDataSet::LoadNonLogData ( const G4String fileName)
virtual

Implements G4VEMDataSet.

Definition at line 173 of file G4CompositeEMDataSet.cc.

174{
175 CleanUpComponents();
176
177 for (G4int z(minZ); z<maxZ; z++)
178 {
179 G4VEMDataSet* component = new G4EMDataSet(z, algorithm->Clone(), unitEnergies, unitData);
180 if (!component->LoadNonLogData(argFileName))
181 {
182 delete component;
183 return false;
184 }
185 AddComponent(component);
186 }
187 return true;
188}
virtual G4bool LoadNonLogData(const G4String &fileName)=0

◆ NumberOfComponents()

virtual size_t G4CompositeEMDataSet::NumberOfComponents ( void  ) const
inlinevirtual

Implements G4VEMDataSet.

Definition at line 76 of file G4CompositeEMDataSet.hh.

76{ return components.size(); }

Referenced by PrintData().

◆ PrintData()

void G4CompositeEMDataSet::PrintData ( void  ) const
virtual

Implements G4VEMDataSet.

Definition at line 99 of file G4CompositeEMDataSet.cc.

100{
101 const size_t n(NumberOfComponents());
102
103 G4cout << "The data set has " << n << " components" << G4endl;
104 G4cout << G4endl;
105
106 size_t i(0);
107
108 while (i<n)
109 {
110 G4cout << "--- Component " << i << " ---" << G4endl;
112 i++;
113 }
114}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
virtual size_t NumberOfComponents() const
virtual void PrintData(void) const =0

◆ RandomSelect()

G4double G4CompositeEMDataSet::RandomSelect ( G4int  componentId) const
virtual

Implements G4VEMDataSet.

Definition at line 224 of file G4CompositeEMDataSet.cc.

225{
226 G4double value = 0.;
227 if (componentId >= 0 && componentId < (G4int)components.size())
228 {
229 const G4VEMDataSet* dataSet = GetComponent(componentId);
230 value = dataSet->RandomSelect();
231 }
232 return value;
233}
double G4double
Definition: G4Types.hh:64
virtual G4double RandomSelect(G4int componentId=0) const =0

◆ SaveData()

G4bool G4CompositeEMDataSet::SaveData ( const G4String fileName) const
virtual

Implements G4VEMDataSet.

Definition at line 191 of file G4CompositeEMDataSet.cc.

192{
193 for (G4int z=minZ; z<maxZ; z++)
194 {
195 const G4VEMDataSet* component(GetComponent(z-minZ));
196
197 if (!component)
198 {
199 std::ostringstream message;
200 message << "G4CompositeEMDataSet::SaveData - component " << (z-minZ) << " not found";
201 G4Exception("G4CompositeEMDataSet::SaveData",
202 "em1004",FatalException,message.str().c_str());
203 return false;
204 }
205
206 if (!component->SaveData(argFileName))
207 return false;
208 }
209
210 return true;
211}

◆ SetEnergiesData()

void G4CompositeEMDataSet::SetEnergiesData ( G4DataVector x,
G4DataVector data,
G4int  componentId 
)
virtual

Implements G4VEMDataSet.

Definition at line 116 of file G4CompositeEMDataSet.cc.

117{
118 G4VEMDataSet * component(components[argComponentId]);
119
120 if (component)
121 {
122 component->SetEnergiesData(argEnergies, argData, 0);
123 return;
124 }
125
126 std::ostringstream message;
127 message << "G4CompositeEMDataSet::SetEnergiesData - component " << argComponentId << " not found";
128
129 G4Exception("G4CompositeEMDataSet::SetEnergiesData",
130 "em1004",FatalException,message.str().c_str());
131}

◆ SetLogEnergiesData()

void G4CompositeEMDataSet::SetLogEnergiesData ( G4DataVector xData,
G4DataVector data,
G4DataVector xLogData,
G4DataVector Logdata,
G4int  componentId 
)
virtual

Implements G4VEMDataSet.

Definition at line 133 of file G4CompositeEMDataSet.cc.

138{
139 G4VEMDataSet * component(components[argComponentId]);
140
141 if (component)
142 {
143 component->SetLogEnergiesData(argEnergies, argData, argLogEnergies, argLogData, 0);
144 return;
145 }
146
147 std::ostringstream message;
148 message << "G4CompositeEMDataSet::SetEnergiesData - component " << argComponentId << " not found";
149
150 G4Exception("G4CompositeEMDataSet::SetLogEnergiesData",
151 "em1004",FatalException,message.str().c_str());
152}

The documentation for this class was generated from the following files: