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 "AliTrackPointArray.h"
27 ClassImp(AliTrackResiduals)
29 //_____________________________________________________________________________
30 AliTrackResiduals::AliTrackResiduals():
35 // Default constructor
37 fVolArray = fTrackArray = 0x0;
40 //_____________________________________________________________________________
41 AliTrackResiduals::AliTrackResiduals(Int_t ntracks, AliAlignObj *alignobj):
49 fVolArray = new AliTrackPointArray*[ntracks];
50 fTrackArray = new AliTrackPointArray*[ntracks];
51 for (Int_t itrack = 0; itrack < ntracks; itrack++)
52 fVolArray[itrack] = fTrackArray[itrack] = 0x0;
56 //_____________________________________________________________________________
57 AliTrackResiduals::AliTrackResiduals(const AliTrackResiduals &res):
61 fAlignObj(res.fAlignObj),
65 // By default the created copy owns the track point arrays
67 fVolArray = new AliTrackPointArray*[fN];
68 fTrackArray = new AliTrackPointArray*[fN];
69 for (Int_t itrack = 0; itrack < fN; itrack++)
71 if (res.fVolArray[itrack])
72 fVolArray[itrack] = new AliTrackPointArray(*res.fVolArray[itrack]);
75 if (res.fTrackArray[itrack])
76 fTrackArray[itrack] = new AliTrackPointArray(*res.fTrackArray[itrack]);
83 //_____________________________________________________________________________
84 AliTrackResiduals &AliTrackResiduals::operator =(const AliTrackResiduals& res)
86 // assignment operator
87 // Does not copy the track point arrays
88 if(this==&res) return *this;
89 ((TObject *)this)->operator=(res);
94 fAlignObj = res.fAlignObj;
96 fVolArray = res.fVolArray;
97 fTrackArray = res.fTrackArray;
102 //_____________________________________________________________________________
103 AliTrackResiduals::~AliTrackResiduals()
106 DeleteTrackPointArrays();
109 //_____________________________________________________________________________
110 void AliTrackResiduals::SetNTracks(Int_t ntracks)
112 // Set new size for the track point arrays.
113 // Delete the old arrays and allocate the
115 DeleteTrackPointArrays();
122 fVolArray = new AliTrackPointArray*[ntracks];
123 fTrackArray = new AliTrackPointArray*[ntracks];
124 for (Int_t itrack = 0; itrack < ntracks; itrack++)
125 fVolArray[itrack] = fTrackArray[itrack] = 0x0;
129 //_____________________________________________________________________________
130 Bool_t AliTrackResiduals::AddTrackPointArrays(AliTrackPointArray *volarray, AliTrackPointArray *trackarray)
132 // Adds pair of track space point and
133 // track extrapolation point arrays
134 if (!fVolArray || !fTrackArray) return kFALSE;
136 if (fLast >= fN) return kFALSE;
138 fVolArray[fLast] = volarray;
139 fTrackArray[fLast] = trackarray;
145 //_____________________________________________________________________________
146 Bool_t AliTrackResiduals::GetTrackPointArrays(Int_t i, AliTrackPointArray* &volarray, AliTrackPointArray* &trackarray) const
148 // Provide an access to a pair of track point arrays
151 volarray = trackarray = 0x0;
155 volarray = fVolArray[i];
156 trackarray = fTrackArray[i];
161 //_____________________________________________________________________________
162 void AliTrackResiduals::DeleteTrackPointArrays()
164 // Deletes the track point arrays only in case
165 // the object is their owner.
166 // Called by the destructor and SetNTracks methods.
168 for (Int_t itrack = 0; itrack < fLast; itrack++)
170 delete fVolArray[itrack];
171 delete fTrackArray[itrack];
174 delete [] fTrackArray;