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