Geant4 11.2.2
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 ()
 
 G4VEMDataSet (const G4VEMDataSet &copy)=delete
 
G4VEMDataSetoperator= (const G4VEMDataSet &right)=delete
 

Detailed Description

Definition at line 57 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 )
explicit

Definition at line 58 of file G4CompositeEMDataSet.cc.

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

Referenced by G4CompositeEMDataSet().

◆ ~G4CompositeEMDataSet()

G4CompositeEMDataSet::~G4CompositeEMDataSet ( )
virtual

Definition at line 78 of file G4CompositeEMDataSet.cc.

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

Member Function Documentation

◆ AddComponent()

virtual void G4CompositeEMDataSet::AddComponent ( G4VEMDataSet * dataSet)
inlinevirtual

Implements G4VEMDataSet.

Definition at line 73 of file G4CompositeEMDataSet.hh.

73{ 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 85 of file G4CompositeEMDataSet.cc.

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

Referenced by G4LivermorePolarizedComptonModel::SampleSecondaries().

◆ GetComponent()

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

Implements G4VEMDataSet.

Definition at line 72 of file G4CompositeEMDataSet.hh.

72{ 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 77 of file G4CompositeEMDataSet.hh.

77{ 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 76 of file G4CompositeEMDataSet.hh.

76{ 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 79 of file G4CompositeEMDataSet.hh.

79{ 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 78 of file G4CompositeEMDataSet.hh.

78{ 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 163 of file G4CompositeEMDataSet.cc.

164{
165 CleanUpComponents();
166
167 for (G4int z(minZ); z<maxZ; ++z)
168 {
169 G4VEMDataSet* component = new G4EMDataSet(z, algorithm->Clone(), unitEnergies, unitData);
170 if (!component->LoadData(argFileName))
171 {
172 delete component;
173 return false;
174 }
175 AddComponent(component);
176 }
177 return true;
178}
int G4int
Definition G4Types.hh:85
virtual void AddComponent(G4VEMDataSet *dataSet)
virtual G4VDataSetAlgorithm * Clone() const =0
virtual G4bool LoadData(const G4String &fileName)=0

Referenced by G4LivermorePolarizedComptonModel::Initialise().

◆ LoadNonLogData()

G4bool G4CompositeEMDataSet::LoadNonLogData ( const G4String & fileName)
virtual

Implements G4VEMDataSet.

Definition at line 182 of file G4CompositeEMDataSet.cc.

183{
184 CleanUpComponents();
185
186 for (G4int z(minZ); z<maxZ; ++z)
187 {
188 G4VEMDataSet* component = new G4EMDataSet(z, algorithm->Clone(), unitEnergies, unitData);
189 if (!component->LoadNonLogData(argFileName))
190 {
191 delete component;
192 return false;
193 }
194 AddComponent(component);
195 }
196 return true;
197}
virtual G4bool LoadNonLogData(const G4String &fileName)=0

◆ NumberOfComponents()

virtual size_t G4CompositeEMDataSet::NumberOfComponents ( void ) const
inlinevirtual

Implements G4VEMDataSet.

Definition at line 74 of file G4CompositeEMDataSet.hh.

74{ return components.size(); }

Referenced by PrintData().

◆ PrintData()

void G4CompositeEMDataSet::PrintData ( void ) const
virtual

Implements G4VEMDataSet.

Definition at line 102 of file G4CompositeEMDataSet.cc.

103{
104 const G4int n = (G4int)NumberOfComponents();
105
106 G4cout << "The data set has " << n << " components" << G4endl;
107 G4cout << G4endl;
108
109 G4int i(0);
110
111 while (i<n)
112 {
113 G4cout << "--- Component " << i << " ---" << G4endl;
115 ++i;
116 }
117}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL 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 237 of file G4CompositeEMDataSet.cc.

238{
239 G4double value = 0.;
240 if (componentId >= 0 && componentId < (G4int)components.size())
241 {
242 const G4VEMDataSet* dataSet = GetComponent(componentId);
243 value = dataSet->RandomSelect();
244 }
245 return value;
246}
double G4double
Definition G4Types.hh:83
virtual G4double RandomSelect(G4int componentId=0) const =0

◆ SaveData()

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

Implements G4VEMDataSet.

Definition at line 201 of file G4CompositeEMDataSet.cc.

202{
203 for (G4int z=minZ; z<maxZ; ++z)
204 {
205 const G4VEMDataSet* component(GetComponent(z-minZ));
206
207 if (!component)
208 {
209 std::ostringstream message;
210 message << "G4CompositeEMDataSet::SaveData - component " << (z-minZ) << " not found";
211 G4Exception("G4CompositeEMDataSet::SaveData",
212 "em1004",FatalException,message.str().c_str());
213 return false;
214 }
215
216 if (!component->SaveData(argFileName))
217 return false;
218 }
219
220 return true;
221}

◆ SetEnergiesData()

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

Implements G4VEMDataSet.

Definition at line 121 of file G4CompositeEMDataSet.cc.

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

◆ SetLogEnergiesData()

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

Implements G4VEMDataSet.

Definition at line 140 of file G4CompositeEMDataSet.cc.

145{
146 G4VEMDataSet * component(components[argComponentId]);
147
148 if (component)
149 {
150 component->SetLogEnergiesData(argEnergies, argData, argLogEnergies, argLogData, 0);
151 return;
152 }
153
154 std::ostringstream message;
155 message << "G4CompositeEMDataSet::SetEnergiesData - component " << argComponentId << " not found";
156
157 G4Exception("G4CompositeEMDataSet::SetLogEnergiesData",
158 "em1004",FatalException,message.str().c_str());
159}

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