BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/TrkBase/TrkBase/TrkPredicates.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: TrkPredicates.h,v 1.2 2007/11/13 07:27:23 codeman Exp $
4//
5// Description:
6// general, simple tracking predicates
7//
8// All classes (or structs) here should inherit from either
9// unary_function< X, bool> or binary_function<X,Y,bool> and
10// provide bool operator()(const X&,const Y&) const. In addition,
11// this operator should be a 'pure' function, i.e. _no_ side effects...
12//
13// Environment:
14// Software developed for the BaBar Detector at the SLAC B-Factory.
15//
16// Author List:
17// Gerhard Raven
18//------------------------------------------------------------------------
19#include <functional>
20
21#include "TrkBase/TrkRecoTrk.h"
22#include "TrkBase/TrkHitOnTrk.h"
23#include "TrkBase/TrkFitStatus.h"
24
25namespace TrkBase { namespace Predicates {
26
28 bool operator()(const TrkHitOnTrk& h) const
29 { return h.isActive(); }
30 };
31
33 public:
34 isLayer(int layer) : _layer(layer) {}
35 bool operator()(const TrkHitOnTrk& h) const
36 { return h.layerNumber() == _layer; }
37 private:
38 int _layer;
39 };
40
42 bool operator()(const TrkHitOnTrk& h) const
43 { return h.hasResidual(); }
44 };
45
47 public:
48 isSvtHitOnTrack(bool activeOnly=false) : _activeOnly(activeOnly) { }
49 bool operator()(const TrkHitOnTrk& h) const
50 { return h.svtHitOnTrack()!=0 && ( !_activeOnly || h.isActive() ); }
51 private:
52 bool _activeOnly;
53 };
54
56 public:
57 isMdcHitOnTrack(bool activeOnly=false) : _activeOnly(activeOnly) { }
58 bool operator()(const TrkHitOnTrk& h) const
59 { return h.mdcHitOnTrack()!=0 && ( !_activeOnly || h.isActive() ); }
60 private:
61 bool _activeOnly;
62 };
63
65 public:
67 bool operator()(const TrkHitOnTrk& h) const
68 {
69 if (_view==TrkEnums::bothView) return true;
70 TrkEnums::TrkViewInfo hotview = h.whatView();
71 if (h.svtHitOnTrack() != 0) {
72 return _view == hotview;
73 } else if (h.mdcHitOnTrack() != 0) {
74// unfortunately the Mdc calls stereo hits 'both view': I'm re-interpreting it here
75 return _view == TrkEnums::xyView && hotview == _view ||
76 _view == TrkEnums::zView && hotview == TrkEnums::bothView;
77 }
78 return false;
79 }
80 private:
82 };
83
84
86 public:
87 hotMatchesFundHit(const TrkFundHit *h) : _h(h) { }
88 bool operator()(const TrkHitOnTrk& h) const
89 { return h.hit()==_h; }
90 private:
91 const TrkFundHit *_h;
92 };
93
94
95 struct isHotOnTrack : std::binary_function<TrkHitOnTrk,const TrkRecoTrk*, bool>
96 {
97 bool operator()(const TrkHitOnTrk& h, const TrkRecoTrk* const & t) const
98 { return h.parentTrack() == t; }
99 };
100
102 bool operator()( const TrkFitStatus& t) const
103 { return (t.fitValid()); }
104 };
105
107 bool operator()( const TrkFitStatus& t) const
108 { return (t.fitCurrent()); }
109 };
110
111 // note that we use 'has' in here, not 'is' as above.... subtly distinction ;-)
112
114 bool operator()( const TrkRecoTrk& t) const
115 { const TrkFitStatus *x = t.status(); return x!=0 && isFitValid()(*x); }
116 };
117
119 bool operator()( const TrkRecoTrk& t) const
120 { const TrkFitStatus *x = t.status(); return x!=0 && isFitCurrent()(*x); }
121 };
122
123
124} }
Double_t x[10]
hasView(TrkEnums::TrkViewInfo view=TrkEnums::bothView)
std::unary_function< TrkFitStatus, bool > predicate_type
virtual const SvtHitOnTrack * svtHitOnTrack() const
Definition: TrkHitOnTrk.cxx:31
virtual const MdcHitOnTrack * mdcHitOnTrack() const
Definition: TrkHitOnTrk.cxx:30
virtual TrkEnums::TrkViewInfo whatView() const =0
std::unary_function< TrkHitOnTrk, bool > predicate_type
TrkRecoTrk * parentTrack() const
virtual unsigned layerNumber() const =0
std::unary_function< TrkRecoTrk, bool > predicate_type
bool operator()(const TrkHitOnTrk &h, const TrkRecoTrk *const &t) const
int t()
Definition: t.c:1