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 **************************************************************************/
18 Revision 1.9 2001/12/05 14:36:47 hristov
19 The default constructor now creates no objects; destructor corrected (thanks to R.Brun).
21 Revision 1.8 2001/10/21 18:38:43 hristov
22 Several pointers were set to zero in the default constructors to avoid memory management problems
24 Revision 1.7 2000/11/30 07:12:49 alibrary
25 Introducing new Rndm and QA classes
27 Revision 1.6 2000/10/02 21:28:14 fca
28 Removal of useless dependecies via forward declarations
30 Revision 1.5 2000/07/11 18:24:59 fca
31 Coding convention corrections + few minor bug fixes
33 Revision 1.4 2000/05/16 08:30:02 fca
34 Using automatic streamer for c arrays
36 Revision 1.3 2000/03/20 14:22:25 fca
37 New version to support new PHOS code
39 Revision 1.2 2000/02/15 09:43:54 fca
41 - a bug in the streamer (wrong size of the arrays)
42 - replace Read/WriteArray by Read/WriteFastArray (suggestion R.Brun)
44 Revision 1.1 1999/12/17 09:01:14 fca
45 Y.Schutz new classes for reconstruction
50 //_________________________________________________________________________
51 // Base Class for reconstructed space points
52 // usually coming from the clusterisation algorithms
55 //*-- Author : Yves Schutz SUBATECH
56 //////////////////////////////////////////////////////////////////////////////
59 // --- ROOT system ---
61 // --- Standard library ---
63 // --- AliRoot header files ---
65 #include "AliRecPoint.h"
66 #include "AliGeometry.h"
67 #include "AliDigitNew.h"
72 //_______________________________________________________________________
73 AliRecPoint::AliRecPoint():
76 fIndexInList(-1), // to be set when the point is already stored
91 //_______________________________________________________________________
92 AliRecPoint::AliRecPoint(const char * ):
95 fIndexInList(-1), // to be set when the point is already stored
97 fLocPosM(new TMatrix(3,3)),
102 fDigitsList(new int[fMaxDigit]),
103 fTracksList(new int[fMaxTrack])
110 //_______________________________________________________________________
111 AliRecPoint::AliRecPoint(const AliRecPoint& recp):
115 fIndexInList(-1), // to be set when the point is already stored
131 //_______________________________________________________________________
132 AliRecPoint::~AliRecPoint()
137 delete [] fDigitsList ;
138 delete [] fTracksList ;
142 //_______________________________________________________________________
143 void AliRecPoint::AddDigit(AliDigitNew & digit)
145 // adds a digit to the digits list
146 // and accumulates the total amplitude and the multiplicity
149 if ( fMulDigit >= fMaxDigit ) { // increase the size of the list
150 int * tempo = new ( int[fMaxDigit*=2] ) ;
154 for ( index = 0 ; index < fMulDigit ; index++ )
155 tempo[index] = fDigitsList[index] ;
158 fDigitsList = tempo ;
161 fDigitsList[fMulDigit] = digit.GetIndexInList() ;
163 fAmp += digit.GetAmp() ;
166 //_______________________________________________________________________
167 // void AliRecPoint::AddTrack(AliTrack & track)
169 // // adds a digit to the digits list
170 // // and accumulates the total amplitude and the multiplicity
173 // if ( fMulTrack >= fMaxTrack ) { // increase the size of the list
174 // int * tempo = new int[fMaxTrack*=2] ;
176 // for ( index = 0 ; index < fMulTrack ; index++ )
177 // tempo[index] = fTracksList[index] ;
178 // delete fTracksList ;
179 // fTracksList = tempo ;
182 // fTracksList[fMulTrack++]= (int) &Track ;
185 //_______________________________________________________________________
186 void AliRecPoint::Copy(AliRecPoint& recp) const
189 // Copy *this onto pts
193 ((TObject*) this)->Copy(dynamic_cast<TObject&>(recp));
196 recp.fIndexInList = fIndexInList;
197 recp.fLocPos = fLocPos;
198 recp.fLocPosM = new TMatrix(*fLocPosM);
199 recp.fMaxDigit = fMaxDigit;
200 recp.fMulDigit = fMulDigit;
201 recp.fMaxTrack = fMaxTrack;
202 recp.fMulTrack = fMulTrack;
204 // Duplicate pointed objects
205 recp.fDigitsList = new Int_t[fMulDigit];
206 memcpy(recp.fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t));
207 recp.fTracksList = new Int_t[fMulTrack];
208 memcpy(recp.fTracksList,fTracksList,fMulTrack*sizeof(Int_t));
212 //_______________________________________________________________________
213 void AliRecPoint::GetCovarianceMatrix(TMatrix & mat) const
215 // returns the covariant matrix for the local position
221 //____________________________________________________________________________
222 void AliRecPoint::GetLocalPosition(TVector3 & pos) const
224 // returns the position of the cluster in the local reference system of the sub-detector
231 //____________________________________________________________________________
232 void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const
234 // returns the position of the cluster in the global reference system of ALICE
235 // and the uncertainty on this position
238 fGeom->GetGlobal(this, gpos, gmat) ;