Line data Source code
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 :
16 : /* $Id$ */
17 :
18 : ///////////////////////////////////////////////////////////////////////////////
19 : //
20 : /// \class AliESDMuonTrack
21 : /// Class to describe the MUON tracks in the Event Summary Data class
22 : /// This is where the results of reconstruction are stored for the muons
23 : ///
24 : /// \author G.Martinez
25 : //
26 : ///////////////////////////////////////////////////////////////////////////////
27 :
28 : #include "AliESDMuonTrack.h"
29 : #include "AliESDMuonCluster.h"
30 : #include "AliESDEvent.h"
31 :
32 : #include <TClonesArray.h>
33 : #include <TLorentzVector.h>
34 : #include <TMath.h>
35 :
36 172 : ClassImp(AliESDMuonTrack)
37 :
38 : //_____________________________________________________________________________
39 : AliESDMuonTrack::AliESDMuonTrack ():
40 34 : AliVParticle(),
41 34 : fInverseBendingMomentum(FLT_MAX),
42 34 : fThetaX(0),
43 34 : fThetaY(0),
44 34 : fZ(0),
45 34 : fBendingCoor(0),
46 34 : fNonBendingCoor(0),
47 34 : fInverseBendingMomentumAtDCA(FLT_MAX),
48 34 : fThetaXAtDCA(0),
49 34 : fThetaYAtDCA(0),
50 34 : fBendingCoorAtDCA(0),
51 34 : fNonBendingCoorAtDCA(0),
52 34 : fInverseBendingMomentumUncorrected(FLT_MAX),
53 34 : fThetaXUncorrected(0),
54 34 : fThetaYUncorrected(0),
55 34 : fZUncorrected(0),
56 34 : fBendingCoorUncorrected(0),
57 34 : fNonBendingCoorUncorrected(0),
58 34 : fRAtAbsorberEnd(0),
59 34 : fChi2(0),
60 34 : fChi2MatchTrigger(0),
61 34 : fLocalTrigger(0),
62 34 : fX1Pattern(0),
63 34 : fY1Pattern(0),
64 34 : fX2Pattern(0),
65 34 : fY2Pattern(0),
66 34 : fX3Pattern(0),
67 34 : fY3Pattern(0),
68 34 : fX4Pattern(0),
69 34 : fY4Pattern(0),
70 34 : fMuonClusterMap(0),
71 34 : fHitsPatternInTrigCh(0),
72 34 : fHitsPatternInTrigChTrk(0),
73 34 : fNHit(0),
74 34 : fClusters(0x0),
75 34 : fClustersId(0x0),
76 34 : fLabel(-1),
77 34 : fESDEvent(0)
78 :
79 170 : {
80 : //
81 : /// Default constructor
82 : //
83 1088 : for (Int_t i = 0; i < 15; i++) fCovariances[i] = 0;
84 68 : }
85 :
86 :
87 : //_____________________________________________________________________________
88 : AliESDMuonTrack::AliESDMuonTrack (const AliESDMuonTrack& muonTrack):
89 0 : AliVParticle(muonTrack),
90 0 : fInverseBendingMomentum(muonTrack.fInverseBendingMomentum),
91 0 : fThetaX(muonTrack.fThetaX),
92 0 : fThetaY(muonTrack.fThetaY),
93 0 : fZ(muonTrack.fZ),
94 0 : fBendingCoor(muonTrack.fBendingCoor),
95 0 : fNonBendingCoor(muonTrack.fNonBendingCoor),
96 0 : fInverseBendingMomentumAtDCA(muonTrack.fInverseBendingMomentumAtDCA),
97 0 : fThetaXAtDCA(muonTrack.fThetaXAtDCA),
98 0 : fThetaYAtDCA(muonTrack.fThetaYAtDCA),
99 0 : fBendingCoorAtDCA(muonTrack.fBendingCoorAtDCA),
100 0 : fNonBendingCoorAtDCA(muonTrack.fNonBendingCoorAtDCA),
101 0 : fInverseBendingMomentumUncorrected(muonTrack.fInverseBendingMomentumUncorrected),
102 0 : fThetaXUncorrected(muonTrack.fThetaXUncorrected),
103 0 : fThetaYUncorrected(muonTrack.fThetaYUncorrected),
104 0 : fZUncorrected(muonTrack.fZUncorrected),
105 0 : fBendingCoorUncorrected(muonTrack.fBendingCoorUncorrected),
106 0 : fNonBendingCoorUncorrected(muonTrack.fNonBendingCoorUncorrected),
107 0 : fRAtAbsorberEnd(muonTrack.fRAtAbsorberEnd),
108 0 : fChi2(muonTrack.fChi2),
109 0 : fChi2MatchTrigger(muonTrack.fChi2MatchTrigger),
110 0 : fLocalTrigger(muonTrack.fLocalTrigger),
111 0 : fX1Pattern(muonTrack.fX1Pattern),
112 0 : fY1Pattern(muonTrack.fY1Pattern),
113 0 : fX2Pattern(muonTrack.fX2Pattern),
114 0 : fY2Pattern(muonTrack.fY2Pattern),
115 0 : fX3Pattern(muonTrack.fX3Pattern),
116 0 : fY3Pattern(muonTrack.fY3Pattern),
117 0 : fX4Pattern(muonTrack.fX4Pattern),
118 0 : fY4Pattern(muonTrack.fY4Pattern),
119 0 : fMuonClusterMap(muonTrack.fMuonClusterMap),
120 0 : fHitsPatternInTrigCh(muonTrack.fHitsPatternInTrigCh),
121 0 : fHitsPatternInTrigChTrk(muonTrack.fHitsPatternInTrigChTrk),
122 0 : fNHit(muonTrack.fNHit),
123 0 : fClusters(0x0),
124 0 : fClustersId(0x0),
125 0 : fLabel(muonTrack.fLabel),
126 0 : fESDEvent(muonTrack.fESDEvent)
127 0 : {
128 : //
129 : /// Copy constructor
130 : /// Deep copy implemented
131 : //
132 0 : for (Int_t i = 0; i < 15; i++) fCovariances[i] = muonTrack.fCovariances[i];
133 :
134 : // necessary to make a copy of the objects and not only the pointers in TClonesArray
135 0 : if (muonTrack.fClusters) {
136 0 : fClusters = new TClonesArray("AliESDMuonCluster",muonTrack.fClusters->GetEntriesFast());
137 0 : AliESDMuonCluster *cluster = (AliESDMuonCluster*) muonTrack.fClusters->First();
138 0 : while (cluster) {
139 0 : new ((*fClusters)[fClusters->GetEntriesFast()]) AliESDMuonCluster(*cluster);
140 0 : cluster = (AliESDMuonCluster*) muonTrack.fClusters->After(cluster);
141 : }
142 0 : }
143 :
144 : // copy of cluster Ids
145 0 : if (muonTrack.fClustersId) fClustersId = new TArrayI(*(muonTrack.fClustersId));
146 :
147 0 : }
148 :
149 : //_____________________________________________________________________________
150 : AliESDMuonTrack& AliESDMuonTrack::operator=(const AliESDMuonTrack& muonTrack)
151 : {
152 : //
153 : /// Equal operator for a deep copy
154 : //
155 0 : if (this == &muonTrack)
156 0 : return *this;
157 :
158 0 : AliVParticle::operator=(muonTrack); // don't forget to invoke the base class' assignment operator
159 :
160 0 : fInverseBendingMomentum = muonTrack.fInverseBendingMomentum;
161 0 : fThetaX = muonTrack.fThetaX;
162 0 : fThetaY = muonTrack.fThetaY;
163 0 : fZ = muonTrack.fZ;
164 0 : fBendingCoor = muonTrack.fBendingCoor;
165 0 : fNonBendingCoor = muonTrack.fNonBendingCoor;
166 :
167 0 : fInverseBendingMomentumAtDCA = muonTrack.fInverseBendingMomentumAtDCA;
168 0 : fThetaXAtDCA = muonTrack.fThetaXAtDCA;
169 0 : fThetaYAtDCA = muonTrack.fThetaYAtDCA;
170 0 : fBendingCoorAtDCA = muonTrack.fBendingCoorAtDCA;
171 0 : fNonBendingCoorAtDCA = muonTrack.fNonBendingCoorAtDCA;
172 :
173 0 : fInverseBendingMomentumUncorrected = muonTrack.fInverseBendingMomentumUncorrected;
174 0 : fThetaXUncorrected = muonTrack.fThetaXUncorrected;
175 0 : fThetaYUncorrected = muonTrack.fThetaYUncorrected;
176 0 : fZUncorrected = muonTrack.fZUncorrected;
177 0 : fBendingCoorUncorrected = muonTrack.fBendingCoorUncorrected;
178 0 : fNonBendingCoorUncorrected = muonTrack.fNonBendingCoorUncorrected;
179 :
180 0 : for (Int_t i = 0; i < 15; i++) fCovariances[i] = muonTrack.fCovariances[i];
181 :
182 0 : fRAtAbsorberEnd = muonTrack.fRAtAbsorberEnd;
183 :
184 0 : fChi2 = muonTrack.fChi2;
185 0 : fNHit = muonTrack.fNHit;
186 :
187 0 : fLocalTrigger = muonTrack.fLocalTrigger;
188 0 : fX1Pattern = muonTrack.fX1Pattern;
189 0 : fY1Pattern = muonTrack.fY1Pattern;
190 0 : fX2Pattern = muonTrack.fX2Pattern;
191 0 : fY2Pattern = muonTrack.fY2Pattern;
192 0 : fX3Pattern = muonTrack.fX3Pattern;
193 0 : fY3Pattern = muonTrack.fY3Pattern;
194 0 : fX4Pattern = muonTrack.fX4Pattern;
195 0 : fY4Pattern = muonTrack.fY4Pattern;
196 0 : fChi2MatchTrigger = muonTrack.fChi2MatchTrigger;
197 :
198 0 : fHitsPatternInTrigCh = muonTrack.fHitsPatternInTrigCh;
199 0 : fHitsPatternInTrigChTrk = muonTrack.fHitsPatternInTrigChTrk;
200 :
201 0 : fMuonClusterMap = muonTrack.fMuonClusterMap;
202 :
203 0 : fLabel = muonTrack.fLabel;
204 :
205 0 : fESDEvent = muonTrack.fESDEvent;
206 :
207 : // necessary to make a copy of the objects and not only the pointers in TClonesArray
208 0 : delete fClusters;
209 0 : if (muonTrack.fClusters) {
210 0 : fClusters = new TClonesArray("AliESDMuonCluster",muonTrack.fClusters->GetEntriesFast());
211 0 : AliESDMuonCluster *cluster = (AliESDMuonCluster*) muonTrack.fClusters->First();
212 0 : while (cluster) {
213 0 : new ((*fClusters)[fClusters->GetEntriesFast()]) AliESDMuonCluster(*cluster);
214 0 : cluster = (AliESDMuonCluster*) muonTrack.fClusters->After(cluster);
215 : }
216 0 : } else fClusters = 0x0;
217 :
218 : // copy of cluster Ids
219 0 : if (muonTrack.fClustersId) {
220 0 : if (fClustersId) *fClustersId = *(muonTrack.fClustersId);
221 0 : else fClustersId = new TArrayI(*(muonTrack.fClustersId));
222 : } else {
223 0 : delete fClustersId;
224 0 : fClustersId = 0x0;
225 : }
226 :
227 0 : return *this;
228 0 : }
229 :
230 : //__________________________________________________________________________
231 : void AliESDMuonTrack::Copy(TObject &obj) const {
232 :
233 : /// This overwrites the virtual TOBject::Copy()
234 : /// to allow run time copying without casting
235 : /// in AliESDEvent
236 :
237 0 : if(this==&obj)return;
238 0 : AliESDMuonTrack *robj = dynamic_cast<AliESDMuonTrack*>(&obj);
239 0 : if(!robj)return; // not an AliESDMuonTrack
240 0 : *robj = *this;
241 :
242 0 : }
243 :
244 : //__________________________________________________________________________
245 : AliESDMuonTrack::~AliESDMuonTrack()
246 96 : {
247 : /// Destructor
248 16 : delete fClusters;
249 20 : delete fClustersId;
250 48 : }
251 :
252 : //__________________________________________________________________________
253 : void AliESDMuonTrack::Clear(Option_t* opt)
254 : {
255 : /// Clear arrays
256 156 : if (opt && opt[0] == 'C') {
257 16 : if (fClusters) fClusters->Clear("C");
258 : } else {
259 72 : delete fClusters; fClusters = 0x0;
260 : }
261 136 : delete fClustersId; fClustersId = 0x0;
262 52 : fNHit = 0;
263 52 : }
264 :
265 : //__________________________________________________________________________
266 : void AliESDMuonTrack::Reset()
267 : {
268 : /// Reset to default values
269 4 : SetUniqueID(0);
270 2 : fInverseBendingMomentum = FLT_MAX;
271 2 : fThetaX = 0.;
272 2 : fThetaY = 0.;
273 2 : fZ = 0.;
274 2 : fBendingCoor = 0.;
275 2 : fNonBendingCoor = 0.;
276 2 : fInverseBendingMomentumAtDCA = FLT_MAX;
277 2 : fThetaXAtDCA = 0.;
278 2 : fThetaYAtDCA = 0.;
279 2 : fBendingCoorAtDCA = 0.;
280 2 : fNonBendingCoorAtDCA = 0.;
281 2 : fInverseBendingMomentumUncorrected = FLT_MAX;
282 2 : fThetaXUncorrected = 0.;
283 2 : fThetaYUncorrected = 0.;
284 2 : fZUncorrected = 0.;
285 2 : fBendingCoorUncorrected = 0.;
286 2 : fNonBendingCoorUncorrected = 0.;
287 2 : fRAtAbsorberEnd = 0.;
288 2 : fChi2 = 0.;
289 2 : fChi2MatchTrigger = 0.;
290 2 : fLocalTrigger = 0;
291 2 : fX1Pattern = 0;
292 2 : fY1Pattern = 0;
293 2 : fX2Pattern = 0;
294 2 : fY2Pattern = 0;
295 2 : fX3Pattern = 0;
296 2 : fY3Pattern = 0;
297 2 : fX4Pattern = 0;
298 2 : fY4Pattern = 0;
299 2 : fMuonClusterMap = 0;
300 2 : fHitsPatternInTrigCh = 0;
301 2 : fHitsPatternInTrigChTrk = 0;
302 2 : fNHit = 0;
303 4 : delete fClusters; fClusters = 0x0;
304 4 : delete fClustersId; fClustersId = 0x0;
305 64 : for (Int_t i = 0; i < 15; i++) fCovariances[i] = 0.;
306 2 : fLabel = -1;
307 2 : fESDEvent = 0;
308 2 : }
309 :
310 : //_____________________________________________________________________________
311 : void AliESDMuonTrack::GetCovariances(TMatrixD& cov) const
312 : {
313 : /// return covariance matrix of uncorrected parameters
314 0 : cov.ResizeTo(5,5);
315 0 : for (Int_t i = 0; i < 5; i++)
316 0 : for (Int_t j = 0; j <= i; j++)
317 0 : cov(i,j) = cov (j,i) = fCovariances[i*(i+1)/2 + j];
318 0 : }
319 :
320 : //_____________________________________________________________________________
321 : void AliESDMuonTrack::SetCovariances(const TMatrixD& cov)
322 : {
323 : /// set reduced covariance matrix of uncorrected parameters
324 208 : for (Int_t i = 0; i < 5; i++)
325 640 : for (Int_t j = 0; j <= i; j++)
326 240 : fCovariances[i*(i+1)/2 + j] = cov(i,j);
327 :
328 16 : }
329 :
330 : //_____________________________________________________________________________
331 : void AliESDMuonTrack::GetCovarianceXYZPxPyPz(Double_t cov[21]) const
332 : {
333 : /// return reduced covariance matrix of uncorrected parameters in (X,Y,Z,Px,Py,Pz) coordinate system
334 : ///
335 : /// - Cov(x,x) ... : cov[0]
336 : /// - Cov(y,x) ... : cov[1] cov[2]
337 : /// - Cov(z,x) ... : cov[3] cov[4] cov[5]
338 : /// - Cov(px,x)... : cov[6] cov[7] cov[8] cov[9]
339 : /// - Cov(py,x)... : cov[10] cov[11] cov[12] cov[13] cov[14]
340 : /// - Cov(pz,x)... : cov[15] cov[16] cov[17] cov[18] cov[19] cov[20]
341 : ///
342 : /// Get ESD covariance matrix into a TMatrixD
343 0 : TMatrixD covESD(5,5);
344 0 : GetCovariances(covESD);
345 :
346 : // compute Jacobian to change the coordinate system
347 : // from (X,thetaX,Y,thetaY,c/pYZ) to (X,Y,Z,pX,pY,pZ)
348 0 : Double_t tanThetaX = TMath::Tan(fThetaXUncorrected);
349 0 : Double_t tanThetaY = TMath::Tan(fThetaYUncorrected);
350 0 : Double_t cosThetaX2 = TMath::Cos(fThetaXUncorrected) * TMath::Cos(fThetaXUncorrected);
351 0 : Double_t cosThetaY2 = TMath::Cos(fThetaYUncorrected) * TMath::Cos(fThetaYUncorrected);
352 0 : Double_t pZ = PzUncorrected();
353 0 : Double_t dpZdthetaY = - fInverseBendingMomentumUncorrected * fInverseBendingMomentumUncorrected *
354 0 : pZ * pZ * pZ * tanThetaY / cosThetaY2;
355 0 : Double_t dpZdinvpYZ = (fInverseBendingMomentumUncorrected != 0.) ? - pZ / fInverseBendingMomentumUncorrected : - FLT_MAX;
356 0 : TMatrixD jacob(6,5);
357 0 : jacob.Zero();
358 0 : jacob(0,0) = 1.;
359 0 : jacob(1,2) = 1.;
360 0 : jacob(3,1) = pZ / cosThetaX2;
361 0 : jacob(3,3) = dpZdthetaY * tanThetaX;
362 0 : jacob(3,4) = dpZdinvpYZ * tanThetaX;
363 0 : jacob(4,3) = dpZdthetaY * tanThetaY + pZ / cosThetaY2;
364 0 : jacob(4,4) = dpZdinvpYZ * tanThetaY;
365 0 : jacob(5,3) = dpZdthetaY;
366 0 : jacob(5,4) = dpZdinvpYZ;
367 :
368 : // compute covariance matrix in AOD coordinate system
369 0 : TMatrixD tmp(covESD,TMatrixD::kMultTranspose,jacob);
370 0 : TMatrixD covAOD(jacob,TMatrixD::kMult,tmp);
371 :
372 : // Get AOD covariance matrix into co[21]
373 0 : for (Int_t i = 0; i < 6; i++)
374 0 : for (Int_t j = 0; j <= i; j++)
375 0 : cov[i*(i+1)/2 + j] = covAOD(i,j);
376 :
377 0 : }
378 :
379 : //_____________________________________________________________________________
380 : Double_t AliESDMuonTrack::Px() const
381 : {
382 : /// return p_x from track parameters
383 32 : Double_t nonBendingSlope = TMath::Tan(fThetaX);
384 16 : Double_t bendingSlope = TMath::Tan(fThetaY);
385 48 : Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : - FLT_MAX;
386 16 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
387 16 : return pZ * nonBendingSlope;
388 : }
389 :
390 : //_____________________________________________________________________________
391 : Double_t AliESDMuonTrack::Py() const
392 : {
393 : /// return p_y from track parameters
394 32 : Double_t bendingSlope = TMath::Tan(fThetaY);
395 48 : Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : - FLT_MAX;
396 16 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
397 16 : return pZ * bendingSlope;
398 : }
399 :
400 : //_____________________________________________________________________________
401 : Double_t AliESDMuonTrack::Pz() const
402 : {
403 : /// return p_z from track parameters
404 32 : Double_t bendingSlope = TMath::Tan(fThetaY);
405 48 : Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : - FLT_MAX;
406 16 : return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
407 : }
408 :
409 : //_____________________________________________________________________________
410 : Double_t AliESDMuonTrack::P() const
411 : {
412 : /// return p from track parameters
413 0 : Double_t nonBendingSlope = TMath::Tan(fThetaX);
414 0 : Double_t bendingSlope = TMath::Tan(fThetaY);
415 0 : Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : - FLT_MAX;
416 0 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
417 0 : return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
418 : }
419 :
420 : //_____________________________________________________________________________
421 : void AliESDMuonTrack::LorentzP(TLorentzVector& vP) const
422 : {
423 : /// return Lorentz momentum vector from track parameters
424 0 : Double_t muonMass = M();
425 0 : Double_t nonBendingSlope = TMath::Tan(fThetaX);
426 0 : Double_t bendingSlope = TMath::Tan(fThetaY);
427 0 : Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : - FLT_MAX;
428 0 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
429 0 : Double_t pX = pZ * nonBendingSlope;
430 0 : Double_t pY = pZ * bendingSlope;
431 0 : Double_t e = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
432 0 : vP.SetPxPyPzE(pX, pY, pZ, e);
433 0 : }
434 :
435 : //_____________________________________________________________________________
436 : Double_t AliESDMuonTrack::PxAtDCA() const
437 : {
438 : /// return p_x from track parameters
439 32 : Double_t nonBendingSlope = TMath::Tan(fThetaXAtDCA);
440 16 : Double_t bendingSlope = TMath::Tan(fThetaYAtDCA);
441 48 : Double_t pYZ = (fInverseBendingMomentumAtDCA != 0.) ? TMath::Abs(1. / fInverseBendingMomentumAtDCA) : - FLT_MAX;
442 16 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
443 16 : return pZ * nonBendingSlope;
444 : }
445 :
446 : //_____________________________________________________________________________
447 : Double_t AliESDMuonTrack::PyAtDCA() const
448 : {
449 : /// return p_y from track parameters
450 32 : Double_t bendingSlope = TMath::Tan(fThetaYAtDCA);
451 48 : Double_t pYZ = (fInverseBendingMomentumAtDCA != 0.) ? TMath::Abs(1. / fInverseBendingMomentumAtDCA) : - FLT_MAX;
452 16 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
453 16 : return pZ * bendingSlope;
454 : }
455 :
456 : //_____________________________________________________________________________
457 : Double_t AliESDMuonTrack::PzAtDCA() const
458 : {
459 : /// return p_z from track parameters
460 32 : Double_t bendingSlope = TMath::Tan(fThetaYAtDCA);
461 48 : Double_t pYZ = (fInverseBendingMomentumAtDCA != 0.) ? TMath::Abs(1. / fInverseBendingMomentumAtDCA) : - FLT_MAX;
462 16 : return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
463 : }
464 :
465 : //_____________________________________________________________________________
466 : Double_t AliESDMuonTrack::PAtDCA() const
467 : {
468 : /// return p from track parameters
469 0 : Double_t nonBendingSlope = TMath::Tan(fThetaXAtDCA);
470 0 : Double_t bendingSlope = TMath::Tan(fThetaYAtDCA);
471 0 : Double_t pYZ = (fInverseBendingMomentumAtDCA != 0.) ? TMath::Abs(1. / fInverseBendingMomentumAtDCA) : - FLT_MAX;
472 0 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
473 0 : return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
474 : }
475 :
476 : //_____________________________________________________________________________
477 : void AliESDMuonTrack::LorentzPAtDCA(TLorentzVector& vP) const
478 : {
479 : /// return Lorentz momentum vector from track parameters
480 0 : Double_t muonMass = M();
481 0 : Double_t nonBendingSlope = TMath::Tan(fThetaXAtDCA);
482 0 : Double_t bendingSlope = TMath::Tan(fThetaYAtDCA);
483 0 : Double_t pYZ = (fInverseBendingMomentumAtDCA != 0.) ? TMath::Abs(1. / fInverseBendingMomentumAtDCA) : - FLT_MAX;
484 0 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
485 0 : Double_t pX = pZ * nonBendingSlope;
486 0 : Double_t pY = pZ * bendingSlope;
487 0 : Double_t e = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
488 0 : vP.SetPxPyPzE(pX, pY, pZ, e);
489 0 : }
490 :
491 : //_____________________________________________________________________________
492 : Double_t AliESDMuonTrack::PxUncorrected() const
493 : {
494 : /// return p_x from track parameters
495 0 : Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
496 0 : Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
497 0 : Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : - FLT_MAX;
498 0 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
499 0 : return pZ * nonBendingSlope;
500 : }
501 :
502 : //_____________________________________________________________________________
503 : Double_t AliESDMuonTrack::PyUncorrected() const
504 : {
505 : /// return p_y from track parameters
506 0 : Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
507 0 : Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : - FLT_MAX;
508 0 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
509 0 : return pZ * bendingSlope;
510 : }
511 :
512 : //_____________________________________________________________________________
513 : Double_t AliESDMuonTrack::PzUncorrected() const
514 : {
515 : /// return p_z from track parameters
516 0 : Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
517 0 : Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : - FLT_MAX;
518 0 : return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
519 : }
520 :
521 : //_____________________________________________________________________________
522 : Double_t AliESDMuonTrack::PUncorrected() const
523 : {
524 : /// return p from track parameters
525 0 : Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
526 0 : Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
527 0 : Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : - FLT_MAX;
528 0 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
529 0 : return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
530 : }
531 :
532 : //_____________________________________________________________________________
533 : void AliESDMuonTrack::LorentzPUncorrected(TLorentzVector& vP) const
534 : {
535 : /// return Lorentz momentum vector from track parameters
536 0 : Double_t muonMass = M();
537 0 : Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
538 0 : Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
539 0 : Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : - FLT_MAX;
540 0 : Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
541 0 : Double_t pX = pZ * nonBendingSlope;
542 0 : Double_t pY = pZ * bendingSlope;
543 0 : Double_t e = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
544 0 : vP.SetPxPyPzE(pX, pY, pZ, e);
545 0 : }
546 :
547 : //_____________________________________________________________________________
548 : Int_t AliESDMuonTrack::GetNDF() const
549 : {
550 : /// return the number of degrees of freedom
551 :
552 0 : Int_t ndf = 2 * static_cast<Int_t>(fNHit) - 5;
553 0 : return (ndf > 0) ? ndf : 0;
554 : }
555 :
556 : //_____________________________________________________________________________
557 : Double_t AliESDMuonTrack::GetNormalizedChi2() const
558 : {
559 : /// return the chi2 value divided by the number of degrees of freedom
560 :
561 0 : Int_t ndf = GetNDF();
562 0 : return (ndf > 0) ? fChi2 / static_cast<Double_t>(ndf) : 0.;
563 : }
564 :
565 : //_____________________________________________________________________________
566 : Int_t AliESDMuonTrack::GetMatchTrigger() const
567 : {
568 : /// backward compatibility after replacing fMatchTrigger by fLocalTrigger
569 : /// - 0 track does not match trigger
570 : /// - 1 track match but does not pass pt cut
571 : /// - 2 track match Low pt cut
572 : /// - 3 track match High pt cut
573 :
574 68 : if (!LoCircuit()) {
575 8 : return 0;
576 26 : } else if (LoLpt() == 0 && LoHpt() == 0) {
577 0 : return 1;
578 52 : } else if (LoLpt() > 0 && LoHpt() == 0) {
579 0 : return 2;
580 : } else {
581 26 : return 3;
582 : }
583 :
584 34 : }
585 :
586 : //_____________________________________________________________________________
587 : Bool_t AliESDMuonTrack::MatchTriggerDigits(Bool_t fromTrack) const
588 : {
589 : /// return kTRUE if the track matches a digit on both planes of at least 2 trigger chambers
590 :
591 0 : UShort_t pattern = ( fromTrack ) ? fHitsPatternInTrigChTrk : fHitsPatternInTrigCh;
592 : Int_t nMatchedChambers = 0;
593 0 : for (Int_t ich=0; ich<4; ich++)
594 0 : if (IsChamberHit(pattern, 0, ich) &&
595 0 : IsChamberHit(pattern, 1, ich)) nMatchedChambers++;
596 :
597 0 : return (nMatchedChambers >= 2);
598 : }
599 :
600 : //_____________________________________________________________________________
601 : Int_t AliESDMuonTrack::GetMuonTrigDevSign() const
602 : {
603 : /// Sign of the deviation provided by trigger
604 32 : Int_t deviation = LoDev();
605 22 : if ( deviation > 15 ) return 1;
606 20 : else if ( deviation < 15 ) return -1;
607 0 : else return 0;
608 16 : }
609 :
610 : //_____________________________________________________________________________
611 : void AliESDMuonTrack::AddClusterId(UInt_t clusterId)
612 : {
613 : /// add the given cluster Id to the list associated to the track
614 356 : if (!fClustersId) fClustersId = new TArrayI(5);
615 244 : if (fClustersId->GetSize() <= fNHit) fClustersId->Set(fNHit+1);
616 162 : fClustersId->AddAt(static_cast<Int_t>(clusterId), fNHit++);
617 162 : }
618 :
619 : //_____________________________________________________________________________
620 : void AliESDMuonTrack::MoveClustersToESD(AliESDEvent &esd)
621 : {
622 : /// move the clusters (and attached pads) to the new ESD structure
623 0 : if (!fClusters) return;
624 0 : fNHit = 0;
625 0 : for (Int_t i = 0; i < fClusters->GetEntriesFast(); i++) {
626 0 : AliESDMuonCluster *cluster = static_cast<AliESDMuonCluster*>(fClusters->UncheckedAt(i));
627 0 : cluster->MovePadsToESD(esd);
628 0 : AliESDMuonCluster *newCluster = esd.NewMuonCluster();
629 0 : *newCluster = *cluster;
630 0 : AddClusterId(newCluster->GetUniqueID());
631 : }
632 0 : delete fClusters;
633 0 : fClusters = 0x0;
634 0 : }
635 :
636 : //_____________________________________________________________________________
637 : void AliESDMuonTrack::SetFiredChamber(UInt_t& pattern, Int_t cathode, Int_t chamber)
638 : {
639 : /// Turn on the bit corresponding to fired chameber
640 480 : pattern |= (0x1 << ( 7 - ( 4*cathode + chamber )));
641 240 : }
642 :
643 : //_____________________________________________________________________________
644 : void AliESDMuonTrack::AddEffInfo(UInt_t& pattern, Int_t slatOrInfo, Int_t board, EAliTriggerChPatternFlag effType)
645 : {
646 : /// Add efficiency flag and crossed RPC or info on rejected track
647 92 : if ( slatOrInfo > 0x1F ) {
648 0 : AliErrorClass(Form("slatOrInfo is 0x%x should be at most 0x1f",slatOrInfo));
649 0 : return;
650 : }
651 46 : if ( board > 242 ) {
652 0 : AliErrorClass(Form("board is %i should be at most 242",board));
653 0 : return;
654 : }
655 46 : if ( effType > 0x3 ) {
656 0 : AliErrorClass(Form("effType is 0x%x should be at most 0x3",effType));
657 0 : return;
658 : }
659 46 : pattern |= effType << 8;
660 46 : pattern |= slatOrInfo << 10;
661 46 : pattern |= board << 15;
662 92 : }
663 :
664 : //_____________________________________________________________________________
665 : Bool_t AliESDMuonTrack::IsChamberHit(UInt_t pattern, Int_t cathode, Int_t chamber)
666 : {
667 : /// Check if chamber was was hit
668 0 : return (pattern >> (7 - ( 4*cathode + chamber ))) & 0x1;
669 : }
670 :
671 : //_____________________________________________________________________________
672 : Int_t AliESDMuonTrack::GetEffFlag(UInt_t pattern)
673 : {
674 : /// Get Efficiency flag
675 0 : return (pattern >> 8) & 0x3;
676 : }
677 :
678 : //_____________________________________________________________________________
679 : Int_t AliESDMuonTrack::GetSlatOrInfo(UInt_t pattern)
680 : {
681 : /// Getting crossed slat or info
682 0 : return (pattern >> 10) & 0x1F;
683 : }
684 :
685 : //_____________________________________________________________________________
686 : Int_t AliESDMuonTrack::GetCrossedBoard(UInt_t pattern)
687 : {
688 : /// Getting crossed board
689 0 : return ( pattern >> 15 ) & 0xFF;
690 : }
691 :
692 :
693 : //_____________________________________________________________________________
694 : void AliESDMuonTrack::AddMuonTrigDevSignInfo ( UInt_t &pattern ) const
695 : {
696 : /// Add trigger deviation sign info to pattern
697 : /// The info is stored in the 2 most significant digit:
698 : /// info<<30
699 : /// The information is:
700 : /// 0x0 => no information present
701 : /// 0x1 => negative deviation
702 : /// 0x2 => undetermined sign
703 : /// 0x3 => positive deviation
704 :
705 : // First clean bits
706 32 : pattern &= 0x3FFFFFFF;
707 : // Then add info
708 16 : UInt_t info = ((UInt_t)(GetMuonTrigDevSign()+2)&0x3)<<30;
709 16 : pattern |= info;
710 16 : }
|