StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiTrackFinderFilter.cxx
1 #include "StiTrackFinderFilter.h"
2 #include "StiKalmanTrack.h"
3 #include "StiKalmanTrackNode.h"
4 #include "StiKTNIterator.h"
5 
6 StiTrackFinderFilter::StiTrackFinderFilter()
7  : _minPtsCount(4),
8  _minFitPtsCount(4),
9  _minFitToPtsRatio(0.5)
10 {}
11 
12 StiTrackFinderFilter::StiTrackFinderFilter(const string & name, const string & description)
13  : _minPtsCount(4),
14  _minFitPtsCount(4),
15  _minFitToPtsRatio(0.3)
16 {}
17 
18 StiTrackFinderFilter::~StiTrackFinderFilter()
19 {}
20 
21 bool StiTrackFinderFilter::accept(const StiTrack *track) const
22 {
23  int npts = track->getPointCount();
24  int fitNpts = track->getFitPointCount();
25 
26  if (npts > _minPtsCount && fitNpts > _minFitPtsCount) {
27 #ifdef NODE_CHECK
28  //cout << " $";
29  const StiKalmanTrack * kTrack = static_cast<const StiKalmanTrack*>(track);
30  if (kTrack==0) return false;
31  StiKalmanTrackNode* leaf = kTrack->getLastNode();
32  if (!leaf) return false;
33  //cout << " = ";
34  StiKTNForwardIterator it(leaf);
35  StiKTNForwardIterator end = it.end();
36  //cout << " #";
37  bool weird = false;
38  int bad = 0;
39  while (it!=end)
40  {
41  const StiKalmanTrackNode& node = *it;
42  double x_g = node.x_g();
43  double y_g = node.y_g();
44  double z_g = node.z_g();
45  double rt_g = sqrt(x_g*x_g+y_g*y_g);
46  if (rt_g>210. || fabs(z_g)>250. )
47  bad++;
48  if (bad>2) weird = true;
49  ++it;
50  }
51 
52  if (!weird)
53  return kNoErrors;
54  else
55  return kWeird;
56 #else
57  return kNoErrors;
58 #endif /* NODE_CHECK */
59  }
60  else{
61  if (npts > _minPtsCount)
62  return kNoEnoughValidHits;
63  else
64  return kNoEnoughFittedValidHits;
65  }
66  return false;
67 }
68 
69 void StiTrackFinderFilter::initialize()
70 {
71 }
72 
73 void StiTrackFinderFilter::setDefaults()
74 {
75 }
Definition of Kalman Track.
Abstract definition of a Track.
Definition: StiTrack.h:59
StiKalmanTrackNode * getLastNode() const
Accessor method returns the last node associated with the track.
Definition of Kalman Track.