BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
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"
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]
bool operator()(const TrkHitOnTrk &h) const
Definition: TrkPredicates.h:67
hasView(TrkEnums::TrkViewInfo view=TrkEnums::bothView)
Definition: TrkPredicates.h:66
bool operator()(const TrkHitOnTrk &h) const
Definition: TrkPredicates.h:88
hotMatchesFundHit(const TrkFundHit *h)
Definition: TrkPredicates.h:87
bool operator()(const TrkHitOnTrk &h) const
Definition: TrkPredicates.h:35
bool operator()(const TrkHitOnTrk &h) const
Definition: TrkPredicates.h:58
isMdcHitOnTrack(bool activeOnly=false)
Definition: TrkPredicates.h:57
bool operator()(const TrkHitOnTrk &h) const
Definition: TrkPredicates.h:49
isSvtHitOnTrack(bool activeOnly=false)
Definition: TrkPredicates.h:48
std::unary_function< TrkFitStatus, bool > predicate_type
Definition: TrkFitStatus.h:31
bool hasResidual() const
Definition: TrkHitOnTrk.h:104
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
Definition: TrkHitOnTrk.h:58
TrkRecoTrk * parentTrack() const
const TrkFundHit * hit() const
Definition: TrkHitOnTrk.h:75
bool isActive() const
Definition: TrkHitOnTrk.h:200
virtual unsigned layerNumber() const =0
std::unary_function< TrkRecoTrk, bool > predicate_type
Definition: TrkRecoTrk.h:73
TrkViewInfo
Definition: TrkEnums.h:22
@ xyView
Definition: TrkEnums.h:22
@ zView
Definition: TrkEnums.h:22
@ bothView
Definition: TrkEnums.h:22
bool operator()(const TrkRecoTrk &t) const
bool operator()(const TrkRecoTrk &t) const
bool operator()(const TrkHitOnTrk &h) const
Definition: TrkPredicates.h:42
bool operator()(const TrkFitStatus &t) const
bool operator()(const TrkFitStatus &t) const
bool operator()(const TrkHitOnTrk &h) const
Definition: TrkPredicates.h:28
bool operator()(const TrkHitOnTrk &h, const TrkRecoTrk *const &t) const
Definition: TrkPredicates.h:97
int t()
Definition: t.c:1