New version of alignment framework.
[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>
23
24#include "AliTrackFitter.h"
25#include "AliTrackPointArray.h"
26
27ClassImp(AliTrackFitter)
28
29//_____________________________________________________________________________
30AliTrackFitter::AliTrackFitter()
31{
32 // default constructor
33 //
34 for (Int_t i=0;i<6;i++) fParams[i] = 0;
35 fCov = 0;
36 fPoints = 0;
46ae650f 37 fPVolId = fPTrack = 0;
38 fChi2 = 0;
39 fNdf = 0;
98937d93 40 fIsOwner = kFALSE;
41}
42
43//_____________________________________________________________________________
44AliTrackFitter::AliTrackFitter(AliTrackPointArray *array, Bool_t owner)
45{
46 // constructor from space points array
47 //
48 for (Int_t i=0;i<6;i++) fParams[i] = 0;
49 fCov = new TMatrixDSym(6);
46ae650f 50 fPVolId = fPTrack = 0;
51 fChi2 = 0;
52 fNdf = 0;
98937d93 53 fIsOwner = kFALSE;
54 SetTrackPointArray(array,owner);
55}
56
57//_____________________________________________________________________________
58AliTrackFitter::AliTrackFitter(const AliTrackFitter &fitter):
59 TObject(fitter)
60{
61 // Copy constructor
62 //
46ae650f 63 SetTrackPointArray(fitter.fPoints,fitter.fIsOwner);
98937d93 64 for (Int_t i=0;i<6;i++) fParams[i] = fitter.fParams[i];
65 fCov = new TMatrixDSym(*fitter.fCov);
46ae650f 66 fChi2 = fitter.fChi2;
67 fNdf = fitter.fNdf;
98937d93 68 fIsOwner = kFALSE;
98937d93 69}
70
71//_____________________________________________________________________________
72AliTrackFitter &AliTrackFitter::operator =(const AliTrackFitter& fitter)
73{
74 // assignment operator
75 //
76 if(this==&fitter) return *this;
77
46ae650f 78 SetTrackPointArray(fitter.fPoints);
98937d93 79 for (Int_t i=0;i<6;i++) fParams[i] = fitter.fParams[i];
80 fCov = new TMatrixDSym(*fitter.fCov);
46ae650f 81 fChi2 = fitter.fChi2;
82 fNdf = fitter.fNdf;
98937d93 83 fIsOwner = kFALSE;
98937d93 84
85 return *this;
86}
87
88//_____________________________________________________________________________
89AliTrackFitter::~AliTrackFitter()
90{
91 if (fIsOwner)
92 delete fPoints;
93 delete fCov;
94}
95
96//_____________________________________________________________________________
97void AliTrackFitter::Reset()
98{
99 for (Int_t i=0;i<6;i++) fParams[i] = 0;
100 delete fCov;
101 fCov = new TMatrixDSym(6);
46ae650f 102 fPVolId = fPTrack = 0;
103 fChi2 = 0;
104 fNdf = 0;
98937d93 105}
106
107void AliTrackFitter::SetTrackPointArray(AliTrackPointArray *array, Bool_t owner)
108{
109 // Load space points from array
110 // By default we don't copy them but
111 // just put the pointers to them
112 Reset();
113
114 if (fIsOwner) delete fPoints;
115
116 if (owner) {
117 fPoints = new AliTrackPointArray(*array);
118 fIsOwner = kTRUE;
119 }
120 else {
121 fPoints = array;
122 fIsOwner = kFALSE;
123 }
124}