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 **************************************************************************/
19 //_________________________________________________________________________
20 // Base Class for reconstructed space points
21 // usually coming from the clusterisation algorithms
24 //*-- Author : Yves Schutz SUBATECH
25 //////////////////////////////////////////////////////////////////////////////
28 // --- ROOT system ---
30 // --- Standard library ---
32 // --- AliRoot header files ---
34 #include "AliRecPoint.h"
35 #include "AliGeometry.h"
36 #include "AliDigitNew.h"
41 //_______________________________________________________________________
42 AliRecPoint::AliRecPoint():
45 fIndexInList(-1), // to be set when the point is already stored
60 //_______________________________________________________________________
61 AliRecPoint::AliRecPoint(const char * ):
64 fIndexInList(-1), // to be set when the point is already stored
66 fLocPosM(new TMatrixF(3,3)),
71 fDigitsList(new int[fMaxDigit]),
72 fTracksList(new int[fMaxTrack])
79 //_______________________________________________________________________
80 AliRecPoint::AliRecPoint(const AliRecPoint& recp):
84 fIndexInList(-1), // to be set when the point is already stored
85 fLocPos(recp.fLocPos),
86 fLocPosM(new TMatrixF(*(recp.fLocPosM))),
87 fMaxDigit(recp.fMaxDigit),
88 fMulDigit(recp.fMulDigit),
89 fMaxTrack(recp.fMaxTrack),
90 fMulTrack(recp.fMulTrack),
91 fDigitsList(new Int_t[fMulDigit]),
92 fTracksList(new Int_t[fMulTrack])
97 memcpy(fDigitsList,recp.fDigitsList,sizeof(Int_t)*fMulDigit);
98 memcpy(fTracksList,recp.fTracksList,sizeof(Int_t)*fMulTrack);
101 //_______________________________________________________________________
102 AliRecPoint& AliRecPoint::operator=(const AliRecPoint& recp)
105 // Assignement constructor
108 TObject::operator=(recp);
111 fIndexInList=-1; // to be set when the point is already stored
112 fLocPos=recp.fLocPos;
114 fLocPosM=recp.fLocPosM;
115 fMaxDigit=recp.fMaxDigit;
116 fMulDigit=recp.fMulDigit;
117 fMaxTrack=recp.fMaxTrack;
118 fMulTrack=recp.fMulTrack;
119 delete [] fDigitsList;
120 fDigitsList=new Int_t[fMulDigit];
121 delete [] fTracksList;
122 fTracksList=new Int_t[fMulTrack];
124 memcpy(fDigitsList,recp.fDigitsList,sizeof(Int_t)*fMulDigit);
125 memcpy(fTracksList,recp.fTracksList,sizeof(Int_t)*fMulTrack);
130 //_______________________________________________________________________
131 AliRecPoint::~AliRecPoint()
136 delete [] fDigitsList ;
137 delete [] fTracksList ;
141 //_______________________________________________________________________
142 void AliRecPoint::AddDigit(AliDigitNew & digit)
144 // adds a digit to the digits list
145 // and accumulates the total amplitude and the multiplicity
148 if ( fMulDigit >= fMaxDigit ) { // increase the size of the list
149 int * tempo = new int[fMaxDigit*2];
153 for ( index = 0 ; index < fMulDigit ; index++ )
154 tempo[index] = fDigitsList[index] ;
156 delete [] fDigitsList ;
157 fDigitsList = tempo ;
160 fDigitsList[fMulDigit] = digit.GetIndexInList() ;
162 fAmp += digit.GetAmp() ;
165 //_______________________________________________________________________
166 // void AliRecPoint::AddTrack(AliTrack & track)
168 // // adds a digit to the digits list
169 // // and accumulates the total amplitude and the multiplicity
172 // if ( fMulTrack >= fMaxTrack ) { // increase the size of the list
173 // int * tempo = new int[fMaxTrack*=2] ;
175 // for ( index = 0 ; index < fMulTrack ; index++ )
176 // tempo[index] = fTracksList[index] ;
177 // delete fTracksList ;
178 // fTracksList = tempo ;
181 // fTracksList[fMulTrack++]= (int) &Track ;
184 //_______________________________________________________________________
185 void AliRecPoint::Copy(TObject& recp) const
188 // Copy *this onto pts
191 if((TObject*)this != &recp) {
192 ((TObject*) this)->Copy(recp);
193 (dynamic_cast<AliRecPoint&>(recp)).fAmp = fAmp;
194 (dynamic_cast<AliRecPoint&>(recp)).fGeom = fGeom;
195 (dynamic_cast<AliRecPoint&>(recp)).fIndexInList = fIndexInList;
196 (dynamic_cast<AliRecPoint&>(recp)).fLocPos = fLocPos;
197 (dynamic_cast<AliRecPoint&>(recp)).fLocPosM = new TMatrixF(*fLocPosM);
198 (dynamic_cast<AliRecPoint&>(recp)).fMaxDigit = fMaxDigit;
199 (dynamic_cast<AliRecPoint&>(recp)).fMulDigit = fMulDigit;
200 (dynamic_cast<AliRecPoint&>(recp)).fMaxTrack = fMaxTrack;
201 (dynamic_cast<AliRecPoint&>(recp)).fMulTrack = fMulTrack;
203 // Duplicate pointed objects
204 (dynamic_cast<AliRecPoint&>(recp)).fDigitsList = new Int_t[fMulDigit];
205 memcpy((dynamic_cast<AliRecPoint&>(recp)).fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t));
206 (dynamic_cast<AliRecPoint&>(recp)).fTracksList = new Int_t[fMulTrack];
207 memcpy((dynamic_cast<AliRecPoint&>(recp)).fTracksList,fTracksList,fMulTrack*sizeof(Int_t));
211 //_______________________________________________________________________
212 void AliRecPoint::GetCovarianceMatrix(TMatrixF & mat) const
214 // returns the covariant matrix for the local position
220 //____________________________________________________________________________
221 void AliRecPoint::GetLocalPosition(TVector3 & pos) const
223 // returns the position of the cluster in the local reference system of the sub-detector
230 //____________________________________________________________________________
231 void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrixF & gmat) const
233 // returns the position of the cluster in the global reference system of ALICE
234 // and the uncertainty on this position
237 fGeom->GetGlobal(this, gpos, gmat) ;