ENSDF++ 1.1
An easy, fast and simple way to run querys towards the ENSDF database, written in C++.
DataQueryIsomer.cpp
Go to the documentation of this file.
00001 #include "DataQueryIsomer.h"
00002 
00003 DataQueryIsomer::DataQueryIsomer(ENSDF * ENSDFDatabase, VerbosePrinter * toRegister)
00004 {
00005   registerListener(toRegister);
00006   myENSDF = ENSDFDatabase;
00007 }
00008 
00009 
00010 list<InterestingDecayIsomer* > DataQueryIsomer::RunQuery(double minT, double maxT)
00011 {
00012   vPrint(4,"Query parameters: Min time: %e s, max time: %e s.\n", minT, maxT);
00013 
00014   list<InterestingDecayIsomer* > toReturn;
00015   map< Nukleid, Isotop*> myIsotopeMap = myENSDF->getAllIsotopes();
00016   
00017   vPrint(4,"Searching through isotopes.\n");
00018   for(map< Nukleid, Isotop*>::iterator it = myIsotopeMap.begin(); 
00019       it!=myIsotopeMap.end(); it++)
00020     {
00021       list<InterestingDecayIsomer* > tempList = DetectInterestingStuffWithThisIsotope(it->second, minT, maxT);
00022       toReturn.insert(toReturn.end(), tempList.begin(), tempList.end());
00023     }
00024   toReturn.sort();
00025   toReturn.unique();
00026   return toReturn;
00027 }
00028 
00029 list<InterestingDecayIsomer* > DataQueryIsomer::DetectInterestingStuffWithThisIsotope(Isotop * isotopToCheck, double minT, double maxT)
00030 {
00031   list<InterestingDecayIsomer* > toReturn;
00032 
00033   vPrint(7, "Searching through isotope %s.\n", isotopToCheck->getNukleid().toString().c_str());
00034   list<Dataset* > myDatasets = isotopToCheck->getDatasets();
00035   vPrint(9, "%d datasets to search.\n",myDatasets.size());
00036   for(list<Dataset* >::iterator ir = myDatasets.begin(); ir!=myDatasets.end(); ir++)
00037     {
00038       list<LevelRecord *> myLevelRecords = (*ir)->getLevelRecords();
00039       vPrint(12, "Found %d levels.\n", myLevelRecords.size());
00040       for(list<LevelRecord *>::iterator it = myLevelRecords.begin(); it!=myLevelRecords.end(); it++)
00041         {
00042           if(*it!=NULL)
00043             {
00044               int pushback = 0;
00045               if((*it)->getEnergy()>0 && (*it)->getHalfLife()>=minT && (*it)->getHalfLife()<=maxT)
00046                 {
00047                   pushback = 1;
00048                   toReturn.push_back(new InterestingDecayIsomer((*it)->getNukleid(), (*it)->getHalfLife(), (*it)->getEnergy()));
00049                 }
00050               vPrint(15,"%s with energy %f, half-life %f, pushback %d.\n", isotopToCheck->getNukleid().toString().c_str(),(*it)->getEnergy(), (*it)->getHalfLife(), pushback);
00051             }
00052         }
00053     }
00054   toReturn.sort(&CompareElementsForSort);
00055   vPrint(8,"Size before truncation: %d.\n",toReturn.size());
00056   toReturn.unique(&CompareElementsForUnique);
00057   vPrint(8,"Size after truncation: %d.\n", toReturn.size());
00058   return toReturn;
00059 }
00060 
00061 bool DataQueryIsomer::CompareElementsForSort(const InterestingDecayIsomer * G1, const InterestingDecayIsomer * G2)
00062 {
00063   if(G1!=NULL && G2!=NULL)
00064     return G1->getNukleid()<G2->getNukleid();
00065   return G1!=NULL;
00066 }
00067 
00068 bool DataQueryIsomer::CompareElementsForUnique(const InterestingDecayIsomer * G1, const InterestingDecayIsomer * G2)
00069 {
00070   if(G1!=NULL && G2!=NULL)
00071     return G1->getNukleid()==G2->getNukleid();
00072   return G1==G2;
00073 }
 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