+ //__________________________________________________________________________
+const TMatrixD& AliMUONTrackParam::GetSmoothCovariances() const
+{
+ /// Return the smoothed covariance matrix (create it before if needed)
+ if (!fSmoothCovariances) {
+ fSmoothCovariances = new TMatrixD(5,5);
+ fSmoothCovariances->Zero();
+ }
+ return *fSmoothCovariances;
+ }
+
+ //__________________________________________________________________________
+void AliMUONTrackParam::SetSmoothCovariances(const TMatrixD& smoothCovariances)
+{
+ /// Set the smoothed covariance matrix
+ if (fSmoothCovariances) *fSmoothCovariances = smoothCovariances;
+ else fSmoothCovariances = new TMatrixD(smoothCovariances);
+}
+
+//__________________________________________________________________________
+void AliMUONTrackParam::SetClusterPtr(AliMUONVCluster* cluster, Bool_t owner)
+{
+ /// set pointeur to associated cluster
+ if (fOwnCluster) delete fClusterPtr;
+ fClusterPtr = cluster;
+ fOwnCluster = owner;
+}
+
+ //__________________________________________________________________________
+Int_t AliMUONTrackParam::Compare(const TObject* trackParam) const
+{
+ /// "Compare" function to sort with decreasing Z (spectro. muon Z <0).
+ /// Returns 1 (0, -1) if the current Z
+ /// is smaller than (equal to, larger than) Z of trackParam
+ if (fZ < ((AliMUONTrackParam*)trackParam)->GetZ()) return(1);
+ else if (fZ == ((AliMUONTrackParam*)trackParam)->GetZ()) return(0);
+ else return(-1);
+}
+
+ //__________________________________________________________________________
+Bool_t AliMUONTrackParam::CompatibleTrackParam(const AliMUONTrackParam &trackParam, Double_t sigma2Cut, Double_t &chi2) const
+{
+ /// Return kTRUE if the two set of track parameters are compatible within sigma2Cut
+ /// Set chi2 to the compatible chi2 value
+ /// Note that parameter covariances must exist for at least one set of parameters
+ /// Note also that if parameters are not given at the same Z, results will be meaningless
+
+ // reset chi2 value
+ chi2 = 0.;
+
+ // ckeck covariance matrices
+ if (!fCovariances && !trackParam.fCovariances) {
+ AliError("Covariance matrix must exist for at least one set of parameters");
+ return kFALSE;
+ }
+
+ Double_t maxChi2 = 5. * sigma2Cut * sigma2Cut; // 5 degrees of freedom
+
+ // check Z parameters
+ if (fZ != trackParam.fZ)
+ AliWarning(Form("Parameters are given at different Z position (%le : %le): results are meaningless", fZ, trackParam.fZ));
+
+ // compute the parameter residuals
+ TMatrixD deltaParam(fParameters, TMatrixD::kMinus, trackParam.fParameters);
+
+ // build the error matrix
+ TMatrixD weight(5,5);
+ if (fCovariances) weight += *fCovariances;
+ if (trackParam.fCovariances) weight += *(trackParam.fCovariances);
+
+ // invert the error matrix to get the parameter weights if possible
+ if (weight.Determinant() == 0) {
+ AliError("Cannot compute the compatibility chi2");
+ return kFALSE;
+ }
+ weight.Invert();
+
+ // compute the compatibility chi2
+ TMatrixD tmp(deltaParam, TMatrixD::kTransposeMult, weight);
+ TMatrixD mChi2(tmp, TMatrixD::kMult, deltaParam);
+
+ // set chi2 value
+ chi2 = mChi2(0,0);
+
+ // check compatibility
+ if (chi2 > maxChi2) return kFALSE;
+
+ return kTRUE;
+}
+
+ //__________________________________________________________________________
+void AliMUONTrackParam::Print(Option_t* opt) const
+{
+ /// Printing TrackParam information
+ /// "full" option for printing all the information about the TrackParam
+ TString sopt(opt);
+ sopt.ToUpper();
+
+ if ( sopt.Contains("FULL") ) {
+ cout << "<AliMUONTrackParam> Bending P=" << setw(5) << setprecision(3) << 1./fParameters(4,0) <<
+ ", NonBendSlope=" << setw(5) << setprecision(3) << fParameters(1,0)*180./TMath::Pi() <<
+ ", BendSlope=" << setw(5) << setprecision(3) << fParameters(3,0)*180./TMath::Pi() <<
+ ", (x,y,z)_IP=(" << setw(5) << setprecision(3) << fParameters(0,0) <<
+ "," << setw(5) << setprecision(3) << fParameters(2,0) <<
+ "," << setw(5) << setprecision(3) << fZ <<
+ ") cm, (px,py,pz)=(" << setw(5) << setprecision(3) << Px() <<
+ "," << setw(5) << setprecision(3) << Py() <<
+ "," << setw(5) << setprecision(3) << Pz() << ") GeV/c" << endl;
+ }
+ else {
+ cout << "<AliMUONTrackParam>" << endl;
+ }
+
+}