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 //-----------------------------------------------------------------------------
19 // Class AliMUONTriggerTrack
20 //---------------------------
21 // Reconstructed Trigger track in ALICE dimuon spectrometer
22 // Note: equivalent to AliMUONTriggerTrack for tracking,
23 // No need for a AliMUONTriggerTrackParam
24 // Author: Philippe Crochet
25 //-----------------------------------------------------------------------------
27 #include "AliMUONTriggerTrack.h"
28 #include "AliMUONTrackReconstructor.h"
30 #include <Riostream.h>
36 ClassImp(AliMUONTriggerTrack)
39 //__________________________________________________________________________
40 AliMUONTriggerTrack::AliMUONTriggerTrack()
51 fHitsPatternInTrigCh(0),
55 AliDebug(5,Form("this=%p",this));
57 //__________________________________________________________________________
58 AliMUONTriggerTrack::AliMUONTriggerTrack(Float_t x11, Float_t y11, Float_t z11, Float_t z21, Float_t slopeX, Float_t slopeY, Int_t loTrgNum, Long_t theGTPattern, Int_t ptCutLevel)
67 fGTPattern(theGTPattern),
68 fPtCutLevel(ptCutLevel),
69 fHitsPatternInTrigCh(0),
72 /// ctor from local trigger output
73 AliDebug(5,Form("this=%p x11=%f y11=%f z11=%f z21=%f slopeX=%f slopeY=%f loTrgNum=%d GTPattern=%ld HitsPatternInTrigCh %i",
74 this,x11,y11,z11,z21,slopeX,slopeY,loTrgNum,theGTPattern,fHitsPatternInTrigCh));
78 //__________________________________________________________________________
79 AliMUONTriggerTrack::~AliMUONTriggerTrack()
82 AliDebug(5,Form("this=%p",this));
89 //__________________________________________________________________________
90 AliMUONTriggerTrack::AliMUONTriggerTrack (const AliMUONTriggerTrack& theMUONTriggerTrack)
91 : TObject(theMUONTriggerTrack),
92 fx11(theMUONTriggerTrack.fx11),
93 fy11(theMUONTriggerTrack.fy11),
94 fz11(theMUONTriggerTrack.fz11),
95 fz21(theMUONTriggerTrack.fz21),
96 fSlopeX(theMUONTriggerTrack.fSlopeX),
97 fSlopeY(theMUONTriggerTrack.fSlopeY),
98 floTrgNum(theMUONTriggerTrack.floTrgNum),
99 fGTPattern(theMUONTriggerTrack.fGTPattern),
100 fPtCutLevel(theMUONTriggerTrack.fPtCutLevel),
101 fHitsPatternInTrigCh(theMUONTriggerTrack.fHitsPatternInTrigCh),
107 if (theMUONTriggerTrack.fCovariances) fCovariances = new TMatrixD(*(theMUONTriggerTrack.fCovariances));
108 AliDebug(5,Form("this=%p copy ctor",this));
112 //__________________________________________________________________________
113 AliMUONTriggerTrack & AliMUONTriggerTrack::operator=(const AliMUONTriggerTrack&
116 /// Assignment operator
118 // check assignement to self
119 if (this == &theMUONTriggerTrack)
122 /// base class assignement
123 TObject::operator=(theMUONTriggerTrack);
125 fx11 = theMUONTriggerTrack.fx11;
126 fy11 = theMUONTriggerTrack.fy11;
127 fz11 = theMUONTriggerTrack.fz11;
128 fz21 = theMUONTriggerTrack.fz21;
129 fSlopeX = theMUONTriggerTrack.fSlopeX;
130 fSlopeY = theMUONTriggerTrack.fSlopeY;
131 floTrgNum = theMUONTriggerTrack.floTrgNum;
132 fGTPattern = theMUONTriggerTrack.fGTPattern;
133 fHitsPatternInTrigCh = theMUONTriggerTrack.fHitsPatternInTrigCh;
135 if (theMUONTriggerTrack.fCovariances) {
136 if (fCovariances) *fCovariances = *(theMUONTriggerTrack.fCovariances);
137 else fCovariances = new TMatrixD(*(theMUONTriggerTrack.fCovariances));
146 //__________________________________________________________________________
147 void AliMUONTriggerTrack::Clear(Option_t* /*opt*/)
154 //__________________________________________________________________________
156 AliMUONTriggerTrack::Print(Option_t* opt) const
159 TString optString(opt);
161 if ( optString.Contains("FULL") ) optString = "PARAM COV";
163 if ( optString.Contains("PARAM"))
164 cout << Form("(X,Y,Z)11=(%7.2f,%7.2f,%7.2f) Z21=%7.2f Slope(X,Y)=(%7.2f,%7.2f) LocalBoard #%3d GlobalTriggerPattern %x HitsPatternInTrigCh %x",
165 fx11,fy11,fz11,fz21,fSlopeX,fSlopeY,floTrgNum,fGTPattern,fHitsPatternInTrigCh) << endl;
167 if ( optString.Contains("COV") ){
168 if ( ! fCovariances ) cout << "Covariances not initialized " << endl;
169 else fCovariances->Print();
173 //__________________________________________________________________________
174 void AliMUONTriggerTrack::SetCovariances(const TMatrixD& covariances)
176 /// Set the covariance matrix
177 if (fCovariances) *fCovariances = covariances;
178 else fCovariances = new TMatrixD(covariances);
181 //__________________________________________________________________________
182 void AliMUONTriggerTrack::SetCovariances(const Double_t matrix[3][3])
184 /// Set the covariance matrix
185 if (fCovariances) fCovariances->SetMatrixArray(&(matrix[0][0]));
186 else fCovariances = new TMatrixD(3,3,&(matrix[0][0]));
189 //__________________________________________________________________________
190 const TMatrixD& AliMUONTriggerTrack::GetCovariances() const
192 /// Return the covariance matrix (create it before if needed)
194 fCovariances = new TMatrixD(3,3);
195 fCovariances->Zero();
197 return *fCovariances;
200 //__________________________________________________________________________
201 Bool_t AliMUONTriggerTrack::Match(AliMUONTriggerTrack &track,
202 Double_t sigmaCut) const
204 /// Try to match this track with the given track. Matching conditions:
205 /// - x, y position and y slope within sigmaCut
207 // Find the track with the covariances correctly set
208 // Extrapolate to the z of the other track
209 Bool_t hasCov1 = ( GetCovariances().NonZeros() != 0 );
210 Bool_t hasCov2 = ( track.GetCovariances().NonZeros() != 0 );
212 const AliMUONTriggerTrack* trackToExtrap = ( hasCov2 ) ? &track : this;
213 const AliMUONTriggerTrack* fixedTrack = ( hasCov2 ) ? this : &track;
215 TMatrixD paramDiff(3,1);
216 Double_t deltaZ = fixedTrack->GetZ11() - trackToExtrap->GetZ11();
217 paramDiff(0,0) = fixedTrack->GetX11() - trackToExtrap->GetX11();
218 paramDiff(1,0) = fixedTrack->GetY11() - ( trackToExtrap->GetY11() + trackToExtrap->GetSlopeY() * deltaZ );
219 paramDiff(2,0) = fixedTrack->GetSlopeY() - trackToExtrap->GetSlopeY();
222 TMatrixD cov1(fixedTrack->GetCovariances());
223 TMatrixD cov2(trackToExtrap->GetCovariances());
225 // Extrapolate covariances to z
227 if ( hasCov1 || hasCov2 ){
231 TMatrixD tmp(trackToExtrap->GetCovariances(),TMatrixD::kMultTranspose,jacob);
232 TMatrixD tmp2(jacob,TMatrixD::kMult,tmp);
237 AliDebug(3, Form("track1 Y11 %f track2 Y11: %f (Z11 %f) -> %f (Z11 %f)", fixedTrack->GetY11(), trackToExtrap->GetY11(), trackToExtrap->GetZ11(), trackToExtrap->GetY11() + trackToExtrap->GetSlopeY() * deltaZ, fixedTrack->GetZ11()));
239 TMatrixD sumCov(cov1,TMatrixD::kPlus,cov2);
240 if (sumCov.Determinant() != 0) {
242 TMatrixD tmp(sumCov,TMatrixD::kMult,paramDiff);
243 TMatrixD chi2M(paramDiff,TMatrixD::kTransposeMult,tmp);
246 AliWarning(" Determinant = 0");
247 Double_t sigma2 = 0.;
248 for (Int_t iVar = 0; iVar < 3; iVar++) {
249 sigma2 = cov1(iVar,iVar) + cov2(iVar,iVar);
250 chi2 += paramDiff(iVar,0) * paramDiff(iVar,0) / sigma2;
254 if ( chi2/3 > sigmaCut * sigmaCut )