StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiTrackContainer.cxx
1 //StiTrackContainer.cxx
2 //M.L. Miller (Yale Software)
3 //05/05
4 
5 //std
6 #include "Stiostream.h"
7 #include <algorithm>
8 using namespace std;
9 
10 #include "StiTrack.h"
11 #include "StiKalmanTrack.h"
12 #include "StiTrackContainer.h"
13 #include "Sti/Base/Filter.h"
14 
15 StiTrackContainer::StiTrackContainer(const string & name, const string & description)
16  : Named(name),
17  Described(description)
18 {
19  cout <<"StiTrackContainer::StiTrackContainer() -I- Started with name:"<< name <<endl;
20 }
21 
22 StiTrackContainer::~StiTrackContainer()
23 {
24  cout <<"StiTrackContainer::~StiTrackContainer() -I- Done"<<endl;
25 }
26 
27 
28 
29 bool StiTrackLessThan::operator()(const StiTrack* lhs, const StiTrack* rhs) const
30 {
31 #if 0
32  double lhsCurv = lhs->getCurvature();
33  double rhsCurv = rhs->getCurvature();
34  return fabs(lhsCurv) < fabs(rhsCurv);
35 #endif //0
36  int lN = ((StiKalmanTrack*)lhs)->getNNodes(3);
37  int rN = ((StiKalmanTrack*)rhs)->getNNodes(3);
38  return lN >= rN;
39 
40 
41 }
42 
49 {
50  if (filter)
51  {
52  // reset filter counter to zero.
53  filter->reset();
54  // loop over all tracks and filter
55  vector<StiTrack*>::const_iterator it;
56  for (it=begin(); it!=end(); ++it)
57  filter->filter(*it);
58  return filter->getAcceptedCount();
59  }
60  else
61  return size();
62 }
63 void StiTrackContainer::sort()
64 {
65  std::sort(begin(),end(),StiTrackLessThan());
66 }
Definition of Kalman Track.
Abstract definition of a Track.
Definition: StiTrack.h:59
Define the Less-Than operator for track ordering in the track container.
Definition: Named.h:16
Definition of Kalman Track.
int getTrackCount(Filter< StiTrack > *filter) const