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>
34 ClassImp(AliMUONTriggerTrack)
37 //__________________________________________________________________________
38 AliMUONTriggerTrack::AliMUONTriggerTrack()
48 fHitsPatternInTrigCh(0),
52 AliDebug(5,Form("this=%p",this));
54 //__________________________________________________________________________
55 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, UShort_t hitsPatternInTrigCh)
64 fGTPattern(theGTPattern),
65 fHitsPatternInTrigCh(hitsPatternInTrigCh),
68 /// ctor from local trigger output
69 AliDebug(5,Form("this=%p x11=%f y11=%f z11=%f z21=%f slopeX=%f slopeY=%f loTrgNum=%d GTPattern=%ld HitsPatternInTrigCh %i",
70 this,x11,y11,z11,z21,slopeX,slopeY,loTrgNum,theGTPattern,fHitsPatternInTrigCh));
74 //__________________________________________________________________________
75 AliMUONTriggerTrack::~AliMUONTriggerTrack()
78 AliDebug(5,Form("this=%p",this));
85 //__________________________________________________________________________
86 AliMUONTriggerTrack::AliMUONTriggerTrack (const AliMUONTriggerTrack& theMUONTriggerTrack)
87 : TObject(theMUONTriggerTrack),
88 fx11(theMUONTriggerTrack.fx11),
89 fy11(theMUONTriggerTrack.fy11),
90 fz11(theMUONTriggerTrack.fz11),
91 fz21(theMUONTriggerTrack.fz21),
92 fSlopeX(theMUONTriggerTrack.fSlopeX),
93 fSlopeY(theMUONTriggerTrack.fSlopeY),
94 floTrgNum(theMUONTriggerTrack.floTrgNum),
95 fGTPattern(theMUONTriggerTrack.fGTPattern),
96 fHitsPatternInTrigCh(theMUONTriggerTrack.fHitsPatternInTrigCh),
102 if (theMUONTriggerTrack.fCovariances) fCovariances = new TMatrixD(*(theMUONTriggerTrack.fCovariances));
103 AliDebug(5,Form("this=%p copy ctor",this));
107 //__________________________________________________________________________
108 AliMUONTriggerTrack & AliMUONTriggerTrack::operator=(const AliMUONTriggerTrack&
111 /// Assignment operator
113 // check assignement to self
114 if (this == &theMUONTriggerTrack)
117 /// base class assignement
118 TObject::operator=(theMUONTriggerTrack);
120 fx11 = theMUONTriggerTrack.fx11;
121 fy11 = theMUONTriggerTrack.fy11;
122 fz11 = theMUONTriggerTrack.fz11;
123 fz21 = theMUONTriggerTrack.fz21;
124 fSlopeX = theMUONTriggerTrack.fSlopeX;
125 fSlopeY = theMUONTriggerTrack.fSlopeY;
126 floTrgNum = theMUONTriggerTrack.floTrgNum;
127 fGTPattern = theMUONTriggerTrack.fGTPattern;
128 fHitsPatternInTrigCh = theMUONTriggerTrack.fHitsPatternInTrigCh;
130 if (theMUONTriggerTrack.fCovariances) {
131 if (fCovariances) *fCovariances = *(theMUONTriggerTrack.fCovariances);
132 else fCovariances = new TMatrixD(*(theMUONTriggerTrack.fCovariances));
141 //__________________________________________________________________________
143 AliMUONTriggerTrack::Print(Option_t* opt) const
146 TString optString(opt);
148 if ( optString.Contains("FULL") ) optString = "PARAM COV";
150 if ( optString.Contains("PARAM"))
151 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",
152 fx11,fy11,fz11,fz21,fSlopeX,fSlopeY,floTrgNum,fGTPattern,fHitsPatternInTrigCh) << endl;
154 if ( optString.Contains("COV") ){
155 if ( ! fCovariances ) cout << "Covariances not initialized " << endl;
156 else fCovariances->Print();
160 //__________________________________________________________________________
161 void AliMUONTriggerTrack::SetCovariances(const TMatrixD& covariances)
163 /// Set the covariance matrix
164 if (fCovariances) *fCovariances = covariances;
165 else fCovariances = new TMatrixD(covariances);
168 //__________________________________________________________________________
169 void AliMUONTriggerTrack::SetCovariances(const Double_t matrix[3][3])
171 /// Set the covariance matrix
172 if (fCovariances) fCovariances->SetMatrixArray(&(matrix[0][0]));
173 else fCovariances = new TMatrixD(3,3,&(matrix[0][0]));
176 //__________________________________________________________________________
177 const TMatrixD& AliMUONTriggerTrack::GetCovariances() const
179 /// Return the covariance matrix (create it before if needed)
181 fCovariances = new TMatrixD(3,3);
182 fCovariances->Zero();
184 return *fCovariances;
187 //__________________________________________________________________________
188 Bool_t AliMUONTriggerTrack::Match(AliMUONTriggerTrack &track, Double_t sigmaCut) const
190 /// Try to match this track with the given track. Matching conditions:
191 /// - x, y position and y slope within sigmaCut
193 TMatrixD paramDiff(3,1);
194 Double_t deltaZ = GetZ11() - track.GetZ11();
195 paramDiff(0,0) = GetX11() - track.GetX11();
196 paramDiff(1,0) = GetY11() - ( track.GetY11() + track.GetSlopeY() * deltaZ );
197 paramDiff(2,0) = GetSlopeY() - track.GetSlopeY();
199 TMatrixD cov1(GetCovariances());
200 TMatrixD cov2(track.GetCovariances());
202 AliDebug(3, Form("this Y11 %f track Y11: %f (Z11 %f) -> %f (Z11 %f)", GetY11(), track.GetY11(), track.GetZ11(), track.GetY11() + track.GetSlopeY() * deltaZ, GetZ11()));
204 TMatrixD sumCov(cov1,TMatrixD::kPlus,cov2);
205 if (sumCov.Determinant() != 0) {
207 TMatrixD tmp(sumCov,TMatrixD::kMult,paramDiff);
208 TMatrixD chi2M(paramDiff,TMatrixD::kTransposeMult,tmp);
211 AliWarning(" Determinant = 0");
212 Double_t sigma2 = 0.;
213 for (Int_t iVar = 0; iVar < 3; iVar++) {
214 sigma2 = cov1(iVar,iVar) + cov2(iVar,iVar);
215 chi2 += paramDiff(iVar,0) * paramDiff(iVar,0) / sigma2;
219 if ( chi2/3 > sigmaCut * sigmaCut )