Geant4-11
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
G4PixeShellDataSet Class Reference

#include <G4PixeShellDataSet.hh>

Inheritance diagram for G4PixeShellDataSet:
G4IDataSet

Public Member Functions

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

Protected Member Functions

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

Private Member Functions

G4String FullFileName (const G4String &particleType, const G4String &subShell) const
 
 G4PixeShellDataSet ()
 
 G4PixeShellDataSet (const G4PixeShellDataSet &copy)
 
G4PixeShellDataSetoperator= (const G4PixeShellDataSet &right)
 
G4int TranslateShell (const G4String &subShell) const
 

Private Attributes

G4IInterpolatoralgorithm
 
std::vector< G4IDataSet * > components
 
std::vector< G4StringcrossModel
 
std::vector< G4StringshellName
 
std::vector< G4StringsubShellName
 
G4double unitData
 
G4double unitEnergies
 
G4int z
 

Detailed Description

Definition at line 56 of file G4PixeShellDataSet.hh.

Constructor & Destructor Documentation

◆ G4PixeShellDataSet() [1/3]

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 size_t sizeK = modelK.size();
73 size_t sizeL = modelL.size();
74 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)
Definition: G4Exception.cc:35
std::vector< G4String > crossModel
std::vector< G4String > subShellName
std::vector< G4String > shellName
G4IInterpolator * algorithm

References algorithm, crossModel, FatalException, G4Exception(), shellName, and subShellName.

◆ ~G4PixeShellDataSet()

G4PixeShellDataSet::~G4PixeShellDataSet ( )
virtual

Definition at line 95 of file G4PixeShellDataSet.cc.

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

References algorithm, and CleanUpComponents().

◆ G4PixeShellDataSet() [2/3]

G4PixeShellDataSet::G4PixeShellDataSet ( )
private

◆ G4PixeShellDataSet() [3/3]

G4PixeShellDataSet::G4PixeShellDataSet ( const G4PixeShellDataSet copy)
private

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); }
std::vector< G4IDataSet * > components

References components.

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}

References components.

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
G4double energy(const ThreeVector &p, const G4double m)

References components, and G4INCL::KinematicsUtils::energy().

◆ FullFileName()

G4String G4PixeShellDataSet::FullFileName ( const G4String particleType,
const G4String subShell 
) const
private

Definition at line 201 of file G4PixeShellDataSet.cc.

203{
204 char* path = std::getenv("G4PIIDATA");
205 if (!path)
206 G4Exception("G4PixeShellDataSet::FullFileName",
207 "pii00000320",
209 "G4PIIDATA environment variable not set");
210
211 // Identify the shell this subshell belongs to
212 G4int shellIndex = TranslateShell(subShell);
213 G4String shellString = shellName[shellIndex];
214 G4String shellModel = crossModel[shellIndex];
215
216 std::ostringstream fullFileName;
217
218 fullFileName
219 //<< path
220 << "pixe/"
221 << file
222 << '/'
223 << shellString
224 << '/'
225 << shellModel
226 << '/'
227 << subShell
228 << '-' ;
229// << z
230 // << ".dat";
231
232 G4String test(fullFileName.str().c_str());
233 // std::cout << "PixeShellDataSet - Reading data from file " << test << std::endl;
234
235 return G4String(fullFileName.str().c_str());
236}
int G4int
Definition: G4Types.hh:85
G4int TranslateShell(const G4String &subShell) const
def test()
Definition: mcscore.py:117

References crossModel, FatalException, geant4_check_module_cycles::file, G4Exception(), shellName, mcscore::test(), and TranslateShell().

Referenced by LoadData().

◆ GetAlgorithm()

const G4IInterpolator * G4PixeShellDataSet::GetAlgorithm ( ) const
inlineprotected

Definition at line 102 of file G4PixeShellDataSet.hh.

102{ return algorithm; }

References 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]; }

References components.

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

References GetComponent(), and G4IDataSet::GetData().

◆ 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

References GetComponent(), and G4IDataSet::GetEnergies().

◆ GetUnitData()

G4double G4PixeShellDataSet::GetUnitData ( ) const
inlineprotected

Definition at line 101 of file G4PixeShellDataSet.hh.

101{ return unitData; }

References unitData.

◆ GetUnitEnergies()

G4double G4PixeShellDataSet::GetUnitEnergies ( ) const
inlineprotected

Definition at line 100 of file G4PixeShellDataSet.hh.

100{ return unitEnergies; }

References 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 G4int nShells = subShellName.size();
166
167 for (G4int 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)
G4String FullFileName(const G4String &particleType, const G4String &subShell) const

References AddComponent(), algorithm, CleanUpComponents(), geant4_check_module_cycles::file, FullFileName(), G4IDataSet::LoadData(), subShellName, and z.

◆ NumberOfComponents()

virtual size_t G4PixeShellDataSet::NumberOfComponents ( void  ) const
inlinevirtual

Implements G4IDataSet.

Definition at line 80 of file G4PixeShellDataSet.hh.

81 { return components.size(); }

References components.

Referenced by PrintData().

◆ operator=()

G4PixeShellDataSet & G4PixeShellDataSet::operator= ( const G4PixeShellDataSet right)
private

◆ PrintData()

void G4PixeShellDataSet::PrintData ( void  ) const
virtual

Implements G4IDataSet.

Definition at line 119 of file G4PixeShellDataSet.cc.

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

References G4cout, G4endl, GetComponent(), CLHEP::detail::n, NumberOfComponents(), and G4IDataSet::PrintData().

◆ 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

References components, FatalException, G4Exception(), and G4IDataSet::SetEnergiesData().

◆ TranslateShell()

G4int G4PixeShellDataSet::TranslateShell ( const G4String subShell) const
private

Definition at line 238 of file G4PixeShellDataSet.cc.

239{
240 // By default return K shell
241 G4int index = 0;
242
243 if (subShell == "l1" || subShell == "l2" || subShell == "l3" ) index = 1;
244 if (subShell == "m1" ||
245 subShell == "m2" ||
246 subShell == "m3" ||
247 subShell == "m4" ||
248 subShell == "m5" ) index = 2;
249 return index;
250}

Referenced by FullFileName().

Field Documentation

◆ algorithm

G4IInterpolator* G4PixeShellDataSet::algorithm
private

◆ components

std::vector<G4IDataSet*> G4PixeShellDataSet::components
private

◆ crossModel

std::vector<G4String> G4PixeShellDataSet::crossModel
private

Definition at line 125 of file G4PixeShellDataSet.hh.

Referenced by FullFileName(), and G4PixeShellDataSet().

◆ shellName

std::vector<G4String> G4PixeShellDataSet::shellName
private

Definition at line 128 of file G4PixeShellDataSet.hh.

Referenced by FullFileName(), and G4PixeShellDataSet().

◆ subShellName

std::vector<G4String> G4PixeShellDataSet::subShellName
private

Definition at line 129 of file G4PixeShellDataSet.hh.

Referenced by G4PixeShellDataSet(), and LoadData().

◆ unitData

G4double G4PixeShellDataSet::unitData
private

Definition at line 127 of file G4PixeShellDataSet.hh.

Referenced by GetUnitData().

◆ unitEnergies

G4double G4PixeShellDataSet::unitEnergies
private

Definition at line 126 of file G4PixeShellDataSet.hh.

Referenced by GetUnitEnergies().

◆ z

G4int G4PixeShellDataSet::z
private

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