![]() |
ENSDF++ 1.1
An easy, fast and simple way to run querys towards the ENSDF database, written in C++.
|
The purpose of this class is to run a specific query on the ENSDF object. More...
#include <DataQueryIsomer.h>
Public Member Functions | |
DataQueryIsomer (ENSDF *ENSDFDatabase, VerbosePrinter *toRegister=NULL) | |
Creates the object and prepares it for running queries on it. | |
list< InterestingDecayIsomer * > | RunQuery (double minT, double maxT) |
Runs a query on the ENSDF object. | |
Protected Member Functions | |
list< InterestingDecayIsomer * > | DetectInterestingStuffWithThisIsotope (Isotop *isotopToCheck, double minT, double maxT) |
Searches a specific isotope for isomers. | |
Static Protected Member Functions | |
static bool | CompareElementsForUnique (const InterestingDecayIsomer *G1, const InterestingDecayIsomer *G2) |
Predicate used for comparing InterestingDecayIsomer pointers when sorting. Just compares the nucleid objects. | |
static bool | CompareElementsForSort (const InterestingDecayIsomer *G1, const InterestingDecayIsomer *G2) |
Predicate used for comparing InterestingDecayIsomer pointers when removing doubles. Just compares the nucleid objects. |
The purpose of this class is to run a specific query on the ENSDF object.
This query searches the ENSDF for isomers, that is, isotopes that has excited levels that have a lifetime within a certain timespan.
Definition at line 35 of file DataQueryIsomer.h.
DataQueryIsomer::DataQueryIsomer | ( | ENSDF * | ENSDFDatabase, |
VerbosePrinter * | toRegister = NULL |
||
) |
Creates the object and prepares it for running queries on it.
ENSDFDatabase | The ENSDF object to run queries on. |
toRegister | Used to display information to the user. |
Definition at line 3 of file DataQueryIsomer.cpp.
References DataQuery::myENSDF, and VerbosePrinterEventEnabled::registerListener().
{ registerListener(toRegister); myENSDF = ENSDFDatabase; }
bool DataQueryIsomer::CompareElementsForSort | ( | const InterestingDecayIsomer * | G1, |
const InterestingDecayIsomer * | G2 | ||
) | [static, protected] |
Predicate used for comparing InterestingDecayIsomer pointers when removing doubles. Just compares the nucleid objects.
G1 | Pointer to compare. |
G2 | Pointer to compare. |
Definition at line 61 of file DataQueryIsomer.cpp.
References InterestingDecay::getNukleid(), and NULL.
Referenced by DetectInterestingStuffWithThisIsotope().
{ if(G1!=NULL && G2!=NULL) return G1->getNukleid()<G2->getNukleid(); return G1!=NULL; }
bool DataQueryIsomer::CompareElementsForUnique | ( | const InterestingDecayIsomer * | G1, |
const InterestingDecayIsomer * | G2 | ||
) | [static, protected] |
Predicate used for comparing InterestingDecayIsomer pointers when sorting. Just compares the nucleid objects.
G1 | Pointer to compare. |
G2 | Pointer to compare. |
Definition at line 68 of file DataQueryIsomer.cpp.
References InterestingDecay::getNukleid(), and NULL.
Referenced by DetectInterestingStuffWithThisIsotope().
{ if(G1!=NULL && G2!=NULL) return G1->getNukleid()==G2->getNukleid(); return G1==G2; }
list< InterestingDecayIsomer * > DataQueryIsomer::DetectInterestingStuffWithThisIsotope | ( | Isotop * | isotopToCheck, |
double | minT, | ||
double | maxT | ||
) | [protected] |
Searches a specific isotope for isomers.
isotopToCheck | The isotope to search. |
minT | The minimum level lifetime. |
maxT | The maximum level lifetime. |
Definition at line 29 of file DataQueryIsomer.cpp.
References CompareElementsForSort(), CompareElementsForUnique(), Isotop::getDatasets(), Isotop::getNukleid(), NULL, Nukleid::toString(), and VerbosePrinterEventEnabled::vPrint().
Referenced by RunQuery().
{ list<InterestingDecayIsomer* > toReturn; vPrint(7, "Searching through isotope %s.\n", isotopToCheck->getNukleid().toString().c_str()); list<Dataset* > myDatasets = isotopToCheck->getDatasets(); vPrint(9, "%d datasets to search.\n",myDatasets.size()); for(list<Dataset* >::iterator ir = myDatasets.begin(); ir!=myDatasets.end(); ir++) { list<LevelRecord *> myLevelRecords = (*ir)->getLevelRecords(); vPrint(12, "Found %d levels.\n", myLevelRecords.size()); for(list<LevelRecord *>::iterator it = myLevelRecords.begin(); it!=myLevelRecords.end(); it++) { if(*it!=NULL) { int pushback = 0; if((*it)->getEnergy()>0 && (*it)->getHalfLife()>=minT && (*it)->getHalfLife()<=maxT) { pushback = 1; toReturn.push_back(new InterestingDecayIsomer((*it)->getNukleid(), (*it)->getHalfLife(), (*it)->getEnergy())); } vPrint(15,"%s with energy %f, half-life %f, pushback %d.\n", isotopToCheck->getNukleid().toString().c_str(),(*it)->getEnergy(), (*it)->getHalfLife(), pushback); } } } toReturn.sort(&CompareElementsForSort); vPrint(8,"Size before truncation: %d.\n",toReturn.size()); toReturn.unique(&CompareElementsForUnique); vPrint(8,"Size after truncation: %d.\n", toReturn.size()); return toReturn; }
list< InterestingDecayIsomer * > DataQueryIsomer::RunQuery | ( | double | minT, |
double | maxT | ||
) |
Runs a query on the ENSDF object.
minT | The minimum time for the excited level. |
maxT | The maximum time for the excited level. |
Definition at line 10 of file DataQueryIsomer.cpp.
References DetectInterestingStuffWithThisIsotope(), ENSDF::getAllIsotopes(), DataQuery::myENSDF, and VerbosePrinterEventEnabled::vPrint().
Referenced by ENSDFProcessor::runIsomerQuery().
{ vPrint(4,"Query parameters: Min time: %e s, max time: %e s.\n", minT, maxT); list<InterestingDecayIsomer* > toReturn; map< Nukleid, Isotop*> myIsotopeMap = myENSDF->getAllIsotopes(); vPrint(4,"Searching through isotopes.\n"); for(map< Nukleid, Isotop*>::iterator it = myIsotopeMap.begin(); it!=myIsotopeMap.end(); it++) { list<InterestingDecayIsomer* > tempList = DetectInterestingStuffWithThisIsotope(it->second, minT, maxT); toReturn.insert(toReturn.end(), tempList.begin(), tempList.end()); } toReturn.sort(); toReturn.unique(); return toReturn; }