]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/MUON/src/Tracking/MansoTracker.cxx
Replacing some non-standard operators (not,and,or) with the standard ones. Code clean-up
[u/mrichter/AliRoot.git] / HLT / MUON / src / Tracking / MansoTracker.cxx
CommitLineData
8356cc1d 1////////////////////////////////////////////////////////////////////////////////
2//
3// Author: Artur Szostak
4// Email: artur@alice.phy.uct.ac.za | artursz@iafrica.com
5//
6////////////////////////////////////////////////////////////////////////////////
7
8#include "Tracking/MansoTracker.hpp"
9#include <math.h>
10#include "Tracking/Calculations.hpp"
11#include "Utils.hpp"
12#include "Error.hpp"
13#include "RegionOfInterest.hpp"
14
15
12ab84fc 16#if defined(DEBUG) || (defined(USE_ALILOG) && ! defined(LOG_NO_DEBUG))
8356cc1d 17#include <ostream>
18#include "Debug/print.hpp"
19namespace
20{
21
22using dHLT::Tracking::MansoTracker;
23
e33f3609 24std::ostream& operator << (std::ostream& os, MansoTracker::StatesSM4 state)
8356cc1d 25{
26 switch (state)
27 {
28 case MansoTracker::SM4Idle: os << "SM4Idle"; break;
29 case MansoTracker::WaitChamber8: os << "WaitChamber8"; break;
30 case MansoTracker::WaitMoreChamber8: os << "WaitMoreChamber8"; break;
31 case MansoTracker::WaitChamber7: os << "WaitChamber7"; break;
32 case MansoTracker::WaitMoreChamber7: os << "WaitMoreChamber7"; break;
33 default: os << "FAULT!!";
f086c81b 34 }
8356cc1d 35 return os;
f086c81b 36}
8356cc1d 37
e33f3609 38std::ostream& operator << (std::ostream& os, MansoTracker::StatesSM5 state)
8356cc1d 39{
40 switch (state)
41 {
42 case MansoTracker::SM5Idle: os << "SM5Idle"; break;
43 case MansoTracker::WaitChamber10: os << "WaitChamber10"; break;
44 case MansoTracker::WaitMoreChamber10: os << "WaitMoreChamber10"; break;
45 case MansoTracker::WaitChamber9: os << "WaitChamber9"; break;
46 case MansoTracker::WaitMoreChamber9: os << "WaitMoreChamber9"; break;
47 case MansoTracker::SM5Done: os << "SM5Done"; break;
48 default: os << "FAULT!!";
f086c81b 49 }
8356cc1d 50 return os;
f086c81b 51}
8356cc1d 52
d6576e27 53} // end of namespace
8356cc1d 54#endif // DEBUG
55
56
57namespace dHLT
58{
59namespace Tracking
60{
61
62
63// Deviate from the Manso implementation by allowing a and b
64// parameters per chamber and not just per station.
65// The default values are derived from the work done in
66// "A first algorithm for dimuon High Level Trigger"
67// Ref ID: ALICE-INT-2002-04 version 1.0
68Float MansoTracker::a7 = 0.016f;
69Float MansoTracker::b7 = 2.0f;
70Float MansoTracker::a8 = 0.016f;
71Float MansoTracker::b8 = 2.0f;
72Float MansoTracker::a9 = 0.020f;
73Float MansoTracker::b9 = 3.0f;
74Float MansoTracker::a10 = 0.020f;
75Float MansoTracker::b10 = 3.0f;
d6576e27 76Float MansoTracker::z7 = 1274.5f;
77Float MansoTracker::z8 = 1305.5f;
78Float MansoTracker::z9 = 1408.6f;
79Float MansoTracker::z10 = 1439.6f;
8356cc1d 80Float MansoTracker::z11 = 1603.5f;
81Float MansoTracker::z13 = 1703.5f;
82
83
e33f3609 84void MansoTracker::RegionOfInterest::Create(Point p, Float a, Float b)
8356cc1d 85{
86 centre = p;
87 // Compute the radius Rp
88 Float Rp = (Float) sqrt( p.x * p.x + p.y * p.y );
89
90 // The radius Rs for the region of interest is computed from the
91 // specification given in the document:
92 // "A first algorithm for dimuon High Level Trigger"
93 // Ref ID: ALICE-INT-2002-04 version 1.0
94 // equation:
95 // Rs = a * Rp + b
96 // given on page 3 section 4.
97 Rs = a * Rp + b;
f086c81b 98}
8356cc1d 99
100
e33f3609 101bool MansoTracker::RegionOfInterest::Contains(Point p) const
8356cc1d 102{
103 // Compute the distance between the centre of the region of interest and
104 // the point p. This distance must be less than the radius of the region
105 // of interest for p to be contained in the region of interest.
106 register Float lx = centre.x - p.x;
107 register Float ly = centre.y - p.y;
108 register Float r = (Float) sqrt( lx * lx + ly * ly );
109 DebugMsg(4, "\tRegionOfInterest::Contains : p = " << p
110 << " , centre = " << centre << " , r = " << r << " , Rs = " << Rs
111 );
112 return r <= Rs;
f086c81b 113}
8356cc1d 114
115
116void MansoTracker::RegionOfInterest::GetBoundaryBox(Float& left, Float& right, Float& bottom, Float& top)
117{
118 left = centre.x - Rs;
119 right = centre.x + Rs;
120 bottom = centre.y - Rs;
121 top = centre.y + Rs;
f086c81b 122}
8356cc1d 123
124
e33f3609 125MansoTracker::Vertex::Vertex(Float x, Float y, Float z)
8356cc1d 126{
127 this->x = x;
128 this->y = y;
129 this->z = z;
f086c81b 130}
8356cc1d 131
132
e33f3609 133MansoTracker::Vertex::Vertex(Point xy, Float z)
8356cc1d 134{
135 x = xy.x;
136 y = xy.y;
137 this->z = z;
f086c81b 138}
8356cc1d 139
140
141MansoTracker::Line::Line(
e33f3609 142 Float Ax, Float Ay, Float Az,
143 Float Bx, Float By, Float Bz
8356cc1d 144 )
145{
146 Mx = Ax - Bx;
147 My = Ay - By;
148 Mz = Az - Bz;
149 Cx = Bx;
150 Cy = By;
151 Cz = Bz;
f086c81b 152}
8356cc1d 153
154
e33f3609 155MansoTracker::Line::Line(Vertex A, Vertex B)
8356cc1d 156{
157 Mx = A.x - B.x;
158 My = A.y - B.y;
159 Mz = A.z - B.z;
160 Cx = B.x;
161 Cy = B.y;
162 Cz = B.z;
f086c81b 163}
8356cc1d 164
165
e33f3609 166Point MansoTracker::Line::FindIntersectWithXYPlain(Float z) const
8356cc1d 167{
168 Assert( Mz != 0.0 ); // Should not have a ray perpendicular to the beam axis.
169 Float t = (z - Cz) / Mz;
170 Float Lx = Mx*t + Cx;
171 Float Ly = My*t + Cy;
172
173 return Point(Lx, Ly);
f086c81b 174}
8356cc1d 175
176
177MansoTracker::MansoTracker() : Tracker()
178{
179 sm4state = SM4Idle;
180 sm5state = SM5Idle;
181 requests_completed = 0;
f086c81b 182}
8356cc1d 183
184
185void MansoTracker::FindTrack(const TriggerRecord& trigger)
186{
187 DebugMsg(4, "SM5 state = " << sm5state << " , SM4 state = " << sm4state);
188 DebugMsg(1, "Processing trigger with pt = " << trigger.pt);
189 v1 = Vertex( trigger.station1impact, z11 );
190 Vertex v2 = Vertex( trigger.station2impact, z13 );
191
192 // Form the vector line between the above two impact points and
193 // find the crossing point of the line with chamber 10 (i.e. station 5).
194 mc1.line = Line(v1, v2);
195 Point p10 = mc1.line.FindIntersectWithXYPlain( z10 );
196
197 // Build a region of interest for tracking station 5 (chamber 10).
198 // Remember the parameters a and b are station specific.
199 mc1.chamber = Chamber10;
200 mc1.roi.Create(p10, a10, b10);
201
202 // Make SM5 state transition before the call to RequestClusters since
203 // that method could call one of our methods again, so we need to be
204 // in a consistant internal state.
205 sm5state = WaitChamber10;
206
207 Float left, right, bottom, top;
208 mc1.roi.GetBoundaryBox(left, right, bottom, top);
209 RequestClusters(left, right, bottom, top, Chamber10, &mc1);
f086c81b 210}
8356cc1d 211
212
e33f3609 213void MansoTracker::ReturnClusters(void* tag, const ClusterPoint* clusters, UInt count)
8356cc1d 214{
215 Assert( count > 0 );
216 Assert( clusters != NULL );
217
218 TagData* data = (TagData*)tag;
219 DebugMsg(4, "Got MansoTracker::ReturnClusters(tag = " << tag
220 << ", chamber = " << data->chamber
221 << ", clusters = " << clusters << ", count = " << count << ")"
222 );
223 DebugMsg(4, "SM5 state = " << sm5state << " , SM4 state = " << sm4state);
224
225 switch (data->chamber)
226 {
227 case Chamber7: ReceiveClustersChamber7(clusters, count, data); break;
228 case Chamber8: ReceiveClustersChamber8(clusters, count, data); break;
229 case Chamber9: ReceiveClustersChamber9(clusters, count); break;
230 case Chamber10: ReceiveClustersChamber10(clusters, count); break;
231 default:
232 // Error
233 DebugMsg(1, "ERROR: Got tag with an invalid value: " << data->chamber);
f086c81b 234 }
235}
8356cc1d 236
237
238void MansoTracker::EndOfClusters(void* tag)
239{
240 TagData* data = (TagData*)tag;
241 DebugMsg(4, "Got MansoTracker::EndOfClusters(chamber = " << data->chamber << ")");
242 DebugMsg(4, "SM5 state = " << sm5state << " , SM4 state = " << sm4state);
243
244 switch (data->chamber)
245 {
246 case Chamber7: EndOfClustersChamber7(); break;
247 case Chamber8: EndOfClustersChamber8(); break;
248 case Chamber9: EndOfClustersChamber9(); break;
249 case Chamber10: EndOfClustersChamber10(); break;
250 default:
251 // Error
252 DebugMsg(1, "ERROR: Got tag with an invalid value: " << data->chamber);
f086c81b 253 }
254}
8356cc1d 255
256
257void MansoTracker::FillTrackData(Track& track)
258{
d6576e27 259 DebugMsg(4, "FillTrack: st5 = " << st5rec->clusterpoint << ", st4 = " << foundpoint->clusterpoint);
8356cc1d 260
d6576e27 261 Float x1 = foundpoint->clusterpoint.x;
262 Float y1 = foundpoint->clusterpoint.y;
8356cc1d 263 Float y2 = st5rec->clusterpoint.y;
264 Float momentum;
265 Float pt = CalculateSignedPt(x1, y1, y2, st4z, st5z, momentum);
266 DebugMsg(1, "Calculated Pt = " << pt);
267 DebugMsg(1, "\tusing x1 = " << x1 << " , y1 = " << y1 << " , y2 = " << y2
268 << " , z1 = " << st4z << " , z2 = " << st5z
269 );
270
271 if (pt < 0)
272 track.sign = Minus;
273 else if (pt > 0)
274 track.sign = Plus;
275 else
276 track.sign = UnknownSign;
277
278 track.p = momentum;
279 track.pt = (Float) fabs(pt);
280 for (UInt i = 0; i < 6; i++)
281 {
282 track.point[i] = Point(0.0, 0.0);
283 track.region[i] = INVALID_ROI;
f086c81b 284 }
8356cc1d 285
286 Float left, right, bottom, top;
287
288 // Have to create the ROI numbers from the internal region of interest structures.
289 st5rec->tag.roi.GetBoundaryBox(left, right, bottom, top);
290 dHLT::RegionOfInterest region4(left, right, bottom, top, st4chamber);
291 mc1.roi.GetBoundaryBox(left, right, bottom, top);
292 dHLT::RegionOfInterest region5(left, right, bottom, top, mc1.chamber);
293
294 // Depending on the chamber we received cluster points from, fill the appropriate
295 // point and ROI number. This is done for station 4 then 5.
296 if (st4chamber == Chamber8)
297 {
298 track.point[6] = Point(0.0, 0.0);
299 track.region[6] = INVALID_ROI;
d6576e27 300 track.point[7] = foundpoint->clusterpoint;
8356cc1d 301 track.region[7] = region4;
302 }
303 else
304 {
d6576e27 305 track.point[6] = foundpoint->clusterpoint;
8356cc1d 306 track.region[6] = region4;
307 track.point[7] = Point(0.0, 0.0);
308 track.region[7] = INVALID_ROI;
f086c81b 309 }
8356cc1d 310 if (mc1.chamber == Chamber10)
311 {
312 track.point[8] = Point(0.0, 0.0);
313 track.region[8] = INVALID_ROI;
314 track.point[9] = st5rec->clusterpoint;
315 track.region[9] = region5;
316 }
317 else
318 {
319 track.point[8] = st5rec->clusterpoint;
320 track.region[8] = region5;
321 track.point[9] = Point(0.0, 0.0);
322 track.region[9] = INVALID_ROI;
f086c81b 323 }
324}
8356cc1d 325
326
327void MansoTracker::Reset()
328{
329 DebugMsg(4, "SM5 state = " << sm5state << " , SM4 state = " << sm4state);
330 st5data.Clear();
331 st4points.Clear();
332 sm4state = SM4Idle;
333 sm5state = SM5Idle;
334 requests_completed = 0;
f086c81b 335}
8356cc1d 336
337
338// Note: In the following ReceiveClustersXXX and EndOfClustersXXX methods we make
339// the state machine transitions before calls to RequestClusters, FoundTrack,
340// NoTrackFound or EndOfClusterRequests. This is important since the callback
d6576e27 341// object will make recursive calls to the tracker's methods so we need to maintain
8356cc1d 342// a consistant internal state.
343// The same would go for updating internal variables.
344// In general one should only call the callback methods at the end of any of the
345// following routines.
346
e33f3609 347void MansoTracker::ReceiveClustersChamber7(const ClusterPoint* clusters, UInt count, const TagData* data)
8356cc1d 348{
349 switch (sm4state)
350 {
351 case WaitChamber7:
352 sm4state = WaitMoreChamber7;
353
354 case WaitMoreChamber7:
355 for (UInt j = 0; j < count; j++)
356 {
357 ClusterPoint cluster = clusters[j];
358 // Check that the cluster actually is in our region of interest on station 4.
359 if ( data->roi.Contains(cluster) )
360 {
361 DebugMsg(4, "Adding cluster [" << cluster.x << ", " << cluster.y << "] from chamber 7.");
d6576e27 362 Station4Data* newdata = st4points.New();
363 newdata->clusterpoint = cluster;
364 newdata->st5tag = data;
f086c81b 365 }
366 }
8356cc1d 367 break;
368
369 default:
370 DebugMsg(1, "ERROR: Unexpected state for SM4 in MansoTracker::ReceiveClustersChamber7!");
f086c81b 371 }
372}
8356cc1d 373
374
e33f3609 375void MansoTracker::ReceiveClustersChamber8(const ClusterPoint* clusters, UInt count, const TagData* data)
8356cc1d 376{
377 switch (sm4state)
378 {
379 case WaitChamber8:
380 sm4state = WaitMoreChamber8;
381 st4z = z8;
382 st4chamber = Chamber8;
383
384 case WaitMoreChamber8:
385 for (UInt j = 0; j < count; j++)
386 {
387 ClusterPoint cluster = clusters[j];
388 // Check that the cluster actually is in our region of interest on station 4.
389 if ( data->roi.Contains(cluster) )
390 {
391 DebugMsg(4, "Adding cluster [" << cluster.x << ", " << cluster.y << "] from chamber 8.");
d6576e27 392 Station4Data* newdata = st4points.New();
393 newdata->clusterpoint = cluster;
394 newdata->st5tag = data;
f086c81b 395 }
396 }
8356cc1d 397 break;
398
399 default:
400 DebugMsg(1, "ERROR: Unexpected state for SM4 in MansoTracker::ReceiveClustersChamber8!");
f086c81b 401 }
402}
8356cc1d 403
404
e33f3609 405void MansoTracker::ReceiveClustersChamber9(const ClusterPoint* clusters, UInt count)
8356cc1d 406{
407 switch (sm5state)
408 {
409 case WaitChamber9:
410 sm5state = WaitMoreChamber9;
411 sm4state = WaitChamber8; // Start SM4.
412
413 case WaitMoreChamber9:
414 for (UInt j = 0; j < count; j++)
415 {
416 ClusterPoint cluster = clusters[j];
417 // Check that the cluster actually is in our region of interest on station 5.
418 if ( mc1.roi.Contains(cluster) )
419 {
420 DebugMsg(4, "Adding cluster [" << cluster.x << ", " << cluster.y << "] from chamber 9.");
421 Station5Data* data = st5data.New();
422 data->clusterpoint = cluster;
423 ProjectToStation4(data, z9); // This adds a new request for station 4.
f086c81b 424 }
425 }
8356cc1d 426 break;
427
428 default:
429 DebugMsg(1, "ERROR: Unexpected state for SM5 in MansoTracker::ReceiveClustersChamber9!");
f086c81b 430 }
431}
8356cc1d 432
433
e33f3609 434void MansoTracker::ReceiveClustersChamber10(const ClusterPoint* clusters, UInt count)
8356cc1d 435{
436 switch (sm5state)
437 {
438 case WaitChamber10:
439 sm5state = WaitMoreChamber10;
440 st5z = z10;
441 sm4state = WaitChamber8; // Start SM4.
442
443 case WaitMoreChamber10:
444 for (UInt j = 0; j < count; j++)
445 {
446 ClusterPoint cluster = clusters[j];
447 // Check that the cluster actually is in our region of interest on station 5.
448 if ( mc1.roi.Contains(cluster) )
449 {
450 DebugMsg(4, "Adding cluster [" << cluster.x << ", " << cluster.y << "] from chamber 10.");
451 Station5Data* data = st5data.New();
452 data->clusterpoint = cluster;
453 ProjectToStation4(data, z10); // This adds a new request for station 4.
f086c81b 454 }
455 }
8356cc1d 456 break;
457
458 default:
459 DebugMsg(1, "ERROR: Unexpected state for SM5 in MansoTracker::ReceiveClustersChamber10!");
f086c81b 460 }
461}
8356cc1d 462
463
464void MansoTracker::EndOfClustersChamber7()
465{
466 requests_completed++; // Increment the number of requests completed for station 4.
467 DebugMsg(4, "requests_completed = " << requests_completed );
468
469 switch (sm4state)
470 {
471 case WaitChamber7:
472 // If all data from station 5 is received and no data found on
473 // chambers 7 or 8 then we can not find a track.
474 if (sm5state == SM5Done) NoTrackFound();
475 break;
476
477 case WaitMoreChamber7:
f086c81b 478 if (requests_completed == st5data.Count() && sm5state == SM5Done)
8356cc1d 479 ProcessClusters();
480 break;
481
482 default:
483 DebugMsg(1, "ERROR: Unexpected state for SM4 in MansoTracker::EndOfClustersChamber7!");
f086c81b 484 }
485}
8356cc1d 486
487
488void MansoTracker::EndOfClustersChamber8()
489{
490 requests_completed++; // Increment the number of requests completed for station 4.
491 DebugMsg(4, "requests_completed = " << requests_completed );
492
493 switch (sm4state)
494 {
495 case WaitChamber7:
496 // Ignore. The requests for chamber 8 are already re-requested below.
497 break;
498
499 case WaitChamber8:
500 {
501 sm4state = WaitChamber7;
502 st4z = z7;
503 st4chamber = Chamber7;
504
505 // We need to resend the requests for chamber 8, but change the request
506 // to get data for chamber 7 instead:
507 UInt reqlistsize = st5data.Count();
508 DebugMsg(4, "Re-requesting clusters from chamber 7... reqlistsize = " << reqlistsize);
509
510 Station5List::Iterator rec = st5data.First();
511 for (UInt i = 0; i < reqlistsize; i++, rec++)
512 {
513 // Need to create a new st5 data block for the request.
514 Station5Data* data = st5data.New();
515 data->clusterpoint = rec->clusterpoint;
516 data->tag.line = rec->tag.line;
517
518 // Rebuild a region of interest for chamber 7.
519 // Remember the parameters a and b are station specific.
520 Point p7 = data->tag.line.FindIntersectWithXYPlain( z7 );
521 data->tag.chamber = Chamber7;
522 data->tag.roi.Create(p7, a7, b7);
523
524 Float left, right, bottom, top;
525 data->tag.roi.GetBoundaryBox(left, right, bottom, top);
526 // Make request for chamber 7 data.
527 RequestClusters(left, right, bottom, top, Chamber7, &data->tag);
f086c81b 528 }
8356cc1d 529 }
530 break;
531
532 case WaitMoreChamber8:
f086c81b 533 if (requests_completed == st5data.Count() && sm5state == SM5Done)
8356cc1d 534 ProcessClusters();
535 break;
536
537 default:
538 DebugMsg(1, "ERROR: Unexpected state for SM4 in MansoTracker::EndOfClustersChamber8!");
f086c81b 539 }
540}
8356cc1d 541
542
543void MansoTracker::EndOfClustersChamber9()
544{
545 switch (sm5state)
546 {
547 case WaitChamber9:
548 sm5state = SM5Done;
549 EndOfClusterRequests();
550 NoTrackFound();
551 break;
552
553 case WaitMoreChamber9:
554 sm5state = SM5Done;
555 EndOfClusterRequests();
556 if (requests_completed == st5data.Count())
557 ProcessClusters();
558 break;
559
560 default:
561 DebugMsg(1, "ERROR: Unexpected state for SM5 in MansoTracker::EndOfClustersChamber9!");
f086c81b 562 }
563}
8356cc1d 564
565
566void MansoTracker::EndOfClustersChamber10()
567{
568 switch (sm5state)
569 {
570 case WaitChamber10:
571 {
572 sm5state = WaitChamber9;
573 st5z = z9;
574
575 // No clusters found on chamber 10 so we need to make a request for
576 // clusters from chamber 9:
577 Point p9 = mc1.line.FindIntersectWithXYPlain( z9 );
578
579 // Build a region of interest for tracking station 5 (chamber 9).
580 // Remember the parameters a and b are station specific.
581 mc1.chamber = Chamber9;
582 mc1.roi.Create(p9, a9, b9);
583
584 Float left, right, bottom, top;
585 mc1.roi.GetBoundaryBox(left, right, bottom, top);
586 RequestClusters(left, right, bottom, top, Chamber9, &mc1);
587 }
588 break;
589
590 case WaitMoreChamber10:
591 sm5state = SM5Done;
592 EndOfClusterRequests();
593 if (requests_completed == st5data.Count())
594 ProcessClusters();
595 break;
596
597 default:
598 DebugMsg(1, "ERROR: Unexpected state for SM5 in MansoTracker::EndOfClustersChamber10!");
f086c81b 599 }
600}
8356cc1d 601
602
603void MansoTracker::ProjectToStation4(Station5Data* data, register Float station5z)
604{
605 // Perform chamber specific operations:
606 // Since certain states of SM4 means that it is fetching for Chamber8
607 // and other states are for fetching from Chamber7. We need to make
608 // requests for the correct chamber.
f086c81b 609 Assert( sm4state == WaitChamber8
610 || sm4state == WaitMoreChamber8
611 || sm4state == WaitChamber7
612 || sm4state == WaitMoreChamber7
8356cc1d 613 );
614 TagData* tag = &data->tag;
f086c81b 615 if (sm4state == WaitChamber8 || sm4state == WaitMoreChamber8)
8356cc1d 616 {
617 // Form the vector line between trigger station 1 and tracking station 5,
618 // and find the intersection point of the line with station 4 (chamber8).
619 Line line51( Vertex(data->clusterpoint, station5z), v1 );
620 Point intercept = line51.FindIntersectWithXYPlain(z8);
621 tag->line = line51;
622
623 // Build a region of interest for tracking station 4.
624 tag->chamber = Chamber8;
625 tag->roi.Create(intercept, a8, b8);
626 }
627 else
628 {
629 // Form the vector line between trigger station 1 and tracking station 5,
630 // and find the intersection point of the line with station 4 (chamber7).
631 Line line51( Vertex(data->clusterpoint, station5z), v1 );
632 Point intercept = line51.FindIntersectWithXYPlain(z7);
633 tag->line = line51;
634
635 // Build a region of interest for tracking station 4.
636 tag->chamber = Chamber7;
637 tag->roi.Create(intercept, a7, b7);
f086c81b 638 }
8356cc1d 639
640 // Make the request for clusters from station 4.
641 Float left, right, bottom, top;
642 tag->roi.GetBoundaryBox(left, right, bottom, top);
643 RequestClusters(left, right, bottom, top, tag->chamber, tag);
f086c81b 644}
8356cc1d 645
646
647void MansoTracker::ProcessClusters()
648{
649 DebugMsg(2, "ProcessClusters...");
650
651 // Check if the cluster point list on station 4 is empty.
652 // If it is then we have not found any tracks.
653 foundpoint = st4points.First();
654 if (foundpoint == st4points.End())
655 {
656 NoTrackFound();
657 return;
f086c81b 658 }
8356cc1d 659
660 st5rec = st5data.First();
661 if (st5rec != st5data.End())
662 {
663 // Only look at station 5 data records that are for the found chamber number.
664 // Note: either we only have chamber 8 data or we have chamber 7 data followed
665 // by chamber 8 data.
666 // Thus if we hit records that we are not interested in already then the list
667 // contains no interesting data and we can signal no track found.
668 if (st5rec->tag.chamber != st4chamber)
669 {
670 NoTrackFound();
671 return;
f086c81b 672 }
8356cc1d 673
674 // For all combinations of cluster point pairs from station 4 and 5
675 // signal a found track:
676 do
677 {
678 DebugMsg(4, "\tst5rec->tag.chamber = " << st5rec->tag.chamber
679 << " , st4chamber = " << st4chamber
680 );
681
682 for (foundpoint = st4points.First(); foundpoint != st4points.End(); foundpoint++)
d6576e27 683 {
684 if (foundpoint->st5tag == &st5rec->tag)
685 FoundTrack();
686 }
8356cc1d 687
688 st5rec++; // Get next station 5 cluster point.
f086c81b 689 } while (st5rec != st5data.End() && st5rec->tag.chamber == st4chamber);
8356cc1d 690 }
691 else
692 NoTrackFound();
f086c81b 693}
8356cc1d 694
695
696} // Tracking
697} // dHLT