1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //-----------------------------------------------------------------
17 // Implementation of the base class for track residuals
20 //-----------------------------------------------------------------
22 #include "AliTrackResiduals.h"
24 #include "AliAlignObj.h"
25 #include "AliAlignObjParams.h"
26 #include "AliTrackPointArray.h"
28 ClassImp(AliTrackResiduals)
30 //_____________________________________________________________________________
31 AliTrackResiduals::AliTrackResiduals():
42 // Default constructor
43 for (Int_t ipar=0; ipar<6; ipar++){
44 fBFixed[ipar] = kFALSE;
49 //_____________________________________________________________________________
50 AliTrackResiduals::AliTrackResiduals(Int_t ntracks):
63 fVolArray = new AliTrackPointArray*[ntracks];
64 fTrackArray = new AliTrackPointArray*[ntracks];
65 for (Int_t itrack = 0; itrack < ntracks; itrack++)
66 fVolArray[itrack] = fTrackArray[itrack] = 0x0;
68 for (Int_t ipar=0; ipar<6; ipar++){
69 fBFixed[ipar] = kFALSE;
74 //_____________________________________________________________________________
75 AliTrackResiduals::AliTrackResiduals(const AliTrackResiduals &res):
84 fMinNPoints(res.fMinNPoints),
88 // By default the created copy owns the track point arrays
90 fAlignObj = (AliAlignObj *)res.fAlignObj->Clone();
93 fVolArray = new AliTrackPointArray*[fN];
94 fTrackArray = new AliTrackPointArray*[fN];
95 for (Int_t itrack = 0; itrack < fN; itrack++)
97 if (res.fVolArray[itrack])
98 fVolArray[itrack] = new AliTrackPointArray(*res.fVolArray[itrack]);
101 if (res.fTrackArray[itrack])
102 fTrackArray[itrack] = new AliTrackPointArray(*res.fTrackArray[itrack]);
107 for(Int_t i=0;i<6;i++) {
108 fBFixed[i]=res.fBFixed[i];
109 fFixed[i]=res.fFixed[i];
113 //_____________________________________________________________________________
114 AliTrackResiduals &AliTrackResiduals::operator =(const AliTrackResiduals& res)
116 // assignment operator
117 // Does not copy the track point arrays
118 if(this==&res) return *this;
119 ((TObject *)this)->operator=(res);
125 fMinNPoints = res.fMinNPoints;
127 fAlignObj = res.fAlignObj;
129 fVolArray = res.fVolArray;
130 fTrackArray = res.fTrackArray;
132 for(Int_t i=0;i<6;i++) {
133 fBFixed[i]=res.fBFixed[i];
134 fFixed[i]=res.fFixed[i];
140 //_____________________________________________________________________________
141 AliTrackResiduals::~AliTrackResiduals()
144 if (fAlignObj) delete fAlignObj;
145 DeleteTrackPointArrays();
148 //_____________________________________________________________________________
149 void AliTrackResiduals::SetNTracks(Int_t ntracks)
151 // Set new size for the track point arrays.
152 // Delete the old arrays and allocate the
154 DeleteTrackPointArrays();
163 fVolArray = new AliTrackPointArray*[ntracks];
164 fTrackArray = new AliTrackPointArray*[ntracks];
165 for (Int_t itrack = 0; itrack < ntracks; itrack++)
166 fVolArray[itrack] = fTrackArray[itrack] = 0x0;
170 //_____________________________________________________________________________
171 Bool_t AliTrackResiduals::AddTrackPointArrays(AliTrackPointArray *volarray, AliTrackPointArray *trackarray)
173 // Adds pair of track space point and
174 // track extrapolation point arrays
175 if (!fVolArray || !fTrackArray) return kFALSE;
177 if (!volarray || !trackarray) return kFALSE;
179 if (volarray->GetNPoints() < fMinNPoints) return kFALSE;
181 if (fLast >= fN) return kFALSE;
183 fVolArray[fLast] = volarray;
184 fTrackArray[fLast] = trackarray;
190 //_____________________________________________________________________________
191 void AliTrackResiduals::InitAlignObj()
193 // Create the alignment object
195 if (fAlignObj) delete fAlignObj;
196 fAlignObj = new AliAlignObjParams;
200 //_____________________________________________________________________________
201 Bool_t AliTrackResiduals::GetTrackPointArrays(Int_t i, AliTrackPointArray* &volarray, AliTrackPointArray* &trackarray) const
203 // Provide an access to a pair of track point arrays
206 volarray = trackarray = 0x0;
210 volarray = fVolArray[i];
211 trackarray = fTrackArray[i];
216 //_____________________________________________________________________________
217 void AliTrackResiduals::DeleteTrackPointArrays()
219 // Deletes the track point arrays only in case
220 // the object is their owner.
221 // Called by the destructor and SetNTracks methods.
223 for (Int_t itrack = 0; itrack < fLast; itrack++)
225 delete fVolArray[itrack];
226 delete fTrackArray[itrack];
229 delete [] fTrackArray;