]>
Commit | Line | Data |
---|---|---|
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$ | |
ef07487e | 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 | |
20 | ||
2685bf00 | 21 | Revision 1.7 2000/11/30 07:12:49 alibrary |
22 | Introducing new Rndm and QA classes | |
23 | ||
65fb704d | 24 | Revision 1.6 2000/10/02 21:28:14 fca |
25 | Removal of useless dependecies via forward declarations | |
26 | ||
94de3818 | 27 | Revision 1.5 2000/07/11 18:24:59 fca |
28 | Coding convention corrections + few minor bug fixes | |
29 | ||
aee8290b | 30 | Revision 1.4 2000/05/16 08:30:02 fca |
31 | Using automatic streamer for c arrays | |
32 | ||
712d6528 | 33 | Revision 1.3 2000/03/20 14:22:25 fca |
34 | New version to support new PHOS code | |
35 | ||
65a2d2b0 | 36 | Revision 1.2 2000/02/15 09:43:54 fca |
37 | Corrections | |
38 | - a bug in the streamer (wrong size of the arrays) | |
39 | - replace Read/WriteArray by Read/WriteFastArray (suggestion R.Brun) | |
40 | ||
dad18d4d | 41 | Revision 1.1 1999/12/17 09:01:14 fca |
42 | Y.Schutz new classes for reconstruction | |
43 | ||
2a33668d | 44 | */ |
45 | ||
46 | //-*-C++-*- | |
47 | //_________________________________________________________________________ | |
94de3818 | 48 | // Base Class for reconstructed space points |
49 | // usually coming from the clusterisation algorithms | |
50 | // run on the digits | |
51 | // | |
2a33668d | 52 | //*-- Author : Yves Schutz SUBATECH |
53 | ////////////////////////////////////////////////////////////////////////////// | |
54 | ||
2a33668d | 55 | |
65fb704d | 56 | // --- ROOT system --- |
2a33668d | 57 | |
58 | // --- Standard library --- | |
59 | ||
60 | // --- AliRoot header files --- | |
61 | ||
62 | #include "AliRecPoint.h" | |
94de3818 | 63 | #include "AliGeometry.h" |
64 | #include "AliDigitNew.h" | |
2a33668d | 65 | |
66 | ClassImp(AliRecPoint) | |
67 | ||
68 | ||
69 | //____________________________________________________________________________ | |
70 | AliRecPoint::AliRecPoint() | |
ef07487e | 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 | //____________________________________________________________________________ | |
88 | AliRecPoint::AliRecPoint(const char * opt) | |
2a33668d | 89 | { |
90 | // ctor | |
2685bf00 | 91 | fGeom = 0; |
2a33668d | 92 | fAmp = 0.0 ; |
93 | ||
94 | fLocPos.SetXYZ(0., 0., 0.) ; | |
65a2d2b0 | 95 | fLocPosM = new TMatrix(3,3) ; |
96 | fMaxDigit = 100 ; | |
97 | fMulDigit = 0 ; | |
ef07487e | 98 | fDigitsList = new int[fMaxDigit]; |
65a2d2b0 | 99 | fMaxTrack = 5 ; |
100 | fMulTrack = 0 ; | |
101 | fTracksList = new int[fMaxTrack]; ; | |
102 | fIndexInList = -1 ; // to be set when the point is already stored | |
2a33668d | 103 | } |
104 | ||
aee8290b | 105 | //____________________________________________________________________________ |
106 | AliRecPoint::AliRecPoint(const AliRecPoint& recp) | |
107 | { | |
108 | // | |
109 | // Copy constructor | |
110 | // | |
111 | recp.Copy(*this); | |
112 | } | |
113 | ||
2a33668d | 114 | //____________________________________________________________________________ |
115 | AliRecPoint::~AliRecPoint() | |
116 | { | |
117 | // dtor | |
118 | ||
119 | delete fLocPosM ; | |
ef07487e | 120 | delete [] fDigitsList ; |
121 | delete [] fTracksList ; | |
2a33668d | 122 | |
123 | } | |
124 | ||
125 | //____________________________________________________________________________ | |
126 | void 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 | ||
65a2d2b0 | 144 | fDigitsList[fMulDigit] = digit.GetIndexInList() ; |
145 | fMulDigit++ ; | |
2a33668d | 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 | ||
aee8290b | 168 | //____________________________________________________________________________ |
169 | void 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 | ||
2a33668d | 195 | //____________________________________________________________________________ |
196 | void AliRecPoint::GetCovarianceMatrix(TMatrix & mat) | |
197 | { | |
198 | // returns the covariant matrix for the local position | |
199 | ||
200 | mat = *fLocPosM ; | |
201 | ||
202 | } | |
203 | ||
204 | //____________________________________________________________________________ | |
94de3818 | 205 | void AliRecPoint::GetLocalPosition(TVector3 & pos) const |
2a33668d | 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 | ||
aee8290b | 214 | //____________________________________________________________________________ |
215 | AliRecPoint & AliRecPoint::operator= (const AliRecPoint &recp) | |
216 | { | |
217 | recp.Copy(*this); | |
218 | return (*this); | |
219 | } | |
220 | ||
221 | ||
2a33668d | 222 | //____________________________________________________________________________ |
94de3818 | 223 | void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const |
2a33668d | 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 | ||
65a2d2b0 | 233 |