Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4RDFluoData Class Reference

#include <G4RDFluoData.hh>

Public Member Functions

 G4RDFluoData ()
 
 ~G4RDFluoData ()
 
size_t NumberOfVacancies () const
 
G4int VacancyId (G4int vacancyIndex) const
 
size_t NumberOfTransitions (G4int vacancyIndex) const
 
G4int StartShellId (G4int initIndex, G4int vacancyIndex) const
 
G4double StartShellEnergy (G4int initIndex, G4int vacancyIndex) const
 
G4double StartShellProb (G4int initIndex, G4int vacancyIndex) const
 
void LoadData (G4int Z)
 
void PrintData ()
 

Detailed Description

Definition at line 52 of file G4RDFluoData.hh.

Constructor & Destructor Documentation

G4RDFluoData::G4RDFluoData ( )

Definition at line 44 of file G4RDFluoData.cc.

45 {
46  numberOfVacancies=0;
47 }
G4RDFluoData::~G4RDFluoData ( )

Definition at line 49 of file G4RDFluoData.cc.

50 {
51  std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos;
52 
53  for (pos = idMap.begin(); pos != idMap.end(); ++pos)
54  {
55  G4DataVector* dataSet = (*pos).second;
56  delete dataSet;
57  }
58  for (pos = energyMap.begin(); pos != energyMap.end(); ++pos)
59  {
60  G4DataVector* dataSet = (*pos).second;
61  delete dataSet;
62  }
63  for (pos = probabilityMap.begin(); pos != probabilityMap.end(); ++pos)
64  {
65  G4DataVector* dataSet = (*pos).second;
66  delete dataSet;
67  }
68 }

Member Function Documentation

void G4RDFluoData::LoadData ( G4int  Z)

Definition at line 186 of file G4RDFluoData.cc.

References test::a, FatalException, G4Exception(), python.hepunit::MeV, and n.

Referenced by G4RDAtomicTransitionManager::G4RDAtomicTransitionManager().

187 {
188  // Build the complete string identifying the file with the data set
189 
190  std::ostringstream ost;
191  if(Z != 0){
192  ost << "fl-tr-pr-"<< Z << ".dat";
193  }
194  else{
195  ost << "fl-tr-pr-"<<".dat";
196  }
197  G4String name(ost.str());
198 
199  char* path = getenv("G4LEDATA");
200  if (!path)
201  {
202  G4String excep("G4LEDATA environment variable not set!");
203  G4Exception("G4RDEMDataSet::LoadData()", "InvalidSetup",
204  FatalException, excep);
205  }
206 
207  G4String pathString(path);
208  G4String fluor("/fluor/");
209  G4String dirFile = pathString + fluor + name;
210  std::ifstream file(dirFile);
211  std::filebuf* lsdp = file.rdbuf();
212 
213  if (! (lsdp->is_open()) )
214  {
215  G4String excep = "Data file: " + dirFile + " not found";
216  G4Exception("G4RDEMDataSet::LoadData()", "DataNotFound",
217  FatalException, excep);
218  }
219 
220  G4double a = 0;
221  G4int k = 1;
222  G4int s = 0;
223 
224  G4int vacIndex = 0;
225  G4DataVector* initIds = new G4DataVector;
226  G4DataVector* transEnergies = new G4DataVector;
227  G4DataVector* transProbabilities = new G4DataVector;
228 
229  do {
230  file >> a;
231  G4int nColumns = 3;
232  if (a == -1)
233  {
234  if (s == 0)
235  {
236  // End of a shell data set
237  idMap[vacIndex] = initIds;
238  energyMap[vacIndex] = transEnergies;
239  probabilityMap[vacIndex] = transProbabilities;
240  // G4double size=transProbabilities->size();
241  G4int n = initIds->size();
242 
243  nInitShells.push_back(n);
244  numberOfVacancies++;
245  // Start of new shell data set
246  initIds = new G4DataVector;
247  transEnergies = new G4DataVector;
248  transProbabilities = new G4DataVector;
249  vacIndex++;
250  }
251  s++;
252  if (s == nColumns)
253  {
254  s = 0;
255  }
256  }
257  else if (a == -2)
258  {
259  // End of file; delete the empty vectors created
260  //when encountering the last -1 -1 row
261  delete initIds;
262  delete transEnergies;
263  delete transProbabilities;
264  }
265  else
266  {
267 
268  if(k%nColumns == 2)
269  {
270  // 2nd column is transition probabilities
271 
272  if (a != -1) transProbabilities->push_back(a);
273 
274  k++;
275  }
276  else if (k%nColumns == 1)
277  {
278  // 1st column is shell id
279  // if this is the first data of the shell, all the colums are equal
280  // to the shell Id; so we skip the next colums ang go to the next row
281  if(initIds->size() == 0) {
282  if (a != -1) initIds->push_back((G4int)a);
283  file >> a;
284  file >> a;
285  k=k+2;
286  }
287  else{
288  if (a != -1) initIds->push_back(a);
289  }
290  k++;
291  }
292  else if (k%nColumns == 0)
293 
294  {//third column is transition energies
295 
296  if (a != -1)
297  {G4double e = a * MeV;
298  transEnergies->push_back(e);}
299 
300  k=1;
301  }
302  }
303  }
304  while (a != -2); // end of file
305  file.close();
306 }
const XML_Char * s
const XML_Char * name
int G4int
Definition: G4Types.hh:78
const G4int n
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double G4double
Definition: G4Types.hh:76
size_t G4RDFluoData::NumberOfTransitions ( G4int  vacancyIndex) const

Definition at line 94 of file G4RDFluoData.cc.

References FatalException, G4Exception(), and n.

Referenced by G4RDAtomicTransitionManager::G4RDAtomicTransitionManager(), and PrintData().

95 {
96  G4int n = 0;
97  if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies)
98  {G4Exception("G4RDFluoData::NumberOfTransitions()", "OutOfRange",
99  FatalException, "VacancyIndex outside boundaries!");}
100  else
101  {
102  n = nInitShells[vacancyIndex]-1;
103  //-1 is necessary because the elements of the vector nInitShells
104  //include also the vacancy shell:
105  // -1 subtracts this last one
106  }
107  return n;
108 }
int G4int
Definition: G4Types.hh:78
const G4int n
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
size_t G4RDFluoData::NumberOfVacancies ( ) const

Definition at line 70 of file G4RDFluoData.cc.

71 {
72  return numberOfVacancies;
73 }
void G4RDFluoData::PrintData ( void  )

Definition at line 308 of file G4RDFluoData.cc.

References G4cout, G4endl, python.hepunit::MeV, NumberOfTransitions(), StartShellEnergy(), StartShellId(), and StartShellProb().

309 {
310 
311  for (G4int i = 0; i <numberOfVacancies; i++)
312  {
313  G4cout << "---- TransitionData for the vacancy nb "
314  <<i
315  <<" ----- "
316  <<G4endl;
317 
318  for (size_t k = 0; k<NumberOfTransitions(i); k++)
319  {
320  G4int id = StartShellId(k,i);
321  // let's start from 1 because the first (index = 0) element of the vector
322  // is the id of the intial vacancy
323  G4double e = StartShellEnergy(k,i) /MeV;
324  G4double p = StartShellProb(k,i);
325  G4cout << k <<") Shell id: " << id <<G4endl;
326  G4cout << " - Transition energy = " << e << " MeV "<<G4endl;
327  G4cout << " - Transition probability = " << p <<G4endl;
328 
329  }
330  G4cout << "-------------------------------------------------"
331  << G4endl;
332  }
333 }
size_t NumberOfTransitions(G4int vacancyIndex) const
Definition: G4RDFluoData.cc:94
const char * p
Definition: xmltok.h:285
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4double StartShellEnergy(G4int initIndex, G4int vacancyIndex) const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4double StartShellProb(G4int initIndex, G4int vacancyIndex) const
G4int StartShellId(G4int initIndex, G4int vacancyIndex) const
G4double G4RDFluoData::StartShellEnergy ( G4int  initIndex,
G4int  vacancyIndex 
) const

Definition at line 136 of file G4RDFluoData.cc.

References FatalException, G4Exception(), and n.

Referenced by G4RDAtomicTransitionManager::G4RDAtomicTransitionManager(), and PrintData().

137 {
138  G4double n = -1;
139 
140  if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies)
141  {G4Exception("G4RDFluoData::StartShellEnergy()", "OutOfRange",
142  FatalException, "VacancyIndex outside boundaries!");}
143  else
144  {
145  std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
146 
147  pos = energyMap.find(vacancyIndex);
148 
149  G4DataVector dataSet = *((*pos).second);
150 
151  G4int nData = dataSet.size();
152  if (initIndex >= 0 && initIndex < nData)
153  {
154  n = dataSet[initIndex];
155 
156  }
157  }
158  return n;
159 }
int G4int
Definition: G4Types.hh:78
const G4int n
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double G4double
Definition: G4Types.hh:76
G4int G4RDFluoData::StartShellId ( G4int  initIndex,
G4int  vacancyIndex 
) const

Definition at line 109 of file G4RDFluoData.cc.

References FatalException, G4Exception(), and n.

Referenced by G4RDAtomicTransitionManager::G4RDAtomicTransitionManager(), and PrintData().

110 {
111  G4int n = -1;
112 
113  if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies)
114  {G4Exception("G4RDFluoData::StartShellId()", "OutOfRange",
115  FatalException, "VacancyIndex outside boundaries!");}
116  else
117  {
118  std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
119 
120  pos = idMap.find(vacancyIndex);
121 
122  G4DataVector dataSet = *((*pos).second);
123 
124  G4int nData = dataSet.size();
125  //The first Element of idMap's dataSets is the original shell of the vacancy,
126  //so we must start from the first element of dataSet
127  if (initIndex >= 0 && initIndex < nData)
128  {
129  n = (G4int) dataSet[initIndex+1];
130 
131  }
132  }
133  return n;
134 }
int G4int
Definition: G4Types.hh:78
const G4int n
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4double G4RDFluoData::StartShellProb ( G4int  initIndex,
G4int  vacancyIndex 
) const

Definition at line 161 of file G4RDFluoData.cc.

References FatalException, G4Exception(), and n.

Referenced by G4RDAtomicTransitionManager::G4RDAtomicTransitionManager(), and PrintData().

162 {
163  G4double n = -1;
164 
165  if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies)
166  {G4Exception("G4RDFluoData::StartShellProb()", "OutOfRange",
167  FatalException, "VacancyIndex outside boundaries!");}
168  else
169  {
170  std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
171 
172  pos = probabilityMap.find(vacancyIndex);
173 
174  G4DataVector dataSet = *((*pos).second);
175 
176  G4int nData = dataSet.size();
177  if (initIndex >= 0 && initIndex < nData)
178  {
179  n = dataSet[initIndex];
180 
181  }
182  }
183  return n;
184 }
int G4int
Definition: G4Types.hh:78
const G4int n
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double G4double
Definition: G4Types.hh:76
G4int G4RDFluoData::VacancyId ( G4int  vacancyIndex) const

Definition at line 75 of file G4RDFluoData.cc.

References FatalException, G4Exception(), and n.

Referenced by G4RDAtomicTransitionManager::G4RDAtomicTransitionManager().

76 {
77  G4int n = -1;
78  if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies)
79  {G4Exception("G4RDFluoData::VacancyId()", "OutOfRange",
80  FatalException, "VacancyIndex outside boundaries!");}
81  else
82  {
83  std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
84  pos = idMap.find(vacancyIndex);
85  if (pos!= idMap.end())
86  { G4DataVector dataSet = (*(*pos).second);
87  n = (G4int) dataSet[0];
88 
89  }
90  }
91  return n;
92 }
int G4int
Definition: G4Types.hh:78
const G4int n
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

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