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