ENSDF++ 1.1
An easy, fast and simple way to run querys towards the ENSDF database, written in C++.
Public Member Functions | Protected Member Functions | Static Protected Member Functions
DataQueryIsomer Class Reference

The purpose of this class is to run a specific query on the ENSDF object. More...

#include <DataQueryIsomer.h>

Inheritance diagram for DataQueryIsomer:
DataQuery VerbosePrinterEventEnabled

List of all members.

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.

Detailed Description

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.

Author:
Rikard Lundmark

Definition at line 35 of file DataQueryIsomer.h.


Constructor & Destructor Documentation

DataQueryIsomer::DataQueryIsomer ( ENSDF ENSDFDatabase,
VerbosePrinter toRegister = NULL 
)

Creates the object and prepares it for running queries on it.

Parameters:
ENSDFDatabaseThe ENSDF object to run queries on.
toRegisterUsed to display information to the user.

Definition at line 3 of file DataQueryIsomer.cpp.

References DataQuery::myENSDF, and VerbosePrinterEventEnabled::registerListener().

{
  registerListener(toRegister);
  myENSDF = ENSDFDatabase;
}

Member Function Documentation

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.

Parameters:
G1Pointer to compare.
G2Pointer 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.

Parameters:
G1Pointer to compare.
G2Pointer 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.

Returns:
a list containing the InterestingDecayIsomer objects for this specific query.
Parameters:
isotopToCheckThe isotope to search.
minTThe minimum level lifetime.
maxTThe 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.

Returns:
a list containing the InterestingDecayIsomer objects detected when running the query.
Parameters:
minTThe minimum time for the excited level.
maxTThe 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;
}

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator Defines

Back to the main page of the Precalibrated Ion Beam Identification Detector project

Created by Rikard Lundmark