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

#include <G4PixeShellDataSet.hh>

+ Inheritance diagram for G4PixeShellDataSet:

Public Member Functions

 G4PixeShellDataSet (G4int Z, G4IInterpolator *algo, const G4String &modelK="ecpssr", const G4String &modelL="ecpssr", const G4String &modelM="ecpssr", G4double eUnit=CLHEP::MeV, G4double dataUnit=CLHEP::barn)
 
virtual ~G4PixeShellDataSet ()
 
virtual G4double FindValue (G4double energy, G4int componentId=0) const
 
virtual void PrintData (void) const
 
virtual const G4IDataSetGetComponent (G4int componentId) const
 
virtual void AddComponent (G4IDataSet *dataSet)
 
virtual size_t NumberOfComponents (void) const
 
virtual const G4DataVectorGetEnergies (G4int componentId) const
 
virtual const G4DataVectorGetData (G4int componentId) const
 
virtual void SetEnergiesData (G4DataVector *energies, G4DataVector *data, G4int componentId)
 
virtual G4bool LoadData (const G4String &fileName)
 
virtual G4bool SaveData (const G4String &fileName) const
 
virtual G4double RandomSelect (G4int) const
 
- Public Member Functions inherited from G4IDataSet
 G4IDataSet ()
 
virtual ~G4IDataSet ()
 

Protected Member Functions

G4double GetUnitEnergies () const
 
G4double GetUnitData () const
 
const G4IInterpolatorGetAlgorithm () const
 
void CleanUpComponents (void)
 

Detailed Description

Definition at line 56 of file G4PixeShellDataSet.hh.

Constructor & Destructor Documentation

◆ G4PixeShellDataSet()

G4PixeShellDataSet::G4PixeShellDataSet ( G4int Z,
G4IInterpolator * algo,
const G4String & modelK = "ecpssr",
const G4String & modelL = "ecpssr",
const G4String & modelM = "ecpssr",
G4double eUnit = CLHEP::MeV,
G4double dataUnit = CLHEP::barn )

Definition at line 47 of file G4PixeShellDataSet.cc.

53 :
54 z(zeta),
55 algorithm(algo),
56 unitEnergies(eUnit),
57 unitData(dataUnit)
58{
59 if (algorithm == 0) G4Exception("G4PixeShellDataSet::G4PixeShellDataSet",
60 "pii00000301",
62 "interpolation == 0");
63
64 crossModel.push_back(modelK);
65 crossModel.push_back(modelL);
66 crossModel.push_back(modelM);
67
68 shellName.push_back("k");
69 shellName.push_back("l");
70 shellName.push_back("m");
71
72 std::size_t sizeK = modelK.size();
73 std::size_t sizeL = modelL.size();
74 std::size_t sizeM = modelM.size();
75
76 if (sizeK > 0) subShellName.push_back("k");
77
78 if (sizeK > 0 && sizeL > 0)
79 {
80 subShellName.push_back("l1");
81 subShellName.push_back("l2");
82 subShellName.push_back("l3");
83 }
84 if (sizeK > 0 && sizeL > 0 && sizeM >0)
85 {
86 subShellName.push_back("m1");
87 subShellName.push_back("m2");
88 subShellName.push_back("m3");
89 subShellName.push_back("m4");
90 subShellName.push_back("m5");
91 }
92}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)

Referenced by G4PixeShellDataSet().

◆ ~G4PixeShellDataSet()

G4PixeShellDataSet::~G4PixeShellDataSet ( )
virtual

Definition at line 95 of file G4PixeShellDataSet.cc.

96{
98 if (algorithm) delete algorithm;
99}

Member Function Documentation

◆ AddComponent()

virtual void G4PixeShellDataSet::AddComponent ( G4IDataSet * dataSet)
inlinevirtual

Implements G4IDataSet.

Definition at line 77 of file G4PixeShellDataSet.hh.

78 { components.push_back(dataSet); }

Referenced by LoadData().

◆ CleanUpComponents()

void G4PixeShellDataSet::CleanUpComponents ( void )
protected

Definition at line 191 of file G4PixeShellDataSet.cc.

192{
193 while (!components.empty())
194 {
195 if (components.back()) delete components.back();
196 components.pop_back();
197 }
198}

Referenced by LoadData(), and ~G4PixeShellDataSet().

◆ FindValue()

G4double G4PixeShellDataSet::FindValue ( G4double energy,
G4int componentId = 0 ) const
virtual

Implements G4IDataSet.

Definition at line 102 of file G4PixeShellDataSet.cc.

103{
104 // Returns the sum over the shells corresponding to e
105 G4double value = 0.;
106
107 std::vector<G4IDataSet *>::const_iterator i(components.begin());
108 std::vector<G4IDataSet *>::const_iterator end(components.end());
109
110 while (i != end)
111 {
112 value += (*i)->FindValue(energy);
113 i++;
114 }
115 return value;
116}
double G4double
Definition G4Types.hh:83

◆ GetAlgorithm()

const G4IInterpolator * G4PixeShellDataSet::GetAlgorithm ( ) const
inlineprotected

Definition at line 102 of file G4PixeShellDataSet.hh.

102{ return algorithm; }

◆ GetComponent()

virtual const G4IDataSet * G4PixeShellDataSet::GetComponent ( G4int componentId) const
inlinevirtual

Implements G4IDataSet.

Definition at line 74 of file G4PixeShellDataSet.hh.

75 { return components[componentId]; }

Referenced by GetData(), GetEnergies(), and PrintData().

◆ GetData()

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

Implements G4IDataSet.

Definition at line 86 of file G4PixeShellDataSet.hh.

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

◆ GetEnergies()

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

Implements G4IDataSet.

Definition at line 83 of file G4PixeShellDataSet.hh.

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

◆ GetUnitData()

G4double G4PixeShellDataSet::GetUnitData ( ) const
inlineprotected

Definition at line 101 of file G4PixeShellDataSet.hh.

101{ return unitData; }

◆ GetUnitEnergies()

G4double G4PixeShellDataSet::GetUnitEnergies ( ) const
inlineprotected

Definition at line 100 of file G4PixeShellDataSet.hh.

100{ return unitEnergies; }

◆ LoadData()

G4bool G4PixeShellDataSet::LoadData ( const G4String & fileName)
virtual

Implements G4IDataSet.

Definition at line 159 of file G4PixeShellDataSet.cc.

160{
162
163 // Load shell cross sections
164
165 std::size_t nShells = subShellName.size();
166
167 for (std::size_t subShellIndex=0; subShellIndex<nShells; ++subShellIndex)
168 {
169 G4String subName = subShellName[subShellIndex];
170 G4String fullFileName = FullFileName(file,subName);
171
172 // Create component DataSet with the data from the current subshell
173 G4IDataSet* dataSet = new G4DataSet(z,algorithm);
174 dataSet->LoadData(fullFileName);
175
176 // Add component to the ShellDataSet
177 AddComponent(dataSet);
178 }
179
180 return true;
181}
virtual G4bool LoadData(const G4String &fileName)=0
virtual void AddComponent(G4IDataSet *dataSet)

◆ NumberOfComponents()

virtual size_t G4PixeShellDataSet::NumberOfComponents ( void ) const
inlinevirtual

Implements G4IDataSet.

Definition at line 80 of file G4PixeShellDataSet.hh.

81 { return components.size(); }

Referenced by PrintData().

◆ PrintData()

void G4PixeShellDataSet::PrintData ( void ) const
virtual

Implements G4IDataSet.

Definition at line 119 of file G4PixeShellDataSet.cc.

120{
121 const G4int n = (G4int)NumberOfComponents();
122
123 G4cout << "The data set has " << n << " components" << G4endl;
124 G4cout << G4endl;
125
126 G4int i = 0;
127
128 while (i < n)
129 {
130 G4cout << "--- Component " << i << " ---" << G4endl;
132 ++i;
133 }
134}
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
virtual void PrintData(void) const =0
virtual size_t NumberOfComponents(void) const

◆ RandomSelect()

virtual G4double G4PixeShellDataSet::RandomSelect ( G4int ) const
inlinevirtual

Implements G4IDataSet.

Definition at line 96 of file G4PixeShellDataSet.hh.

96{return -1.;};

◆ SaveData()

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

Implements G4IDataSet.

Definition at line 184 of file G4PixeShellDataSet.cc.

185{
186 // Dummy implementation
187 return true;
188}

◆ SetEnergiesData()

void G4PixeShellDataSet::SetEnergiesData ( G4DataVector * energies,
G4DataVector * data,
G4int componentId )
virtual

Implements G4IDataSet.

Definition at line 137 of file G4PixeShellDataSet.cc.

140{
141 G4IDataSet* component = components[componentId];
142
143 if (component)
144 {
145 component->SetEnergiesData(energies, data, 0);
146 return;
147 }
148
149 std::ostringstream message;
150 message << "G4PixeShellDataSet::SetEnergiesData - component " << componentId << " not found";
151
152 G4Exception("G4PixeShellDataSet::SetEnergiesData",
153 "pii000000310",
155 message.str().c_str());
156}
virtual void SetEnergiesData(G4DataVector *x, G4DataVector *data, G4int component=0)=0

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