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.8 2001/10/21 18:38:43 hristov
19 Several pointers were set to zero in the default constructors to avoid memory management problems
21 Revision 1.7 2000/11/30 07:12:49 alibrary
22 Introducing new Rndm and QA classes
24 Revision 1.6 2000/10/02 21:28:14 fca
25 Removal of useless dependecies via forward declarations
27 Revision 1.5 2000/07/11 18:24:59 fca
28 Coding convention corrections + few minor bug fixes
30 Revision 1.4 2000/05/16 08:30:02 fca
31 Using automatic streamer for c arrays
33 Revision 1.3 2000/03/20 14:22:25 fca
34 New version to support new PHOS code
36 Revision 1.2 2000/02/15 09:43:54 fca
38 - a bug in the streamer (wrong size of the arrays)
39 - replace Read/WriteArray by Read/WriteFastArray (suggestion R.Brun)
41 Revision 1.1 1999/12/17 09:01:14 fca
42 Y.Schutz new classes for reconstruction
47 //_________________________________________________________________________
48 // Base Class for reconstructed space points
49 // usually coming from the clusterisation algorithms
52 //*-- Author : Yves Schutz SUBATECH
53 //////////////////////////////////////////////////////////////////////////////
56 // --- ROOT system ---
58 // --- Standard library ---
60 // --- AliRoot header files ---
62 #include "AliRecPoint.h"
63 #include "AliGeometry.h"
64 #include "AliDigitNew.h"
69 //____________________________________________________________________________
70 AliRecPoint::AliRecPoint()
76 fLocPos.SetXYZ(0., 0., 0.) ;
84 fIndexInList = -1 ; // to be set when the point is already stored
87 //____________________________________________________________________________
88 AliRecPoint::AliRecPoint(const char * opt)
94 fLocPos.SetXYZ(0., 0., 0.) ;
95 fLocPosM = new TMatrix(3,3) ;
98 fDigitsList = new int[fMaxDigit];
101 fTracksList = new int[fMaxTrack]; ;
102 fIndexInList = -1 ; // to be set when the point is already stored
105 //____________________________________________________________________________
106 AliRecPoint::AliRecPoint(const AliRecPoint& recp)
114 //____________________________________________________________________________
115 AliRecPoint::~AliRecPoint()
120 delete [] fDigitsList ;
121 delete [] fTracksList ;
125 //____________________________________________________________________________
126 void AliRecPoint::AddDigit(AliDigitNew & digit)
128 // adds a digit to the digits list
129 // and accumulates the total amplitude and the multiplicity
132 if ( fMulDigit >= fMaxDigit ) { // increase the size of the list
133 int * tempo = new ( int[fMaxDigit*=2] ) ;
137 for ( index = 0 ; index < fMulDigit ; index++ )
138 tempo[index] = fDigitsList[index] ;
141 fDigitsList = tempo ;
144 fDigitsList[fMulDigit] = digit.GetIndexInList() ;
146 fAmp += digit.GetAmp() ;
149 //____________________________________________________________________________
150 // void AliRecPoint::AddTrack(AliTrack & track)
152 // // adds a digit to the digits list
153 // // and accumulates the total amplitude and the multiplicity
156 // if ( fMulTrack >= fMaxTrack ) { // increase the size of the list
157 // int * tempo = new int[fMaxTrack*=2] ;
159 // for ( index = 0 ; index < fMulTrack ; index++ )
160 // tempo[index] = fTracksList[index] ;
161 // delete fTracksList ;
162 // fTracksList = tempo ;
165 // fTracksList[fMulTrack++]= (int) &Track ;
168 //____________________________________________________________________________
169 void AliRecPoint::Copy(AliRecPoint& recp) const
172 // Copy *this onto pts
176 ((TObject*) this)->Copy((TObject&)recp);
179 recp.fIndexInList = fIndexInList;
180 recp.fLocPos = fLocPos;
181 recp.fLocPosM = new TMatrix(*fLocPosM);
182 recp.fMaxDigit = fMaxDigit;
183 recp.fMulDigit = fMulDigit;
184 recp.fMaxTrack = fMaxTrack;
185 recp.fMulTrack = fMulTrack;
187 // Duplicate pointed objects
188 recp.fDigitsList = new Int_t[fMulDigit];
189 memcpy(recp.fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t));
190 recp.fTracksList = new Int_t[fMulTrack];
191 memcpy(recp.fTracksList,fTracksList,fMulTrack*sizeof(Int_t));
195 //____________________________________________________________________________
196 void AliRecPoint::GetCovarianceMatrix(TMatrix & mat)
198 // returns the covariant matrix for the local position
204 //____________________________________________________________________________
205 void AliRecPoint::GetLocalPosition(TVector3 & pos) const
207 // returns the position of the cluster in the local reference system of the sub-detector
214 //____________________________________________________________________________
215 AliRecPoint & AliRecPoint::operator= (const AliRecPoint &recp)
222 //____________________________________________________________________________
223 void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const
225 // returns the position of the cluster in the global reference system of ALICE
226 // and the uncertainty on this position
229 fGeom->GetGlobal(this, gpos, gmat) ;