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 // Class AliTrackPointArray //
18 // This class contains the ESD track space-points which are used during //
19 // the alignment procedures. Each space-point consist of 3 coordinates //
20 // (and their errors) and the index of the sub-detector which contains //
21 // the space-point. //
22 // cvetan.cheshkov@cern.ch 3/11/2005 //
23 //////////////////////////////////////////////////////////////////////////////
25 #include "AliTrackPointArray.h"
27 ClassImp(AliTrackPointArray)
29 //______________________________________________________________________________
30 AliTrackPointArray::AliTrackPointArray()
38 //______________________________________________________________________________
39 AliTrackPointArray::AliTrackPointArray(Int_t npoints):
45 fX = new Float_t[npoints];
46 fY = new Float_t[npoints];
47 fZ = new Float_t[npoints];
48 fVolumeID = new UShort_t[npoints];
49 fCov = new Float_t[fSize];
52 //______________________________________________________________________________
53 AliTrackPointArray::AliTrackPointArray(const AliTrackPointArray &array):
58 fNPoints = array.fNPoints;
60 fX = new Float_t[fNPoints];
61 fY = new Float_t[fNPoints];
62 fZ = new Float_t[fNPoints];
63 fVolumeID = new UShort_t[fNPoints];
64 fCov = new Float_t[fSize];
65 memcpy(fX,array.fX,fNPoints*sizeof(Float_t));
66 memcpy(fY,array.fY,fNPoints*sizeof(Float_t));
67 memcpy(fZ,array.fZ,fNPoints*sizeof(Float_t));
68 memcpy(fVolumeID,array.fVolumeID,fNPoints*sizeof(UShort_t));
69 memcpy(fCov,array.fCov,fSize*sizeof(Float_t));
72 //_____________________________________________________________________________
73 AliTrackPointArray &AliTrackPointArray::operator =(const AliTrackPointArray& array)
75 // assignment operator
77 if(this==&array) return *this;
78 ((TObject *)this)->operator=(array);
80 fNPoints = array.fNPoints;
82 fX = new Float_t[fNPoints];
83 fY = new Float_t[fNPoints];
84 fZ = new Float_t[fNPoints];
85 fVolumeID = new UShort_t[fNPoints];
86 fCov = new Float_t[fSize];
87 memcpy(fX,array.fX,fNPoints*sizeof(Float_t));
88 memcpy(fY,array.fY,fNPoints*sizeof(Float_t));
89 memcpy(fZ,array.fZ,fNPoints*sizeof(Float_t));
90 memcpy(fVolumeID,array.fVolumeID,fNPoints*sizeof(UShort_t));
91 memcpy(fCov,array.fCov,fSize*sizeof(Float_t));
96 //______________________________________________________________________________
97 AliTrackPointArray::~AliTrackPointArray()
109 //______________________________________________________________________________
110 Bool_t AliTrackPointArray::AddPoint(Int_t i, const AliTrackPoint *p)
112 // Add a point to the array at position i
114 if (i >= fNPoints) return kFALSE;
118 fVolumeID[i] = p->GetVolumeID();
119 memcpy(&fCov[6*i],p->GetCov(),6*sizeof(Float_t));
123 //______________________________________________________________________________
124 Bool_t AliTrackPointArray::GetPoint(AliTrackPoint &p, Int_t i) const
126 // Get the point at position i
128 if (i >= fNPoints) return kFALSE;
129 p.SetXYZ(fX[i],fY[i],fZ[i],&fCov[6*i]);
130 p.SetVolumeID(fVolumeID[i]);
134 //______________________________________________________________________________
135 Bool_t AliTrackPointArray::HasVolumeID(UShort_t volid) const
137 // This method checks if the array
138 // has at least one hit in the detector
139 // volume defined by volid
140 Bool_t check = kFALSE;
141 for (Int_t ipoint = 0; ipoint < fNPoints; ipoint++)
142 if (fVolumeID[ipoint] == volid) check = kTRUE;
147 ClassImp(AliTrackPoint)
149 //______________________________________________________________________________
150 AliTrackPoint::AliTrackPoint()
152 // Default constructor
156 memset(fCov,0,6*sizeof(Float_t));
160 //______________________________________________________________________________
161 AliTrackPoint::AliTrackPoint(Float_t x, Float_t y, Float_t z, const Float_t *cov, UShort_t volid)
169 //______________________________________________________________________________
170 AliTrackPoint::AliTrackPoint(const Float_t *xyz, const Float_t *cov, UShort_t volid)
174 SetXYZ(xyz[0],xyz[1],xyz[2],cov);
178 //______________________________________________________________________________
179 AliTrackPoint::AliTrackPoint(const AliTrackPoint &p):
184 SetXYZ(p.fX,p.fY,p.fZ,&(p.fCov[0]));
185 SetVolumeID(p.fVolumeID);
188 //_____________________________________________________________________________
189 AliTrackPoint &AliTrackPoint::operator =(const AliTrackPoint& p)
191 // assignment operator
193 if(this==&p) return *this;
194 ((TObject *)this)->operator=(p);
196 SetXYZ(p.fX,p.fY,p.fZ,&(p.fCov[0]));
197 SetVolumeID(p.fVolumeID);
202 //______________________________________________________________________________
203 void AliTrackPoint::SetXYZ(Float_t x, Float_t y, Float_t z, const Float_t *cov)
205 // Set XYZ coordinates and their cov matrix
211 memcpy(fCov,cov,6*sizeof(Float_t));
214 //______________________________________________________________________________
215 void AliTrackPoint::SetXYZ(const Float_t *xyz, const Float_t *cov)
217 // Set XYZ coordinates and their cov matrix
219 SetXYZ(xyz[0],xyz[1],xyz[2],cov);
222 //______________________________________________________________________________
223 void AliTrackPoint::GetXYZ(Float_t *xyz, Float_t *cov) const
229 memcpy(cov,fCov,6*sizeof(Float_t));