Geant4 10.7.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 58 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 56 of file G4CompositeEMDataSet.cc.

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

Referenced by G4CompositeEMDataSet().

◆ ~G4CompositeEMDataSet()

G4CompositeEMDataSet::~G4CompositeEMDataSet ( )
virtual

Definition at line 76 of file G4CompositeEMDataSet.cc.

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

Member Function Documentation

◆ AddComponent()

virtual void G4CompositeEMDataSet::AddComponent ( G4VEMDataSet dataSet)
inlinevirtual

Implements G4VEMDataSet.

Definition at line 74 of file G4CompositeEMDataSet.hh.

74{ 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 83 of file G4CompositeEMDataSet.cc.

84{
85 const G4VEMDataSet* component(GetComponent(argComponentId));
86
87 if (component) return component->FindValue(argEnergy);
88
89 std::ostringstream message;
90 message << "G4CompositeEMDataSet::FindValue - component " << argComponentId << " not found";
91
92 G4Exception("G4CompositeEMDataSet::FindValue",
93 "em1004",FatalException,message.str().c_str());
94
95 return 0.;
96}
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 73 of file G4CompositeEMDataSet.hh.

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

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

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

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

79{ 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 154 of file G4CompositeEMDataSet.cc.

155{
156 CleanUpComponents();
157
158 for (G4int z(minZ); z<maxZ; z++)
159 {
160 G4VEMDataSet* component = new G4EMDataSet(z, algorithm->Clone(), unitEnergies, unitData);
161 if (!component->LoadData(argFileName))
162 {
163 delete component;
164 return false;
165 }
166 AddComponent(component);
167 }
168 return true;
169}
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 172 of file G4CompositeEMDataSet.cc.

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

◆ NumberOfComponents()

virtual size_t G4CompositeEMDataSet::NumberOfComponents ( void  ) const
inlinevirtual

Implements G4VEMDataSet.

Definition at line 75 of file G4CompositeEMDataSet.hh.

75{ return components.size(); }

Referenced by PrintData().

◆ PrintData()

void G4CompositeEMDataSet::PrintData ( void  ) const
virtual

Implements G4VEMDataSet.

Definition at line 98 of file G4CompositeEMDataSet.cc.

99{
100 const size_t n(NumberOfComponents());
101
102 G4cout << "The data set has " << n << " components" << G4endl;
103 G4cout << G4endl;
104
105 size_t i(0);
106
107 while (i<n)
108 {
109 G4cout << "--- Component " << i << " ---" << G4endl;
111 i++;
112 }
113}
#define G4endl
Definition: G4ios.hh:57
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 223 of file G4CompositeEMDataSet.cc.

224{
225 G4double value = 0.;
226 if (componentId >= 0 && componentId < (G4int)components.size())
227 {
228 const G4VEMDataSet* dataSet = GetComponent(componentId);
229 value = dataSet->RandomSelect();
230 }
231 return value;
232}
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 190 of file G4CompositeEMDataSet.cc.

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

◆ SetEnergiesData()

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

Implements G4VEMDataSet.

Definition at line 115 of file G4CompositeEMDataSet.cc.

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

◆ SetLogEnergiesData()

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

Implements G4VEMDataSet.

Definition at line 132 of file G4CompositeEMDataSet.cc.

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

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