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 //-----------------------------------------------------------------------------
21 // Reconstructed track in ALICE dimuon spectrometer
22 //-----------------------------------------------------------------------------
24 #include "AliMUONTrack.h"
26 #include "AliMUONReconstructor.h"
27 #include "AliMUONVCluster.h"
28 #include "AliMUONVClusterStore.h"
29 #include "AliMUONObjectPair.h"
30 #include "AliMUONTrackExtrap.h"
31 #include "AliMUONConstants.h"
32 #include "AliMUONTrackParam.h"
38 #include <Riostream.h>
43 using std::streamsize;
44 using std::setprecision;
46 ClassImp(AliMUONTrack) // Class implementation in ROOT context
50 const Double_t AliMUONTrack::fgkMaxChi2 = 1.e10; ///< maximum chi2 above which the track can be considered as abnormal
53 //__________________________________________________________________________
54 AliMUONTrack::AliMUONTrack()
56 fTrackParamAtCluster(0x0),
57 fFitWithVertex(kFALSE),
60 fClusterWeightsNonBending(0x0),
61 fClusterWeightsBending(0x0),
65 fChi2MatchTrigger(0.),
67 fTrackParamAtVertex(0x0),
68 fHitsPatternInTrigCh(0),
69 fHitsPatternInTrigChTrk(0),
73 /// Default constructor
74 fVertexErrXY2[0] = 0.;
75 fVertexErrXY2[1] = 0.;
78 //__________________________________________________________________________
79 AliMUONTrack::AliMUONTrack(AliMUONObjectPair *segment, Double_t bendingVertexDispersion)
81 fTrackParamAtCluster(new TObjArray(20)),
82 fFitWithVertex(kFALSE),
85 fClusterWeightsNonBending(0x0),
86 fClusterWeightsBending(0x0),
90 fChi2MatchTrigger(0.),
92 fTrackParamAtVertex(0x0),
93 fHitsPatternInTrigCh(0),
94 fHitsPatternInTrigChTrk(0),
98 /// Constructor from two clusters
100 fTrackParamAtCluster->SetOwner(kTRUE);
102 fVertexErrXY2[0] = 0.;
103 fVertexErrXY2[1] = 0.;
105 // Pointers to clusters from the segment
106 AliMUONVCluster* firstCluster = (AliMUONVCluster*) segment->First();
107 AliMUONVCluster* lastCluster = (AliMUONVCluster*) segment->Second();
109 // Compute track parameters
110 Double_t z1 = firstCluster->GetZ();
111 Double_t z2 = lastCluster->GetZ();
112 Double_t dZ = z1 - z2;
114 Double_t nonBendingCoor1 = firstCluster->GetX();
115 Double_t nonBendingCoor2 = lastCluster->GetX();
116 Double_t nonBendingSlope = (nonBendingCoor1 - nonBendingCoor2) / dZ;
118 Double_t bendingCoor1 = firstCluster->GetY();
119 Double_t bendingCoor2 = lastCluster->GetY();
120 Double_t bendingSlope = (bendingCoor1 - bendingCoor2) / dZ;
121 // Inverse bending momentum
122 Double_t bendingImpact = bendingCoor1 - z1 * bendingSlope;
123 Double_t inverseBendingMomentum = 1. / AliMUONTrackExtrap::GetBendingMomentumFromImpactParam(bendingImpact);
125 // Set track parameters at first cluster
126 AliMUONTrackParam trackParamAtFirstCluster;
127 trackParamAtFirstCluster.SetZ(z1);
128 trackParamAtFirstCluster.SetNonBendingCoor(nonBendingCoor1);
129 trackParamAtFirstCluster.SetNonBendingSlope(nonBendingSlope);
130 trackParamAtFirstCluster.SetBendingCoor(bendingCoor1);
131 trackParamAtFirstCluster.SetBendingSlope(bendingSlope);
132 trackParamAtFirstCluster.SetInverseBendingMomentum(inverseBendingMomentum);
134 // Set track parameters at last cluster
135 AliMUONTrackParam trackParamAtLastCluster;
136 trackParamAtLastCluster.SetZ(z2);
137 trackParamAtLastCluster.SetNonBendingCoor(nonBendingCoor2);
138 trackParamAtLastCluster.SetNonBendingSlope(nonBendingSlope);
139 trackParamAtLastCluster.SetBendingCoor(bendingCoor2);
140 trackParamAtLastCluster.SetBendingSlope(bendingSlope);
141 trackParamAtLastCluster.SetInverseBendingMomentum(inverseBendingMomentum);
143 // Compute and set track parameters covariances at first cluster
144 TMatrixD paramCov(5,5);
147 paramCov(0,0) = firstCluster->GetErrX2();
148 paramCov(0,1) = firstCluster->GetErrX2() / dZ;
149 paramCov(1,0) = paramCov(0,1);
150 paramCov(1,1) = ( firstCluster->GetErrX2() + lastCluster->GetErrX2() ) / dZ / dZ;
152 paramCov(2,2) = firstCluster->GetErrY2();
153 paramCov(2,3) = firstCluster->GetErrY2() / dZ;
154 paramCov(3,2) = paramCov(2,3);
155 paramCov(3,3) = ( firstCluster->GetErrY2() + lastCluster->GetErrY2() ) / dZ / dZ;
156 // Inverse bending momentum (vertex resolution + bending slope resolution + 10% error on dipole parameters+field)
157 if (AliMUONTrackExtrap::IsFieldON()) {
158 paramCov(4,4) = ( ( bendingVertexDispersion*bendingVertexDispersion +
159 (z1 * z1 * lastCluster->GetErrY2() + z2 * z2 * firstCluster->GetErrY2()) / dZ / dZ) /
160 bendingImpact / bendingImpact + 0.1 * 0.1) * inverseBendingMomentum * inverseBendingMomentum ;
161 paramCov(2,4) = - z2 * firstCluster->GetErrY2() * inverseBendingMomentum / bendingImpact / dZ;
162 paramCov(4,2) = paramCov(2,4);
163 paramCov(3,4) = - (z1 * lastCluster->GetErrY2() + z2 * firstCluster->GetErrY2()) * inverseBendingMomentum / bendingImpact / dZ / dZ;
164 paramCov(4,3) = paramCov(3,4);
165 } else paramCov(4,4) = inverseBendingMomentum*inverseBendingMomentum;
166 trackParamAtFirstCluster.SetCovariances(paramCov);
168 // Compute and set track parameters covariances at last cluster
170 paramCov(0,0) = lastCluster->GetErrX2();
171 paramCov(0,1) = - lastCluster->GetErrX2() / dZ;
172 paramCov(1,0) = paramCov(0,1);
174 paramCov(2,2) = lastCluster->GetErrY2();
175 paramCov(2,3) = - lastCluster->GetErrY2() / dZ;
176 paramCov(3,2) = paramCov(2,3);
177 // Inverse bending momentum (vertex resolution + bending slope resolution + 10% error on dipole parameters+field)
178 if (AliMUONTrackExtrap::IsFieldON()) {
179 paramCov(2,4) = z1 * lastCluster->GetErrY2() * inverseBendingMomentum / bendingImpact / dZ;
180 paramCov(4,2) = paramCov(2,4);
182 trackParamAtLastCluster.SetCovariances(paramCov);
184 // Add track parameters at clusters
185 AddTrackParamAtCluster(trackParamAtFirstCluster,*firstCluster);
186 AddTrackParamAtCluster(trackParamAtLastCluster,*lastCluster);
190 //__________________________________________________________________________
191 AliMUONTrack::AliMUONTrack(const AliMUONTrack& track)
193 fTrackParamAtCluster(0x0),
194 fFitWithVertex(track.fFitWithVertex),
196 fFitWithMCS(track.fFitWithMCS),
197 fClusterWeightsNonBending(0x0),
198 fClusterWeightsBending(0x0),
199 fGlobalChi2(track.fGlobalChi2),
200 fImproved(track.fImproved),
201 fMatchTrigger(track.fMatchTrigger),
202 fChi2MatchTrigger(track.fChi2MatchTrigger),
203 fTrackID(track.fTrackID),
204 fTrackParamAtVertex(0x0),
205 fHitsPatternInTrigCh(track.fHitsPatternInTrigCh),
206 fHitsPatternInTrigChTrk(track.fHitsPatternInTrigChTrk),
207 fLocalTrigger(track.fLocalTrigger),
208 fConnected(track.fConnected)
212 // necessary to make a copy of the objects and not only the pointers in TObjArray.
213 if (track.fTrackParamAtCluster) {
214 fTrackParamAtCluster = new TObjArray(track.fTrackParamAtCluster->GetSize());
215 fTrackParamAtCluster->SetOwner(kTRUE);
216 for (Int_t i = 0; i < track.GetNClusters(); i++)
217 fTrackParamAtCluster->AddLast(new AliMUONTrackParam(*static_cast<AliMUONTrackParam*>(track.fTrackParamAtCluster->UncheckedAt(i))));
220 // copy vertex resolution square used during the tracking procedure
221 fVertexErrXY2[0] = track.fVertexErrXY2[0];
222 fVertexErrXY2[1] = track.fVertexErrXY2[1];
224 // copy cluster weights matrices if any
225 if (track.fClusterWeightsNonBending) fClusterWeightsNonBending = new TMatrixD(*(track.fClusterWeightsNonBending));
226 if (track.fClusterWeightsBending) fClusterWeightsBending = new TMatrixD(*(track.fClusterWeightsBending));
228 // copy track parameters at vertex if any
229 if (track.fTrackParamAtVertex) fTrackParamAtVertex = new AliMUONTrackParam(*(track.fTrackParamAtVertex));
233 //__________________________________________________________________________
234 AliMUONTrack & AliMUONTrack::operator=(const AliMUONTrack& track)
236 /// Asignment operator
237 // check assignement to self
241 // base class assignement
242 TObject::operator=(track);
247 // necessary to make a copy of the objects and not only the pointers in TObjArray
248 if (track.fTrackParamAtCluster) {
249 fTrackParamAtCluster = new TObjArray(track.fTrackParamAtCluster->GetSize());
250 fTrackParamAtCluster->SetOwner(kTRUE);
251 for (Int_t i = 0; i < track.GetNClusters(); i++)
252 fTrackParamAtCluster->AddLast(new AliMUONTrackParam(*static_cast<AliMUONTrackParam*>(track.fTrackParamAtCluster->UncheckedAt(i))));
255 // copy cluster weights matrix if any
256 if (track.fClusterWeightsNonBending) {
257 if (fClusterWeightsNonBending) {
258 fClusterWeightsNonBending->ResizeTo(*(track.fClusterWeightsNonBending));
259 *fClusterWeightsNonBending = *(track.fClusterWeightsNonBending);
260 } else fClusterWeightsNonBending = new TMatrixD(*(track.fClusterWeightsNonBending));
263 // copy cluster weights matrix if any
264 if (track.fClusterWeightsBending) {
265 if (fClusterWeightsBending) {
266 fClusterWeightsBending->ResizeTo(*(track.fClusterWeightsBending));
267 *fClusterWeightsBending = *(track.fClusterWeightsBending);
268 } else fClusterWeightsBending = new TMatrixD(*(track.fClusterWeightsBending));
271 // copy track parameters at vertex if any
272 if (track.fTrackParamAtVertex) {
273 if (fTrackParamAtVertex) *fTrackParamAtVertex = *(track.fTrackParamAtVertex);
274 else fTrackParamAtVertex = new AliMUONTrackParam(*(track.fTrackParamAtVertex));
277 fFitWithVertex = track.fFitWithVertex;
278 fVertexErrXY2[0] = track.fVertexErrXY2[0];
279 fVertexErrXY2[1] = track.fVertexErrXY2[1];
280 fFitWithMCS = track.fFitWithMCS;
281 fGlobalChi2 = track.fGlobalChi2;
282 fImproved = track.fImproved;
283 fMatchTrigger = track.fMatchTrigger;
284 fChi2MatchTrigger = track.fChi2MatchTrigger;
285 fTrackID = track.fTrackID;
286 fHitsPatternInTrigCh = track.fHitsPatternInTrigCh;
287 fHitsPatternInTrigChTrk = track.fHitsPatternInTrigChTrk;
288 fLocalTrigger = track.fLocalTrigger;
289 fConnected = track.fConnected;
294 //__________________________________________________________________________
295 AliMUONTrack::~AliMUONTrack()
298 delete fTrackParamAtCluster;
299 delete fClusterWeightsNonBending;
300 delete fClusterWeightsBending;
301 delete fTrackParamAtVertex;
304 //__________________________________________________________________________
305 void AliMUONTrack::Clear(Option_t* /*opt*/)
308 delete fTrackParamAtCluster; fTrackParamAtCluster = 0x0;
309 delete fClusterWeightsNonBending; fClusterWeightsNonBending = 0x0;
310 delete fClusterWeightsBending; fClusterWeightsBending = 0x0;
311 delete fTrackParamAtVertex; fTrackParamAtVertex = 0x0;
314 //__________________________________________________________________________
315 void AliMUONTrack::Reset()
317 /// Reset to default values
319 fFitWithVertex = kFALSE;
320 fVertexErrXY2[0] = 0.;
321 fVertexErrXY2[1] = 0.;
322 fFitWithMCS = kFALSE;
326 fChi2MatchTrigger = 0.;
328 fHitsPatternInTrigCh = 0;
329 fHitsPatternInTrigChTrk = 0;
332 delete fTrackParamAtCluster; fTrackParamAtCluster = 0x0;
333 delete fClusterWeightsNonBending; fClusterWeightsNonBending = 0x0;
334 delete fClusterWeightsBending; fClusterWeightsBending = 0x0;
335 delete fTrackParamAtVertex; fTrackParamAtVertex = 0x0;
338 //__________________________________________________________________________
339 TObjArray* AliMUONTrack::GetTrackParamAtCluster() const
341 /// return array of track parameters at cluster (create it if needed)
342 if (!fTrackParamAtCluster) {
343 fTrackParamAtCluster = new TObjArray(20);
344 fTrackParamAtCluster->SetOwner(kTRUE);
346 return fTrackParamAtCluster;
349 //__________________________________________________________________________
350 void AliMUONTrack::AddTrackParamAtCluster(const AliMUONTrackParam &trackParam, AliMUONVCluster &cluster, Bool_t copy)
352 /// Copy given track parameters into a new TrackParamAtCluster
353 /// Link parameters with the associated cluster
354 /// If copy=kTRUE: the cluster is copied then passed the trackParam which become its owner
355 /// otherwise: make sure to do not delete the cluster until it is used by the track
357 // check chamber ID of the associated cluster
358 if (cluster.GetChamberId() < 0 || cluster.GetChamberId() > AliMUONConstants::NTrackingCh()) {
359 AliError(Form("Chamber ID of the associated cluster is not valid (ChamberId=%d)",cluster.GetChamberId()));
363 // check whether track parameters are given at the correct cluster z position
364 if (TMath::Abs(cluster.GetZ() - trackParam.GetZ())>1.e-5) { // AU
365 AliError("track parameters are given at a different z position than the one of the associated cluster");
369 // add parameters to the array of track parameters
370 if (!fTrackParamAtCluster) {
371 fTrackParamAtCluster = new TObjArray(20);
372 fTrackParamAtCluster->SetOwner(kTRUE);
374 AliMUONTrackParam* trackParamAtCluster = new AliMUONTrackParam(trackParam);
375 fTrackParamAtCluster->AddLast(trackParamAtCluster);
377 // link parameters with the associated cluster or its copy
379 AliMUONVCluster *clusterCopy = static_cast<AliMUONVCluster*>(cluster.Clone());
380 trackParamAtCluster->SetClusterPtr(clusterCopy, kTRUE);
381 } else trackParamAtCluster->SetClusterPtr(&cluster);
383 // sort the array of track parameters
384 fTrackParamAtCluster->Sort();
387 //__________________________________________________________________________
388 void AliMUONTrack::RemoveTrackParamAtCluster(AliMUONTrackParam *trackParam)
390 /// Remove trackParam from the array of TrackParamAtCluster and delete it since the array is owner
392 if (fTrackParamAtCluster) {
394 AliMUONTrackParam* trackParamAtCluster = static_cast<AliMUONTrackParam*>(fTrackParamAtCluster->Remove(trackParam));
396 if (trackParamAtCluster) {
399 delete trackParamAtCluster;
402 fTrackParamAtCluster->Compress();
404 } else AliWarning("object to remove does not exist in array fTrackParamAtCluster");
406 } else AliWarning("array fTrackParamAtCluster does not exist");
410 //__________________________________________________________________________
411 Bool_t AliMUONTrack::UpdateTrackParamAtCluster()
413 /// Update track parameters at each attached cluster
414 /// Return kFALSE in case of failure (i.e. extrapolation problem)
416 Int_t nClusters = GetNClusters();
417 if (nClusters == 0) {
418 AliWarning("no cluster attached to the track");
422 Bool_t extrapStatus = kTRUE;
423 AliMUONTrackParam* startingTrackParam = static_cast<AliMUONTrackParam*>(fTrackParamAtCluster->UncheckedAt(0));
425 for (Int_t i = 1; i < nClusters; i++) {
426 AliMUONTrackParam* trackParamAtCluster = static_cast<AliMUONTrackParam*>(fTrackParamAtCluster->UncheckedAt(i));
428 // reset track parameters and their covariances
429 trackParamAtCluster->SetParameters(startingTrackParam->GetParameters());
430 trackParamAtCluster->SetZ(startingTrackParam->GetZ());
432 // extrapolation to the given z
433 if (!AliMUONTrackExtrap::ExtrapToZ(trackParamAtCluster, trackParamAtCluster->GetClusterPtr()->GetZ())) extrapStatus = kFALSE;
436 startingTrackParam = trackParamAtCluster;
439 // set global chi2 to max value in case of problem during track extrapolation
440 if (!extrapStatus) SetGlobalChi2(2.*MaxChi2());
445 //__________________________________________________________________________
446 Bool_t AliMUONTrack::UpdateCovTrackParamAtCluster()
448 /// Update track parameters and their covariances at each attached cluster
449 /// Include effects of multiple scattering in chambers
450 /// Return kFALSE in case of failure (i.e. extrapolation problem)
452 Int_t nClusters = GetNClusters();
453 if (nClusters == 0) {
454 AliWarning("no cluster attached to the track");
458 Bool_t extrapStatus = kTRUE;
459 AliMUONTrackParam* startingTrackParam = static_cast<AliMUONTrackParam*>(fTrackParamAtCluster->UncheckedAt(0));
460 Int_t expectedChamber = startingTrackParam->GetClusterPtr()->GetChamberId() + 1;
461 Int_t currentChamber;
463 for (Int_t i = 1; i < nClusters; i++) {
464 AliMUONTrackParam* trackParamAtCluster = static_cast<AliMUONTrackParam*>(fTrackParamAtCluster->UncheckedAt(i));
466 // reset track parameters and their covariances
467 trackParamAtCluster->SetParameters(startingTrackParam->GetParameters());
468 trackParamAtCluster->SetZ(startingTrackParam->GetZ());
469 trackParamAtCluster->SetCovariances(startingTrackParam->GetCovariances());
472 AliMUONTrackExtrap::AddMCSEffect(trackParamAtCluster,AliMUONConstants::ChamberThicknessInX0(expectedChamber-1),-1.);
474 // add MCS in missing chambers if any
475 currentChamber = trackParamAtCluster->GetClusterPtr()->GetChamberId();
476 while (currentChamber > expectedChamber) {
477 // extrapolation to the missing chamber
478 if (!AliMUONTrackExtrap::ExtrapToZCov(trackParamAtCluster, AliMUONConstants::DefaultChamberZ(expectedChamber))) extrapStatus = kFALSE;
480 AliMUONTrackExtrap::AddMCSEffect(trackParamAtCluster,AliMUONConstants::ChamberThicknessInX0(expectedChamber),-1.);
484 // extrapolation to the z of the current cluster
485 if (!AliMUONTrackExtrap::ExtrapToZCov(trackParamAtCluster, trackParamAtCluster->GetClusterPtr()->GetZ())) extrapStatus = kFALSE;
488 expectedChamber = currentChamber + 1;
489 startingTrackParam = trackParamAtCluster;
492 // set global chi2 to max value in case of problem during track extrapolation
493 if (!extrapStatus) SetGlobalChi2(2.*MaxChi2());
498 //__________________________________________________________________________
499 Bool_t AliMUONTrack::IsValid(UInt_t requestedStationMask, Bool_t request2ChInSameSt45)
501 /// check the validity of the current track:
502 /// at least one cluster per requested station
503 /// and at least 2 chambers in stations 4 & 5 that contain cluster(s)
504 /// + if request2ChInSameSt45 = kTRUE: 2 chambers hit in the same station (4 or 5)
506 Int_t nClusters = GetNClusters();
507 AliMUONTrackParam *trackParam;
508 Int_t currentCh, currentSt, previousCh = -1, nChHitInSt4 = 0, nChHitInSt5 = 0;
509 UInt_t presentStationMask(0);
511 // first loop over clusters
512 for (Int_t i = 0; i < nClusters; i++) {
513 trackParam = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(i);
515 currentCh = trackParam->GetClusterPtr()->GetChamberId();
516 currentSt = currentCh/2;
518 // build present station mask
519 presentStationMask |= ( 1 << currentSt );
521 // count the number of chambers hit in station 4 that contain cluster(s)
522 if (currentSt == 3 && currentCh != previousCh) {
524 previousCh = currentCh;
527 // count the number of chambers hit in station 5 that contain cluster(s)
528 if (currentSt == 4 && currentCh != previousCh) {
530 previousCh = currentCh;
535 // at least one cluster per requested station
536 if ((requestedStationMask & presentStationMask) != requestedStationMask) return kFALSE;
538 // 2 chambers hit in the same station (4 or 5)
539 if (request2ChInSameSt45) return (nChHitInSt4 == 2 || nChHitInSt5 == 2);
540 // or 2 chambers hit in station 4 & 5 together
541 else return (nChHitInSt4+nChHitInSt5 >= 2);
545 //__________________________________________________________________________
546 void AliMUONTrack::TagRemovableClusters(UInt_t requestedStationMask) {
547 /// Identify clusters that can be removed from the track,
548 /// with the only requirements to have at least 1 cluster per requested station
549 /// and at least 2 chambers over 4 in stations 4 & 5 that contain cluster(s)
551 Int_t nClusters = GetNClusters();
552 AliMUONTrackParam *trackParam, *nextTrackParam;
553 Int_t currentCh, nextCh, currentSt, nextSt, previousCh = -1, nChHitInSt45 = 0;
555 // first loop over clusters
556 for (Int_t i = 0; i < nClusters; i++) {
557 trackParam = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(i);
559 currentCh = trackParam->GetClusterPtr()->GetChamberId();
560 currentSt = currentCh/2;
562 // reset flags to kFALSE for all clusters in required station
563 if ((1 << currentSt) & requestedStationMask) trackParam->SetRemovable(kFALSE);
564 else trackParam->SetRemovable(kTRUE);
566 // count the number of chambers in station 4 & 5 that contain cluster(s)
567 if (currentCh > 5 && currentCh != previousCh) {
569 previousCh = currentCh;
574 // second loop over clusters
575 for (Int_t i = 0; i < nClusters; i++) {
576 trackParam = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(i);
578 currentCh = trackParam->GetClusterPtr()->GetChamberId();
579 currentSt = currentCh/2;
581 // make sure they are more than 2 clusters in 2 different chambers of stations 4 & 5
582 // but 2 clusters in he same chamber will still be flagged as removable
583 if (nChHitInSt45 < 3 && currentSt > 2) {
585 if (i == nClusters-1) {
587 trackParam->SetRemovable(kFALSE);
591 nextTrackParam = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(i+1);
592 nextCh = nextTrackParam->GetClusterPtr()->GetChamberId();
594 // set clusters in the same chamber as being removable
595 if (nextCh == currentCh) {
596 trackParam->SetRemovable(kTRUE);
597 nextTrackParam->SetRemovable(kTRUE);
598 i++; // skip cluster already checked
600 trackParam->SetRemovable(kFALSE);
607 // skip clusters already flag as removable
608 if (trackParam->IsRemovable()) continue;
610 // loop over next track parameters
611 for (Int_t j = i+1; j < nClusters; j++) {
612 nextTrackParam = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(j);
614 nextCh = nextTrackParam->GetClusterPtr()->GetChamberId();
617 // set clusters in the same station as being removable
618 if (nextSt == currentSt) {
619 trackParam->SetRemovable(kTRUE);
620 nextTrackParam->SetRemovable(kTRUE);
621 i++; // skip cluster already checked
632 //__________________________________________________________________________
633 Bool_t AliMUONTrack::ComputeLocalChi2(Bool_t accountForMCS)
635 /// Compute each cluster contribution to the chi2 of the track
636 /// accounting for multiple scattering or not according to the flag
637 /// - Also recompute the weight matrices of the attached clusters if accountForMCS=kTRUE
638 /// - Assume that track parameters at each cluster are corrects
639 /// - Return kFALSE if computation failed
640 AliDebug(1,"Enter ComputeLocalChi2");
642 if (!fTrackParamAtCluster) {
643 AliWarning("no cluster attached to this track");
647 if (accountForMCS) { // Compute local chi2 taking into account multiple scattering effects
649 // Compute MCS covariance matrix only once
650 Int_t nClusters = GetNClusters();
651 TMatrixD mcsCovariances(nClusters,nClusters);
652 ComputeMCSCovariances(mcsCovariances);
654 // Make sure cluster weights are consistent with following calculations
655 if (!ComputeClusterWeights(&mcsCovariances)) {
656 AliWarning("cannot take into account the multiple scattering effects");
657 return ComputeLocalChi2(kFALSE);
660 // Compute chi2 of the track
661 Double_t globalChi2 = ComputeGlobalChi2(kTRUE);
662 if (globalChi2 < 0.) return kFALSE;
664 // Loop over removable clusters and compute their local chi2
665 AliMUONTrackParam* trackParamAtCluster;
666 AliMUONTrackParam* trackParamAtCluster1;
667 AliMUONVCluster *cluster, *discardedCluster;
668 Int_t iCluster1, iCluster2, iCurrentCluster1, iCurrentCluster2;
669 TMatrixD clusterWeightsNB(nClusters-1,nClusters-1);
670 TMatrixD clusterWeightsB(nClusters-1,nClusters-1);
671 Double_t *dX = new Double_t[nClusters-1];
672 Double_t *dY = new Double_t[nClusters-1];
673 Double_t globalChi2b;
674 for (Int_t iCluster = 0; iCluster < nClusters ; iCluster++) {
675 trackParamAtCluster = static_cast<AliMUONTrackParam*>(fTrackParamAtCluster->UncheckedAt(iCluster));
677 discardedCluster = trackParamAtCluster->GetClusterPtr();
679 // Recompute cluster weights without the current cluster
680 if (!ComputeClusterWeights(clusterWeightsNB, clusterWeightsB, &mcsCovariances, discardedCluster)) {
681 AliWarning("cannot take into account the multiple scattering effects");
684 return ComputeLocalChi2(kFALSE);
687 // Compute track chi2 without the current cluster
689 iCurrentCluster1 = 0;
690 for (iCluster1 = 0; iCluster1 < nClusters ; iCluster1++) {
691 trackParamAtCluster1 = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(iCluster1);
692 cluster = trackParamAtCluster1->GetClusterPtr();
694 if (cluster == discardedCluster) continue;
696 // Compute and save residuals
697 dX[iCurrentCluster1] = cluster->GetX() - trackParamAtCluster1->GetNonBendingCoor();
698 dY[iCurrentCluster1] = cluster->GetY() - trackParamAtCluster1->GetBendingCoor();
700 iCurrentCluster2 = 0;
701 for (iCluster2 = 0; iCluster2 < iCluster1; iCluster2++) {
702 cluster = ((AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(iCluster2))->GetClusterPtr();
704 if (cluster == discardedCluster) continue;
706 // Add contribution from covariances
707 globalChi2b += (clusterWeightsNB(iCurrentCluster1, iCurrentCluster2) +
708 clusterWeightsNB(iCurrentCluster2, iCurrentCluster1)) * dX[iCurrentCluster1] * dX[iCurrentCluster2] +
709 (clusterWeightsB(iCurrentCluster1, iCurrentCluster2) +
710 clusterWeightsB(iCurrentCluster2, iCurrentCluster1)) * dY[iCurrentCluster1] * dY[iCurrentCluster2];
715 // Add contribution from variances
716 globalChi2b += clusterWeightsNB(iCurrentCluster1, iCurrentCluster1) * dX[iCurrentCluster1] * dX[iCurrentCluster1] +
717 clusterWeightsB(iCurrentCluster1, iCurrentCluster1) * dY[iCurrentCluster1] * dY[iCurrentCluster1];
723 trackParamAtCluster->SetLocalChi2(globalChi2 - globalChi2b);
729 } else { // without multiple scattering effects
731 Int_t nClusters = GetNClusters();
732 AliMUONTrackParam* trackParamAtCluster;
733 AliMUONVCluster *discardedCluster;
735 for (Int_t iCluster = 0; iCluster < nClusters ; iCluster++) {
736 trackParamAtCluster = static_cast<AliMUONTrackParam*>(fTrackParamAtCluster->UncheckedAt(iCluster));
738 discardedCluster = trackParamAtCluster->GetClusterPtr();
741 dX = discardedCluster->GetX() - trackParamAtCluster->GetNonBendingCoor();
742 dY = discardedCluster->GetY() - trackParamAtCluster->GetBendingCoor();
745 trackParamAtCluster->SetLocalChi2(dX * dX / discardedCluster->GetErrX2() + dY * dY / discardedCluster->GetErrY2());
754 //__________________________________________________________________________
755 Double_t AliMUONTrack::ComputeGlobalChi2(Bool_t accountForMCS)
757 /// Compute the chi2 of the track accounting for multiple scattering or not according to the flag
758 /// - Assume that track parameters at each cluster are corrects
759 /// - Assume the cluster weights matrices are corrects
760 /// - Return a value of chi2 higher than the maximum allowed if computation failed
761 AliDebug(1,"Enter ComputeGlobalChi2");
763 if (!fTrackParamAtCluster) {
764 AliWarning("no cluster attached to this track");
772 // Check the weight matrices. If weight matrices are not available compute chi2 without MCS
773 if (!fClusterWeightsNonBending || !fClusterWeightsBending) {
774 AliWarning("cluster weights including multiple scattering effects are not available\n\t\t --> compute chi2 WITHOUT multiple scattering");
775 return ComputeGlobalChi2(kFALSE);
777 Int_t nClusters = GetNClusters();
778 if (fClusterWeightsNonBending->GetNrows() != nClusters || fClusterWeightsBending->GetNcols() != nClusters) {
779 AliWarning("cluster weights including multiple scattering effects are not available\n\t\t --> compute chi2 WITHOUT multiple scattering");
780 return ComputeGlobalChi2(kFALSE);
784 AliMUONVCluster *cluster;
785 Double_t *dX = new Double_t[nClusters];
786 Double_t *dY = new Double_t[nClusters];
787 AliMUONTrackParam* trackParamAtCluster;
788 for (Int_t iCluster1 = 0; iCluster1 < nClusters; iCluster1++) {
789 trackParamAtCluster = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(iCluster1);
790 cluster = trackParamAtCluster->GetClusterPtr();
791 dX[iCluster1] = cluster->GetX() - trackParamAtCluster->GetNonBendingCoor();
792 dY[iCluster1] = cluster->GetY() - trackParamAtCluster->GetBendingCoor();
793 for (Int_t iCluster2 = 0; iCluster2 < iCluster1; iCluster2++) {
794 chi2 += ((*fClusterWeightsNonBending)(iCluster1, iCluster2) + (*fClusterWeightsNonBending)(iCluster2, iCluster1)) * dX[iCluster1] * dX[iCluster2] +
795 ((*fClusterWeightsBending)(iCluster1, iCluster2) + (*fClusterWeightsBending)(iCluster2, iCluster1)) * dY[iCluster1] * dY[iCluster2];
797 chi2 += ((*fClusterWeightsNonBending)(iCluster1, iCluster1) * dX[iCluster1] * dX[iCluster1]) +
798 ((*fClusterWeightsBending)(iCluster1, iCluster1) * dY[iCluster1] * dY[iCluster1]);
805 AliMUONVCluster *cluster;
807 AliMUONTrackParam* trackParamAtCluster;
808 Int_t nClusters = GetNClusters();
809 for (Int_t iCluster = 0; iCluster < nClusters ; iCluster++) {
810 trackParamAtCluster = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(iCluster);
811 cluster = trackParamAtCluster->GetClusterPtr();
812 dX = cluster->GetX() - trackParamAtCluster->GetNonBendingCoor();
813 dY = cluster->GetY() - trackParamAtCluster->GetBendingCoor();
814 chi2 += dX * dX / cluster->GetErrX2() + dY * dY / cluster->GetErrY2();
823 //__________________________________________________________________________
824 Bool_t AliMUONTrack::ComputeClusterWeights(TMatrixD* mcsCovariances)
826 /// Compute the weight matrices of the attached clusters, in non bending and bending direction,
827 /// accounting for multiple scattering correlations and cluster resolution
828 /// - Use the provided MCS covariance matrix if any (otherwise build it temporarily)
829 /// - Assume that track parameters at each cluster are corrects
830 /// - Return kFALSE if computation failed
831 AliDebug(1,"Enter ComputeClusterWeights1");
833 if (!fTrackParamAtCluster) {
834 AliWarning("no cluster attached to this track");
839 Int_t nClusters = GetNClusters();
840 if (!fClusterWeightsNonBending) fClusterWeightsNonBending = new TMatrixD(nClusters,nClusters);
841 if (!fClusterWeightsBending) fClusterWeightsBending = new TMatrixD(nClusters,nClusters);
843 // Compute weights matrices
844 if (!ComputeClusterWeights(*fClusterWeightsNonBending, *fClusterWeightsBending, mcsCovariances)) return kFALSE;
850 //__________________________________________________________________________
851 Bool_t AliMUONTrack::ComputeClusterWeights(TMatrixD& clusterWeightsNB, TMatrixD& clusterWeightsB,
852 TMatrixD* mcsCovariances, const AliMUONVCluster* discardedCluster) const
854 /// Compute the weight matrices, in non bending and bending direction,
855 /// of the other attached clusters assuming the discarded one does not exist
856 /// accounting for multiple scattering correlations and cluster resolution
857 /// - Use the provided MCS covariance matrix if any (otherwise build it temporarily)
858 /// - Return kFALSE if computation failed
859 AliDebug(1,"Enter ComputeClusterWeights2");
861 // Check MCS covariance matrix and recompute it if need
862 Int_t nClusters = GetNClusters();
863 Bool_t deleteMCSCov = kFALSE;
864 if (!mcsCovariances) {
865 mcsCovariances = new TMatrixD(nClusters,nClusters);
866 deleteMCSCov = kTRUE;
867 ComputeMCSCovariances(*mcsCovariances);
870 // Resize the weights matrices; alocate memory
871 if (discardedCluster) {
872 clusterWeightsNB.ResizeTo(nClusters-1,nClusters-1);
873 clusterWeightsB.ResizeTo(nClusters-1,nClusters-1);
875 clusterWeightsNB.ResizeTo(nClusters,nClusters);
876 clusterWeightsB.ResizeTo(nClusters,nClusters);
880 AliMUONVCluster *cluster1, *cluster2;
881 Int_t iCurrentCluster1, iCurrentCluster2;
883 // Compute the covariance matrices
884 iCurrentCluster1 = 0;
885 for (Int_t iCluster1 = 0; iCluster1 < nClusters; iCluster1++) {
886 cluster1 = ((AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(iCluster1))->GetClusterPtr();
888 if (cluster1 == discardedCluster) continue;
890 // Loop over next clusters
891 iCurrentCluster2 = iCurrentCluster1;
892 for (Int_t iCluster2 = iCluster1; iCluster2 < nClusters; iCluster2++) {
893 cluster2 = ((AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(iCluster2))->GetClusterPtr();
895 if (cluster2 == discardedCluster) continue;
897 // Fill with MCS covariances
898 clusterWeightsNB(iCurrentCluster1, iCurrentCluster2) = (*mcsCovariances)(iCluster1,iCluster2);
900 // Equal contribution from multiple scattering in non bending and bending directions
901 clusterWeightsB(iCurrentCluster1, iCurrentCluster2) = clusterWeightsNB(iCurrentCluster1, iCurrentCluster2);
903 // Add contribution from cluster resolution to diagonal element and symmetrize the matrix
904 if (iCurrentCluster1 == iCurrentCluster2) {
906 // In non bending plane
907 clusterWeightsNB(iCurrentCluster1, iCurrentCluster1) += cluster1->GetErrX2();
909 clusterWeightsB(iCurrentCluster1, iCurrentCluster1) += cluster1->GetErrY2();
913 // In non bending plane
914 clusterWeightsNB(iCurrentCluster2, iCurrentCluster1) = clusterWeightsNB(iCurrentCluster1, iCurrentCluster2);
916 clusterWeightsB(iCurrentCluster2, iCurrentCluster1) = clusterWeightsB(iCurrentCluster1, iCurrentCluster2);
926 // Inversion of covariance matrices to get the weights
927 if (clusterWeightsNB.Determinant() != 0 && clusterWeightsB.Determinant() != 0) {
928 clusterWeightsNB.Invert();
929 clusterWeightsB.Invert();
931 AliWarning(" Determinant = 0");
932 clusterWeightsNB.ResizeTo(0,0);
933 clusterWeightsB.ResizeTo(0,0);
934 if(deleteMCSCov) delete mcsCovariances;
938 if(deleteMCSCov) delete mcsCovariances;
944 //__________________________________________________________________________
945 void AliMUONTrack::ComputeMCSCovariances(TMatrixD& mcsCovariances) const
947 /// Compute the multiple scattering covariance matrix
948 /// (assume that track parameters at each cluster are corrects)
949 AliDebug(1,"Enter ComputeMCSCovariances");
951 // Reset the size of the covariance matrix if needed
952 Int_t nClusters = GetNClusters();
953 if (mcsCovariances.GetNrows() != nClusters) mcsCovariances.ResizeTo(nClusters,nClusters);
956 Int_t nChambers = AliMUONConstants::NTrackingCh();
957 AliMUONTrackParam* trackParamAtCluster;
958 AliMUONTrackParam extrapTrackParam;
959 Int_t currentChamber = 0, expectedChamber = 0, size = 0;
960 Double_t *mcsAngle2 = new Double_t[2*nChambers];
961 Double_t *zMCS = new Double_t[2*nChambers];
962 Int_t *indices = new Int_t[2*nClusters];
964 // Compute multiple scattering dispersion angle at each chamber
965 // and save the z position where it is calculated
966 for (Int_t iCluster = 0; iCluster < nClusters; iCluster++) {
967 trackParamAtCluster = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(iCluster);
969 // look for missing chambers if any
970 currentChamber = trackParamAtCluster->GetClusterPtr()->GetChamberId();
971 while (currentChamber > expectedChamber) {
973 // Save the z position where MCS dispersion is calculated
974 zMCS[size] = AliMUONConstants::DefaultChamberZ(expectedChamber);
976 // Do not take into account MCS in chambers prior the first cluster
979 // Get track parameters at missing chamber z
980 extrapTrackParam = *trackParamAtCluster;
981 AliMUONTrackExtrap::ExtrapToZ(&extrapTrackParam, zMCS[size]);
983 // Save multiple scattering dispersion angle in missing chamber
984 mcsAngle2[size] = AliMUONTrackExtrap::GetMCSAngle2(extrapTrackParam,AliMUONConstants::ChamberThicknessInX0(expectedChamber),1.);
986 } else mcsAngle2[size] = 0.;
992 // Save z position where MCS dispersion is calculated
993 zMCS[size] = trackParamAtCluster->GetZ();
995 // Save multiple scattering dispersion angle in current chamber
996 mcsAngle2[size] = AliMUONTrackExtrap::GetMCSAngle2(*trackParamAtCluster,AliMUONConstants::ChamberThicknessInX0(currentChamber),1.);
998 // Save indice in zMCS array corresponding to the current cluster
999 indices[iCluster] = size;
1001 expectedChamber = currentChamber + 1;
1005 // complete array of z if last cluster is on the last but one chamber
1006 if (currentChamber != nChambers-1) zMCS[size++] = AliMUONConstants::DefaultChamberZ(nChambers-1);
1008 // Compute the covariance matrix
1009 for (Int_t iCluster1 = 0; iCluster1 < nClusters; iCluster1++) {
1011 for (Int_t iCluster2 = iCluster1; iCluster2 < nClusters; iCluster2++) {
1013 // Initialization to 0 (diagonal plus upper triangular part)
1014 mcsCovariances(iCluster1,iCluster2) = 0.;
1016 // Compute contribution from multiple scattering in upstream chambers
1017 for (Int_t k = 0; k < indices[iCluster1]; k++) {
1018 mcsCovariances(iCluster1,iCluster2) += (zMCS[indices[iCluster1]] - zMCS[k]) * (zMCS[indices[iCluster2]] - zMCS[k]) * mcsAngle2[k];
1021 // Symetrize the matrix
1022 mcsCovariances(iCluster2,iCluster1) = mcsCovariances(iCluster1,iCluster2);
1027 delete [] mcsAngle2;
1033 //__________________________________________________________________________
1034 Int_t AliMUONTrack::ClustersInCommon(AliMUONTrack* track, Int_t stMin, Int_t stMax) const
1036 /// Returns the number of clusters in common in stations [stMin, stMax]
1037 /// between the current track ("this") and the track pointed to by "track".
1039 if (!track || !track->fTrackParamAtCluster || !this->fTrackParamAtCluster) return 0;
1041 Int_t chMin = 2 * stMin;
1042 Int_t chMax = 2 * stMax + 1;
1043 Int_t clustersInCommon = 0;
1045 // Loop over clusters of first track
1046 Int_t nCl1 = this->GetNClusters();
1047 for(Int_t iCl1 = 0; iCl1 < nCl1; iCl1++) {
1048 AliMUONVCluster* cl1 = ((AliMUONTrackParam*) this->fTrackParamAtCluster->UncheckedAt(iCl1))->GetClusterPtr();
1050 Int_t chCl1 = cl1->GetChamberId();
1051 if (chCl1 < chMin || chCl1 > chMax) continue;
1053 // Loop over clusters of second track
1054 Int_t nCl2 = track->GetNClusters();
1055 for(Int_t iCl2 = 0; iCl2 < nCl2; iCl2++) {
1056 AliMUONVCluster* cl2 = ((AliMUONTrackParam*) track->fTrackParamAtCluster->UncheckedAt(iCl2))->GetClusterPtr();
1058 Int_t chCl2 = cl2->GetChamberId();
1059 if (chCl2 < chMin || chCl2 > chMax) continue;
1061 // Increment "clustersInCommon" if both clusters have the same ID
1062 if (cl1->GetUniqueID() == cl2->GetUniqueID()) {
1071 return clustersInCommon;
1074 //__________________________________________________________________________
1075 Int_t AliMUONTrack::GetNDF() const
1077 /// return the number of degrees of freedom
1079 Int_t ndf = 2 * GetNClusters() - 5;
1080 return (ndf > 0) ? ndf : 0;
1083 //__________________________________________________________________________
1084 Double_t AliMUONTrack::GetNormalizedChi2() const
1086 /// return the chi2 value divided by the number of degrees of freedom (or FLT_MAX if ndf <= 0)
1088 Double_t ndf = (Double_t) GetNDF();
1089 return (ndf > 0.) ? fGlobalChi2 / ndf : 2.*MaxChi2();
1092 //__________________________________________________________________________
1093 Int_t AliMUONTrack::FindCompatibleClusters(const AliMUONTrack &track, Double_t sigmaCut, Bool_t compatibleCluster[10]) const
1095 /// Try to match clusters from this track with clusters from the given track within the provided sigma cut:
1096 /// - Fill the array compatibleCluster[iCh] with kTRUE if a compatible cluster has been found in chamber iCh.
1097 /// - Return the number of clusters of "this" track matched with one cluster of the given track.
1098 AliMUONVCluster *cluster1, *cluster2;
1099 Double_t chi2, dX, dY;
1100 Double_t chi2Max = sigmaCut * sigmaCut;
1103 Int_t nMatchClusters = 0;
1104 for ( Int_t ch = 0; ch < AliMUONConstants::NTrackingCh(); ch++) compatibleCluster[ch] = kFALSE;
1106 if (!track.fTrackParamAtCluster || !this->fTrackParamAtCluster) return nMatchClusters;
1108 // Loop over clusters of first track
1109 Int_t nCl1 = this->GetNClusters();
1110 for(Int_t iCl1 = 0; iCl1 < nCl1; iCl1++) {
1111 cluster1 = static_cast<AliMUONTrackParam*>(this->fTrackParamAtCluster->UncheckedAt(iCl1))->GetClusterPtr();
1113 // Loop over clusters of second track
1114 Int_t nCl2 = track.GetNClusters();
1115 for(Int_t iCl2 = 0; iCl2 < nCl2; iCl2++) {
1116 cluster2 = static_cast<AliMUONTrackParam*>(track.fTrackParamAtCluster->UncheckedAt(iCl2))->GetClusterPtr();
1119 if (cluster1->GetDetElemId() != cluster2->GetDetElemId()) continue;
1122 dX = cluster1->GetX() - cluster2->GetX();
1123 dY = cluster1->GetY() - cluster2->GetY();
1124 chi2 = dX * dX / (cluster1->GetErrX2() + cluster2->GetErrX2()) + dY * dY / (cluster1->GetErrY2() + cluster2->GetErrY2());
1125 if (chi2 > 2. * chi2Max) continue; // 2 because 2 quantities in chi2
1127 compatibleCluster[cluster1->GetChamberId()] = kTRUE;
1134 return nMatchClusters;
1137 //__________________________________________________________________________
1138 Bool_t AliMUONTrack::Match(AliMUONTrack &track, Double_t sigmaCut, Int_t &nMatchClusters) const
1140 /// Try to match this track with the given track. Matching conditions:
1141 /// - more than 50% of clusters from this track matched with clusters from the given track
1142 /// - at least 1 cluster matched before and 1 cluster matched after the dipole
1144 Bool_t compTrack[10];
1145 nMatchClusters = FindCompatibleClusters(track, sigmaCut, compTrack);
1147 if ((compTrack[0] || compTrack[1] || compTrack[2] || compTrack[3]) && // at least 1 cluster matched in st 1 & 2
1148 (compTrack[6] || compTrack[7] || compTrack[8] || compTrack[9]) && // at least 1 cluster matched in st 4 & 5
1149 2 * nMatchClusters > GetNClusters()) return kTRUE; // more than 50% of clusters matched
1154 //__________________________________________________________________________
1155 void AliMUONTrack::SetTrackParamAtVertex(const AliMUONTrackParam* trackParam)
1157 /// set track parameters at vertex
1158 if (trackParam == 0x0) return;
1159 if (fTrackParamAtVertex) *fTrackParamAtVertex = *trackParam;
1160 else fTrackParamAtVertex = new AliMUONTrackParam(*trackParam);
1163 //__________________________________________________________________________
1164 void AliMUONTrack::RecursiveDump() const
1166 /// Recursive dump of AliMUONTrack, i.e. with dump of trackParamAtCluster and attached clusters
1167 AliMUONTrackParam *trackParamAtCluster;
1168 AliMUONVCluster *cluster;
1169 cout << "Recursive dump of Track: " << this << endl;
1172 for (Int_t iCluster = 0; iCluster < GetNClusters(); iCluster++) {
1173 trackParamAtCluster = (AliMUONTrackParam*) ((*fTrackParamAtCluster)[iCluster]);
1174 // trackParamAtCluster
1175 cout << "trackParamAtCluster: " << trackParamAtCluster << " (index: " << iCluster << ")" << endl;
1176 trackParamAtCluster->Dump();
1177 cluster = trackParamAtCluster->GetClusterPtr();
1179 cout << "cluster: " << cluster << endl;
1185 //_____________________________________________-
1186 void AliMUONTrack::Print(Option_t*) const
1188 /// Printing Track information
1190 streamsize curW = cout.width();
1191 streamsize curPrecision = cout.precision();
1192 cout << "<AliMUONTrack> No.Clusters=" << setw(2) << GetNClusters() <<
1193 ", Match2Trig=" << setw(1) << GetMatchTrigger() <<
1194 ", LoTrgNum=" << setw(3) << LoCircuit() <<
1195 ", Chi2-tracking-trigger=" << setw(8) << setprecision(5) << GetChi2MatchTrigger();
1196 cout << Form(" HitTriggerPattern trig %x track %x",fHitsPatternInTrigCh, fHitsPatternInTrigChTrk);
1197 cout << Form(" MClabel=%d",fTrackID) << endl;
1198 if (fTrackParamAtCluster) fTrackParamAtCluster->First()->Print("FULL");
1200 cout.precision(curPrecision);
1203 //__________________________________________________________________________
1204 void AliMUONTrack::SetLocalTrigger(Int_t loCirc, Int_t loStripX, Int_t loStripY, Int_t loDev, Int_t loLpt, Int_t loHpt, UChar_t respWithoutChamber)
1206 /// pack the local trigger information and store
1208 if (loCirc < 0) return;
1211 fLocalTrigger += loCirc;
1212 fLocalTrigger += loStripX << 8;
1213 fLocalTrigger += loStripY << 13;
1214 fLocalTrigger += loDev << 17;
1215 fLocalTrigger += loLpt << 22;
1216 fLocalTrigger += loHpt << 24;
1217 fLocalTrigger += respWithoutChamber << 26;
1221 //__________________________________________________________________________
1222 void AliMUONTrack::FindMCLabel()
1224 /// Determine the MC label from the label of the attached clusters and fill fMCLabel data member:
1225 /// More than 50% of clusters, including 1 before and 1 after the dipole, must share the same label
1227 Int_t nClusters = GetNClusters();
1228 Int_t halfCluster = nClusters/2;
1233 // loop over first clusters (if nClusters left < (nClusters-halfCluster) the conditions cannot be fulfilled)
1234 for (Int_t iCluster1 = 0; iCluster1 < nClusters-halfCluster; iCluster1++) {
1235 AliMUONVCluster* cluster1 = ((AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(iCluster1))->GetClusterPtr();
1237 // if the first cluster is not on station 1 or 2 the conditions cannot be fulfilled
1238 if (cluster1->GetChamberId() > 3) return;
1240 Int_t label1 = cluster1->GetMCLabel();
1241 if (label1 < 0) continue;
1243 Int_t nIdenticalLabel = 1;
1245 // Loop over next clusters
1246 for (Int_t iCluster2 = iCluster1+1; iCluster2 < nClusters; iCluster2++) {
1247 AliMUONVCluster* cluster2 = ((AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(iCluster2))->GetClusterPtr();
1249 if (cluster2->GetMCLabel() != label1) continue;
1253 // stop as soon as conditions are fulfilled
1254 if (nIdenticalLabel > halfCluster && cluster2->GetChamberId() > 5) {