Geant4  10.02.p03
G4RDeIonisationParameters Class Reference

#include <G4RDeIonisationParameters.hh>

Collaboration diagram for G4RDeIonisationParameters:

Public Member Functions

 G4RDeIonisationParameters (G4int minZ=1, G4int maxZ=99)
 
 ~G4RDeIonisationParameters ()
 
G4double Parameter (G4int Z, G4int shellIndex, G4int parameterIndex, G4double e) const
 
G4double Excitation (G4int Z, G4double e) const
 
void PrintData () const
 

Private Member Functions

 G4RDeIonisationParameters (const G4RDeIonisationParameters &)
 
G4RDeIonisationParametersoperator= (const G4RDeIonisationParameters &right)
 
void LoadData ()
 

Private Attributes

G4int zMin
 
G4int zMax
 
G4DataVector activeZ
 
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > param
 
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > excit
 
size_t length
 

Detailed Description

Definition at line 62 of file G4RDeIonisationParameters.hh.

Constructor & Destructor Documentation

◆ G4RDeIonisationParameters() [1/2]

G4RDeIonisationParameters::G4RDeIonisationParameters ( G4int  minZ = 1,
G4int  maxZ = 99 
)

Definition at line 62 of file G4RDeIonisationParameters.cc.

Here is the call graph for this function:

◆ ~G4RDeIonisationParameters()

G4RDeIonisationParameters::~G4RDeIonisationParameters ( )

Definition at line 70 of file G4RDeIonisationParameters.cc.

71 {
72  // Reset the map of data sets: remove the data sets from the map
73  std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::iterator pos;
74 
75  for (pos = param.begin(); pos != param.end(); ++pos)
76  {
77  G4RDVEMDataSet* dataSet = (*pos).second;
78  delete dataSet;
79  }
80 
81  for (pos = excit.begin(); pos != excit.end(); ++pos)
82  {
83  G4RDVEMDataSet* dataSet = (*pos).second;
84  delete dataSet;
85  }
86 
87  activeZ.clear();
88 }
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > excit
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > param
static const G4double pos

◆ G4RDeIonisationParameters() [2/2]

G4RDeIonisationParameters::G4RDeIonisationParameters ( const G4RDeIonisationParameters )
private

Member Function Documentation

◆ Excitation()

G4double G4RDeIonisationParameters::Excitation ( G4int  Z,
G4double  e 
) const

Definition at line 124 of file G4RDeIonisationParameters.cc.

125 {
126  G4double value = 0.;
127  std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator pos;
128 
129  pos = excit.find(Z);
130  if (pos!= excit.end()) {
131  G4RDVEMDataSet* dataSet = (*pos).second;
132 
133  const G4DataVector ener = dataSet->GetEnergies(0);
134  G4double ee = std::max(ener.front(),std::min(ener.back(),e));
135  value = dataSet->FindValue(ee);
136  } else {
137  G4cout << "WARNING: G4IonisationParameters::Excitation "
138  << "did not find ID = "
139  << Z << G4endl;
140  }
141 
142  return value;
143 }
G4GLOB_DLL std::ostream G4cout
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > excit
Float_t Z
virtual G4double FindValue(G4double x, G4int componentId=0) const =0
virtual const G4DataVector & GetEnergies(G4int componentId) const =0
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static const G4double pos
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadData()

void G4RDeIonisationParameters::LoadData ( )
private

Definition at line 146 of file G4RDeIonisationParameters.cc.

147 {
148  // ---------------------------------------
149  // Please document what are the parameters
150  // ---------------------------------------
151 
152  // define active elements
153 
154  const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
155  if (materialTable == 0)
156  G4Exception("G4RDeIonisationParameters::LoadData()", "InvalidSetup",
157  FatalException, "No MaterialTable found!");
158 
160 
161  for (G4int m=0; m<nMaterials; m++) {
162 
163  const G4Material* material= (*materialTable)[m];
164  const G4ElementVector* elementVector = material->GetElementVector();
165  const size_t nElements = material->GetNumberOfElements();
166 
167  for (size_t iEl=0; iEl<nElements; iEl++) {
168  G4Element* element = (*elementVector)[iEl];
169  G4double Z = element->GetZ();
170  if (!(activeZ.contains(Z))) {
171  activeZ.push_back(Z);
172  }
173  }
174  }
175 
176  char* path = getenv("G4LEDATA");
177  if (!path)
178  {
179  G4String excep("G4LEDATA environment variable not set!");
180  G4Exception("G4RDeIonisationParameters::LoadData()", "InvalidSetup",
181  FatalException, excep);
182  }
183 
184  G4String pathString(path);
185  G4String path2("/ioni/ion-sp-");
186  pathString += path2;
187 
188  G4double energy, sum;
189 
190  size_t nZ = activeZ.size();
191 
192  for (size_t i=0; i<nZ; i++) {
193 
194  G4int Z = (G4int)activeZ[i];
195  std::ostringstream ost;
196  ost << pathString << Z << ".dat";
197  G4String name(ost.str());
198 
199  std::ifstream file(name);
200  std::filebuf* lsdp = file.rdbuf();
201 
202  if (! (lsdp->is_open()) ) {
203  G4String excep = G4String("Data file: ")
204  + name + G4String(" not found. The version 1.# of G4LEDATA should be used");
205  G4Exception("G4RDeIonisationParameters::LoadData()", "DataNotFound",
206  FatalException, excep);
207  }
208 
209  // The file is organized into:
210  // For each shell there are two lines:
211  // 1st line:
212  // 1st column is the energy of incident e-,
213  // 2d column is the parameter of screan term;
214  // 2d line:
215  // 3 energy (MeV) subdividing different approximation area of the spectrum
216  // 20 point on the spectrum
217  // The shell terminates with the pattern: -1 -1
218  // The file terminates with the pattern: -2 -2
219 
220  std::vector<G4RDVEMDataSet*> p;
221  for (size_t k=0; k<length; k++)
222  {
224  G4RDVEMDataSet* composite = new G4RDCompositeEMDataSet(inter,1.,1.);
225  p.push_back(composite);
226  }
227 
228  G4int shell = 0;
229  std::vector<G4DataVector*> a;
230  for (size_t j=0; j<length; j++)
231  {
232  G4DataVector* aa = new G4DataVector();
233  a.push_back(aa);
234  }
235  G4DataVector e;
236  e.clear();
237  do {
238  file >> energy >> sum;
239  if (energy == -2) break;
240 
241  if (energy > -1) {
242  e.push_back(energy);
243  a[0]->push_back(sum);
244  for (size_t j=0; j<length-1; j++) {
245  G4double qRead;
246  file >> qRead;
247  a[j + 1]->push_back(qRead);
248  }
249 
250  } else {
251 
252  // End of set for a shell, fill the map
253  for (size_t k=0; k<length; k++) {
254 
255  G4RDVDataSetAlgorithm* interp;
256  if(0 == k) interp = new G4RDLinLogLogInterpolation();
257  else interp = new G4RDLogLogInterpolation();
258 
259  G4DataVector* eVector = new G4DataVector;
260  size_t eSize = e.size();
261  for (size_t s=0; s<eSize; s++) {
262  eVector->push_back(e[s]);
263  }
264  G4RDVEMDataSet* set = new G4RDEMDataSet(shell,eVector,a[k],interp,1.,1.);
265 
266  p[k]->AddComponent(set);
267  }
268 
269  // clear vectors
270  for (size_t j2=0; j2<length; j2++) {
271  a[j2] = new G4DataVector();
272  }
273  shell++;
274  e.clear();
275  }
276  } while (energy > -2);
277 
278  file.close();
279 
280  for (size_t kk=0; kk<length; kk++)
281  {
282  G4int id = Z*100 + kk;
283  param[id] = p[kk];
284  }
285  }
286 
287  G4String pathString_a(path);
288  G4String name_a = pathString_a + G4String("/ioni/ion-ex-av.dat");
289  std::ifstream file_a(name_a);
290  std::filebuf* lsdp_a = file_a.rdbuf();
291  G4String pathString_b(path);
292  G4String name_b = pathString_b + G4String("/ioni/ion-ex-sig.dat");
293  std::ifstream file_b(name_b);
294  std::filebuf* lsdp_b = file_b.rdbuf();
295 
296  if (! (lsdp_a->is_open()) ) {
297  G4String excep = G4String("Cannot open file ")
298  + name_a;
299  G4Exception("G4RDeIonisationParameters::LoadData()", "CannotOpenFile",
300  FatalException, excep);
301  }
302  if (! (lsdp_b->is_open()) ) {
303  G4String excep = G4String("Cannot open file ")
304  + name_b;
305  G4Exception("G4RDeIonisationParameters::LoadData()", "CannotOpenFile",
306  FatalException, excep);
307  }
308 
309  // The file is organized into two columns:
310  // 1st column is the energy
311  // 2nd column is the corresponding value
312  // The file terminates with the pattern: -1 -1
313  // -2 -2
314 
315  G4double ener, ener1, sig, sig1;
316  G4int z = 0;
317 
318  G4DataVector e;
319  e.clear();
320  G4DataVector d;
321  d.clear();
322 
323  do {
324  file_a >> ener >> sig;
325  file_b >> ener1 >> sig1;
326 
327  if(ener != ener1) {
328  G4cout << "G4RDeIonisationParameters: problem in excitation data "
329  << "ener= " << ener
330  << " ener1= " << ener1
331  << G4endl;
332  }
333 
334  // End of file
335  if (ener == -2) {
336  break;
337 
338  // End of next element
339  } else if (ener == -1) {
340 
341  z++;
342  G4double Z = (G4double)z;
343 
344  // fill map if Z is used
345  if (activeZ.contains(Z)) {
346 
348  G4DataVector* eVector = new G4DataVector;
349  G4DataVector* dVector = new G4DataVector;
350  size_t eSize = e.size();
351  for (size_t s=0; s<eSize; s++) {
352  eVector->push_back(e[s]);
353  dVector->push_back(d[s]);
354  }
355  G4RDVEMDataSet* set = new G4RDEMDataSet(z,eVector,dVector,inter,1.,1.);
356  excit[z] = set;
357  }
358  e.clear();
359  d.clear();
360 
361  } else {
362 
363  e.push_back(ener*MeV);
364  d.push_back(sig1*sig*barn*MeV);
365  }
366  } while (ener != -2);
367 
368  file_a.close();
369 
370 }
static const double MeV
Definition: G4SIunits.hh:211
std::vector< G4Element * > G4ElementVector
Float_t d
G4String name
Definition: TRTMaterials.hh:40
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:589
std::vector< G4Material * > G4MaterialTable
TFile * file
int G4int
Definition: G4Types.hh:78
static const double s
Definition: G4SIunits.hh:168
string material
Definition: eplot.py:19
G4GLOB_DLL std::ostream G4cout
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > excit
double energy
Definition: plottest35.C:25
Float_t Z
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:596
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > param
G4bool contains(const G4double &) const
size_t GetNumberOfElements() const
Definition: G4Material.hh:186
#define G4endl
Definition: G4ios.hh:61
static const double m
Definition: G4SIunits.hh:128
static const double barn
Definition: G4SIunits.hh:104
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:190
double G4double
Definition: G4Types.hh:76
G4double GetZ() const
Definition: G4Element.hh:131
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

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

◆ Parameter()

G4double G4RDeIonisationParameters::Parameter ( G4int  Z,
G4int  shellIndex,
G4int  parameterIndex,
G4double  e 
) const

Definition at line 91 of file G4RDeIonisationParameters.cc.

94 {
95  G4double value = 0.;
96  G4int id = Z*100 + parameterIndex;
97  std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator pos;
98 
99  pos = param.find(id);
100  if (pos!= param.end()) {
101  G4RDVEMDataSet* dataSet = (*pos).second;
102  G4int nShells = dataSet->NumberOfComponents();
103 
104  if(shellIndex < nShells) {
105  const G4RDVEMDataSet* component = dataSet->GetComponent(shellIndex);
106  const G4DataVector ener = component->GetEnergies(0);
107  G4double ee = std::max(ener.front(),std::min(ener.back(),e));
108  value = component->FindValue(ee);
109  } else {
110  G4cout << "WARNING: G4IonisationParameters::FindParameter "
111  << "has no parameters for shell= " << shellIndex
112  << "; Z= " << Z
113  << G4endl;
114  }
115  } else {
116  G4cout << "WARNING: G4IonisationParameters::Parameter "
117  << "did not find ID = "
118  << shellIndex << G4endl;
119  }
120 
121  return value;
122 }
virtual const G4RDVEMDataSet * GetComponent(G4int componentId) const =0
int G4int
Definition: G4Types.hh:78
virtual size_t NumberOfComponents(void) const =0
G4GLOB_DLL std::ostream G4cout
Float_t Z
virtual G4double FindValue(G4double x, G4int componentId=0) const =0
virtual const G4DataVector & GetEnergies(G4int componentId) const =0
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > param
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static const G4double pos
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintData()

void G4RDeIonisationParameters::PrintData ( void  ) const

Definition at line 373 of file G4RDeIonisationParameters.cc.

374 {
375  G4cout << G4endl;
376  G4cout << "===== G4RDeIonisationParameters =====" << G4endl;
377  G4cout << G4endl;
378 
379  size_t nZ = activeZ.size();
380  std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator pos;
381 
382  for (size_t i=0; i<nZ; i++) {
383  G4int Z = (G4int)activeZ[i];
384 
385  for (size_t j=0; j<length; j++) {
386 
387  G4int index = Z*100 + j;
388 
389  pos = param.find(index);
390  if (pos!= param.end()) {
391  G4RDVEMDataSet* dataSet = (*pos).second;
392  size_t nShells = dataSet->NumberOfComponents();
393 
394  for (size_t k=0; k<nShells; k++) {
395 
396  G4cout << "===== Z= " << Z << " shell= " << k
397  << " parameter[" << j << "] ====="
398  << G4endl;
399  const G4RDVEMDataSet* comp = dataSet->GetComponent(k);
400  comp->PrintData();
401  }
402  }
403  }
404  }
405  G4cout << "====================================" << G4endl;
406 }
Int_t index
virtual const G4RDVEMDataSet * GetComponent(G4int componentId) const =0
int G4int
Definition: G4Types.hh:78
virtual size_t NumberOfComponents(void) const =0
G4GLOB_DLL std::ostream G4cout
Float_t Z
virtual void PrintData(void) const =0
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > param
#define G4endl
Definition: G4ios.hh:61
static const G4double pos
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ activeZ

G4DataVector G4RDeIonisationParameters::activeZ
private

Definition at line 88 of file G4RDeIonisationParameters.hh.

◆ excit

std::map<G4int,G4RDVEMDataSet*,std::less<G4int> > G4RDeIonisationParameters::excit
private

Definition at line 92 of file G4RDeIonisationParameters.hh.

◆ length

size_t G4RDeIonisationParameters::length
private

Definition at line 94 of file G4RDeIonisationParameters.hh.

◆ param

std::map<G4int,G4RDVEMDataSet*,std::less<G4int> > G4RDeIonisationParameters::param
private

Definition at line 91 of file G4RDeIonisationParameters.hh.

◆ zMax

G4int G4RDeIonisationParameters::zMax
private

Definition at line 86 of file G4RDeIonisationParameters.hh.

◆ zMin

G4int G4RDeIonisationParameters::zMin
private

Definition at line 85 of file G4RDeIonisationParameters.hh.


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