Import Geant4 4.1.0 source tree
This commit is contained in:
@@ -0,0 +1,527 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4AugerData.cc v1.0
|
||||
//
|
||||
//
|
||||
// Author: Alfonso Mmantero (Alfonso.Mantero@ge.infn.it)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// Based on G4FluoData by Elena Guardincerri
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4AugerData.hh"
|
||||
#include "G4DataVector.hh"
|
||||
#include "g4std/fstream"
|
||||
#include "g4std/strstream"
|
||||
|
||||
G4AugerData::G4AugerData()
|
||||
{
|
||||
|
||||
G4int n = 0;
|
||||
G4int pos = 0;
|
||||
|
||||
for (pos = 0 ; pos < 100; pos++)
|
||||
{
|
||||
numberOfVacancies.push_back(n);
|
||||
}
|
||||
|
||||
BuildAugerTransitionTable();
|
||||
|
||||
|
||||
}
|
||||
|
||||
G4AugerData::~G4AugerData()
|
||||
{
|
||||
/*
|
||||
G4std::map<G4int,G4std::vector<G4AugerTransition>,G4std::less<G4int> >::iterator pos;
|
||||
|
||||
for (pos = augerTransitionTable.begin(); pos != augerTransitionTable.end(); pos++)
|
||||
{
|
||||
G4std::vector<G4AugerTransition> dataSet = (*pos).second;
|
||||
delete dataSet;
|
||||
}
|
||||
for (pos = energyMap.begin(); pos != energyMap.end(); pos++)
|
||||
{
|
||||
G4std::map<G4Int,G4DataVector*,G4std::less<G4int>>* dataMap = (*pos).second;
|
||||
for (pos2 = newIdProbabilityMap.begin(); pos2 != idMap.end(); pos2++)
|
||||
{
|
||||
G4DataVector* dataSet = (*pos2).second;
|
||||
delete dataSet;
|
||||
}
|
||||
}
|
||||
for (pos = probabilityMap.begin(); pos != probabilityMap.end(); pos++)
|
||||
{
|
||||
G4std::map<G4Int,G4DataVector*,G4std::less<G4int>>* dataMap = (*pos).second;
|
||||
for (pos2 = newIdProbabilityMap.begin(); pos2 != idMap.end(); pos2++)
|
||||
{
|
||||
G4DataVector* dataSet = (*pos2).second;
|
||||
delete dataSet;
|
||||
}
|
||||
}
|
||||
for (pos2 = newIdMap.begin(); pos2 != idMap.end(); pos2++)
|
||||
{
|
||||
G4DataVector* dataSet = (*pos2).second;
|
||||
delete dataSet;
|
||||
}
|
||||
for (pos2 = newIdEnergyMap.begin(); pos2 != idMap.end(); pos2++)
|
||||
{
|
||||
G4DataVector* dataSet = (*pos2).second;
|
||||
delete dataSet;
|
||||
}
|
||||
for (pos2 = newIdProbabilityMap.begin(); pos2 != idMap.end(); pos2++)
|
||||
{
|
||||
G4DataVector* dataSet = (*pos2).second;
|
||||
delete dataSet;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
size_t G4AugerData::NumberOfVacancies(G4int Z) const
|
||||
{
|
||||
return numberOfVacancies[Z];
|
||||
}
|
||||
|
||||
G4int G4AugerData::VacancyId(G4int Z, G4int vacancyIndex) const
|
||||
{
|
||||
|
||||
G4int n = 0;
|
||||
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
|
||||
{G4Exception("G4AugerData::vacancyIndex outside boundaries");}
|
||||
else {
|
||||
trans_Table::const_iterator element = augerTransitionTable.find(Z);
|
||||
if (element == augerTransitionTable.end()) {G4Exception("G4AugerData::augerTransitionTable: Data not Loaded");}
|
||||
G4std::vector<G4AugerTransition> dataSet = (*element).second;
|
||||
n = (G4int) dataSet[vacancyIndex].FinalShellId();
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Attenzione: questa funzione vuole l'indice della vacanza, non l'Id
|
||||
|
||||
|
||||
size_t G4AugerData::NumberOfTransitions(G4int Z, G4int vacancyIndex) const
|
||||
{
|
||||
G4int n = 0;
|
||||
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
|
||||
{G4Exception("G4AugerData::vacancyIndex outside boundaries");}
|
||||
else {
|
||||
trans_Table::const_iterator element = augerTransitionTable.find(Z);
|
||||
if (element == augerTransitionTable.end()) {G4Exception("G4AugerData::augerTransitionTable: Data not Loaded");}
|
||||
G4std::vector<G4AugerTransition> dataSet = (*element).second;
|
||||
n = (G4int)dataSet[vacancyIndex].TransitionOriginatingShellIds()->size();
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
||||
size_t G4AugerData::NumberOfAuger(G4int Z, G4int initIndex, G4int vacancyId) const
|
||||
{
|
||||
size_t n = 0;
|
||||
if (initIndex<0 || initIndex>=numberOfVacancies[Z])
|
||||
{G4Exception("G4AugerData::vacancyIndex outside boundaries");}
|
||||
else {
|
||||
trans_Table::const_iterator element = augerTransitionTable.find(Z);
|
||||
if (element == augerTransitionTable.end()) {G4Exception("G4AugerData::augerTransitionTable: Data not Loaded");}
|
||||
G4std::vector<G4AugerTransition> dataSet = (*element).second;
|
||||
const G4std::vector<G4int>* temp = dataSet[initIndex].AugerOriginatingShellIds(vacancyId);
|
||||
n = temp->size();
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t G4AugerData::AugerShellId(G4int Z, G4int vacancyIndex, G4int transId, G4int augerIndex) const
|
||||
{
|
||||
size_t n = 0;
|
||||
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
|
||||
{G4Exception("G4AugerData::vacancyIndex outside boundaries");}
|
||||
else {
|
||||
trans_Table::const_iterator element = augerTransitionTable.find(Z);
|
||||
if (element == augerTransitionTable.end()) {G4Exception("G4AugerData::augerTransitionTable: Data not Loaded");}
|
||||
G4std::vector<G4AugerTransition> dataSet = (*element).second;
|
||||
n = dataSet[vacancyIndex].AugerOriginatingShellId(augerIndex,transId);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
G4int G4AugerData::StartShellId(G4int Z, G4int vacancyIndex, G4int transitionShellIndex) const
|
||||
{
|
||||
G4int n = 0;
|
||||
|
||||
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
|
||||
{G4Exception("G4AugerData::vacancyIndex outside boundaries");}
|
||||
else {
|
||||
trans_Table::const_iterator element = augerTransitionTable.find(Z);
|
||||
if (element == augerTransitionTable.end()) {G4Exception("G4AugerData::augerTransitionTable: Data not Loaded");}
|
||||
G4std::vector<G4AugerTransition> dataSet = (*element).second;
|
||||
n = dataSet[vacancyIndex].TransitionOriginatingShellId(transitionShellIndex);
|
||||
}
|
||||
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
G4double G4AugerData::StartShellEnergy(G4int Z, G4int vacancyIndex, G4int transitionId, G4int augerIndex) const
|
||||
{
|
||||
G4double n = 0;
|
||||
|
||||
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
|
||||
{G4Exception("G4AugerData::vacancyIndex outside boundaries");}
|
||||
else {
|
||||
trans_Table::const_iterator element = augerTransitionTable.find(Z);
|
||||
if (element == augerTransitionTable.end()) {G4Exception("G4AugerData::augerTransitionTable: Data not Loaded");}
|
||||
G4std::vector<G4AugerTransition> dataSet = (*element).second;
|
||||
n = dataSet[vacancyIndex].AugerTransitionEnergy(augerIndex,transitionId);
|
||||
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
G4double G4AugerData::StartShellProb(G4int Z, G4int vacancyIndex,G4int transitionId,G4int augerIndex) const
|
||||
{
|
||||
G4double n = 0;
|
||||
|
||||
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
|
||||
{G4Exception("G4AugerData::vacancyIndex outside boundaries");}
|
||||
else {
|
||||
trans_Table::const_iterator element = augerTransitionTable.find(Z);
|
||||
if (element == augerTransitionTable.end()) {G4Exception("G4AugerData::augerTransitionTable: Data not Loaded");}
|
||||
G4std::vector<G4AugerTransition> dataSet = (*element).second;
|
||||
n = dataSet[vacancyIndex].AugerTransitionProbability(augerIndex, transitionId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
G4std::vector<G4AugerTransition> G4AugerData::LoadData(G4int Z)
|
||||
{
|
||||
// Build the complete string identifying the file with the data set
|
||||
|
||||
char nameChar[100] = {""};
|
||||
G4std::ostrstream ost(nameChar, 100, G4std::ios::out);
|
||||
if(Z != 0){
|
||||
ost << "au-tr-pr-"<< Z << ".dat";
|
||||
}
|
||||
else{
|
||||
ost << "au-tr-pr-"<<".dat";
|
||||
}
|
||||
G4String name(nameChar);
|
||||
|
||||
char* path = getenv("G4LEDATA");
|
||||
if (!path)
|
||||
{
|
||||
G4String excep = "G4EMDataSet - G4LEDATA environment variable not set";
|
||||
G4Exception(excep);
|
||||
}
|
||||
|
||||
G4String pathString(path);
|
||||
G4String dirFile = pathString + "/auger/" + name;
|
||||
G4std::ifstream file(dirFile);
|
||||
G4std::filebuf* lsdp = file.rdbuf();
|
||||
|
||||
if (! (lsdp->is_open()) )
|
||||
{
|
||||
G4String excep = "G4AugerData - data file: " + dirFile + " not found";
|
||||
G4Exception(excep);
|
||||
}
|
||||
|
||||
|
||||
G4double a = 0;
|
||||
G4int k = 1;
|
||||
G4int s = 0;
|
||||
|
||||
G4int vacId = 0;
|
||||
G4std::vector<G4int>* initIds = new G4std::vector<G4int>;
|
||||
G4std::vector<G4int>* newIds = new G4std::vector<G4int>;
|
||||
G4DataVector* transEnergies = new G4DataVector;
|
||||
G4DataVector* transProbabilities = new G4DataVector;
|
||||
G4std::vector<G4AugerTransition> augerTransitionVector;
|
||||
G4std::map<G4int,G4std::vector<G4int>,G4std::less<G4int> >* newIdMap =
|
||||
new G4std::map<G4int,G4std::vector<G4int>,G4std::less<G4int> >;
|
||||
G4std::map<G4int,G4DataVector,G4std::less<G4int> >* newEnergyMap =
|
||||
new G4std::map<G4int,G4DataVector,G4std::less<G4int> >;
|
||||
G4std::map<G4int,G4DataVector,G4std::less<G4int> >* newProbabilityMap =
|
||||
new G4std::map<G4int,G4DataVector,G4std::less<G4int> >;
|
||||
|
||||
|
||||
do {
|
||||
file >> a;
|
||||
|
||||
|
||||
G4int nColumns = 4;
|
||||
|
||||
if (a == -1)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (s == 0)
|
||||
{
|
||||
// End of a shell data set
|
||||
|
||||
|
||||
|
||||
G4std::vector<G4int>::iterator vectorIndex = initIds->begin();
|
||||
|
||||
vacId = *vectorIndex;
|
||||
|
||||
//initIds->erase(vectorIndex);
|
||||
|
||||
|
||||
|
||||
G4std::vector<G4int> identifiers;
|
||||
for (vectorIndex = initIds->begin()+1 ; vectorIndex != initIds->end(); ++vectorIndex){
|
||||
|
||||
identifiers.push_back(*vectorIndex);
|
||||
}
|
||||
|
||||
vectorIndex = (initIds->end())-1;
|
||||
|
||||
G4int augerShellId = *(vectorIndex);
|
||||
|
||||
|
||||
(*newIdMap)[augerShellId] = *newIds;
|
||||
(*newEnergyMap)[augerShellId] = *transEnergies;
|
||||
(*newProbabilityMap)[augerShellId] = *transProbabilities;
|
||||
|
||||
augerTransitionVector.push_back(G4AugerTransition(vacId, identifiers, newIdMap, newEnergyMap, newProbabilityMap));
|
||||
|
||||
// Now deleting all the variables I used, and creating new ones for the next shell
|
||||
|
||||
delete newIdMap;
|
||||
delete newEnergyMap;
|
||||
delete newProbabilityMap;
|
||||
|
||||
G4int n = initIds->size();
|
||||
nInitShells.push_back(n);
|
||||
numberOfVacancies[Z]++;
|
||||
delete initIds;
|
||||
delete newIds;
|
||||
delete transEnergies;
|
||||
delete transProbabilities;
|
||||
initIds = new G4std::vector<G4int>;
|
||||
newIds = new G4std::vector<G4int>;
|
||||
transEnergies = new G4DataVector;
|
||||
transProbabilities = new G4DataVector;
|
||||
newIdMap = new G4std::map<G4int,G4std::vector<G4int>,G4std::less<G4int> >;
|
||||
newEnergyMap = new G4std::map<G4int,G4DataVector,G4std::less<G4int> >;
|
||||
newProbabilityMap = new G4std::map<G4int,G4DataVector,G4std::less<G4int> >;
|
||||
|
||||
|
||||
|
||||
}
|
||||
s++;
|
||||
if (s == nColumns)
|
||||
{
|
||||
s = 0;
|
||||
}
|
||||
}
|
||||
else if (a == -2)
|
||||
{
|
||||
// End of file; delete the empty vectors created
|
||||
//when encountering the last -1 -1 row
|
||||
delete initIds;
|
||||
delete newIds;
|
||||
delete transEnergies;
|
||||
delete transProbabilities;
|
||||
delete newIdMap ;
|
||||
delete newEnergyMap;
|
||||
delete newProbabilityMap;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (k%nColumns == 3){
|
||||
// 3rd column is the transition probabilities
|
||||
transProbabilities->push_back(a);
|
||||
|
||||
k++;}
|
||||
else if(k%nColumns == 2){
|
||||
// 2nd column is new auger vacancy
|
||||
|
||||
// 2nd column is new auger vacancy
|
||||
|
||||
G4int l = (G4int)a;
|
||||
newIds->push_back(l);
|
||||
|
||||
|
||||
k++;
|
||||
}
|
||||
else if (k%nColumns == 1)
|
||||
{
|
||||
// 1st column is shell id
|
||||
|
||||
if(initIds->size() == 0) {
|
||||
|
||||
// if this is the first data of the shell, alla the colums are equal
|
||||
// to the shell Id; so we skip the next colums ang go to the next row
|
||||
|
||||
initIds->push_back(a);
|
||||
file >> a;
|
||||
file >> a;
|
||||
file >> a;
|
||||
k = k+3;
|
||||
}
|
||||
else {
|
||||
|
||||
G4std::vector<G4int>::iterator vectorIndex = (initIds->end())-1;
|
||||
if((G4int)a != *vectorIndex){
|
||||
|
||||
|
||||
if((initIds->size()) == 1) {
|
||||
initIds->push_back(a);
|
||||
}
|
||||
else {
|
||||
|
||||
initIds->push_back(a);
|
||||
G4int augerShellId = *vectorIndex;
|
||||
|
||||
|
||||
(*newIdMap)[augerShellId] = *newIds;
|
||||
(*newEnergyMap)[augerShellId] = *transEnergies;
|
||||
(*newProbabilityMap)[augerShellId] = *transProbabilities;
|
||||
delete newIds;
|
||||
delete transEnergies;
|
||||
delete transProbabilities;
|
||||
newIds = new G4std::vector<G4int>;
|
||||
transEnergies = new G4DataVector;
|
||||
transProbabilities = new G4DataVector;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
k++;
|
||||
|
||||
}
|
||||
else if (k%nColumns == 0)
|
||||
|
||||
{//fourth column is transition energies
|
||||
G4double e = a * MeV;
|
||||
|
||||
transEnergies->push_back(e);
|
||||
k=1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (a != -2); // end of file
|
||||
file.close();
|
||||
return augerTransitionVector;
|
||||
}
|
||||
|
||||
void G4AugerData::BuildAugerTransitionTable()
|
||||
{
|
||||
|
||||
// trans_Table::iterator pos = augerTransitionTable.begin();
|
||||
|
||||
|
||||
for (G4int element = 6; element < 99; element++)
|
||||
{
|
||||
augerTransitionTable.insert(trans_Table::value_type(element,LoadData(element)));
|
||||
|
||||
//G4cout << "G4AugerData for Element no. " << element << " are loaded" << G4endl;
|
||||
|
||||
|
||||
}
|
||||
|
||||
G4cout << "AugerTransitionTable complete"<< G4endl;
|
||||
}
|
||||
|
||||
void G4AugerData::PrintData(G4int Z)
|
||||
{
|
||||
|
||||
for (G4int i = 0; i < numberOfVacancies[Z]; i++)
|
||||
{
|
||||
G4cout << "---- TransitionData for the vacancy nb "
|
||||
<<i
|
||||
<<" of the atomic number elemnt "
|
||||
<< Z
|
||||
<<"----- "
|
||||
<<G4endl;
|
||||
|
||||
for (size_t k = 0; k<=NumberOfTransitions(Z,i); k++)
|
||||
{
|
||||
G4int id = StartShellId(Z,i,k);
|
||||
|
||||
for (size_t a = 0; a <= NumberOfAuger(Z,i,id); a++) {
|
||||
|
||||
G4double e = StartShellEnergy(Z,i,id,a) /MeV;
|
||||
G4double p = StartShellProb(Z,i,id,a);
|
||||
G4int augerId = AugerShellId(Z, i, id, a);
|
||||
G4cout << k <<") Shell id: " << id <<G4endl;
|
||||
G4cout << " Auger Originatig Shell Id :"<< augerId <<G4endl;
|
||||
G4cout << " - Transition energy = " << e << " MeV "<<G4endl;
|
||||
G4cout << " - Transition probability = " << p <<G4endl;
|
||||
}
|
||||
}
|
||||
G4cout << "-------------------------------------------------"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
G4AugerTransition* G4AugerData::GetAugerTransition(G4int Z,G4int vacancyShellIndex)
|
||||
{
|
||||
G4std::vector<G4AugerTransition>* dataSet = &augerTransitionTable[Z];
|
||||
G4std::vector<G4AugerTransition>::iterator vectorIndex = dataSet->begin() + vacancyShellIndex;
|
||||
|
||||
G4AugerTransition* augerTransition = &(*vectorIndex);
|
||||
return augerTransition;
|
||||
}
|
||||
|
||||
G4std::vector<G4AugerTransition>* G4AugerData::GetAugerTransitions(G4int Z)
|
||||
{
|
||||
G4std::vector<G4AugerTransition>* dataSet = &augerTransitionTable[Z];
|
||||
return dataSet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user