1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ////////////////////////////////////
20 /// \class AliMUONVTrackReconstructor
21 /// Virtual MUON track reconstructor in ALICE (class renamed from AliMUONEventReconstructor)
23 /// This class contains as data:
24 /// * a pointer to the array of hits to be reconstructed (the event)
25 /// * a pointer to the array of segments made with these hits inside each station
26 /// * a pointer to the array of reconstructed tracks
28 /// It contains as methods, among others:
29 /// * EventReconstruct to build the muon tracks
30 /// * EventReconstructTrigger to build the trigger tracks
32 /// Several options and adjustable parameters are available for both Kalman and Original
33 /// tracking algorithms (hard coded for the moment in AliMUONVTrackReconstructor.cxx):
34 /// - *fgkSigmaToCutForTracking* : quality cut used to select new clusters to be
35 /// attached to the track candidate and to select good tracks.
36 /// - *fgkTrackAllTracks* : according to the value of this flag, in case that several
37 /// new clusters pass the quality cut, either we consider all the possibilities
38 /// (duplicating tracks) or we attach only the best cluster.
39 /// - *fgkRecoverTracks* : if this flag is set to 'true', we try to recover the tracks
40 /// lost during the tracking by removing the worst of the 2 clusters attached in the
42 /// - *fgkImproveTracks* : if this flag is set to 'true', we try to improve the quality
43 /// of the tracks at the end of the tracking by removing clusters that do not pass
44 /// new quality cut (within the limit that we must keep at least one cluster per
46 /// - *fgkSigmaToCutForImprovement* : quality cut used when we try to improve the
47 /// quality of the tracks.
49 /// \author Philippe Pillot
51 ////////////////////////////////////
53 #include "AliMUONVTrackReconstructor.h"
55 #include "AliMUONConstants.h"
56 #include "AliMUONRawCluster.h"
57 #include "AliMUONHitForRec.h"
58 #include "AliMUONObjectPair.h"
59 #include "AliMUONTriggerTrack.h"
60 #include "AliMUONTriggerCircuit.h"
61 #include "AliMUONLocalTrigger.h"
62 #include "AliMUONGlobalTrigger.h"
63 #include "AliMUONTrack.h"
64 #include "AliMUONTrackParam.h"
65 #include "AliMUONTrackExtrap.h"
66 #include "AliMUONTrackHitPattern.h"
67 #include "AliMUONVTrackStore.h"
68 #include "AliMUONVClusterStore.h"
69 #include "AliMUONRawCluster.h"
70 #include "AliMUONVTriggerStore.h"
71 #include "AliMUONVTriggerTrackStore.h"
72 #include "AliMpDEManager.h"
75 #include "AliTracker.h"
77 #include <TClonesArray.h>
81 #include <Riostream.h>
84 ClassImp(AliMUONVTrackReconstructor) // Class implementation in ROOT context
87 //************* Defaults parameters for reconstruction
88 const Double_t AliMUONVTrackReconstructor::fgkDefaultMinBendingMomentum = 3.0;
89 const Double_t AliMUONVTrackReconstructor::fgkDefaultMaxBendingMomentum = 3000.0;
90 const Double_t AliMUONVTrackReconstructor::fgkDefaultMaxNormChi2MatchTrigger = 16.0;
92 const Double_t AliMUONVTrackReconstructor::fgkSigmaToCutForTracking = 6.0;
93 const Double_t AliMUONVTrackReconstructor::fgkSigmaToCutForImprovement = 4.0;
94 const Bool_t AliMUONVTrackReconstructor::fgkTrackAllTracks = kTRUE;
95 const Double_t AliMUONVTrackReconstructor::fgkMaxTrackingDistanceBending = 2.;
96 const Double_t AliMUONVTrackReconstructor::fgkMaxTrackingDistanceNonBending = 2.;
97 const Bool_t AliMUONVTrackReconstructor::fgkRecoverTracks = kTRUE;
98 const Bool_t AliMUONVTrackReconstructor::fgkImproveTracks = kTRUE;
101 //__________________________________________________________________________
102 AliMUONVTrackReconstructor::AliMUONVTrackReconstructor()
104 fMinBendingMomentum(fgkDefaultMinBendingMomentum),
105 fMaxBendingMomentum(fgkDefaultMaxBendingMomentum),
106 fMaxNormChi2MatchTrigger(fgkDefaultMaxNormChi2MatchTrigger),
109 fNHitsForRecPerChamber(0x0),
110 fIndexOfFirstHitForRecPerChamber(0x0),
114 /// Constructor for class AliMUONVTrackReconstructor
115 fNHitsForRecPerChamber = new Int_t[AliMUONConstants::NTrackingCh()];
116 fIndexOfFirstHitForRecPerChamber = new Int_t[AliMUONConstants::NTrackingCh()];
118 // Memory allocation for the TClonesArray of hits for reconstruction
119 // Is 10000 the right size ????
120 fHitsForRecPtr = new TClonesArray("AliMUONHitForRec", 10000);
122 // Memory allocation for the TClonesArray of reconstructed tracks
123 fRecTracksPtr = new TClonesArray("AliMUONTrack", 10);
125 // set the magnetic field for track extrapolations
126 const AliMagF* kField = AliTracker::GetFieldMap();
127 if (!kField) AliFatal("No field available");
128 AliMUONTrackExtrap::SetField(kField);
131 //__________________________________________________________________________
132 AliMUONVTrackReconstructor::~AliMUONVTrackReconstructor()
134 /// Destructor for class AliMUONVTrackReconstructor
135 delete [] fNHitsForRecPerChamber;
136 delete [] fIndexOfFirstHitForRecPerChamber;
137 delete fHitsForRecPtr;
138 delete fRecTracksPtr;
141 //__________________________________________________________________________
142 void AliMUONVTrackReconstructor::ResetHitsForRec()
144 /// To reset the TClonesArray of HitsForRec,
145 /// and the number of HitForRec and the index of the first HitForRec per chamber
146 if (fHitsForRecPtr) fHitsForRecPtr->Clear("C");
148 for (Int_t ch = 0; ch < AliMUONConstants::NTrackingCh(); ch++) {
149 fNHitsForRecPerChamber[ch] = 0;
150 fIndexOfFirstHitForRecPerChamber[ch] = 0;
154 //__________________________________________________________________________
155 void AliMUONVTrackReconstructor::ResetTracks()
157 /// To reset the TClonesArray of reconstructed tracks
158 if (fRecTracksPtr) fRecTracksPtr->Clear("C");
163 //__________________________________________________________________________
164 void AliMUONVTrackReconstructor::EventReconstruct(const AliMUONVClusterStore& clusterStore, AliMUONVTrackStore& trackStore)
166 /// To reconstruct one event
171 AddHitsForRecFromRawClusters(clusterStore);
174 // Add tracks to MUON data container
175 for (Int_t i=0; i<fNRecTracks; ++i)
177 AliMUONTrack * track = (AliMUONTrack*) fRecTracksPtr->At(i);
178 trackStore.Add(*track);
182 //__________________________________________________________________________
183 void AliMUONVTrackReconstructor::AddHitsForRecFromRawClusters(const AliMUONVClusterStore& clusterStore)
185 /// Build internal array of hit for rec from clusterStore
187 TIter next(clusterStore.CreateIterator());
188 AliMUONRawCluster* clus(0x0);
191 while ( ( clus = static_cast<AliMUONRawCluster*>(next()) ) )
193 // new AliMUONHitForRec from raw cluster
194 // and increment number of AliMUONHitForRec's (total and in chamber)
195 AliMUONHitForRec* hitForRec = new ((*fHitsForRecPtr)[fNHitsForRec]) AliMUONHitForRec(clus);
197 // more information into HitForRec
198 hitForRec->SetBendingReso2(clus->GetErrY() * clus->GetErrY());
199 hitForRec->SetNonBendingReso2(clus->GetErrX() * clus->GetErrX());
200 // original raw cluster
201 Int_t ch = AliMpDEManager::GetChamberId(clus->GetDetElemId());
202 hitForRec->SetChamberNumber(ch);
203 hitForRec->SetHitNumber(iclus);
204 // Z coordinate of the raw cluster (cm)
205 hitForRec->SetZ(clus->GetZ(0));
206 if (AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 3) {
207 cout << "Chamber " << ch <<" raw cluster " << iclus << " : " << endl;
209 cout << "AliMUONHitForRec number (1...): " << fNHitsForRec << endl;
210 hitForRec->Print("full");
213 } // end of chamber loop
215 SortHitsForRecWithIncreasingChamber();
217 AliDebug(1,"End of AddHitsForRecFromRawClusters");
219 if (AliLog::GetGlobalDebugLevel() > 0)
221 AliDebug(1, Form("NHitsForRec: %d",fNHitsForRec));
222 for (Int_t ch = 0; ch < AliMUONConstants::NTrackingCh(); ch++)
224 AliDebug(1, Form("Chamber(0...): %d",ch));
225 AliDebug(1, Form("NHitsForRec: %d", fNHitsForRecPerChamber[ch]));
226 AliDebug(1, Form("Index(first HitForRec): %d", fIndexOfFirstHitForRecPerChamber[ch]));
227 for (Int_t hit = fIndexOfFirstHitForRecPerChamber[ch];
228 hit < fIndexOfFirstHitForRecPerChamber[ch] + fNHitsForRecPerChamber[ch];
230 AliDebug(1, Form("HitForRec index(0...): %d",hit));
231 ((*fHitsForRecPtr)[hit])->Dump();
237 //__________________________________________________________________________
238 void AliMUONVTrackReconstructor::SortHitsForRecWithIncreasingChamber()
240 /// Sort HitsForRec's in increasing order with respect to chamber number.
241 /// Uses the function "Compare".
242 /// Update the information for HitsForRec per chamber too.
243 Int_t ch, nhits, prevch;
244 fHitsForRecPtr->Sort();
245 for (ch = 0; ch < AliMUONConstants::NTrackingCh(); ch++) {
246 fNHitsForRecPerChamber[ch] = 0;
247 fIndexOfFirstHitForRecPerChamber[ch] = 0;
249 prevch = 0; // previous chamber
250 nhits = 0; // number of hits in current chamber
251 // Loop over HitsForRec
252 for (Int_t hit = 0; hit < fNHitsForRec; hit++) {
253 // chamber number (0...)
254 ch = ((AliMUONHitForRec*) ((*fHitsForRecPtr)[hit]))->GetChamberNumber();
255 // increment number of hits in current chamber
256 (fNHitsForRecPerChamber[ch])++;
257 // update index of first HitForRec in current chamber
258 // if chamber number different from previous one
260 fIndexOfFirstHitForRecPerChamber[ch] = hit;
267 //__________________________________________________________________________
268 void AliMUONVTrackReconstructor::MakeTracks()
270 /// To make the tracks from the list of segments and points in all stations
271 AliDebug(1,"Enter MakeTracks");
272 // Look for candidates from at least 3 aligned points in stations(1..) 4 and 5
273 MakeTrackCandidates();
274 if (fRecTracksPtr->GetEntriesFast() == 0) return;
275 // Follow tracks in stations(1..) 3, 2 and 1
277 // Improve the reconstructed tracks
278 if (fgkImproveTracks) ImproveTracks();
279 // Remove double tracks
280 RemoveDoubleTracks();
281 // Fill AliMUONTrack data members
285 //__________________________________________________________________________
286 TClonesArray* AliMUONVTrackReconstructor::MakeSegmentsInStation(Int_t station)
288 /// To make the list of segments in station(0..) "Station" from the list of hits to be reconstructed.
289 /// Return a new TClonesArray of segments.
290 /// It is the responsibility of the user to delete it afterward.
291 AliDebug(1,Form("Enter MakeSegmentsPerStation (0...) %d",station));
293 AliMUONHitForRec *hit1Ptr, *hit2Ptr;
294 AliMUONObjectPair *segment;
295 Double_t bendingSlope = 0, impactParam = 0., bendingMomentum = 0.; // to avoid compilation warning
296 // first and second chambers (0...) in the station
297 Int_t ch1 = 2 * station;
301 TClonesArray *segments = new TClonesArray("AliMUONObjectPair", fNHitsForRecPerChamber[ch2]);
302 segments->SetOwner(kTRUE);
304 // Loop over HitForRec's in the first chamber of the station
305 for (Int_t hit1 = fIndexOfFirstHitForRecPerChamber[ch1];
306 hit1 < fIndexOfFirstHitForRecPerChamber[ch1] + fNHitsForRecPerChamber[ch1];
309 // pointer to the HitForRec
310 hit1Ptr = (AliMUONHitForRec*) ((*fHitsForRecPtr)[hit1]);
311 // Loop over HitsForRec's in the second chamber of the station
312 for (Int_t hit2 = fIndexOfFirstHitForRecPerChamber[ch2];
313 hit2 < fIndexOfFirstHitForRecPerChamber[ch2] + fNHitsForRecPerChamber[ch2];
316 // pointer to the HitForRec
317 hit2Ptr = (AliMUONHitForRec*) ((*fHitsForRecPtr)[hit2]);
318 if ( hit1Ptr->GetZ() - hit2Ptr->GetZ() != 0. )
321 bendingSlope = (hit1Ptr->GetBendingCoor() - hit2Ptr->GetBendingCoor()) / (hit1Ptr->GetZ() - hit2Ptr->GetZ());
323 impactParam = hit1Ptr->GetBendingCoor() - hit1Ptr->GetZ() * bendingSlope;
324 // absolute value of bending momentum
325 bendingMomentum = TMath::Abs(AliMUONTrackExtrap::GetBendingMomentumFromImpactParam(impactParam));
328 AliWarning("hit1Ptr->GetZ() = hit2Ptr->GetZ(): no segment created");
331 // check for bending momentum within tolerances
332 if ((bendingMomentum < fMaxBendingMomentum) && (bendingMomentum > fMinBendingMomentum))
335 segment = new ((*segments)[segments->GetLast()+1]) AliMUONObjectPair(hit1Ptr, hit2Ptr, kFALSE, kFALSE);
336 if (AliLog::GetGlobalDebugLevel() > 1) {
337 cout << "segmentIndex(0...): " << segments->GetLast() << endl;
339 cout << "HitForRec in first chamber" << endl;
341 cout << "HitForRec in second chamber" << endl;
346 } // for (Int_t hit1...
347 AliDebug(1,Form("Station: %d NSegments: %d ", station, segments->GetEntriesFast()));
351 //__________________________________________________________________________
352 void AliMUONVTrackReconstructor::RemoveIdenticalTracks()
354 /// To remove identical tracks:
355 /// Tracks are considered identical if they have all their hits in common.
356 /// One keeps the track with the larger number of hits if need be
357 AliMUONTrack *track1, *track2, *trackToRemove;
358 Int_t hitsInCommon, nHits1, nHits2;
359 Bool_t removedTrack1;
360 // Loop over first track of the pair
361 track1 = (AliMUONTrack*) fRecTracksPtr->First();
363 removedTrack1 = kFALSE;
364 nHits1 = track1->GetNTrackHits();
365 // Loop over second track of the pair
366 track2 = (AliMUONTrack*) fRecTracksPtr->After(track1);
368 nHits2 = track2->GetNTrackHits();
369 // number of hits in common between two tracks
370 hitsInCommon = track1->HitsInCommon(track2);
371 // check for identical tracks
372 if ((hitsInCommon == nHits1) || (hitsInCommon == nHits2)) {
373 // decide which track to remove
374 if (nHits2 > nHits1) {
375 // remove track1 and continue the first loop with the track next to track1
376 trackToRemove = track1;
377 track1 = (AliMUONTrack*) fRecTracksPtr->After(track1);
378 fRecTracksPtr->Remove(trackToRemove);
379 fRecTracksPtr->Compress(); // this is essential to retrieve the TClonesArray afterwards
381 removedTrack1 = kTRUE;
384 // remove track2 and continue the second loop with the track next to track2
385 trackToRemove = track2;
386 track2 = (AliMUONTrack*) fRecTracksPtr->After(track2);
387 fRecTracksPtr->Remove(trackToRemove);
388 fRecTracksPtr->Compress(); // this is essential to retrieve the TClonesArray afterwards
391 } else track2 = (AliMUONTrack*) fRecTracksPtr->After(track2);
393 if (removedTrack1) continue;
394 track1 = (AliMUONTrack*) fRecTracksPtr->After(track1);
399 //__________________________________________________________________________
400 void AliMUONVTrackReconstructor::RemoveDoubleTracks()
402 /// To remove double tracks:
403 /// Tracks are considered identical if more than half of the hits of the track
404 /// which has the smaller number of hits are in common with the other track.
405 /// Among two identical tracks, one keeps the track with the larger number of hits
406 /// or, if these numbers are equal, the track with the minimum chi2.
407 AliMUONTrack *track1, *track2, *trackToRemove;
408 Int_t hitsInCommon, nHits1, nHits2;
409 Bool_t removedTrack1;
410 // Loop over first track of the pair
411 track1 = (AliMUONTrack*) fRecTracksPtr->First();
413 removedTrack1 = kFALSE;
414 nHits1 = track1->GetNTrackHits();
415 // Loop over second track of the pair
416 track2 = (AliMUONTrack*) fRecTracksPtr->After(track1);
418 nHits2 = track2->GetNTrackHits();
419 // number of hits in common between two tracks
420 hitsInCommon = track1->HitsInCommon(track2);
421 // check for identical tracks
422 if (((nHits1 < nHits2) && (2 * hitsInCommon > nHits1)) || (2 * hitsInCommon > nHits2)) {
423 // decide which track to remove
424 if ((nHits1 > nHits2) || ((nHits1 == nHits2) && (track1->GetFitFMin() <= track2->GetFitFMin()))) {
425 // remove track2 and continue the second loop with the track next to track2
426 trackToRemove = track2;
427 track2 = (AliMUONTrack*) fRecTracksPtr->After(track2);
428 fRecTracksPtr->Remove(trackToRemove);
429 fRecTracksPtr->Compress(); // this is essential to retrieve the TClonesArray afterwards
432 // else remove track1 and continue the first loop with the track next to track1
433 trackToRemove = track1;
434 track1 = (AliMUONTrack*) fRecTracksPtr->After(track1);
435 fRecTracksPtr->Remove(trackToRemove);
436 fRecTracksPtr->Compress(); // this is essential to retrieve the TClonesArray afterwards
438 removedTrack1 = kTRUE;
441 } else track2 = (AliMUONTrack*) fRecTracksPtr->After(track2);
443 if (removedTrack1) continue;
444 track1 = (AliMUONTrack*) fRecTracksPtr->After(track1);
449 //__________________________________________________________________________
450 Double_t AliMUONVTrackReconstructor::TryOneHitForRec(const AliMUONTrackParam &trackParam, AliMUONHitForRec* hitForRec,
451 AliMUONTrackParam &trackParamAtHit, Bool_t updatePropagator)
453 /// Test the compatibility between the track and the hitForRec (using trackParam's covariance matrix):
454 /// return the corresponding Chi2
455 /// return trackParamAtHit
457 if (!trackParam.CovariancesExist()) AliWarning(" track parameter covariance matrix does not exist");
459 // extrapolate track parameters and covariances at the z position of the tested hit
460 if (&trackParam != &trackParamAtHit) {
461 trackParamAtHit = trackParam;
462 AliMUONTrackExtrap::ExtrapToZCov(&trackParamAtHit, hitForRec->GetZ(), updatePropagator);
465 // set pointer to hit into trackParamAtHit
466 trackParamAtHit.SetHitForRecPtr(hitForRec);
468 // Set differences between trackParam and hitForRec in the bending and non bending directions
470 dPos(0,0) = hitForRec->GetNonBendingCoor() - trackParamAtHit.GetNonBendingCoor();
471 dPos(1,0) = hitForRec->GetBendingCoor() - trackParamAtHit.GetBendingCoor();
473 // quick test of hitForRec compatibility within a wide road of x*y = 10*1 cm2 to save computing time
474 if (TMath::Abs(dPos(0,0)) > fgkMaxTrackingDistanceNonBending ||
475 TMath::Abs(dPos(1,0)) > fgkMaxTrackingDistanceBending) return 1.e10;
477 // Set the error matrix from trackParam covariances and hitForRec resolution
478 const TMatrixD& kParamCov = trackParamAtHit.GetCovariances();
480 error(0,0) = kParamCov(0,0) + hitForRec->GetNonBendingReso2();
481 error(0,1) = kParamCov(0,2);
482 error(1,0) = kParamCov(2,0);
483 error(1,1) = kParamCov(2,2) + hitForRec->GetBendingReso2();
485 // Invert the error matrix for Chi2 calculation
486 if (error.Determinant() != 0) {
489 AliWarning(" Determinant error=0");
493 // Compute the Chi2 value
494 TMatrixD tmp(dPos,TMatrixD::kTransposeMult,error);
495 TMatrixD result(tmp,TMatrixD::kMult,dPos);
501 //__________________________________________________________________________
502 void AliMUONVTrackReconstructor::ValidateTracksWithTrigger(AliMUONVTrackStore& trackStore,
503 const AliMUONVTriggerTrackStore& triggerTrackStore,
504 const AliMUONVTriggerStore& triggerStore,
505 const AliMUONTrackHitPattern& trackHitPattern)
507 /// Try to match track from tracking system with trigger track
508 static const Double_t kDistSigma[3]={1,1,0.02}; // sigma of distributions (trigger-track) X,Y,slopeY
512 Double_t distTriggerTrack[3];
513 Double_t xTrack, yTrack, ySlopeTrack, chi2MatchTrigger, minChi2MatchTrigger, chi2;
515 TIter itTrack(trackStore.CreateIterator());
518 while ( ( track = static_cast<AliMUONTrack*>(itTrack()) ) )
521 chi2MatchTrigger = 0.;
523 Int_t doubleMatch=-1; // Check if track matches 2 trigger tracks
524 Double_t doubleChi2 = -1.;
526 AliMUONTrackParam trackParam(*((AliMUONTrackParam*) (track->GetTrackParamAtHit()->Last())));
527 AliMUONTrackExtrap::ExtrapToZ(&trackParam, AliMUONConstants::DefaultChamberZ(10)); // extrap to 1st trigger chamber
529 xTrack = trackParam.GetNonBendingCoor();
530 yTrack = trackParam.GetBendingCoor();
531 ySlopeTrack = trackParam.GetBendingSlope();
532 minChi2MatchTrigger = 999.;
534 AliMUONTriggerTrack *triggerTrack;
535 TIter itTriggerTrack(triggerTrackStore.CreateIterator());
536 while ( ( triggerTrack = static_cast<AliMUONTriggerTrack*>(itTriggerTrack() ) ) )
538 distTriggerTrack[0] = (triggerTrack->GetX11()-xTrack)/kDistSigma[0];
539 distTriggerTrack[1] = (triggerTrack->GetY11()-yTrack)/kDistSigma[1];
540 distTriggerTrack[2] = (TMath::Tan(triggerTrack->GetThetay())-ySlopeTrack)/kDistSigma[2];
542 for (Int_t iVar = 0; iVar < 3; iVar++) chi2 += distTriggerTrack[iVar]*distTriggerTrack[iVar];
543 chi2 /= 3.; // Normalized Chi2: 3 degrees of freedom (X,Y,slopeY)
544 if (chi2 < fMaxNormChi2MatchTrigger)
546 Bool_t isDoubleTrack = (TMath::Abs(chi2 - minChi2MatchTrigger)<1.);
547 if (chi2 < minChi2MatchTrigger && chi2 < fMaxNormChi2MatchTrigger)
551 doubleMatch = loTrgNum;
552 doubleChi2 = chi2MatchTrigger;
554 minChi2MatchTrigger = chi2;
555 chi2MatchTrigger = chi2;
556 loTrgNum = triggerTrack->GetLoTrgNum();
557 AliMUONLocalTrigger* locTrg = triggerStore.FindLocal(loTrgNum);
559 if(locTrg->LoLpt()>0)matchTrigger=2;
560 if(locTrg->LoHpt()>0)matchTrigger=3;
562 else if(isDoubleTrack)
564 doubleMatch = triggerTrack->GetLoTrgNum();
570 { // If two trigger tracks match, select the one passing more trigger cuts
571 AliDebug(1, Form("Two candidates found: %i and %i",loTrgNum,doubleMatch));
572 AliMUONLocalTrigger* locTrg1 = triggerStore.FindLocal(doubleMatch);
573 if((locTrg1->LoLpt()>0 && matchTrigger<2) || (locTrg1->LoHpt() && matchTrigger<3))
575 if(locTrg1->LoHpt()>0)matchTrigger=3;
577 loTrgNum = doubleMatch;
578 chi2MatchTrigger=doubleChi2;
582 track->SetMatchTrigger(matchTrigger);
583 track->SetLoTrgNum(loTrgNum);
584 track->SetChi2MatchTrigger(chi2MatchTrigger);
586 AliMUONLocalTrigger* locTrg = static_cast<AliMUONLocalTrigger*>(triggerStore.FindLocal(loTrgNum));
590 track->SetLocalTrigger(locTrg->LoCircuit(),
599 trackHitPattern.GetHitPattern(trackStore,triggerStore);
602 //__________________________________________________________________________
603 void AliMUONVTrackReconstructor::EventReconstructTrigger(const AliMUONTriggerCircuit& circuit,
604 const AliMUONVTriggerStore& triggerStore,
605 AliMUONVTriggerTrackStore& triggerTrackStore)
607 /// To make the trigger tracks from Local Trigger
610 AliMUONGlobalTrigger* globalTrigger = triggerStore.Global();
612 UChar_t gloTrigPat = 0;
616 gloTrigPat = globalTrigger->GetGlobalResponse();
619 TIter next(triggerStore.CreateIterator());
620 AliMUONLocalTrigger* locTrg(0x0);
622 Float_t z11 = AliMUONConstants::DefaultChamberZ(10);
623 Float_t z21 = AliMUONConstants::DefaultChamberZ(12);
625 AliMUONTriggerTrack triggerTrack;
627 while ( ( locTrg = static_cast<AliMUONLocalTrigger*>(next()) ) )
632 Int_t localBoardId = locTrg->LoCircuit();
633 if ( locTrg->LoSdev()==1 && locTrg->LoDev()==0 &&
634 locTrg->LoStripX()==0) xTrig=kFALSE; // no trigger in X
635 else xTrig=kTRUE; // trigger in X
636 if (locTrg->LoTrigY()==1 &&
637 locTrg->LoStripY()==15 ) yTrig = kFALSE; // no trigger in Y
638 else yTrig = kTRUE; // trigger in Y
641 { // make Trigger Track if trigger in X and Y
643 Float_t y11 = circuit.GetY11Pos(localBoardId, locTrg->LoStripX());
644 // need first to convert deviation to [0-30]
645 // (see AliMUONLocalTriggerBoard::LocalTrigger)
646 Int_t deviation = locTrg->LoDev();
648 if ( !locTrg->LoSdev() && deviation ) sign=-1;
649 if ( !locTrg->LoSdev() && !deviation ) sign= 0;
650 if ( locTrg->LoSdev() == 1 ) sign=+1;
653 Int_t stripX21 = locTrg->LoStripX()+deviation+1;
654 Float_t y21 = circuit.GetY21Pos(localBoardId, stripX21);
655 Float_t x11 = circuit.GetX11Pos(localBoardId, locTrg->LoStripY());
657 AliDebug(1, Form(" MakeTriggerTrack %d %d %d %d %f %f %f \n",locTrg->LoCircuit(),
658 locTrg->LoStripX(),locTrg->LoStripX()+locTrg->LoDev()+1,locTrg->LoStripY(),y11, y21, x11));
660 Float_t thetax = TMath::ATan2( x11 , z11 );
661 Float_t thetay = TMath::ATan2( (y21-y11) , (z21-z11) );
663 triggerTrack.SetX11(x11);
664 triggerTrack.SetY11(y11);
665 triggerTrack.SetThetax(thetax);
666 triggerTrack.SetThetay(thetay);
667 triggerTrack.SetGTPattern(gloTrigPat);
668 triggerTrack.SetLoTrgNum(localBoardId);
670 triggerTrackStore.Add(triggerTrack);
672 } // end of loop on Local Trigger