Geant4 9.6.0
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 ()
 
virtual G4double FindValue (G4double x, G4int componentId=0) const =0
 
virtual void PrintData (void) const =0
 
virtual const G4IDataSetGetComponent (G4int componentId) const =0
 
virtual void AddComponent (G4IDataSet *dataSet)=0
 
virtual size_t NumberOfComponents (void) const =0
 
virtual const G4DataVectorGetEnergies (G4int componentId) const =0
 
virtual const G4DataVectorGetData (G4int componentId) const =0
 
virtual void SetEnergiesData (G4DataVector *x, G4DataVector *data, G4int component=0)=0
 
virtual G4bool LoadData (const G4String &fileName)=0
 
virtual G4bool SaveData (const G4String &fileName) const =0
 
virtual G4double RandomSelect (G4int componentId=0) const =0
 

Protected Member Functions

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

Detailed Description

Definition at line 57 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 48 of file G4PixeShellDataSet.cc.

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

Referenced by G4PixeShellDataSet().

◆ ~G4PixeShellDataSet()

G4PixeShellDataSet::~G4PixeShellDataSet ( )
virtual

Definition at line 96 of file G4PixeShellDataSet.cc.

97{
99 if (algorithm) delete algorithm;
100}

Member Function Documentation

◆ AddComponent()

virtual void G4PixeShellDataSet::AddComponent ( G4IDataSet dataSet)
inlinevirtual

Implements G4IDataSet.

Definition at line 78 of file G4PixeShellDataSet.hh.

79 { components.push_back(dataSet); }

Referenced by LoadData().

◆ CleanUpComponents()

void G4PixeShellDataSet::CleanUpComponents ( void  )
protected

Definition at line 192 of file G4PixeShellDataSet.cc.

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

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

◆ FindValue()

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

Implements G4IDataSet.

Definition at line 103 of file G4PixeShellDataSet.cc.

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

◆ GetAlgorithm()

const G4IInterpolator * G4PixeShellDataSet::GetAlgorithm ( ) const
inlineprotected

Definition at line 103 of file G4PixeShellDataSet.hh.

103{ return algorithm; }

◆ GetComponent()

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

Implements G4IDataSet.

Definition at line 75 of file G4PixeShellDataSet.hh.

76 { return components[componentId]; }

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

◆ GetData()

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

Implements G4IDataSet.

Definition at line 87 of file G4PixeShellDataSet.hh.

88 { 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 84 of file G4PixeShellDataSet.hh.

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

◆ GetUnitData()

G4double G4PixeShellDataSet::GetUnitData ( ) const
inlineprotected

Definition at line 102 of file G4PixeShellDataSet.hh.

102{ return unitData; }

◆ GetUnitEnergies()

G4double G4PixeShellDataSet::GetUnitEnergies ( ) const
inlineprotected

Definition at line 101 of file G4PixeShellDataSet.hh.

101{ return unitEnergies; }

◆ LoadData()

G4bool G4PixeShellDataSet::LoadData ( const G4String fileName)
virtual

Implements G4IDataSet.

Definition at line 160 of file G4PixeShellDataSet.cc.

161{
163
164 // Load shell cross sections
165
166 G4int nShells = subShellName.size();
167
168 for (G4int subShellIndex=0; subShellIndex<nShells; subShellIndex++)
169 {
170 G4String subName = subShellName[subShellIndex];
171 G4String fullFileName = FullFileName(file,subName);
172
173 // Create component DataSet with the data from the current subshell
174 G4IDataSet* dataSet = new G4DataSet(z,algorithm);
175 dataSet->LoadData(fullFileName);
176
177 // Add component to the ShellDataSet
178 AddComponent(dataSet);
179 }
180
181 return true;
182}
int G4int
Definition: G4Types.hh:66
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 81 of file G4PixeShellDataSet.hh.

82 { return components.size(); }

Referenced by PrintData().

◆ PrintData()

void G4PixeShellDataSet::PrintData ( void  ) const
virtual

Implements G4IDataSet.

Definition at line 120 of file G4PixeShellDataSet.cc.

121{
122 const size_t n = NumberOfComponents();
123
124 G4cout << "The data set has " << n << " components" << G4endl;
125 G4cout << G4endl;
126
127 size_t i = 0;
128
129 while (i < n)
130 {
131 G4cout << "--- Component " << i << " ---" << G4endl;
133 i++;
134 }
135}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT 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 97 of file G4PixeShellDataSet.hh.

97{return -1.;};

◆ SaveData()

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

Implements G4IDataSet.

Definition at line 185 of file G4PixeShellDataSet.cc.

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

◆ SetEnergiesData()

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

Implements G4IDataSet.

Definition at line 138 of file G4PixeShellDataSet.cc.

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

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