00001
00002
00003
00004
00005
00006 #include "Stiostream.h"
00007 #include <algorithm>
00008 using namespace std;
00009
00010 #include "StiTrack.h"
00011 #include "StiKalmanTrack.h"
00012 #include "StiTrackContainer.h"
00013 #include "Sti/Base/Filter.h"
00014
00015 StiTrackContainer::StiTrackContainer(const string & name, const string & description)
00016 : Named(name),
00017 Described(description)
00018 {
00019 cout <<"StiTrackContainer::StiTrackContainer() -I- Started with name:"<< name <<endl;
00020 }
00021
00022 StiTrackContainer::~StiTrackContainer()
00023 {
00024 cout <<"StiTrackContainer::~StiTrackContainer() -I- Done"<<endl;
00025 }
00026
00027
00028
00029 bool StiTrackLessThan::operator()(const StiTrack* lhs, const StiTrack* rhs) const
00030 {
00031 #if 0
00032 double lhsCurv = lhs->getCurvature();
00033 double rhsCurv = rhs->getCurvature();
00034 return fabs(lhsCurv) < fabs(rhsCurv);
00035 #endif //0
00036 int lN = ((StiKalmanTrack*)lhs)->getNNodes(3);
00037 int rN = ((StiKalmanTrack*)rhs)->getNNodes(3);
00038 return lN >= rN;
00039
00040
00041 }
00042
00048 int StiTrackContainer::getTrackCount(Filter<StiTrack> * filter) const
00049 {
00050 if (filter)
00051 {
00052
00053 filter->reset();
00054
00055 vector<StiTrack*>::const_iterator it;
00056 for (it=begin(); it!=end(); ++it)
00057 filter->filter(*it);
00058 return filter->getAcceptedCount();
00059 }
00060 else
00061 return size();
00062 }
00063 void StiTrackContainer::sort()
00064 {
00065 std::sort(begin(),end(),StiTrackLessThan());
00066 }