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