1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
6 * Artur Szostak <artursz@iafrica.com> *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
20 /// @file AliHLTMUONMansoTrackerFSM.cxx
21 /// @author Artur Szostak <artursz@iafrica.com>
23 /// @brief Implementation of AliHLTMUONMansoTrackerFSM class.
25 /// Implementation of AliHLTMUONMansoTrackerFSM class which implements the Manso
26 /// tracking algorithm as a finite state machine, which partially reconstructs
27 /// tracks in the muon spectrometer.
29 #include "AliHLTMUONMansoTrackerFSM.h"
30 #include "AliHLTMUONCalculations.h"
31 #include "AliHLTMUONConstants.h"
32 #include "AliHLTMUONUtils.h"
41 std::ostream& operator << (std::ostream& os, AliHLTMUONMansoTrackerFSM::StatesSM4 state)
45 case AliHLTMUONMansoTrackerFSM::kSM4Idle: os << "kSM4Idle"; break;
46 case AliHLTMUONMansoTrackerFSM::kWaitChamber8: os << "kWaitChamber8"; break;
47 case AliHLTMUONMansoTrackerFSM::kWaitMoreChamber8: os << "kWaitMoreChamber8"; break;
48 case AliHLTMUONMansoTrackerFSM::kWaitChamber7: os << "kWaitChamber7"; break;
49 case AliHLTMUONMansoTrackerFSM::kWaitMoreChamber7: os << "kWaitMoreChamber7"; break;
50 default: os << "FAULT!!";
55 std::ostream& operator << (std::ostream& os, AliHLTMUONMansoTrackerFSM::StatesSM5 state)
59 case AliHLTMUONMansoTrackerFSM::kSM5Idle: os << "kSM5Idle"; break;
60 case AliHLTMUONMansoTrackerFSM::kWaitChamber10: os << "kWaitChamber10"; break;
61 case AliHLTMUONMansoTrackerFSM::kWaitMoreChamber10: os << "kWaitMoreChamber10"; break;
62 case AliHLTMUONMansoTrackerFSM::kWaitChamber9: os << "kWaitChamber9"; break;
63 case AliHLTMUONMansoTrackerFSM::kWaitMoreChamber9: os << "kWaitMoreChamber9"; break;
64 case AliHLTMUONMansoTrackerFSM::kSM5Done: os << "kSM5Done"; break;
65 default: os << "FAULT!!";
74 // Deviate from the Manso implementation by allowing a and b
75 // parameters per chamber and not just per station.
76 // The default values are derived from the work done in
77 // "A first algorithm for dimuon High Level Trigger"
78 // Ref ID: ALICE-INT-2002-04 version 1.0
79 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgA7 = 0.016f;
80 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgB7 = 2.0f;
81 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgA8 = 0.016f;
82 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgB8 = 2.0f;
83 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgA9 = 0.020f;
84 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgB9 = 3.0f;
85 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgA10 = 0.020f;
86 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgB10 = 3.0f;
87 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgZ7 = -1274.5f;
88 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgZ8 = -1305.5f;
89 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgZ9 = -1408.6f;
90 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgZ10 = -1439.6f;
91 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgZ11 = -1603.5f;
92 AliHLTFloat32_t AliHLTMUONMansoTrackerFSM::fgZ13 = -1703.5f;
95 void AliHLTMUONMansoTrackerFSM::AliRegionOfInterest::Create(
96 AliHLTMUONRecHitStruct p, AliHLTFloat32_t a, AliHLTFloat32_t b
99 // Creates a region of interest specific to the Manso algorithm from a point and
100 // two Manso specific parameters.
103 // Compute the radius Rp
104 AliHLTFloat32_t rp = (AliHLTFloat32_t) sqrt( p.fX * p.fX + p.fY * p.fY );
106 // The radius Rs for the region of interest is computed from the
107 // specification given in the document:
108 // "A first algorithm for dimuon High Level Trigger"
109 // Ref ID: ALICE-INT-2002-04 version 1.0
112 // given on page 3 section 4.
117 bool AliHLTMUONMansoTrackerFSM::AliRegionOfInterest::Contains(AliHLTMUONRecHitStruct p) const
119 // Compute the distance between the centre of the region of interest and
120 // the point p. This distance must be less than the radius of the region
121 // of interest for p to be contained in the region of interest.
122 register AliHLTFloat32_t lx = fCentre.fX - p.fX;
123 register AliHLTFloat32_t ly = fCentre.fY - p.fY;
124 register AliHLTFloat32_t r = (AliHLTFloat32_t) sqrt( lx * lx + ly * ly );
125 DebugTrace("\tAliRegionOfInterest::Contains : p = " << p
126 << " , centre = " << fCentre << " , r = " << r << " , Rs = " << fRs
132 void AliHLTMUONMansoTrackerFSM::AliRegionOfInterest::GetBoundaryBox(
133 AliHLTFloat32_t& left, AliHLTFloat32_t& right,
134 AliHLTFloat32_t& bottom, AliHLTFloat32_t& top
137 // Works out the smallest boundary box that will contain the region of interest.
139 left = fCentre.fX - fRs;
140 right = fCentre.fX + fRs;
141 bottom = fCentre.fY - fRs;
142 top = fCentre.fY + fRs;
146 AliHLTMUONMansoTrackerFSM::AliVertex::AliVertex(
147 AliHLTFloat32_t x, AliHLTFloat32_t y, AliHLTFloat32_t z
149 : fX(x), fY(y), fZ(z)
151 // Constructor for vertex.
155 AliHLTMUONMansoTrackerFSM::AliVertex::AliVertex(AliHLTMUONRecHitStruct xy, AliHLTFloat32_t z)
156 : fX(xy.fX), fY(xy.fY), fZ(z)
158 // Construct vertex from a point on the XY plane and z coordinate.
162 AliHLTMUONMansoTrackerFSM::AliLine::AliLine(
163 AliHLTFloat32_t ax, AliHLTFloat32_t ay, AliHLTFloat32_t az,
164 AliHLTFloat32_t bx, AliHLTFloat32_t by, AliHLTFloat32_t bz
173 // Construct a line defined by L = M*t + C = (A-B)*t + B
174 // where M and C are 3D vectors and t is a free parameter.
175 // A = (ax, ay, az) and B = (bx, by, bz)
179 AliHLTMUONMansoTrackerFSM::AliLine::AliLine(AliVertex a, AliVertex b) :
187 // Contruct a line to go through two vertices a and b.
191 AliHLTMUONRecHitStruct AliHLTMUONMansoTrackerFSM::AliLine::FindIntersectWithXYPlain(
195 // Find the point of intersection of the line and the XY plane at z.
198 if (fMz != 0) // Should not have a ray perpendicular to the beam axis.
202 AliHLTMUONRecHitStruct p;
211 AliHLTMUONMansoTrackerFSM::AliHLTMUONMansoTrackerFSM() :
215 fRequestsCompleted(0),
216 fSt4chamber(kChamber1),
226 // Default constructor
230 void AliHLTMUONMansoTrackerFSM::FindTrack(const AliHLTMUONTriggerRecordStruct& trigger)
232 // Tries to find the track from the trigger seed.
234 DebugTrace("SM5 state = " << fSm5state << " , SM4 state = " << fSm4state);
235 DebugTrace("Processing trigger with ID = " << trigger.fId);
237 fTriggerId = trigger.fId;
239 // Set Z coordinates of ideal point on trigger track to be nominal
240 // chamber 11 and 13 positions.
241 AliHLTMUONCalculations::IdealZ1(fgZ11);
242 AliHLTMUONCalculations::IdealZ2(fgZ13);
244 if (not AliHLTMUONCalculations::FitLineToTriggerRecord(trigger))
250 AliHLTMUONCalculations::IdealX1(),
251 AliHLTMUONCalculations::IdealY1(),
252 AliHLTMUONCalculations::IdealZ1()
254 AliVertex v2 = AliVertex(
255 AliHLTMUONCalculations::IdealX2(),
256 AliHLTMUONCalculations::IdealY2(),
257 AliHLTMUONCalculations::IdealZ2()
260 DebugTrace("Using fV1 = {x = " << fV1.X() << ", y = " << fV1.Y() << ", " << fV1.Z() << "}");
261 DebugTrace("Using v2 = {x = " << v2.X() << ", y = " << v2.Y() << ", " << v2.Z() << "}");
263 // Form the vector line between the above two impact points and
264 // find the crossing point of the line with chamber 10 (i.e. station 5).
265 fMc1.fLine = AliLine(fV1, v2);
266 AliHLTMUONRecHitStruct p10 = fMc1.fLine.FindIntersectWithXYPlain( fgZ10 );
268 // Build a region of interest for tracking station 5 (chamber 10).
269 // Remember the parameters a and b are station specific.
270 fMc1.fChamber = kChamber10;
271 fMc1.fRoi.Create(p10, fgA10, fgB10);
273 // Make SM5 state transition before the call to RequestClusters since
274 // that method could call one of our methods again, so we need to be
275 // in a consistant internal state.
276 fSm5state = kWaitChamber10;
278 AliHLTFloat32_t left, right, bottom, top;
279 fMc1.fRoi.GetBoundaryBox(left, right, bottom, top);
280 RequestClusters(left, right, bottom, top, kChamber10, &fMc1);
284 void AliHLTMUONMansoTrackerFSM::ReturnClusters(
285 void* tag, const AliHLTMUONRecHitStruct* clusters,
289 // Implementation of AliHLTMUONMansoTrackerFSM::ReturnClusters.
292 assert( clusters != NULL );
294 AliTagData* data = (AliTagData*)tag;
295 DebugTrace("Got AliHLTMUONMansoTrackerFSM::ReturnClusters(tag = " << tag
296 << ", chamber = " << data->fChamber
297 << ", clusters = " << clusters << ", count = " << count << ")"
299 DebugTrace("SM5 state = " << fSm5state << " , SM4 state = " << fSm4state);
301 switch (data->fChamber)
303 case kChamber7: ReceiveClustersChamber7(clusters, count, data); break;
304 case kChamber8: ReceiveClustersChamber8(clusters, count, data); break;
305 case kChamber9: ReceiveClustersChamber9(clusters, count); break;
306 case kChamber10: ReceiveClustersChamber10(clusters, count); break;
309 DebugTrace("ERROR: Got tag with an invalid value: " << data->fChamber);
314 void AliHLTMUONMansoTrackerFSM::EndOfClusters(void* tag)
316 // Implementation of AliHLTMUONMansoTrackerFSM::EndOfClusters.
318 AliTagData* data = (AliTagData*)tag;
319 DebugTrace("Got AliHLTMUONMansoTrackerFSM::EndOfClusters(chamber = " << data->fChamber << ")");
320 DebugTrace("SM5 state = " << fSm5state << " , SM4 state = " << fSm4state);
322 switch (data->fChamber)
324 case kChamber7: EndOfClustersChamber7(); break;
325 case kChamber8: EndOfClustersChamber8(); break;
326 case kChamber9: EndOfClustersChamber9(); break;
327 case kChamber10: EndOfClustersChamber10(); break;
330 DebugTrace("ERROR: Got tag with an invalid value: " << data->fChamber);
335 bool AliHLTMUONMansoTrackerFSM::FillTrackData(AliHLTMUONMansoTrackStruct& track)
337 // Implementation of AliHLTMUONMansoTrackerFSM::FillTrackData
339 DebugTrace("FillTrack: st5 = " << fSt5rec->fClusterPoint << ", st4 = " << fFoundPoint->fClusterPoint);
341 // Construct the track ID from the running counter fTrackId and the
342 // bottom 8 bits of fTriggerId which will make this unique for an event.
343 track.fId = (fTrackId << 8) | (fTriggerId & 0xFF);
345 // Increment the track ID and warp it around at 0x7FFFFF since the
346 // bottom 8 bits are copied from fTriggerId and the sign bit in
347 // track.fId must be positive.
348 fTrackId = (fTrackId + 1) & 0x007FFFFF;
350 track.fTrigRec = fTriggerId;
352 AliHLTFloat32_t x1 = fFoundPoint->fClusterPoint.fX;
353 AliHLTFloat32_t y1 = fFoundPoint->fClusterPoint.fY;
354 AliHLTFloat32_t z1 = fFoundPoint->fClusterPoint.fZ;
355 AliHLTFloat32_t y2 = fSt5rec->fClusterPoint.fY;
356 AliHLTFloat32_t z2 = fSt5rec->fClusterPoint.fZ;
358 bool calculated = AliHLTMUONCalculations::ComputeMomentum(x1, y1, y2, z1, z2);
360 track.fPx = AliHLTMUONCalculations::Px();
361 track.fPy = AliHLTMUONCalculations::Py();
362 track.fPz = AliHLTMUONCalculations::Pz();
363 DebugTrace("Calculated Px = " << track.fPx << ", Py = " << track.fPy
364 << ", Pz = " << track.fPx
366 DebugTrace("\tusing x1 = " << x1 << " , y1 = " << y1 << " , y2 = " << y2
367 << " , z1 = " << z1 << " , z2 = " << z2
373 // Depending on which chamber we found reconstructed hits, fill the hit
374 // in the appropriate location. This is done for station 4 then 5.
375 if (fSt4chamber == kChamber8)
377 track.fHit[0] = AliHLTMUONConstants::NilRecHitStruct();
379 track.fHit[1] = fFoundPoint->fClusterPoint;
384 track.fHit[0] = fFoundPoint->fClusterPoint;
386 track.fHit[1] = AliHLTMUONConstants::NilRecHitStruct();
389 if (fMc1.fChamber == kChamber10)
391 track.fHit[2] = AliHLTMUONConstants::NilRecHitStruct();
393 track.fHit[3] = fSt5rec->fClusterPoint;
398 track.fHit[2] = fSt5rec->fClusterPoint;
400 track.fHit[3] = AliHLTMUONConstants::NilRecHitStruct();
404 track.fFlags = AliHLTMUONUtils::PackMansoTrackFlags(
405 AliHLTMUONCalculations::Sign(), hitset
411 void AliHLTMUONMansoTrackerFSM::Reset()
413 // Implementation of AliHLTMUONMansoTrackerFSM::Reset
415 DebugTrace("SM5 state = " << fSm5state << " , SM4 state = " << fSm4state);
418 fSm4state = kSM4Idle;
419 fSm5state = kSM5Idle;
420 fRequestsCompleted = 0;
425 // Note: In the following ReceiveClustersXXX and EndOfClustersXXX methods we make
426 // the state machine transitions before calls to RequestClusters, FoundTrack,
427 // NoTrackFound or EndOfClusterRequests. This is important since the callback
428 // object will make recursive calls to the tracker's methods so we need to maintain
429 // a consistant internal state.
430 // The same would go for updating internal variables.
431 // In general one should only call the callback methods at the end of any of the
432 // following routines.
434 void AliHLTMUONMansoTrackerFSM::ReceiveClustersChamber7(
435 const AliHLTMUONRecHitStruct* clusters, AliHLTUInt32_t count,
436 const AliTagData* data
439 // State change method for Station 4 state machine.
444 fSm4state = kWaitMoreChamber7;
446 case kWaitMoreChamber7:
447 for (AliHLTUInt32_t j = 0; j < count; j++)
449 AliHLTMUONRecHitStruct cluster = clusters[j];
450 // Check that the cluster actually is in our region of interest on station 4.
451 if ( data->fRoi.Contains(cluster) )
453 DebugTrace("Adding cluster [" << cluster.fX << ", " << cluster.fY << "] from chamber 7.");
454 AliStation4Data* newdata = fSt4points.Add();
455 newdata->fClusterPoint = cluster;
456 newdata->fSt5tag = data;
462 DebugTrace("ERROR: Unexpected state for SM4 in AliHLTMUONMansoTrackerFSM::ReceiveClustersChamber7!");
467 void AliHLTMUONMansoTrackerFSM::ReceiveClustersChamber8(
468 const AliHLTMUONRecHitStruct* clusters, AliHLTUInt32_t count,
469 const AliTagData* data
472 // State change method for Station 4 state machine.
477 fSm4state = kWaitMoreChamber8;
478 fSt4chamber = kChamber8;
480 case kWaitMoreChamber8:
481 for (AliHLTUInt32_t j = 0; j < count; j++)
483 AliHLTMUONRecHitStruct cluster = clusters[j];
484 // Check that the cluster actually is in our region of interest on station 4.
485 if ( data->fRoi.Contains(cluster) )
487 DebugTrace("Adding cluster [" << cluster.fX << ", " << cluster.fY << "] from chamber 8.");
488 AliStation4Data* newdata = fSt4points.Add();
489 newdata->fClusterPoint = cluster;
490 newdata->fSt5tag = data;
496 DebugTrace("ERROR: Unexpected state for SM4 in AliHLTMUONMansoTrackerFSM::ReceiveClustersChamber8!");
501 void AliHLTMUONMansoTrackerFSM::ReceiveClustersChamber9(
502 const AliHLTMUONRecHitStruct* clusters, AliHLTUInt32_t count
505 // State change method for Station 5 state machine.
510 fSm5state = kWaitMoreChamber9;
511 fSm4state = kWaitChamber8; // Start SM4.
513 case kWaitMoreChamber9:
514 for (AliHLTUInt32_t j = 0; j < count; j++)
516 AliHLTMUONRecHitStruct cluster = clusters[j];
517 // Check that the cluster actually is in our region of interest on station 5.
518 if ( fMc1.fRoi.Contains(cluster) )
520 DebugTrace("Adding cluster [" << cluster.fX << ", " << cluster.fY << "] from chamber 9.");
521 AliStation5Data* data = fSt5data.Add();
522 data->fClusterPoint = cluster;
523 ProjectToStation4(data, fgZ9); // This adds a new request for station 4.
529 DebugTrace("ERROR: Unexpected state for SM5 in AliHLTMUONMansoTrackerFSM::ReceiveClustersChamber9!");
534 void AliHLTMUONMansoTrackerFSM::ReceiveClustersChamber10(
535 const AliHLTMUONRecHitStruct* clusters, AliHLTUInt32_t count
538 // State change method for Station 5 state machine.
543 fSm5state = kWaitMoreChamber10;
544 fSm4state = kWaitChamber8; // Start SM4.
546 case kWaitMoreChamber10:
547 for (AliHLTUInt32_t j = 0; j < count; j++)
549 AliHLTMUONRecHitStruct cluster = clusters[j];
550 // Check that the cluster actually is in our region of interest on station 5.
551 if ( fMc1.fRoi.Contains(cluster) )
553 DebugTrace("Adding cluster [" << cluster.fX << ", " << cluster.fY << "] from chamber 10.");
554 AliStation5Data* data = fSt5data.Add();
555 data->fClusterPoint = cluster;
556 ProjectToStation4(data, fgZ10); // This adds a new request for station 4.
562 DebugTrace("ERROR: Unexpected state for SM5 in AliHLTMUONMansoTrackerFSM::ReceiveClustersChamber10!");
567 void AliHLTMUONMansoTrackerFSM::EndOfClustersChamber7()
569 // State change method for Station 4 state machine.
571 fRequestsCompleted++; // Increment the number of requests completed for station 4.
572 DebugTrace("fRequestsCompleted = " << fRequestsCompleted );
577 // If all data from station 5 is received and no data found on
578 // chambers 7 or 8 then we can not find a track.
579 if (fSm5state == kSM5Done) NoTrackFound();
582 case kWaitMoreChamber7:
583 if (fRequestsCompleted == fSt5data.Count() && fSm5state == kSM5Done)
588 DebugTrace("ERROR: Unexpected state for SM4 in AliHLTMUONMansoTrackerFSM::EndOfClustersChamber7!");
593 void AliHLTMUONMansoTrackerFSM::EndOfClustersChamber8()
595 // State change method for Station 4 state machine.
597 fRequestsCompleted++; // Increment the number of requests completed for station 4.
598 DebugTrace("fRequestsCompleted = " << fRequestsCompleted );
603 // Ignore. The requests for chamber 8 are already re-requested below.
608 fSm4state = kWaitChamber7;
609 fSt4chamber = kChamber7;
611 // We need to resend the requests for chamber 8, but change the request
612 // to get data for chamber 7 instead:
613 AliHLTUInt32_t reqlistsize = fSt5data.Count();
614 DebugTrace("Re-requesting clusters from chamber 7... reqlistsize = " << reqlistsize);
616 Station5List::Iterator rec = fSt5data.First();
617 for (AliHLTUInt32_t i = 0; i < reqlistsize; i++, rec++)
619 // Need to create a new st5 data block for the request.
620 AliStation5Data* data = fSt5data.Add();
621 data->fClusterPoint = rec->fClusterPoint;
622 data->fTag.fLine = rec->fTag.fLine;
624 // Rebuild a region of interest for chamber 7.
625 // Remember the parameters a and b are station specific.
626 AliHLTMUONRecHitStruct p7 = data->fTag.fLine.FindIntersectWithXYPlain( fgZ7 );
627 data->fTag.fChamber = kChamber7;
628 data->fTag.fRoi.Create(p7, fgA7, fgB7);
630 AliHLTFloat32_t left, right, bottom, top;
631 data->fTag.fRoi.GetBoundaryBox(left, right, bottom, top);
632 // Make request for chamber 7 data.
633 RequestClusters(left, right, bottom, top, kChamber7, &data->fTag);
638 case kWaitMoreChamber8:
639 if (fRequestsCompleted == fSt5data.Count() && fSm5state == kSM5Done)
644 DebugTrace("ERROR: Unexpected state for SM4 in AliHLTMUONMansoTrackerFSM::EndOfClustersChamber8!");
649 void AliHLTMUONMansoTrackerFSM::EndOfClustersChamber9()
651 // State change method for Station 5 state machine.
656 fSm5state = kSM5Done;
657 EndOfClusterRequests();
661 case kWaitMoreChamber9:
662 fSm5state = kSM5Done;
663 EndOfClusterRequests();
664 if (fRequestsCompleted == fSt5data.Count())
669 DebugTrace("ERROR: Unexpected state for SM5 in AliHLTMUONMansoTrackerFSM::EndOfClustersChamber9!");
674 void AliHLTMUONMansoTrackerFSM::EndOfClustersChamber10()
676 // State change method for Station 5 state machine.
682 fSm5state = kWaitChamber9;
684 // No clusters found on chamber 10 so we need to make a request for
685 // clusters from chamber 9:
686 AliHLTMUONRecHitStruct p9 = fMc1.fLine.FindIntersectWithXYPlain( fgZ9 );
688 // Build a region of interest for tracking station 5 (chamber 9).
689 // Remember the parameters a and b are station specific.
690 fMc1.fChamber = kChamber9;
691 fMc1.fRoi.Create(p9, fgA9, fgB9);
693 AliHLTFloat32_t left, right, bottom, top;
694 fMc1.fRoi.GetBoundaryBox(left, right, bottom, top);
695 RequestClusters(left, right, bottom, top, kChamber9, &fMc1);
699 case kWaitMoreChamber10:
700 fSm5state = kSM5Done;
701 EndOfClusterRequests();
702 if (fRequestsCompleted == fSt5data.Count())
707 DebugTrace("ERROR: Unexpected state for SM5 in AliHLTMUONMansoTrackerFSM::EndOfClustersChamber10!");
712 void AliHLTMUONMansoTrackerFSM::ProjectToStation4(
713 AliStation5Data* data, register AliHLTFloat32_t station5z
716 // Perform chamber specific operations:
717 // Since certain states of SM4 means that it is fetching for Chamber8
718 // and other states are for fetching from Chamber7. We need to make
719 // requests for the correct chamber.
720 assert( fSm4state == kWaitChamber8
721 || fSm4state == kWaitMoreChamber8
722 || fSm4state == kWaitChamber7
723 || fSm4state == kWaitMoreChamber7
725 AliTagData* tag = &data->fTag;
726 if (fSm4state == kWaitChamber8 || fSm4state == kWaitMoreChamber8)
728 // Form the vector line between trigger station 1 and tracking station 5,
729 // and find the intersection point of the line with station 4 (chamber8).
730 AliLine line51( AliVertex(data->fClusterPoint, station5z), fV1 );
731 AliHLTMUONRecHitStruct intercept = line51.FindIntersectWithXYPlain( fgZ8 );
734 // Build a region of interest for tracking station 4.
735 tag->fChamber = kChamber8;
736 tag->fRoi.Create(intercept, fgA8, fgB8);
740 // Form the vector line between trigger station 1 and tracking station 5,
741 // and find the intersection point of the line with station 4 (chamber7).
742 AliLine line51( AliVertex(data->fClusterPoint, station5z), fV1 );
743 AliHLTMUONRecHitStruct intercept = line51.FindIntersectWithXYPlain( fgZ7 );
746 // Build a region of interest for tracking station 4.
747 tag->fChamber = kChamber7;
748 tag->fRoi.Create(intercept, fgA7, fgB7);
751 // Make the request for clusters from station 4.
752 AliHLTFloat32_t left, right, bottom, top;
753 tag->fRoi.GetBoundaryBox(left, right, bottom, top);
754 RequestClusters(left, right, bottom, top, tag->fChamber, tag);
758 void AliHLTMUONMansoTrackerFSM::ProcessClusters()
760 // Process clusters that have been received.
761 // This is called once all clusters have been found.
763 DebugTrace("ProcessClusters...");
765 // Check if the cluster point list on station 4 is empty.
766 // If it is then we have not found any tracks.
767 fFoundPoint = fSt4points.First();
768 if (fFoundPoint == fSt4points.End())
774 fSt5rec = fSt5data.First();
775 if (fSt5rec != fSt5data.End())
777 // Only look at station 5 data records that are for the found chamber number.
778 // Note: either we only have chamber 8 data or we have chamber 7 data followed
779 // by chamber 8 data.
780 // Thus if we hit records that we are not interested in already then the list
781 // contains no interesting data and we can signal no track found.
782 if (fSt5rec->fTag.fChamber != fSt4chamber)
788 // For all combinations of cluster point pairs from station 4 and 5
789 // signal a found track:
792 DebugTrace("\tfSt5rec->fTag.chamber = " << fSt5rec->fTag.fChamber
793 << " , fSt4chamber = " << fSt4chamber
796 for (fFoundPoint = fSt4points.First(); fFoundPoint != fSt4points.End(); fFoundPoint++)
798 if (fFoundPoint->fSt5tag == &fSt5rec->fTag)
802 fSt5rec++; // Get next station 5 cluster point.
803 } while (fSt5rec != fSt5data.End() && fSt5rec->fTag.fChamber == fSt4chamber);