- ((*fSegmentsPtr[st])[seg])->Print();
- }
- }
- );
- return;
-}
-
- //__________________________________________________________________________
-void AliMUONTrackReconstructor::MakeTracks(void)
-{
- /// To make the tracks from the list of segments and points in all stations
- AliDebug(1,"Enter MakeTracks");
- // Look for candidates from at least 3 aligned points in stations(1..) 4 and 5
- MakeTrackCandidates();
- // Follow tracks in stations(1..) 3, 2 and 1
- FollowTracks();
- // Remove double tracks
- RemoveDoubleTracks();
- UpdateHitForRecAtHit();
-}
-
- //__________________________________________________________________________
-void AliMUONTrackReconstructor::MakeTrackCandidates(void)
-{
- /// To make track candidates
- /// with at least 3 aligned points in stations(1..) 4 and 5
- /// (two Segment's or one Segment and one HitForRec)
- Int_t begStation, iBegSegment, nbCan1Seg1Hit, nbCan2Seg;
- AliMUONSegment *begSegment;
- AliDebug(1,"Enter MakeTrackCandidates");
- // Loop over stations(1..) 5 and 4 for the beginning segment
- for (begStation = 4; begStation > 2; begStation--) {
- // Loop over segments in the beginning station
- for (iBegSegment = 0; iBegSegment < fNSegments[begStation]; iBegSegment++) {
- // pointer to segment
- begSegment = (AliMUONSegment*) ((*fSegmentsPtr[begStation])[iBegSegment]);
- AliDebug(2,Form("Look for TrackCandidate's with Segment %d in Station(0..) %d", iBegSegment, begStation));
- // Look for track candidates with two segments,
- // "begSegment" and all compatible segments in other station.
- // Only for beginning station(1..) 5
- // because candidates with 2 segments have to looked for only once.
- if (begStation == 4)
- nbCan2Seg = MakeTrackCandidatesWithTwoSegments(begSegment);
- // Look for track candidates with one segment and one point,
- // "begSegment" and all compatible HitForRec's in other station.
- // Only if "begSegment" does not belong already to a track candidate.
- // Is that a too strong condition ????
- if (!(begSegment->GetInTrack()))
- nbCan1Seg1Hit = MakeTrackCandidatesWithOneSegmentAndOnePoint(begSegment);
- } // for (iBegSegment = 0;...
- } // for (begStation = 4;...
- return;
-}
-
- //__________________________________________________________________________
-Int_t AliMUONTrackReconstructor::MakeTrackCandidatesWithTwoSegments(AliMUONSegment *BegSegment)
-{
- /// To make track candidates with two segments in stations(1..) 4 and 5,
- /// the first segment being pointed to by "BegSegment".
- /// Returns the number of such track candidates.
- Int_t endStation, iEndSegment, nbCan2Seg;
- AliMUONSegment *endSegment;
- AliMUONSegment *extrapSegment = NULL;
- AliMUONTrack *recTrack;
- Double_t mcsFactor;
- AliDebug(1,"Enter MakeTrackCandidatesWithTwoSegments");
- // Station for the end segment
- endStation = 7 - (BegSegment->GetHitForRec1())->GetChamberNumber() / 2;
- // multiple scattering factor corresponding to one chamber
- mcsFactor = 0.0136 /
- GetBendingMomentumFromImpactParam(BegSegment->GetBendingImpact());
- mcsFactor = fChamberThicknessInX0 * mcsFactor * mcsFactor;
- // linear extrapolation to end station
- // number of candidates with 2 segments to 0
- nbCan2Seg = 0;
- // Loop over segments in the end station
- for (iEndSegment = 0; iEndSegment < fNSegments[endStation]; iEndSegment++) {
- // pointer to segment
- endSegment = (AliMUONSegment*) ((*fSegmentsPtr[endStation])[iEndSegment]);
- // test compatibility between current segment and "extrapSegment"
- // 4 because 4 quantities in chi2
- extrapSegment =
- BegSegment->CreateSegmentFromLinearExtrapToStation(endSegment->GetZ(), mcsFactor);
- if ((endSegment->
- NormalizedChi2WithSegment(extrapSegment,
- fMaxSigma2Distance)) <= 4.0) {
- // both segments compatible:
- // make track candidate from "begSegment" and "endSegment"
- AliDebug(2,Form("TrackCandidate with Segment %d in Station(0..) %d", iEndSegment, endStation));
- // flag for both segments in one track:
- // to be done in track constructor ????
- BegSegment->SetInTrack(kTRUE);
- endSegment->SetInTrack(kTRUE);
- recTrack = new ((*fRecTracksPtr)[fNRecTracks]) AliMUONTrack(BegSegment, endSegment);
- // Set track parameters at vertex from last stations 4 & 5
- CalcTrackParamAtVertex(recTrack);
- fNRecTracks++;
- if (AliLog::GetGlobalDebugLevel() > 1) recTrack->RecursiveDump();
- // increment number of track candidates with 2 segments
- nbCan2Seg++;
- }
- delete extrapSegment; // should not delete HitForRec's it points to !!!!
- } // for (iEndSegment = 0;...
- return nbCan2Seg;
-}
-
- //__________________________________________________________________________
-Int_t AliMUONTrackReconstructor::MakeTrackCandidatesWithOneSegmentAndOnePoint(AliMUONSegment *BegSegment)
-{
- /// To make track candidates with one segment and one point
- /// in stations(1..) 4 and 5,
- /// the segment being pointed to by "BegSegment".
- Int_t ch, ch1, ch2, endStation, iHit, iHitMax, iHitMin, nbCan1Seg1Hit;
- AliMUONHitForRec *extrapHitForRec= NULL;
- AliMUONHitForRec *hit;
- AliMUONTrack *recTrack;
- Double_t mcsFactor;
- AliDebug(1,"Enter MakeTrackCandidatesWithOneSegmentAndOnePoint");
- // station for the end point
- endStation = 7 - (BegSegment->GetHitForRec1())->GetChamberNumber() / 2;
- // multiple scattering factor corresponding to one chamber
- mcsFactor = 0.0136 /
- GetBendingMomentumFromImpactParam(BegSegment->GetBendingImpact());
- mcsFactor = fChamberThicknessInX0 * mcsFactor * mcsFactor;
- // first and second chambers(0..) in the end station
- ch1 = 2 * endStation;
- ch2 = ch1 + 1;
- // number of candidates to 0
- nbCan1Seg1Hit = 0;
- // Loop over chambers of the end station
- for (ch = ch2; ch >= ch1; ch--) {
- // limits for the hit index in the loop
- iHitMin = fIndexOfFirstHitForRecPerChamber[ch];
- iHitMax = iHitMin + fNHitsForRecPerChamber[ch];
- // Loop over HitForRec's in the chamber
- for (iHit = iHitMin; iHit < iHitMax; iHit++) {
- // pointer to HitForRec
- hit = (AliMUONHitForRec*) ((*fHitsForRecPtr)[iHit]);
- // test compatibility between current HitForRec and "extrapHitForRec"
- // 2 because 2 quantities in chi2
- // linear extrapolation to chamber
- extrapHitForRec =
- BegSegment->CreateHitForRecFromLinearExtrapToChamber( hit->GetZ(), mcsFactor);
- if ((hit->
- NormalizedChi2WithHitForRec(extrapHitForRec,
- fMaxSigma2Distance)) <= 2.0) {
- // both HitForRec's compatible:
- // make track candidate from begSegment and current HitForRec
- AliDebug(2, Form("TrackCandidate with HitForRec %d in Chamber(0..) %d", iHit, ch));
- // flag for beginning segments in one track:
- // to be done in track constructor ????
- BegSegment->SetInTrack(kTRUE);
- recTrack = new ((*fRecTracksPtr)[fNRecTracks]) AliMUONTrack(BegSegment, hit);
- // Set track parameters at vertex from last stations 4 & 5
- CalcTrackParamAtVertex(recTrack);
- // the right place to eliminate "double counting" ???? how ????