]>
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 | ||
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 | |
38 | ClassImp(AliRecPoint) | |
39 | ||
40 | ||
e2afb3b6 | 41 | //_______________________________________________________________________ |
42 | AliRecPoint::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) | |
ef07487e | 54 | { |
e2afb3b6 | 55 | // |
ef07487e | 56 | // default ctor |
e2afb3b6 | 57 | // |
ef07487e | 58 | } |
59 | ||
e2afb3b6 | 60 | //_______________________________________________________________________ |
61 | AliRecPoint::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), | |
e8d02863 | 66 | fLocPosM(new TMatrixF(3,3)), |
e2afb3b6 | 67 | fMaxDigit(100), |
68 | fMulDigit(0), | |
69 | fMaxTrack(5), | |
70 | fMulTrack(0), | |
71 | fDigitsList(new int[fMaxDigit]), | |
72 | fTracksList(new int[fMaxTrack]) | |
2a33668d | 73 | { |
e2afb3b6 | 74 | // |
75 | // Standard ctor | |
76 | // | |
2a33668d | 77 | } |
78 | ||
e2afb3b6 | 79 | //_______________________________________________________________________ |
80 | AliRecPoint::AliRecPoint(const AliRecPoint& recp): | |
81 | TObject(recp), | |
4c234df8 | 82 | fAmp(recp.fAmp), |
83 | fGeom(recp.fGeom), | |
e2afb3b6 | 84 | fIndexInList(-1), // to be set when the point is already stored |
4c234df8 | 85 | fLocPos(recp.fLocPos), |
86 | fLocPosM(new TMatrixF(*(recp.fLocPosM))), | |
87 | fMaxDigit(recp.fMaxDigit), | |
88 | fMulDigit(recp.fMulDigit), | |
89 | fMaxTrack(recp.fMaxTrack), | |
90 | fMulTrack(recp.fMulTrack), | |
91 | fDigitsList(new Int_t[fMulDigit]), | |
92 | fTracksList(new Int_t[fMulTrack]) | |
aee8290b | 93 | { |
94 | // | |
95 | // Copy constructor | |
96 | // | |
4c234df8 | 97 | memcpy(fDigitsList,recp.fDigitsList,sizeof(Int_t)*fMulDigit); |
98 | memcpy(fTracksList,recp.fTracksList,sizeof(Int_t)*fMulTrack); | |
aee8290b | 99 | } |
100 | ||
883238b7 | 101 | //_______________________________________________________________________ |
102 | AliRecPoint& AliRecPoint::operator=(const AliRecPoint& recp) | |
103 | { | |
104 | // | |
105 | // Assignement constructor | |
106 | // | |
107 | if(this!=&recp) { | |
108 | TObject::operator=(recp); | |
109 | fAmp=recp.fAmp; | |
110 | fGeom=recp.fGeom; | |
111 | fIndexInList=-1; // to be set when the point is already stored | |
112 | fLocPos=recp.fLocPos; | |
113 | delete fLocPosM; | |
114 | fLocPosM=recp.fLocPosM; | |
115 | fMaxDigit=recp.fMaxDigit; | |
116 | fMulDigit=recp.fMulDigit; | |
117 | fMaxTrack=recp.fMaxTrack; | |
118 | fMulTrack=recp.fMulTrack; | |
119 | delete [] fDigitsList; | |
120 | fDigitsList=new Int_t[fMulDigit]; | |
121 | delete [] fTracksList; | |
122 | fTracksList=new Int_t[fMulTrack]; | |
123 | ||
124 | memcpy(fDigitsList,recp.fDigitsList,sizeof(Int_t)*fMulDigit); | |
125 | memcpy(fTracksList,recp.fTracksList,sizeof(Int_t)*fMulTrack); | |
126 | } | |
127 | return *this; | |
128 | } | |
129 | ||
e2afb3b6 | 130 | //_______________________________________________________________________ |
2a33668d | 131 | AliRecPoint::~AliRecPoint() |
132 | { | |
133 | // dtor | |
134 | ||
135 | delete fLocPosM ; | |
ef07487e | 136 | delete [] fDigitsList ; |
137 | delete [] fTracksList ; | |
2a33668d | 138 | |
139 | } | |
140 | ||
e2afb3b6 | 141 | //_______________________________________________________________________ |
2a33668d | 142 | void AliRecPoint::AddDigit(AliDigitNew & digit) |
143 | { | |
144 | // adds a digit to the digits list | |
145 | // and accumulates the total amplitude and the multiplicity | |
146 | ||
147 | ||
148 | if ( fMulDigit >= fMaxDigit ) { // increase the size of the list | |
6fea183e | 149 | int * tempo = new int[fMaxDigit*2]; |
2a33668d | 150 | |
151 | Int_t index ; | |
152 | ||
153 | for ( index = 0 ; index < fMulDigit ; index++ ) | |
154 | tempo[index] = fDigitsList[index] ; | |
155 | ||
a161fd32 | 156 | delete [] fDigitsList ; |
2a33668d | 157 | fDigitsList = tempo ; |
158 | } | |
159 | ||
65a2d2b0 | 160 | fDigitsList[fMulDigit] = digit.GetIndexInList() ; |
161 | fMulDigit++ ; | |
2a33668d | 162 | fAmp += digit.GetAmp() ; |
163 | } | |
164 | ||
e2afb3b6 | 165 | //_______________________________________________________________________ |
2a33668d | 166 | // void AliRecPoint::AddTrack(AliTrack & track) |
167 | // { | |
168 | // // adds a digit to the digits list | |
169 | // // and accumulates the total amplitude and the multiplicity | |
170 | ||
171 | ||
172 | // if ( fMulTrack >= fMaxTrack ) { // increase the size of the list | |
173 | // int * tempo = new int[fMaxTrack*=2] ; | |
174 | // Int_t index ; | |
175 | // for ( index = 0 ; index < fMulTrack ; index++ ) | |
176 | // tempo[index] = fTracksList[index] ; | |
177 | // delete fTracksList ; | |
178 | // fTracksList = tempo ; | |
179 | // } | |
180 | ||
181 | // fTracksList[fMulTrack++]= (int) &Track ; | |
182 | // } | |
183 | ||
e2afb3b6 | 184 | //_______________________________________________________________________ |
6c4904c2 | 185 | void AliRecPoint::Copy(TObject& recp) const |
aee8290b | 186 | { |
187 | // | |
188 | // Copy *this onto pts | |
189 | // | |
190 | // Copy all first | |
b166d013 | 191 | if((TObject*)this != &recp) { |
6c4904c2 | 192 | ((TObject*) this)->Copy(recp); |
193 | (dynamic_cast<AliRecPoint&>(recp)).fAmp = fAmp; | |
194 | (dynamic_cast<AliRecPoint&>(recp)).fGeom = fGeom; | |
195 | (dynamic_cast<AliRecPoint&>(recp)).fIndexInList = fIndexInList; | |
196 | (dynamic_cast<AliRecPoint&>(recp)).fLocPos = fLocPos; | |
e8d02863 | 197 | (dynamic_cast<AliRecPoint&>(recp)).fLocPosM = new TMatrixF(*fLocPosM); |
6c4904c2 | 198 | (dynamic_cast<AliRecPoint&>(recp)).fMaxDigit = fMaxDigit; |
199 | (dynamic_cast<AliRecPoint&>(recp)).fMulDigit = fMulDigit; | |
200 | (dynamic_cast<AliRecPoint&>(recp)).fMaxTrack = fMaxTrack; | |
201 | (dynamic_cast<AliRecPoint&>(recp)).fMulTrack = fMulTrack; | |
aee8290b | 202 | |
203 | // Duplicate pointed objects | |
6c4904c2 | 204 | (dynamic_cast<AliRecPoint&>(recp)).fDigitsList = new Int_t[fMulDigit]; |
205 | memcpy((dynamic_cast<AliRecPoint&>(recp)).fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t)); | |
206 | (dynamic_cast<AliRecPoint&>(recp)).fTracksList = new Int_t[fMulTrack]; | |
207 | memcpy((dynamic_cast<AliRecPoint&>(recp)).fTracksList,fTracksList,fMulTrack*sizeof(Int_t)); | |
aee8290b | 208 | } |
209 | } | |
210 | ||
e2afb3b6 | 211 | //_______________________________________________________________________ |
e8d02863 | 212 | void AliRecPoint::GetCovarianceMatrix(TMatrixF & mat) const |
2a33668d | 213 | { |
214 | // returns the covariant matrix for the local position | |
215 | ||
216 | mat = *fLocPosM ; | |
217 | ||
218 | } | |
219 | ||
220 | //____________________________________________________________________________ | |
94de3818 | 221 | void AliRecPoint::GetLocalPosition(TVector3 & pos) const |
2a33668d | 222 | { |
223 | // returns the position of the cluster in the local reference system of the sub-detector | |
224 | ||
225 | pos = fLocPos; | |
226 | ||
227 | ||
228 | } | |
229 | ||
230 | //____________________________________________________________________________ | |
e8d02863 | 231 | void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrixF & gmat) const |
2a33668d | 232 | { |
233 | // returns the position of the cluster in the global reference system of ALICE | |
234 | // and the uncertainty on this position | |
235 | ||
236 | ||
237 | fGeom->GetGlobal(this, gpos, gmat) ; | |
238 | ||
239 | } | |
240 | ||
65a2d2b0 | 241 |