Geant4  10.02.p03
G4PixeShellDataSet Class Reference

#include <G4PixeShellDataSet.hh>

Inheritance diagram for G4PixeShellDataSet:
Collaboration 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)
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 57 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 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 }
G4IInterpolator * algorithm
std::vector< G4String > crossModel
std::vector< G4String > subShellName
std::vector< G4String > shellName
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:

◆ ~G4PixeShellDataSet()

G4PixeShellDataSet::~G4PixeShellDataSet ( )
virtual

Definition at line 96 of file G4PixeShellDataSet.cc.

97 {
99  if (algorithm) delete algorithm;
100 }
G4IInterpolator * algorithm
Here is the call graph for this function:

◆ G4PixeShellDataSet() [2/3]

G4PixeShellDataSet::G4PixeShellDataSet ( )
private
Here is the caller graph for this function:

◆ 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 78 of file G4PixeShellDataSet.hh.

79  { components.push_back(dataSet); }
std::vector< G4IDataSet * > components
Here is the caller graph for this function:

◆ 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 }
std::vector< G4IDataSet * > components
Here is the caller graph for this function:

◆ 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 }
std::vector< G4IDataSet * > components
double energy
Definition: plottest35.C:25
double G4double
Definition: G4Types.hh:76

◆ FullFileName()

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

Definition at line 202 of file G4PixeShellDataSet.cc.

204 {
205  char* path = getenv("G4PIIDATA");
206  if (!path)
207  G4Exception("G4PixeShellDataSet::FullFileName",
208  "pii00000320",
210  "G4PIIDATA environment variable not set");
211 
212  // Identify the shell this subshell belongs to
213  G4int shellIndex = TranslateShell(subShell);
214  G4String shellString = shellName[shellIndex];
215  G4String shellModel = crossModel[shellIndex];
216 
217  std::ostringstream fullFileName;
218 
219  fullFileName
220  //<< path
221  << "pixe/"
222  << file
223  << '/'
224  << shellString
225  << '/'
226  << shellModel
227  << '/'
228  << subShell
229  << '-' ;
230 // << z
231  // << ".dat";
232 
233  G4String test(fullFileName.str().c_str());
234  // std::cout << "PixeShellDataSet - Reading data from file " << test << std::endl;
235 
236  return G4String(fullFileName.str().c_str());
237 }
std::vector< G4String > crossModel
TFile * file
int G4int
Definition: G4Types.hh:78
std::vector< G4String > shellName
G4int TranslateShell(const G4String &subShell) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
program test
Definition: Main_HIJING.f:1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAlgorithm()

const G4IInterpolator* G4PixeShellDataSet::GetAlgorithm ( ) const
inlineprotected

Definition at line 103 of file G4PixeShellDataSet.hh.

103 { return algorithm; }
G4IInterpolator * algorithm
Here is the call graph for this function:

◆ GetComponent()

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

Implements G4IDataSet.

Definition at line 75 of file G4PixeShellDataSet.hh.

76  { return components[componentId]; }
std::vector< G4IDataSet * > components
Here is the caller graph for this function:

◆ 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
Here is the call graph for this function:

◆ 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
virtual const G4IDataSet * GetComponent(G4int componentId) const
Here is the call graph for this function:

◆ 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 }
G4IInterpolator * algorithm
std::vector< G4String > subShellName
TFile * file
int G4int
Definition: G4Types.hh:78
G4String FullFileName(const G4String &particleType, const G4String &subShell) const
virtual G4bool LoadData(const G4String &fileName)=0
virtual void AddComponent(G4IDataSet *dataSet)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NumberOfComponents()

virtual size_t G4PixeShellDataSet::NumberOfComponents ( void  ) const
inlinevirtual

Implements G4IDataSet.

Definition at line 81 of file G4PixeShellDataSet.hh.

82  { return components.size(); }
std::vector< G4IDataSet * > components
Here is the caller graph for this function:

◆ operator=()

G4PixeShellDataSet& G4PixeShellDataSet::operator= ( const G4PixeShellDataSet right)
private
Here is the caller graph for this function:

◆ 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;
132  GetComponent(i)->PrintData();
133  i++;
134  }
135 }
Char_t n[5]
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
virtual size_t NumberOfComponents(void) const
virtual const G4IDataSet * GetComponent(G4int componentId) const
virtual void PrintData(void) const =0
Here is the call graph for this function:

◆ 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 }
Here is the caller graph for this function:

◆ 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
std::vector< G4IDataSet * > components
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TranslateShell()

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

Definition at line 239 of file G4PixeShellDataSet.cc.

240 {
241  // By default return K shell
242  G4int index = 0;
243 
244  if (subShell == "l1" || subShell == "l2" || subShell == "l3" ) index = 1;
245  if (subShell == "m1" ||
246  subShell == "m2" ||
247  subShell == "m3" ||
248  subShell == "m4" ||
249  subShell == "m5" ) index = 2;
250  return index;
251 }
Int_t index
int G4int
Definition: G4Types.hh:78
Here is the caller graph for this function:

Member Data Documentation

◆ algorithm

G4IInterpolator* G4PixeShellDataSet::algorithm
private

Definition at line 121 of file G4PixeShellDataSet.hh.

◆ components

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

Definition at line 118 of file G4PixeShellDataSet.hh.

◆ crossModel

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

Definition at line 126 of file G4PixeShellDataSet.hh.

◆ shellName

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

Definition at line 129 of file G4PixeShellDataSet.hh.

◆ subShellName

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

Definition at line 130 of file G4PixeShellDataSet.hh.

◆ unitData

G4double G4PixeShellDataSet::unitData
private

Definition at line 128 of file G4PixeShellDataSet.hh.

◆ unitEnergies

G4double G4PixeShellDataSet::unitEnergies
private

Definition at line 127 of file G4PixeShellDataSet.hh.

◆ z

G4int G4PixeShellDataSet::z
private

Definition at line 120 of file G4PixeShellDataSet.hh.


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