]>
Commit | Line | Data |
---|---|---|
98937d93 | 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 | //----------------------------------------------------------------- | |
17 | // Implementation of the base class for fast track fitters | |
18 | // | |
19 | // | |
20 | //----------------------------------------------------------------- | |
21 | ||
22 | #include <TMatrixDSym.h> | |
cc345ce3 | 23 | #include <TArrayI.h> |
98937d93 | 24 | |
25 | #include "AliTrackFitter.h" | |
26 | #include "AliTrackPointArray.h" | |
27 | ||
28 | ClassImp(AliTrackFitter) | |
29 | ||
30 | //_____________________________________________________________________________ | |
31 | AliTrackFitter::AliTrackFitter() | |
32 | { | |
33 | // default constructor | |
34 | // | |
35 | for (Int_t i=0;i<6;i++) fParams[i] = 0; | |
36 | fCov = 0; | |
37 | fPoints = 0; | |
46ae650f | 38 | fPVolId = fPTrack = 0; |
39 | fChi2 = 0; | |
40 | fNdf = 0; | |
cc345ce3 | 41 | fMinNPoints = 0; |
98937d93 | 42 | fIsOwner = kFALSE; |
43 | } | |
44 | ||
45 | //_____________________________________________________________________________ | |
46 | AliTrackFitter::AliTrackFitter(AliTrackPointArray *array, Bool_t owner) | |
47 | { | |
48 | // constructor from space points array | |
49 | // | |
50 | for (Int_t i=0;i<6;i++) fParams[i] = 0; | |
51 | fCov = new TMatrixDSym(6); | |
46ae650f | 52 | fPVolId = fPTrack = 0; |
53 | fChi2 = 0; | |
54 | fNdf = 0; | |
cc345ce3 | 55 | fMinNPoints = 0; |
98937d93 | 56 | fIsOwner = kFALSE; |
57 | SetTrackPointArray(array,owner); | |
58 | } | |
59 | ||
60 | //_____________________________________________________________________________ | |
61 | AliTrackFitter::AliTrackFitter(const AliTrackFitter &fitter): | |
62 | TObject(fitter) | |
63 | { | |
64 | // Copy constructor | |
65 | // | |
46ae650f | 66 | SetTrackPointArray(fitter.fPoints,fitter.fIsOwner); |
98937d93 | 67 | for (Int_t i=0;i<6;i++) fParams[i] = fitter.fParams[i]; |
68 | fCov = new TMatrixDSym(*fitter.fCov); | |
46ae650f | 69 | fChi2 = fitter.fChi2; |
70 | fNdf = fitter.fNdf; | |
cc345ce3 | 71 | fMinNPoints = fitter.fMinNPoints; |
98937d93 | 72 | fIsOwner = kFALSE; |
98937d93 | 73 | } |
74 | ||
75 | //_____________________________________________________________________________ | |
76 | AliTrackFitter &AliTrackFitter::operator =(const AliTrackFitter& fitter) | |
77 | { | |
78 | // assignment operator | |
79 | // | |
80 | if(this==&fitter) return *this; | |
81 | ||
46ae650f | 82 | SetTrackPointArray(fitter.fPoints); |
98937d93 | 83 | for (Int_t i=0;i<6;i++) fParams[i] = fitter.fParams[i]; |
84 | fCov = new TMatrixDSym(*fitter.fCov); | |
46ae650f | 85 | fChi2 = fitter.fChi2; |
86 | fNdf = fitter.fNdf; | |
cc345ce3 | 87 | fMinNPoints = fitter.fMinNPoints; |
98937d93 | 88 | fIsOwner = kFALSE; |
98937d93 | 89 | |
90 | return *this; | |
91 | } | |
92 | ||
93 | //_____________________________________________________________________________ | |
94 | AliTrackFitter::~AliTrackFitter() | |
95 | { | |
96 | if (fIsOwner) | |
97 | delete fPoints; | |
98 | delete fCov; | |
99 | } | |
100 | ||
101 | //_____________________________________________________________________________ | |
102 | void AliTrackFitter::Reset() | |
103 | { | |
104 | for (Int_t i=0;i<6;i++) fParams[i] = 0; | |
105 | delete fCov; | |
106 | fCov = new TMatrixDSym(6); | |
46ae650f | 107 | fPVolId = fPTrack = 0; |
108 | fChi2 = 0; | |
109 | fNdf = 0; | |
98937d93 | 110 | } |
111 | ||
112 | void AliTrackFitter::SetTrackPointArray(AliTrackPointArray *array, Bool_t owner) | |
113 | { | |
114 | // Load space points from array | |
115 | // By default we don't copy them but | |
116 | // just put the pointers to them | |
7b1ba5da | 117 | if (!array) return; |
118 | ||
98937d93 | 119 | Reset(); |
120 | ||
121 | if (fIsOwner) delete fPoints; | |
122 | ||
123 | if (owner) { | |
124 | fPoints = new AliTrackPointArray(*array); | |
125 | fIsOwner = kTRUE; | |
126 | } | |
127 | else { | |
128 | fPoints = array; | |
129 | fIsOwner = kFALSE; | |
130 | } | |
131 | } | |
cc345ce3 | 132 | |
133 | Bool_t AliTrackFitter::FindVolId(const TArrayI *array, UShort_t volid) const | |
134 | { | |
135 | // The method is used to check whenever | |
136 | // the volume id (volid) is contained in | |
137 | // a array of integers | |
138 | Int_t nVolIds = array->GetSize(); | |
139 | if (nVolIds == 0) return kFALSE; | |
140 | ||
141 | Bool_t found = kFALSE; | |
142 | for (Int_t iVolId = 0; iVolId < nVolIds; iVolId++) { | |
143 | if ((*array)[iVolId] == volid) { | |
144 | found = kTRUE; | |
145 | break; | |
146 | } | |
147 | } | |
148 | ||
149 | return found; | |
150 | } |