Replacing Header with Id
[u/mrichter/AliRoot.git] / STEER / AliRecPoint.cxx
CommitLineData
2a33668d 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
acd84897 16/* $Id$ */
2a33668d 17
18//-*-C++-*-
19//_________________________________________________________________________
94de3818 20// Base Class for reconstructed space points
21// usually coming from the clusterisation algorithms
22// run on the digits
23//
2a33668d 24//*-- Author : Yves Schutz SUBATECH
25//////////////////////////////////////////////////////////////////////////////
26
2a33668d 27
65fb704d 28// --- ROOT system ---
2a33668d 29
30// --- Standard library ---
31
32// --- AliRoot header files ---
33
34#include "AliRecPoint.h"
94de3818 35#include "AliGeometry.h"
36#include "AliDigitNew.h"
2a33668d 37
38ClassImp(AliRecPoint)
39
40
e2afb3b6 41//_______________________________________________________________________
42AliRecPoint::AliRecPoint():
43 fAmp(0),
44 fGeom(0),
45 fIndexInList(-1), // to be set when the point is already stored
46 fLocPos(0,0,0),
47 fLocPosM(0),
48 fMaxDigit(100),
49 fMulDigit(0),
50 fMaxTrack(5),
51 fMulTrack(0),
52 fDigitsList(0),
53 fTracksList(0)
2a33668d 54{
e2afb3b6 55 //
ef07487e 56 // default ctor
e2afb3b6 57 //
ef07487e 58}
59
e2afb3b6 60//_______________________________________________________________________
61AliRecPoint::AliRecPoint(const char * ):
62 fAmp(0),
63 fGeom(0),
64 fIndexInList(-1), // to be set when the point is already stored
65 fLocPos(0,0,0),
66 fLocPosM(new TMatrix(3,3)),
67 fMaxDigit(100),
68 fMulDigit(0),
69 fMaxTrack(5),
70 fMulTrack(0),
71 fDigitsList(new int[fMaxDigit]),
72 fTracksList(new int[fMaxTrack])
ef07487e 73{
e2afb3b6 74 //
75 // Standard ctor
76 //
2a33668d 77}
78
e2afb3b6 79//_______________________________________________________________________
80AliRecPoint::AliRecPoint(const AliRecPoint& recp):
81 TObject(recp),
82 fAmp(0),
83 fGeom(0),
84 fIndexInList(-1), // to be set when the point is already stored
85 fLocPos(0,0,0),
86 fLocPosM(0),
87 fMaxDigit(100),
88 fMulDigit(0),
89 fMaxTrack(5),
90 fMulTrack(0),
91 fDigitsList(0),
92 fTracksList(0)
aee8290b 93{
94 //
95 // Copy constructor
96 //
97 recp.Copy(*this);
98}
99
e2afb3b6 100//_______________________________________________________________________
2a33668d 101AliRecPoint::~AliRecPoint()
102{
103 // dtor
104
105 delete fLocPosM ;
ef07487e 106 delete [] fDigitsList ;
107 delete [] fTracksList ;
2a33668d 108
109}
110
e2afb3b6 111//_______________________________________________________________________
2a33668d 112void AliRecPoint::AddDigit(AliDigitNew & digit)
113{
114 // adds a digit to the digits list
115 // and accumulates the total amplitude and the multiplicity
116
117
118 if ( fMulDigit >= fMaxDigit ) { // increase the size of the list
119 int * tempo = new ( int[fMaxDigit*=2] ) ;
120
121 Int_t index ;
122
123 for ( index = 0 ; index < fMulDigit ; index++ )
124 tempo[index] = fDigitsList[index] ;
125
126 delete fDigitsList ;
127 fDigitsList = tempo ;
128 }
129
65a2d2b0 130 fDigitsList[fMulDigit] = digit.GetIndexInList() ;
131 fMulDigit++ ;
2a33668d 132 fAmp += digit.GetAmp() ;
133}
134
e2afb3b6 135//_______________________________________________________________________
2a33668d 136// void AliRecPoint::AddTrack(AliTrack & track)
137// {
138// // adds a digit to the digits list
139// // and accumulates the total amplitude and the multiplicity
140
141
142// if ( fMulTrack >= fMaxTrack ) { // increase the size of the list
143// int * tempo = new int[fMaxTrack*=2] ;
144// Int_t index ;
145// for ( index = 0 ; index < fMulTrack ; index++ )
146// tempo[index] = fTracksList[index] ;
147// delete fTracksList ;
148// fTracksList = tempo ;
149// }
150
151// fTracksList[fMulTrack++]= (int) &Track ;
152// }
153
e2afb3b6 154//_______________________________________________________________________
aee8290b 155void AliRecPoint::Copy(AliRecPoint& recp) const
156{
157 //
158 // Copy *this onto pts
159 //
160 // Copy all first
161 if(this != &recp) {
e2afb3b6 162 ((TObject*) this)->Copy(dynamic_cast<TObject&>(recp));
aee8290b 163 recp.fAmp = fAmp;
164 recp.fGeom = fGeom;
165 recp.fIndexInList = fIndexInList;
166 recp.fLocPos = fLocPos;
167 recp.fLocPosM = new TMatrix(*fLocPosM);
168 recp.fMaxDigit = fMaxDigit;
169 recp.fMulDigit = fMulDigit;
170 recp.fMaxTrack = fMaxTrack;
171 recp.fMulTrack = fMulTrack;
172
173 // Duplicate pointed objects
174 recp.fDigitsList = new Int_t[fMulDigit];
175 memcpy(recp.fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t));
176 recp.fTracksList = new Int_t[fMulTrack];
177 memcpy(recp.fTracksList,fTracksList,fMulTrack*sizeof(Int_t));
178 }
179}
180
e2afb3b6 181//_______________________________________________________________________
182void AliRecPoint::GetCovarianceMatrix(TMatrix & mat) const
2a33668d 183{
184 // returns the covariant matrix for the local position
185
186 mat = *fLocPosM ;
187
188}
189
190//____________________________________________________________________________
94de3818 191void AliRecPoint::GetLocalPosition(TVector3 & pos) const
2a33668d 192{
193 // returns the position of the cluster in the local reference system of the sub-detector
194
195 pos = fLocPos;
196
197
198}
199
200//____________________________________________________________________________
94de3818 201void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const
2a33668d 202{
203 // returns the position of the cluster in the global reference system of ALICE
204 // and the uncertainty on this position
205
206
207 fGeom->GetGlobal(this, gpos, gmat) ;
208
209}
210
65a2d2b0 211