00001 #include <list> 00002 #include <iostream> 00003 #include "ComparisonResult.h" 00004 #include "ComparisonResultList.h" 00005 00006 using std::cout; 00007 using std::endl; 00008 00009 ClassImp(ComparisonResultList) 00010 00011 ComparisonResultList::ComparisonResultList() 00012 { 00013 00014 //ComparisonResult *compres = new ComparisonResult(); 00015 //compResultList.push_back(*compres); 00016 00017 } 00018 00019 ComparisonResultList::~ComparisonResultList() 00020 { 00021 00022 //compResultList.erase(compResultList.begin(),compResultList.end()); 00023 00024 } 00025 00026 //**** METHODS 00027 00028 //------------------------- 00029 void ComparisonResultList::Erase(){ 00030 00031 compResultList.erase(compResultList.begin(),compResultList.end()); 00032 00033 } 00034 00035 //-------------------------- 00036 int ComparisonResultList::Size(){ 00037 00038 return compResultList.size(); 00039 00040 } 00041 00042 //-------------------------- 00043 float ComparisonResultList::LastDeltalnL(){ 00044 00045 if(compResultList.size()>0){ 00046 iter=compResultList.end(); 00047 iter--; 00048 00049 return (*iter).dLnL; 00050 } else { 00051 return 999999; 00052 } 00053 00054 } 00055 00056 //----------------------------- 00057 void ComparisonResultList::PopBack(){ 00058 00059 compResultList.pop_back(); 00060 00061 } 00062 00063 //------------------------------ 00064 void ComparisonResultList::PushBack(ComparisonResult *cr_in){ 00065 00066 compResultList.push_back(*cr_in); 00067 00068 } 00069 00070 //------------------------------- 00071 void ComparisonResultList::Sort(){ 00072 00073 compResultList.sort(); 00074 00075 } 00076 00077 //------------------------------- 00078 void ComparisonResultList::InsertSorted(ComparisonResult *cr_in){ 00079 list<ComparisonResult>::iterator it_beg = compResultList.begin(); 00080 list<ComparisonResult>::iterator it_end = compResultList.end(); 00081 list<ComparisonResult>::iterator it; 00082 for (it=it_beg;it!=it_end;++it) { 00083 if (cr_in->dLnL<(*it).dLnL) { 00084 // got the spot 00085 break; 00086 } 00087 } 00088 compResultList.insert(it,cr_in); // insert at spot (or end) 00089 } 00090 00091 00092 //------------------------------- 00093 void ComparisonResultList::PrintFirstLast(){ 00094 00095 if(compResultList.size()>0){ 00096 iter=compResultList.begin(); 00097 cout << "*********** First out of " << compResultList.size() << endl; 00098 cout << "Neutrino type: " << (*iter).idnu << "," << (*iter).idact <<endl; 00099 cout << "Energy: " << (*iter).eNu << endl; 00100 cout << "Delta lnL: " << (*iter).dLnL << endl; 00101 iter=compResultList.end(); 00102 iter--; 00103 cout << "*********** Last out of " << compResultList.size() << endl; 00104 cout << "Neutrino type: " << (*iter).idnu << "," << (*iter).idact <<endl; 00105 cout << "Energy: " << (*iter).eNu << endl; 00106 cout << "Delta lnL: " << (*iter).dLnL << endl; 00107 } else { 00108 cout << "--> ComparisonResultList is emtpy" << endl; 00109 } 00110 00111 } 00112
1.3.9.1