]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - STEER/AliRecPoint.cxx
The default constructor now creates no objects; destructor corrected (thanks to R...
[u/mrichter/AliRoot.git] / STEER / AliRecPoint.cxx
... / ...
CommitLineData
1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
17$Log$
18Revision 1.8 2001/10/21 18:38:43 hristov
19Several pointers were set to zero in the default constructors to avoid memory management problems
20
21Revision 1.7 2000/11/30 07:12:49 alibrary
22Introducing new Rndm and QA classes
23
24Revision 1.6 2000/10/02 21:28:14 fca
25Removal of useless dependecies via forward declarations
26
27Revision 1.5 2000/07/11 18:24:59 fca
28Coding convention corrections + few minor bug fixes
29
30Revision 1.4 2000/05/16 08:30:02 fca
31Using automatic streamer for c arrays
32
33Revision 1.3 2000/03/20 14:22:25 fca
34New version to support new PHOS code
35
36Revision 1.2 2000/02/15 09:43:54 fca
37Corrections
38- a bug in the streamer (wrong size of the arrays)
39- replace Read/WriteArray by Read/WriteFastArray (suggestion R.Brun)
40
41Revision 1.1 1999/12/17 09:01:14 fca
42Y.Schutz new classes for reconstruction
43
44*/
45
46//-*-C++-*-
47//_________________________________________________________________________
48// Base Class for reconstructed space points
49// usually coming from the clusterisation algorithms
50// run on the digits
51//
52//*-- Author : Yves Schutz SUBATECH
53//////////////////////////////////////////////////////////////////////////////
54
55
56// --- ROOT system ---
57
58// --- Standard library ---
59
60// --- AliRoot header files ---
61
62#include "AliRecPoint.h"
63#include "AliGeometry.h"
64#include "AliDigitNew.h"
65
66ClassImp(AliRecPoint)
67
68
69//____________________________________________________________________________
70AliRecPoint::AliRecPoint()
71{
72 // default ctor
73 fGeom = 0;
74 fAmp = 0.0 ;
75
76 fLocPos.SetXYZ(0., 0., 0.) ;
77 fLocPosM = 0 ;
78 fMaxDigit = 100 ;
79 fMulDigit = 0 ;
80 fDigitsList = 0 ;
81 fMaxTrack = 5 ;
82 fMulTrack = 0 ;
83 fTracksList = 0 ;
84 fIndexInList = -1 ; // to be set when the point is already stored
85}
86
87//____________________________________________________________________________
88AliRecPoint::AliRecPoint(const char * opt)
89{
90 // ctor
91 fGeom = 0;
92 fAmp = 0.0 ;
93
94 fLocPos.SetXYZ(0., 0., 0.) ;
95 fLocPosM = new TMatrix(3,3) ;
96 fMaxDigit = 100 ;
97 fMulDigit = 0 ;
98 fDigitsList = new int[fMaxDigit];
99 fMaxTrack = 5 ;
100 fMulTrack = 0 ;
101 fTracksList = new int[fMaxTrack]; ;
102 fIndexInList = -1 ; // to be set when the point is already stored
103}
104
105//____________________________________________________________________________
106AliRecPoint::AliRecPoint(const AliRecPoint& recp)
107{
108 //
109 // Copy constructor
110 //
111 recp.Copy(*this);
112}
113
114//____________________________________________________________________________
115AliRecPoint::~AliRecPoint()
116{
117 // dtor
118
119 delete fLocPosM ;
120 delete [] fDigitsList ;
121 delete [] fTracksList ;
122
123}
124
125//____________________________________________________________________________
126void AliRecPoint::AddDigit(AliDigitNew & digit)
127{
128 // adds a digit to the digits list
129 // and accumulates the total amplitude and the multiplicity
130
131
132 if ( fMulDigit >= fMaxDigit ) { // increase the size of the list
133 int * tempo = new ( int[fMaxDigit*=2] ) ;
134
135 Int_t index ;
136
137 for ( index = 0 ; index < fMulDigit ; index++ )
138 tempo[index] = fDigitsList[index] ;
139
140 delete fDigitsList ;
141 fDigitsList = tempo ;
142 }
143
144 fDigitsList[fMulDigit] = digit.GetIndexInList() ;
145 fMulDigit++ ;
146 fAmp += digit.GetAmp() ;
147}
148
149//____________________________________________________________________________
150// void AliRecPoint::AddTrack(AliTrack & track)
151// {
152// // adds a digit to the digits list
153// // and accumulates the total amplitude and the multiplicity
154
155
156// if ( fMulTrack >= fMaxTrack ) { // increase the size of the list
157// int * tempo = new int[fMaxTrack*=2] ;
158// Int_t index ;
159// for ( index = 0 ; index < fMulTrack ; index++ )
160// tempo[index] = fTracksList[index] ;
161// delete fTracksList ;
162// fTracksList = tempo ;
163// }
164
165// fTracksList[fMulTrack++]= (int) &Track ;
166// }
167
168//____________________________________________________________________________
169void AliRecPoint::Copy(AliRecPoint& recp) const
170{
171 //
172 // Copy *this onto pts
173 //
174 // Copy all first
175 if(this != &recp) {
176 ((TObject*) this)->Copy((TObject&)recp);
177 recp.fAmp = fAmp;
178 recp.fGeom = fGeom;
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;
186
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));
192 }
193}
194
195//____________________________________________________________________________
196void AliRecPoint::GetCovarianceMatrix(TMatrix & mat)
197{
198 // returns the covariant matrix for the local position
199
200 mat = *fLocPosM ;
201
202}
203
204//____________________________________________________________________________
205void AliRecPoint::GetLocalPosition(TVector3 & pos) const
206{
207 // returns the position of the cluster in the local reference system of the sub-detector
208
209 pos = fLocPos;
210
211
212}
213
214//____________________________________________________________________________
215AliRecPoint & AliRecPoint::operator= (const AliRecPoint &recp)
216{
217 recp.Copy(*this);
218 return (*this);
219}
220
221
222//____________________________________________________________________________
223void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const
224{
225 // returns the position of the cluster in the global reference system of ALICE
226 // and the uncertainty on this position
227
228
229 fGeom->GetGlobal(this, gpos, gmat) ;
230
231}
232
233