appends stereo hits to a track.
32 {
33#ifdef TRKRECO_DEBUG_DETAIL
34 std::cout <<
name() <<
"(stereo) ... dump of stereo candidate hits" << std::endl;
37 std::cout << " ";
38 for (unsigned i = 0; i < tmp.length(); i++) {
42 }
43 std::cout << std::endl;
44#endif
45
46
48#ifdef TRKRECO_DEBUG_DETAIL
49 std::cout <<
name() <<
"(stereo) ... rejected by nLinks(";
50 std::cout << list.length() << ") < ";
52#endif
53 return NULL;
54 }
55
56
57 unsigned n = list.length();
59 for (
unsigned i = 0; i <
n; i++) {
61
62
64
66
67
70 if (err) {
72 continue;
73 }
74
75
78 }
79
80#ifdef TRKRECO_DEBUG_DETAIL
81 std::cout <<
name() <<
"(stereo) ... dump of sz links" << std::endl;
82 std::cout << " ";
83 tmp = forLine;
85 for (unsigned i = 0; i < tmp.length(); i++) {
89 }
90 std::cout << std::endl;
91#endif
92
93
95#ifdef TRKRECO_DEBUG_DETAIL
96 std::cout <<
name() <<
"(stereo) ... rejected by sz nLinks(";
97 std::cout << forLine.length() << ") < ";
99#endif
100 HepAListDeleteAll(forLine);
101 return NULL;
102 }
103
104
105 unsigned nLine = forLine.length();
107 int err = line.fit();
108
109
110 if (err < 0) {
111#ifdef TRKRECO_DEBUG_DETAIL
112 std::cout <<
name() <<
"(stereo) ... linear fit failure. nLinks(";
113 std::cout << forLine.length() << ")" << std::endl;
114#endif
115 HepAListDeleteAll(forLine);
116 return NULL;
117 }
118
119#ifdef TRKRECO_DEBUG_DETAIL
120 std::cout <<
name() <<
"(stereo) ... dump of left-right" << std::endl;
121#endif
122
123
125 for (unsigned i = 0; i < nLine; i++) {
129
132
134 if (err) {
135 delete tl;
136 tl = NULL;
137 }
139 if (err) {
140 delete tr;
141 tr = NULL;
142 }
143 if ((tl == NULL) && (tr == NULL)) continue;
144
146 if (tl == NULL) best = tr;
147 else if (tr == NULL) best = tl;
148 else {
149 if (line.distance(* tl) < line.distance(* tr)) {
150 best = tl;
151 delete tr;
152 }
153 else {
154 best = tr;
155 delete tl;
156 }
157 }
158
159#ifdef TRKRECO_DEBUG_DETAIL
160 std::cout << " ";
161 std::cout <<
t->wire()->layerId() <<
"-";
162 std::cout <<
t->wire()->localId();
163 if (tl != NULL)
164 std::cout <<
",left " << tl->
position() <<
"," << line.distance(* tl);
165 if (tr != NULL)
166 std::cout <<
",right " << tr->
position() <<
"," << line.distance(* tr);
167 std::cout << std::endl;
168#endif
169
170 best->
link(
t->link());
171 forNewLine.append(best);
172 }
173
174
176#ifdef TRKRECO_DEBUG_DETAIL
177 std::cout <<
name() <<
"(stereo) ... rejected by lr nLinks(";
178 std::cout << forNewLine.length() << ") < ";
180#endif
181 HepAListDeleteAll(forLine);
182 HepAListDeleteAll(forNewLine);
183 return NULL;
184 }
185
186
187#ifdef TRKRECO_DEBUG_DETAIL
188 std::cout <<
name() <<
"(stereo) ... creating a new line" << std::endl;
189#endif
190 unsigned nNewLine = forNewLine.length();
191 TLine0 newLine(forNewLine);
192
193
194 err = newLine.fit();
195
196
197 if (err < 0) {
198#ifdef TRKRECO_DEBUG_DETAIL
199 std::cout <<
name() <<
"(stereo) ... 2nd linear fit failure. nLinks(";
200 std::cout << forNewLine.length() << ")" << std::endl;
201#endif
202 HepAListDeleteAll(forLine);
203 HepAListDeleteAll(forNewLine);
204 return NULL;
205 }
206
207
209
210
211
212
213
214
215
216
217 if (err < 0) {
218 HepAListDeleteAll(forLine);
219 HepAListDeleteAll(forNewLine);
220#ifdef TRKRECO_DEBUG_DETAIL
221 std::cout << " appendStereo cut ... new line 2nd linear fit failure. ";
222 std::cout <<
"# of links = " <<
n <<
"," << nLine;
223 std::cout << "," << nNewLine << std::endl;
224#endif
225 return NULL;
226 }
227
228
230 unsigned nn = good.length();
231 for (unsigned i = 0; i < nn; i++) {
232 track.
append(* good[i]->link());
233 }
236 a[3] = newLine.b();
237 a[4] = track.
charge() * newLine.a();
239
240#ifdef LINE_COSMIC
242
243
244 err = _fitter.
fit(*Ltrack);
246 err = _fitter.
fit(*Ltrack);
248 err = _fitter.
fit(*Ltrack);
249
251 err = _fitter.
fit(*Ltrack);
252
253
254
255
256
257
258
259
260
261
262 HepAListDeleteAll(forLine);
263 HepAListDeleteAll(forNewLine);
269 delete Ltrack;
270 return & track;
271#endif
272
273
274 err = _fitter.
fit(track);
276 err = _fitter.
fit(track);
278 err = _fitter.
fit(track);
280
281 err = _fitter.
fit(track);
282
284 HepAListDeleteAll(forLine);
285 HepAListDeleteAll(forNewLine);
286 return NULL;
287 }
288
289
290 HepAListDeleteAll(forLine);
291 HepAListDeleteAll(forNewLine);
292 return & track;
293}
#define WireHitFittingValid
int SortByWireId(const void *av, const void *bv)
Sorter.
const HepVector & a(void) const
returns helix parameters.
A class to represent a track in tracking.
Helix helix(void) const
approximated helix class
TMSelector _trackSelector
int fit(TTrackBase &) const
A class to represent a track in tracking.
unsigned state(void) const
returns state.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
A class to relate TMDCWireHit and TTrack objects.
TMLink * link(void) const
returns a pointer to a TMLink.
unsigned leftRight(void) const
returns left-right. 0:left, 1:right, 2:wire
const TMDCWireHit * hit(void) const
returns a pointer to a hit.
const HepPoint3D & position(void) const
returns position.
const TMDCWire *const wire(void) const
returns a pointer to a wire.
unsigned nLinks(void) const
returns min. # of hits(TMLinks) requried.
double maxSigma(void) const
returns max. sigma for each TMLink.
unsigned nLinksStereo(void) const
returns min. # of stereo hits(TMLinks) requried.
bool select(TTrackBase &) const
returns true if given track satisfys criteria after fitting.
virtual void refine(AList< TMLink > &list, double maxSigma)
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'.
virtual void removeLinks(void)
void append(TMLink &)
appends a TMLink.
const AList< TMLink > & links(unsigned mask=0) const
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
const Helix & helix(void) const
returns helix parameter.
int szPosition(TMLink &link) const
calculates arc length and z for a stereo hit.
double charge(void) const
returns charge.