![]() |
ENSDF++ 1.1
An easy, fast and simple way to run querys towards the ENSDF database, written in C++.
|
This class acts as an intermediate step between the Main function and the ENSDF object and the different DataQuery objects. More...
#include <ENSDFProcessor.h>
Public Member Functions | |
ENSDFProcessor (string ENSDFDirectory, string MassTableDirectory, VerbosePrinter *toRegister=NULL, unsigned int nbrOfThreads=5) | |
Constructor, constructs the processor, which will also construct the underlying ENSDF and MassTable objects. | |
~ENSDFProcessor () | |
Prevents memory leaks by destroying for example the ENSDF and MassTable objects. | |
list< InterestingDecayBetaGamma * > | runBetaGammaQuery (double minBetaDecayTime, double maxBetaDecayTime) |
Runs a DataQueryBetaGamma. | |
void | runBetaGammaQuery (double minBetaDecayTime, double maxBetaDecayTime, double minBetaBranchStrength, double minGammaBranchStrength, string outputFileName) |
Runs a DataQueryBetaGamma with the arguments minBetaDecayTime and maxBetaDecayTime, and saves the results to outputFileName. | |
void | runBetaGammaQuery_GenerateGammaList (double minBetaDecayTime, double maxBetaDecayTime, double minGammaBranchStrength, string outputFileName) |
Just like runBetaGammaQuery(double, double, double, double, string), but generates a list of nucleids and gamma energies only. | |
void | runBetaGammaQuery_GenerateChartList (double minBetaDecayTime, double maxBetaDecayTime, double minGammaBranchStrength, string outputFileName) |
Just like runBetaGammaQuery(double, double, double, double, string), but generates a list of nucleids and gamma energies only. | |
void | runBetaGammaQuery_GenerateTexList (double minBetaDecayTime, double maxBetaDecayTime, double minGammaBranchStrength, string outputFileName) |
Just like runBetaGammaQuery(double, double, double, double, string), but generates a list of nucleids and gamma energies only. | |
list< InterestingDecayIsomer * > | runIsomerQuery (double tLower, double tUpper) |
Runs a DataQueryIsomer. | |
void | runIsomerQuery (double tLower, double tUpper, string outputFileName) |
Calls runIsomerQuery(double, double), and writes the data to the file specified by outputFileName. | |
Protected Member Functions | |
vector< string > | getDirectoryContent (string DirectoryName) |
Returns a list of the files in a given directory. | |
Static Protected Member Functions | |
static int | one (const struct dirent *unused) |
Used to when retrieving directory content. | |
Protected Attributes | |
ENSDF * | myENSDF |
The ENSDF object used in this ENSDFprocessor. | |
MassTable * | myTable |
The MassTable object used in this ENSDFProcessor. |
This class acts as an intermediate step between the Main function and the ENSDF object and the different DataQuery objects.
It controlls the construction of the ENSDF and MassTable objects.
Definition at line 83 of file ENSDFProcessor.h.
ENSDFProcessor::ENSDFProcessor | ( | string | ENSDFDirectory, |
string | MassTableDirectory, | ||
VerbosePrinter * | toRegister = NULL , |
||
unsigned int | nbrOfThreads = 5 |
||
) |
Constructor, constructs the processor, which will also construct the underlying ENSDF and MassTable objects.
ENSDFDirectory | The directory containing the ENSDF files. |
MassTableDirectory | The directory containing the MassTable files (mass.mas03). |
toRegister | Used to display information to the user. |
nbrOfThreads | The number of working threads the ENSDF object should use when constructing the Isotope objects. |
Definition at line 3 of file ENSDFProcessor.cpp.
References getDirectoryContent(), myENSDF, myTable, VerbosePrinterEventEnabled::registerChild(), and VerbosePrinterEventEnabled::registerListener().
{ registerListener(toRegister); vector<string> myDirectory = getDirectoryContent(ENSDFDirectory); for(unsigned int i = 0; i<myDirectory.size(); i++) { myDirectory[i]=ENSDFDirectory + "/" + myDirectory[i]; } myENSDF = new ENSDF(myDirectory, toRegister, nbrOfThreads); vector<string> myMassDirectory = getDirectoryContent(MassTableDirectory); myTable = new MassTable(MassTableDirectory + "/" + myMassDirectory.front(), toRegister); registerChild(myTable); registerChild(myENSDF); }
vector< string > ENSDFProcessor::getDirectoryContent | ( | string | DirectoryName | ) | [protected] |
Returns a list of the files in a given directory.
DirectoryName | The directory to find the files in. |
Definition at line 182 of file ENSDFProcessor.cpp.
References one(), and VerbosePrinterEventEnabled::vPrint().
Referenced by ENSDFProcessor().
{ vPrint(3,"Loading directory content of %s\n",directoryName.c_str()); vector<string> toReturn; struct dirent **eps; int n; n = scandir (directoryName.c_str(), &eps, one, alphasort); if (n >= 0) { int cnt; for (cnt = 0; cnt < n; ++cnt) { string tmp(eps[cnt]->d_name); if(!(tmp.compare(".")==0 || tmp.compare("..")==0 || tmp.compare(".svn")==0)) toReturn.push_back(eps[cnt]->d_name); } } else perror ("Couldn't open the directory"); vPrint(3,"Found %d entries in folder %s\n", (int)toReturn.size(), directoryName.c_str()); return toReturn; }
static int ENSDFProcessor::one | ( | const struct dirent * | unused | ) | [inline, static, protected] |
Used to when retrieving directory content.
unused | Unused. |
Definition at line 147 of file ENSDFProcessor.h.
Referenced by getDirectoryContent().
void ENSDFProcessor::runBetaGammaQuery | ( | double | minBetaDecayTime, |
double | maxBetaDecayTime, | ||
double | minBetaBranchStrength, | ||
double | minGammaBranchStrength, | ||
string | outputFileName | ||
) |
Runs a DataQueryBetaGamma with the arguments minBetaDecayTime and maxBetaDecayTime, and saves the results to outputFileName.
minBetaDecayTime | The minimum beta decay time to search for. |
maxBetaDecayTime | The maximum beta decay time to search for. |
minBetaBranchStrength | The minimum beta branch strength to print. |
minGammaBranchStrength | The minimum gamma branch strength to print. |
outputFileName | The file to write the result to. Must be a valid filename. |
Definition at line 28 of file ENSDFProcessor.cpp.
References NULL, runBetaGammaQuery(), and VerbosePrinterEventEnabled::vPrint().
{ vPrint(2,"Running query to file.\n"); FILE * myFile = fopen (outputFileName.c_str(), "w"); if(myFile!=NULL) { vPrint(3,"File was successfully created.\n"); list<InterestingDecayBetaGamma* > myDecays = runBetaGammaQuery(minBetaDecayTime, maxBetaDecayTime); for(list<InterestingDecayBetaGamma* >::iterator it = myDecays.begin(); it!=myDecays.end(); it++) { fprintf(myFile, "%s\n", (*it)->toString(minBetaBranchStrength, minGammaBranchStrength).c_str()); } vPrint(3,"Wrote %d posts to the file.\n", myDecays.size()); vPrint(3,"Closing file.\n"); fclose(myFile); for(list<InterestingDecayBetaGamma*>::iterator it = myDecays.begin(); it!=myDecays.end(); it++) { delete *it; *it = NULL; } } }
list< InterestingDecayBetaGamma * > ENSDFProcessor::runBetaGammaQuery | ( | double | minBetaDecayTime, |
double | maxBetaDecayTime | ||
) |
Runs a DataQueryBetaGamma.
minBetaDecayTime | The minimum beta decay time to search for. |
maxBetaDecayTime | The maximum beta decay time to search for. |
Definition at line 166 of file ENSDFProcessor.cpp.
References myENSDF, VerbosePrinterEventEnabled::myPrinter, myTable, NULL, VerbosePrinterEventEnabled::registerChild(), DataQueryBetaGamma::RunQuery(), and VerbosePrinterEventEnabled::vPrint().
Referenced by proceed_interact(), proceed_nointeract(), runBetaGammaQuery(), runBetaGammaQuery_GenerateChartList(), runBetaGammaQuery_GenerateGammaList(), and runBetaGammaQuery_GenerateTexList().
{ vPrint(2,"Creating BetaGamma data query.\n"); DataQueryBetaGamma * myQuery = new DataQueryBetaGamma(myENSDF, myTable, myPrinter); registerChild(myQuery); list<InterestingDecayBetaGamma*> myDecayList = myQuery->RunQuery(minBetaDecayTime, maxBetaDecayTime); delete myQuery; myQuery = NULL; return myDecayList; }
void ENSDFProcessor::runBetaGammaQuery_GenerateChartList | ( | double | minBetaDecayTime, |
double | maxBetaDecayTime, | ||
double | minGammaBranchStrength, | ||
string | outputFileName | ||
) |
Just like runBetaGammaQuery(double, double, double, double, string), but generates a list of nucleids and gamma energies only.
minBetaDecayTime | The minimum beta decay time to search for. |
maxBetaDecayTime | The maximum beta decay time to search for. |
minGammaBranchStrength | The minimum gamma branch strength to print. |
outputFileName | The file to write the result to. Must be a valid filename. |
Definition at line 76 of file ENSDFProcessor.cpp.
References NULL, runBetaGammaQuery(), and VerbosePrinterEventEnabled::vPrint().
Referenced by proceed_nointeract().
{ vPrint(2, "Running ChartList query to file.\n"); FILE * myFile = fopen(outputFileName.c_str(), "w"); if(myFile!=NULL) { vPrint(3,"File was successfully created.\n"); list<InterestingDecayBetaGamma* > myDecays = runBetaGammaQuery(minBetaDecayTime, maxBetaDecayTime); for(list<InterestingDecayBetaGamma*>::iterator it = myDecays.begin(); it!=myDecays.end(); it++) { fprintf(myFile, "%s", (*it)->toChartString(minGammaBranchStrength).c_str()); } vPrint(3,"Wrote %d posts to the file.\n", myDecays.size()); vPrint(3,"Closing file.\n"); fclose(myFile); for(list<InterestingDecayBetaGamma*>::iterator it = myDecays.begin(); it!=myDecays.end(); it++) { delete *it; *it = NULL; } } else vPrint(1,"Could not create file!"); }
void ENSDFProcessor::runBetaGammaQuery_GenerateGammaList | ( | double | minBetaDecayTime, |
double | maxBetaDecayTime, | ||
double | minGammaBranchStrength, | ||
string | outputFileName | ||
) |
Just like runBetaGammaQuery(double, double, double, double, string), but generates a list of nucleids and gamma energies only.
minBetaDecayTime | The minimum beta decay time to search for. |
maxBetaDecayTime | The maximum beta decay time to search for. |
minGammaBranchStrength | The minimum gamma branch strength to print. |
outputFileName | The file to write the result to. Must be a valid filename. |
Definition at line 51 of file ENSDFProcessor.cpp.
References NULL, runBetaGammaQuery(), and VerbosePrinterEventEnabled::vPrint().
Referenced by proceed_nointeract().
{ vPrint(2, "Running GammaList query to file.\n"); FILE * myFile = fopen(outputFileName.c_str(), "w"); if(myFile!=NULL) { vPrint(3,"File was successfully created.\n"); list<InterestingDecayBetaGamma* > myDecays = runBetaGammaQuery(minBetaDecayTime, maxBetaDecayTime); for(list<InterestingDecayBetaGamma*>::iterator it = myDecays.begin(); it!=myDecays.end(); it++) { fprintf(myFile, "%s", (*it)->toGammaString(minGammaBranchStrength).c_str()); } vPrint(3,"Wrote %d posts to the file.\n", myDecays.size()); vPrint(3,"Closing file.\n"); fclose(myFile); for(list<InterestingDecayBetaGamma*>::iterator it = myDecays.begin(); it!=myDecays.end(); it++) { delete *it; *it = NULL; } } else vPrint(1,"Could not create file!"); }
void ENSDFProcessor::runBetaGammaQuery_GenerateTexList | ( | double | minBetaDecayTime, |
double | maxBetaDecayTime, | ||
double | minGammaBranchStrength, | ||
string | outputFileName | ||
) |
Just like runBetaGammaQuery(double, double, double, double, string), but generates a list of nucleids and gamma energies only.
minBetaDecayTime | The minimum beta decay time to search for. |
maxBetaDecayTime | The maximum beta decay time to search for. |
minGammaBranchStrength | The minimum gamma branch strength to print. |
outputFileName | The file to write the result to. Must be a valid filename. |
Definition at line 102 of file ENSDFProcessor.cpp.
References NULL, runBetaGammaQuery(), and VerbosePrinterEventEnabled::vPrint().
Referenced by proceed_nointeract().
{ vPrint(2, "Running ChartList query to file.\n"); FILE * myFile = fopen(outputFileName.c_str(), "w"); if(myFile!=NULL) { vPrint(3,"File was successfully created.\n"); list<InterestingDecayBetaGamma* > myDecays = runBetaGammaQuery(minBetaDecayTime, maxBetaDecayTime); for(list<InterestingDecayBetaGamma*>::iterator it = myDecays.begin(); it!=myDecays.end(); it++) { fprintf(myFile, "%s", (*it)->toTexString(minGammaBranchStrength).c_str()); vPrint(3,"%s",(*it)->toTexString(minGammaBranchStrength).c_str()); } vPrint(3,"Wrote %d posts to the file.\n", myDecays.size()); vPrint(3,"Closing file.\n"); fclose(myFile); for(list<InterestingDecayBetaGamma*>::iterator it = myDecays.begin(); it!=myDecays.end(); it++) { delete *it; *it = NULL; } } else vPrint(1,"Could not create file!"); }
list< InterestingDecayIsomer * > ENSDFProcessor::runIsomerQuery | ( | double | tLower, |
double | tUpper | ||
) |
Runs a DataQueryIsomer.
tLower | The lower level decay time to search for. |
tUpper | The upper level decay time to search for. |
Definition at line 153 of file ENSDFProcessor.cpp.
References myENSDF, VerbosePrinterEventEnabled::myPrinter, NULL, VerbosePrinterEventEnabled::registerChild(), DataQueryIsomer::RunQuery(), and VerbosePrinterEventEnabled::vPrint().
Referenced by proceed_nointeract(), and runIsomerQuery().
{ vPrint(2, "Creating Isomer query.\n"); DataQueryIsomer * myQuery = new DataQueryIsomer(myENSDF, myPrinter); registerChild(myQuery); list<InterestingDecayIsomer*> myDecayList = myQuery->RunQuery(tLower, tUpper); delete myQuery; myQuery = NULL; return myDecayList; }
void ENSDFProcessor::runIsomerQuery | ( | double | tLower, |
double | tUpper, | ||
string | outputFileName | ||
) |
Calls runIsomerQuery(double, double), and writes the data to the file specified by outputFileName.
tLower | The lower level decay time to search for. |
tUpper | The upper level decay time to search for. |
outputFileName | The file to write the result to. |
Definition at line 130 of file ENSDFProcessor.cpp.
References NULL, runIsomerQuery(), and VerbosePrinterEventEnabled::vPrint().
{ vPrint(2,"Running Isomer query to file.\n"); FILE * myFile = fopen (outputFileName.c_str(), "w"); if(myFile!=NULL) { vPrint(3,"File was successfully created.\n"); list<InterestingDecayIsomer*> myDecays = runIsomerQuery(tLower, tUpper); for(list<InterestingDecayIsomer*>::iterator it = myDecays.begin(); it!=myDecays.end(); it++) { fprintf(myFile, "%s\n", (*it)->toString().c_str()); } vPrint(3,"Closing file.\n"); fclose(myFile); for(list<InterestingDecayIsomer*>::iterator it = myDecays.begin(); it!=myDecays.end(); it++) { delete *it; *it = NULL; } } vPrint(2,"Done with query.\n"); }