StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiDefaultTrackFilter.cxx
1 #include <cassert>
2 #include "StiDefaultTrackFilter.h"
3 
4 #include <stdexcept>
5 #include <string>
6 using std::string;
7 #include "Sti/Base/Parameter.h"
8 #include "Sti/Base/EditableParameter.h"
9 #include "Sti/StiTrack.h"
10 #include "StiDefaultTrackFilter.h"
11 
12 StiDefaultTrackFilter::StiDefaultTrackFilter()
14 {}
15 
16 StiDefaultTrackFilter::StiDefaultTrackFilter(const string & name, const string & description)
17  : EditableFilter<StiTrack>(name,description)
18 {}
19 
20 
21 StiDefaultTrackFilter::~StiDefaultTrackFilter()
22 {}
23 
24 void StiDefaultTrackFilter::initialize()
25 {
26  cout << "StiDefaultTrackFilter::initialize() - INFO - Starting" << endl;
27  parameterVector.clear();
28  add(new EditableParameter("Chi2Used", "Use Chi2", false, false, 0,1,1,Parameter::Boolean, StiTrack::kChi2));
29  add(new EditableParameter("Chi2Min", "Minimum Chi2", 0., 0., 0., 100.,1,Parameter::Double, StiTrack::kChi2));
30  add(new EditableParameter("Chi2Max", "Maximum Chi2", 20., 20., 0., 100.,1,Parameter::Double, StiTrack::kChi2));
31 
32  add(new EditableParameter("PhiUsed", "Use Phi", false, false, 0,1,1,Parameter::Boolean, StiTrack::kPhi));
33  add(new EditableParameter("PhiMin", "Minimum Phi", -3.2, -3.2, -3.2, 3.2, 2,Parameter::Double, StiTrack::kPhi));
34  add(new EditableParameter("PhiMax", "Maximum Phi", 3.2, 3.2, -3.2, 3.2, 2,Parameter::Double, StiTrack::kPhi));
35 
36  add(new EditableParameter("PtUsed", "Use Pt", true, true, 0,1,1,Parameter::Boolean, StiTrack::kPt));
37  add(new EditableParameter("PtMin", "Minimum Pt", 0.1, 0.1, 0., 100.,2,Parameter::Double, StiTrack::kPt));
38  add(new EditableParameter("PtMax", "Maximum Pt", 10., 10., 0., 100.,2,Parameter::Double, StiTrack::kPt));
39 
40  add(new EditableParameter("PUsed", "Use P", false, false, 0,1,1,Parameter::Boolean, StiTrack::kP));
41  add(new EditableParameter("PMin", "Minimum P", 0., 0., 0., 100.,2,Parameter::Double, StiTrack::kP));
42  add(new EditableParameter("PMax", "Maximum P", 10., 10., 0., 100.,2,Parameter::Double, StiTrack::kP));
43 
44  add(new EditableParameter("EtaUsed", "Use Eta", true, true, 0,1,1,Parameter::Boolean, StiTrack::kPseudoRapidity));
45  add(new EditableParameter("EtaMin", "Minimum Eta", -0.5, -0.5, -10., 10.,2,Parameter::Double, StiTrack::kPseudoRapidity));
46  add(new EditableParameter("EtaMax", "Maximum Eta", 0.5, 0.5, -10., 10.,2,Parameter::Double, StiTrack::kPseudoRapidity));
47 
48  add(new EditableParameter("nPtsUsed", "Use nPts", true, true, 0,1,1,Parameter::Boolean, StiTrack::kPointCount));
49  add(new EditableParameter("nPtsMin", "Minimum nPts", 10., 10., 0., 100.,1,Parameter::Integer, StiTrack::kPointCount));
50  add(new EditableParameter("nPtsMax", "Maximum nPts", 60., 60., 0., 100.,1,Parameter::Integer, StiTrack::kPointCount));
51 
52  add(new EditableParameter("nGapsUsed","Use nGaps", true, true, 0,1,1,Parameter::Boolean, StiTrack::kGapCount));
53  add(new EditableParameter("nGapsMin", "Minimum nGaps", 0., 0., 0., 100.,1,Parameter::Integer, StiTrack::kGapCount));
54  add(new EditableParameter("nGapsMax", "Maximum nGaps", 3., 3., 0., 100.,1,Parameter::Integer, StiTrack::kGapCount));
55 
56  add(new EditableParameter("chargeUsed","Use Charge", false, false, 0,1,1,Parameter::Boolean, StiTrack::kCharge));
57  add(new EditableParameter("chargeMin", "Minimum Charge", -1., -1., -100., 100.,1,Parameter::Integer, StiTrack::kCharge));
58  add(new EditableParameter("chargeMax", "Maximum Charge", 1., 1., -100., 100.,1,Parameter::Integer, StiTrack::kCharge));
59 }
60 
61 
62 bool StiDefaultTrackFilter::accept(const StiTrack * t) const
63 {
64  //cout << "StiDefaultTrackFilter::accept(t) - INFO - Starting" << endl;
65  double v,low,high;
66  ParameterConstIterator iter = begin();
67  Parameter * parUse;
68  Parameter * parLow;
69  Parameter * parHi;
70  while (iter!=end())
71  {
72  parUse = *iter; iter++;
73  parLow = *iter; iter++;
74  parHi = *iter; iter++;
75  if (parUse&&parLow&&parHi)
76  {
77  if (parUse->getBoolValue())
78  {
79  //cout << "/"<<count++;
80  v = t->getValue(parUse->getKey());
81  low = parLow->getDoubleValue();
82  high = parHi->getDoubleValue();
83  if (v<low || v>high)
84  {
85  //cout<<"/false-done"<<endl;
86  return false;
87  }
88  }
89  }
90  else
91  assert(0 && "StiDefaultTrackFilter::accept Internal error");
92  }
93  //cout<<"/true-done"<<endl;
94  return true;
95 }
96 
97 
99 {}
100 
Abstract definition of a Track.
Definition: StiTrack.h:59