BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TMSelector.cxx
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TMSelector.cxx,v 1.1 2006/10/12 07:52:00 liuqg Exp $
3//-----------------------------------------------------------------------------
4// Filename : TMSelector.cc
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : yoshihito.iwasaki@kek.jp
8//-----------------------------------------------------------------------------
9// Description : A class to select a TTrackBase object.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#include "TrkReco/TMSelector.h"
14#include "TrkReco/TCircle.h"
15#include "TrkReco/TMLink.h"
16#include "TrkReco/TTrack.h"
17#include "TrkReco/TTrackBase.h"
18
20 : _nLinksDefined( false )
21 , _nLinks( 0 )
22 , _nSuperLayersDefined( false )
23 , _nSuperLayers( 0 )
24 , _minPtDefined( false )
25 , _minPt( 0. )
26 , _maxImpactDefined( false )
27 , _maxImpact( 0. )
28 , _nLinksStereoDefined( false )
29 , _nLinksStereo( 0 )
30 , _maxDistanceDefined( false )
31 , _maxDistance( 0. ) {}
32
34 : _nLinksDefined( a._nLinksDefined )
35 , _nLinks( a._nLinks )
36 , _nSuperLayersDefined( a._nSuperLayersDefined )
37 , _nSuperLayers( a._nSuperLayers )
38 , _minPtDefined( a._minPtDefined )
39 , _minPt( a._minPt )
40 , _maxImpactDefined( a._maxImpactDefined )
41 , _maxImpact( a._maxImpact )
42 , _nLinksStereoDefined( a._nLinksStereoDefined )
43 , _nLinksStereo( a._nLinksStereo )
44 , _maxDistanceDefined( a._maxDistanceDefined )
45 , _maxDistance( a._maxDistance ) {}
46
48
50
51#ifdef TRKRECO_DEBUG_DETAIL
52 if ( !b.fitted() ) { std::cout << " TSelect::select !!! not fitted yet" << std::endl; }
53#endif
54
55 if ( b.objectType() == Track )
56 {
57 TTrack& a = (TTrack&)b;
58
59 if ( _minPtDefined )
60 {
61 if ( a.pt() < _minPt )
62 {
63#ifdef TRKRECO_DEBUG_DETAIL
64 std::cout << " TSelect ... rejected by min. pt(";
65 std::cout << a.pt() << ") < ";
66 std::cout << _minPt << std::endl;
67#endif
68 return false;
69 }
70 }
71
72 if ( _maxImpactDefined )
73 {
74 if ( fabs( a.impact() ) > _maxImpact )
75 {
76#ifdef TRKRECO_DEBUG_DETAIL
77 std::cout << " TSelect ... rejected by max. impact(";
78 std::cout << a.impact() << ") < ";
79 std::cout << _maxImpact << std::endl;
80#endif
81 return false;
82 }
83 }
84 }
85 else if ( b.objectType() == Circle )
86 {
87 TCircle& a = (TCircle&)b;
88
89 if ( _minPtDefined )
90 {
91 if ( a.pt() < _minPt )
92 {
93#ifdef TRKRECO_DEBUG_DETAIL
94 std::cout << " TSelect ... rejected by min. pt(";
95 std::cout << a.pt() << ") < ";
96 std::cout << _minPt << std::endl;
97#endif
98 return false;
99 }
100 }
101
102 if ( _maxImpactDefined )
103 {
104 if ( fabs( a.impact() ) > _maxImpact )
105 {
106#ifdef TRKRECO_DEBUG_DETAIL
107 std::cout << " TSelect ... rejected by max. impact(";
108 std::cout << a.impact() << ") < ";
109 std::cout << _maxImpact << std::endl;
110#endif
111 return false;
112 }
113 }
114 }
115 else
116 {
117 std::cout << "TMSelector !!! Unknown object type" << std::endl;
118 return false;
119 }
120
121#ifdef TRKRECO_DEBUG_DETAIL
122 std::cout << " TSelect::select ... accepted" << std::endl;
123#endif
124 return true;
125}
126
127bool TMSelector::preSelect( const TTrackBase& a ) const {
128 if ( _nLinksDefined )
129 {
130 if ( a.nLinks() < _nLinks )
131 {
132#ifdef TRKRECO_DEBUG_DETAIL
133 std::cout << " TSelect ... rejected by nLinks(";
134 std::cout << a.nLinks() << ") < ";
135 std::cout << _nLinks << std::endl;
136#endif
137 return false;
138 }
139 }
140
141 if ( _nSuperLayersDefined )
142 {
143 if ( NSuperLayers( a.links() ) < _nSuperLayers )
144 {
145#ifdef TRKRECO_DEBUG_DETAIL
146 std::cout << " TSelect ... rejected by nSuperLayers(";
147 std::cout << NSuperLayers( a.links() ) << ") < ";
148 std::cout << _nSuperLayers << std::endl;
149#endif
150 return false;
151 }
152 }
153
154#ifdef TRKRECO_DEBUG_DETAIL
155 std::cout << " TSelect::preSelect ... accepted" << std::endl;
156#endif
157 return true;
158}
A class to represent a circle in tracking.
double impact(void) const
returns impact parameter to the origin.
TMSelector()
Constructor.
virtual ~TMSelector()
Destructor.
bool preSelect(const TTrackBase &) const
returns true if given track satisfys criteria before fitting.
bool select(TTrackBase &) const
returns true if given track satisfys criteria after fitting.
A virtual class for a track class in tracking.
bool fitted(void) const
returns true if fitted.
const AList< TMLink > & links(unsigned mask=0) const
virtual unsigned objectType(void) const
returns object type.
unsigned nLinks(unsigned mask=0) const
returns # of masked TMLinks assigned to this track object.
A class to represent a track in tracking.
double impact(void) const
returns signed impact parameter to the origin.