]>
Commit | Line | Data |
---|---|---|
0b3dd00a | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
ee8a8d65 | 16 | // $Id$ |
0b3dd00a | 17 | |
ee8a8d65 | 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 | //----------------------------------------------------------------------------- | |
0b3dd00a | 26 | |
0b3dd00a | 27 | #include "AliMUONTriggerTrack.h" |
29f1b13a | 28 | #include "AliMUONTrackReconstructor.h" |
bdfb6eef | 29 | #include "TString.h" |
e5e7be4b | 30 | #include <Riostream.h> |
31 | #include "AliLog.h" | |
0b3dd00a | 32 | |
ee8a8d65 | 33 | /// \cond CLASSIMP |
34 | ClassImp(AliMUONTriggerTrack) | |
35 | /// \endcond | |
36 | ||
0b3dd00a | 37 | //__________________________________________________________________________ |
38 | AliMUONTriggerTrack::AliMUONTriggerTrack() | |
7fe0032c | 39 | : TObject(), |
40 | fx11(0), | |
41 | fy11(0), | |
bdfb6eef | 42 | fz11(0.), |
43 | fz21(0.), | |
44 | fSlopeX(0), | |
45 | fSlopeY(0), | |
c6ba19f7 | 46 | floTrgNum(0), |
67c201be | 47 | fGTPattern(0), |
bdfb6eef | 48 | fHitsPatternInTrigCh(0), |
49 | fCovariances(0x0) | |
0b3dd00a | 50 | { |
7945aae7 | 51 | /// default ctr |
9f164762 | 52 | AliDebug(5,Form("this=%p",this)); |
0b3dd00a | 53 | } |
54 | //__________________________________________________________________________ | |
bdfb6eef | 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) |
1657f946 | 56 | : TObject(), |
57 | fx11(x11), | |
58 | fy11(y11), | |
bdfb6eef | 59 | fz11(z11), |
60 | fz21(z21), | |
61 | fSlopeX(slopeX), | |
62 | fSlopeY(slopeY), | |
c6ba19f7 | 63 | floTrgNum(loTrgNum), |
67c201be | 64 | fGTPattern(theGTPattern), |
bdfb6eef | 65 | fHitsPatternInTrigCh(hitsPatternInTrigCh), |
66 | fCovariances(0x0) | |
0b3dd00a | 67 | { |
7945aae7 | 68 | /// ctor from local trigger output |
9f164762 | 69 | AliDebug(5,Form("this=%p x11=%f y11=%f z11=%f z21=%f slopeX=%f slopeY=%f loTrgNum=%d GTPattern=%ld HitsPatternInTrigCh %i", |
bdfb6eef | 70 | this,x11,y11,z11,z21,slopeX,slopeY,loTrgNum,theGTPattern,fHitsPatternInTrigCh)); |
e5e7be4b | 71 | |
0b3dd00a | 72 | } |
73 | ||
74 | //__________________________________________________________________________ | |
75 | AliMUONTriggerTrack::~AliMUONTriggerTrack() | |
76 | { | |
7945aae7 | 77 | /// Destructor |
9f164762 | 78 | AliDebug(5,Form("this=%p",this)); |
bdfb6eef | 79 | if (fCovariances) { |
80 | delete fCovariances; | |
81 | fCovariances = 0x0; | |
82 | } | |
0b3dd00a | 83 | } |
84 | ||
85 | //__________________________________________________________________________ | |
30178c30 | 86 | AliMUONTriggerTrack::AliMUONTriggerTrack (const AliMUONTriggerTrack& theMUONTriggerTrack) |
1657f946 | 87 | : TObject(theMUONTriggerTrack), |
88 | fx11(theMUONTriggerTrack.fx11), | |
89 | fy11(theMUONTriggerTrack.fy11), | |
bdfb6eef | 90 | fz11(theMUONTriggerTrack.fz11), |
91 | fz21(theMUONTriggerTrack.fz21), | |
92 | fSlopeX(theMUONTriggerTrack.fSlopeX), | |
93 | fSlopeY(theMUONTriggerTrack.fSlopeY), | |
c6ba19f7 | 94 | floTrgNum(theMUONTriggerTrack.floTrgNum), |
67c201be | 95 | fGTPattern(theMUONTriggerTrack.fGTPattern), |
bdfb6eef | 96 | fHitsPatternInTrigCh(theMUONTriggerTrack.fHitsPatternInTrigCh), |
97 | fCovariances(0x0) | |
0b3dd00a | 98 | { |
7945aae7 | 99 | /// |
100 | /// copy ctor | |
101 | /// | |
bdfb6eef | 102 | if (theMUONTriggerTrack.fCovariances) fCovariances = new TMatrixD(*(theMUONTriggerTrack.fCovariances)); |
9f164762 | 103 | AliDebug(5,Form("this=%p copy ctor",this)); |
e5e7be4b | 104 | |
0b3dd00a | 105 | } |
106 | ||
107 | //__________________________________________________________________________ | |
108 | AliMUONTriggerTrack & AliMUONTriggerTrack::operator=(const AliMUONTriggerTrack& | |
30178c30 | 109 | theMUONTriggerTrack) |
0b3dd00a | 110 | { |
7945aae7 | 111 | /// Assignment operator |
112 | ||
30178c30 | 113 | // check assignement to self |
114 | if (this == &theMUONTriggerTrack) | |
0b3dd00a | 115 | return *this; |
116 | ||
7945aae7 | 117 | /// base class assignement |
30178c30 | 118 | TObject::operator=(theMUONTriggerTrack); |
119 | ||
30178c30 | 120 | fx11 = theMUONTriggerTrack.fx11; |
121 | fy11 = theMUONTriggerTrack.fy11; | |
bdfb6eef | 122 | fz11 = theMUONTriggerTrack.fz11; |
123 | fz21 = theMUONTriggerTrack.fz21; | |
124 | fSlopeX = theMUONTriggerTrack.fSlopeX; | |
125 | fSlopeY = theMUONTriggerTrack.fSlopeY; | |
c6ba19f7 | 126 | floTrgNum = theMUONTriggerTrack.floTrgNum; |
30178c30 | 127 | fGTPattern = theMUONTriggerTrack.fGTPattern; |
67c201be | 128 | fHitsPatternInTrigCh = theMUONTriggerTrack.fHitsPatternInTrigCh; |
9131b4fe | 129 | |
bdfb6eef | 130 | if (theMUONTriggerTrack.fCovariances) { |
131 | if (fCovariances) *fCovariances = *(theMUONTriggerTrack.fCovariances); | |
132 | else fCovariances = new TMatrixD(*(theMUONTriggerTrack.fCovariances)); | |
133 | } else { | |
134 | delete fCovariances; | |
135 | fCovariances = 0x0; | |
136 | } | |
137 | ||
0b3dd00a | 138 | return *this; |
139 | } | |
c6ba19f7 | 140 | |
e5e7be4b | 141 | //__________________________________________________________________________ |
142 | void | |
bdfb6eef | 143 | AliMUONTriggerTrack::Print(Option_t* opt) const |
e5e7be4b | 144 | { |
145 | /// Printing | |
bdfb6eef | 146 | TString optString(opt); |
147 | optString.ToUpper(); | |
148 | if ( optString.Contains("FULL") ) optString = "PARAM COV"; | |
149 | ||
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; | |
153 | ||
154 | if ( optString.Contains("COV") ){ | |
155 | if ( ! fCovariances ) cout << "Covariances not initialized " << endl; | |
156 | else fCovariances->Print(); | |
157 | } | |
158 | } | |
e5e7be4b | 159 | |
bdfb6eef | 160 | //__________________________________________________________________________ |
161 | void AliMUONTriggerTrack::SetCovariances(const TMatrixD& covariances) | |
162 | { | |
163 | /// Set the covariance matrix | |
164 | if (fCovariances) *fCovariances = covariances; | |
165 | else fCovariances = new TMatrixD(covariances); | |
166 | } | |
167 | ||
168 | //__________________________________________________________________________ | |
169 | void AliMUONTriggerTrack::SetCovariances(const Double_t matrix[3][3]) | |
170 | { | |
171 | /// Set the covariance matrix | |
172 | if (fCovariances) fCovariances->SetMatrixArray(&(matrix[0][0])); | |
173 | else fCovariances = new TMatrixD(3,3,&(matrix[0][0])); | |
174 | } | |
175 | ||
176 | //__________________________________________________________________________ | |
177 | const TMatrixD& AliMUONTriggerTrack::GetCovariances() const | |
178 | { | |
179 | /// Return the covariance matrix (create it before if needed) | |
180 | if (!fCovariances) { | |
181 | fCovariances = new TMatrixD(3,3); | |
182 | fCovariances->Zero(); | |
183 | } | |
184 | return *fCovariances; | |
e5e7be4b | 185 | } |
9f164762 | 186 | |
187 | //__________________________________________________________________________ | |
64a3533c | 188 | Bool_t AliMUONTriggerTrack::Match(AliMUONTriggerTrack &track, |
189 | Double_t sigmaCut) const | |
9f164762 | 190 | { |
191 | /// Try to match this track with the given track. Matching conditions: | |
192 | /// - x, y position and y slope within sigmaCut | |
193 | ||
64a3533c | 194 | // Find the track with the covariances correctly set |
195 | // Extrapolate to the z of the other track | |
196 | Bool_t hasCov1 = ( GetCovariances().NonZeros() != 0 ); | |
197 | Bool_t hasCov2 = ( track.GetCovariances().NonZeros() != 0 ); | |
198 | ||
199 | const AliMUONTriggerTrack* trackToExtrap = ( hasCov2 ) ? &track : this; | |
200 | const AliMUONTriggerTrack* fixedTrack = ( hasCov2 ) ? this : &track; | |
201 | ||
9f164762 | 202 | TMatrixD paramDiff(3,1); |
64a3533c | 203 | Double_t deltaZ = fixedTrack->GetZ11() - trackToExtrap->GetZ11(); |
204 | paramDiff(0,0) = fixedTrack->GetX11() - trackToExtrap->GetX11(); | |
205 | paramDiff(1,0) = fixedTrack->GetY11() - ( trackToExtrap->GetY11() + trackToExtrap->GetSlopeY() * deltaZ ); | |
206 | paramDiff(2,0) = fixedTrack->GetSlopeY() - trackToExtrap->GetSlopeY(); | |
9f164762 | 207 | Double_t chi2 = 0.; |
9f164762 | 208 | |
64a3533c | 209 | TMatrixD cov1(fixedTrack->GetCovariances()); |
210 | TMatrixD cov2(trackToExtrap->GetCovariances()); | |
211 | ||
212 | // Extrapolate covariances to z | |
213 | if ( deltaZ != 0 ) { | |
214 | if ( hasCov1 || hasCov2 ){ | |
215 | TMatrixD jacob(3,3); | |
216 | jacob.UnitMatrix(); | |
217 | jacob(1,2) = deltaZ; | |
218 | TMatrixD tmp(trackToExtrap->GetCovariances(),TMatrixD::kMultTranspose,jacob); | |
219 | TMatrixD tmp2(jacob,TMatrixD::kMult,tmp); | |
220 | cov2 = tmp2; | |
221 | } | |
222 | } | |
223 | ||
224 | 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())); | |
9f164762 | 225 | |
226 | TMatrixD sumCov(cov1,TMatrixD::kPlus,cov2); | |
227 | if (sumCov.Determinant() != 0) { | |
228 | sumCov.Invert(); | |
229 | TMatrixD tmp(sumCov,TMatrixD::kMult,paramDiff); | |
230 | TMatrixD chi2M(paramDiff,TMatrixD::kTransposeMult,tmp); | |
231 | chi2 = chi2M(0,0); | |
232 | } else { | |
233 | AliWarning(" Determinant = 0"); | |
234 | Double_t sigma2 = 0.; | |
235 | for (Int_t iVar = 0; iVar < 3; iVar++) { | |
236 | sigma2 = cov1(iVar,iVar) + cov2(iVar,iVar); | |
237 | chi2 += paramDiff(iVar,0) * paramDiff(iVar,0) / sigma2; | |
238 | } | |
239 | } | |
240 | ||
241 | if ( chi2/3 > sigmaCut * sigmaCut ) | |
242 | return kFALSE; | |
243 | ||
244 | return kTRUE; | |
245 | } |