]>
Commit | Line | Data |
---|---|---|
b0f5e3fc | 1 | #include <iostream.h> |
2 | ||
3 | #include "AliITSclusterSSD.h" | |
4 | ||
5 | ClassImp(AliITSclusterSSD) | |
6 | ||
7 | AliITSclusterSSD::AliITSclusterSSD() | |
8 | { | |
9 | // default constructor | |
10 | fSide = true; | |
11 | fDigits = 0; | |
12 | fNDigits = 0; | |
13 | fDigitsIndex = 0; | |
14 | fNCrosses = 0; | |
15 | fTotalSignal = -1; | |
16 | fNTrack = -1; | |
17 | fLeftNeighbour = kFALSE; | |
18 | fRightNeighbour = kFALSE; | |
19 | fCrossedClusterIndexes = new TArrayI(300); | |
20 | fConsumed=kFALSE; | |
21 | ||
22 | } | |
23 | /*************************************************************************/ | |
24 | ||
25 | AliITSclusterSSD::AliITSclusterSSD | |
26 | (Int_t ndigits, Int_t *DigitIndexes, | |
27 | TObjArray *Digits, Bool_t side) | |
28 | { | |
29 | // comment to be written | |
30 | fNDigits = ndigits; | |
31 | fDigits = Digits; | |
32 | fSide = side; | |
33 | fDigitsIndex = new TArrayI(fNDigits,DigitIndexes ); | |
34 | fNCrosses = 0; | |
35 | fCrossedClusterIndexes = new TArrayI(300); | |
36 | fLeftNeighbour = kFALSE; | |
37 | fRightNeighbour = kFALSE; | |
38 | fTotalSignal =-1; | |
39 | fNTrack = -1; | |
40 | fConsumed=kFALSE; | |
41 | } | |
42 | /*************************************************************************/ | |
43 | AliITSclusterSSD::~AliITSclusterSSD() | |
44 | { | |
45 | // destructor | |
46 | delete fDigitsIndex; | |
47 | delete fCrossedClusterIndexes; | |
48 | } | |
49 | ||
50 | /*************************************************************************/ | |
51 | AliITSclusterSSD::AliITSclusterSSD(const AliITSclusterSSD &OneSCluster) | |
52 | { | |
53 | // copy constructor | |
54 | if (this == &OneSCluster) return; | |
55 | fNDigits = OneSCluster.fNDigits; | |
56 | fSide=OneSCluster.fSide; | |
57 | fDigits=OneSCluster.fDigits; | |
58 | fDigitsIndex = new TArrayI(fNDigits); | |
59 | fLeftNeighbour = OneSCluster.fLeftNeighbour; | |
60 | fRightNeighbour = OneSCluster.fRightNeighbour; | |
61 | fTotalSignal =-1; | |
62 | fNTrack = -1; | |
63 | fNCrosses = OneSCluster.fNCrosses; | |
64 | fConsumed = OneSCluster.fConsumed; | |
65 | Int_t i; | |
66 | for(i = 0; i< fNCrosses ; i++) | |
67 | { | |
68 | fCrossedClusterIndexes[i] = OneSCluster.fCrossedClusterIndexes[i]; | |
69 | } | |
70 | for(i = 0; i< fNDigits ; i++) | |
71 | { | |
72 | fDigitsIndex[i]=OneSCluster.fDigitsIndex[i]; | |
73 | } | |
74 | return; | |
75 | } | |
76 | ||
77 | /*************************************************************************/ | |
78 | AliITSclusterSSD& AliITSclusterSSD::operator=(const AliITSclusterSSD & OneSCluster) | |
79 | { | |
80 | // assignment operator | |
81 | if (this == &OneSCluster) return *this; | |
82 | fNDigits = OneSCluster.fNDigits; | |
83 | fSide=OneSCluster.fSide; | |
84 | fDigits=OneSCluster.fDigits; | |
85 | fDigitsIndex = new TArrayI(fNDigits); | |
86 | fLeftNeighbour = OneSCluster.fLeftNeighbour; | |
87 | fRightNeighbour = OneSCluster.fRightNeighbour; | |
88 | fTotalSignal =-1; | |
89 | fNTrack = -1; | |
90 | fNCrosses = OneSCluster.fNCrosses; | |
91 | fConsumed = OneSCluster.fConsumed; | |
92 | Int_t i; | |
93 | for(i = 0; i< fNCrosses ; i++) | |
94 | { | |
95 | fCrossedClusterIndexes[i] = OneSCluster.fCrossedClusterIndexes[i]; | |
96 | } | |
97 | for(i = 0; i< fNDigits ; i++) | |
98 | { | |
99 | fDigitsIndex[i]=OneSCluster.fDigitsIndex[i]; | |
100 | } | |
101 | return *this; | |
102 | } | |
103 | ||
104 | /*************************************************************************/ | |
105 | Int_t AliITSclusterSSD::SplitCluster(Int_t where, Int_t *outdigits) | |
106 | { | |
107 | //This methods generate data necessery to make new object of this class | |
108 | //I choosen this way, because methods TClonesArray::Add* dont work | |
109 | //so I have to use constraction: new (a[i]) Creator(params...); | |
110 | //where 'a' is a TClonesArray | |
111 | //This method generate params - see AliITSmoduleSSD::SplitCluster; | |
112 | ||
113 | ||
114 | Int_t tmp = fNDigits; | |
115 | Int_t ind = 0; | |
116 | outdigits[ind++]=(*fDigitsIndex)[where]; | |
117 | //coping border strip (it is shared by this two clusters) | |
118 | Int_t i; | |
119 | for(i = (where+1); i < tmp; i++) | |
120 | { | |
121 | outdigits[ind++]=(*fDigitsIndex)[i]; //"moving" strips from this to the new one | |
122 | (*fDigitsIndex)[i]=-1; | |
123 | fNDigits--; //deleting strips from this cluster | |
124 | } | |
125 | return ind; | |
126 | } | |
127 | ||
128 | /*******************************************************************/ | |
129 | Int_t AliITSclusterSSD::GetDigitStripNo(Int_t digit) | |
130 | { | |
131 | // comment to be written | |
132 | if (digit<0) return -1; | |
133 | return (digit>(fNDigits-1))?-1 : | |
134 | ((AliITSdigitSSD*)((*fDigits)[(*fDigitsIndex)[digit]]))->GetStripNumber(); | |
135 | } | |
136 | /************************************************************/ | |
137 | Int_t AliITSclusterSSD::GetDigitSignal(Int_t digit) | |
138 | { | |
139 | Int_t index,signal; | |
140 | // returns digit signal | |
141 | if (digit<0||digit>=fNDigits) return -1; | |
142 | index = (*fDigitsIndex)[digit]; | |
143 | signal = ((AliITSdigitSSD*)((*fDigits)[index]))->GetSignal(); | |
144 | /* | |
145 | if(signal>1.e5) printf("GetDigitSignal: digit %d index %d signal %d\n", | |
146 | digit,index, signal); | |
147 | */ | |
148 | return signal; | |
149 | } | |
150 | ||
151 | /***********************************************************/ | |
152 | void AliITSclusterSSD::AddCross(Int_t clIndex) | |
153 | { | |
154 | // comment to be written | |
155 | (*fCrossedClusterIndexes)[fNCrosses++] = clIndex; | |
156 | } | |
157 | /***********************************************************/ | |
158 | ||
159 | Int_t AliITSclusterSSD::GetCross(Int_t crIndex) | |
160 | { | |
161 | // comment to be written | |
162 | return ((crIndex>-1)&&(crIndex<fNCrosses))?(*fCrossedClusterIndexes)[crIndex]:-1; | |
163 | } | |
164 | /***********************************************************/ | |
165 | Double_t AliITSclusterSSD::CentrOfGravity() | |
166 | { | |
167 | // comment to be written | |
168 | Float_t ret=0; | |
169 | ||
170 | if (fLeftNeighbour) ret+=(GetDigitStripNo(0)*0.5*GetDigitSignal(0)); | |
171 | else ret+=(GetDigitStripNo(0)*GetDigitSignal(0)); | |
172 | ||
173 | if (fRightNeighbour) ret+=(GetDigitStripNo(fNDigits -1)*0.5*GetDigitSignal(fNDigits -1)); | |
174 | else ret+=(GetDigitStripNo(fNDigits -1)*GetDigitSignal(fNDigits-1)); | |
175 | Int_t i; | |
176 | for(i=1;i<fNDigits-1;i++) | |
177 | { | |
178 | ret +=GetDigitStripNo(i)*GetDigitSignal(i); | |
179 | } | |
180 | ||
181 | if (fTotalSignal<0) GetTotalSignal(); | |
182 | ||
183 | return (ret/fTotalSignal); | |
184 | } | |
185 | ||
186 | /***********************************************************/ | |
187 | Float_t AliITSclusterSSD::GetTotalSignal() | |
188 | { | |
189 | // comment to be written | |
190 | if(fTotalSignal <0) | |
191 | { | |
192 | fTotalSignal=0; | |
193 | if (fNDigits ==1) { | |
194 | fTotalSignal = (Float_t)GetDigitSignal(0); | |
195 | //printf("1 digit: signal %d \n",GetDigitSignal(0)); | |
196 | return fTotalSignal; | |
197 | } | |
198 | ||
199 | if (fLeftNeighbour) fTotalSignal += (Float_t)(0.5*GetDigitSignal(0)); | |
200 | else fTotalSignal += (Float_t) GetDigitSignal(0); | |
201 | //printf("GetTotalSignal :i DigitSignal %d %d \n",0,GetDigitSignal(0)); | |
202 | ||
203 | if (fRightNeighbour) fTotalSignal += (Float_t)(0.5*GetDigitSignal(fNDigits -1)); | |
204 | else fTotalSignal += (Float_t)GetDigitSignal(fNDigits-1); | |
205 | //printf("GetTotalSignal :i DigitSignal %d %d \n",fNDigits -1,GetDigitSignal(fNDigits -1)); | |
206 | Int_t i; | |
207 | for(i = 1;i<fNDigits -1;i++) | |
208 | { | |
209 | fTotalSignal += (Float_t)GetDigitSignal(i); | |
210 | //printf("GetTotalSignal :i DigitSignal %d %d \n",i,GetDigitSignal(i)); | |
211 | } | |
212 | //printf("GetTotalSignal: fNDigits %d fTotalSignal %.0f \n",fNDigits,fTotalSignal); | |
213 | } | |
214 | return fTotalSignal; | |
215 | } | |
216 | /***********************************************************/ | |
217 | ||
218 | Float_t AliITSclusterSSD::GetTotalSignalError() | |
219 | { | |
220 | // comment to be written | |
221 | Float_t err =0; | |
222 | Int_t i; | |
223 | for(i =1; i<fNDigits -1; i++) | |
224 | { | |
225 | err+=0.1*GetDigitSignal(i); | |
226 | } | |
227 | if (GetLeftNeighbour()) | |
228 | { | |
229 | err+=GetDigitSignal(0); | |
230 | } | |
231 | else | |
232 | { | |
233 | err+=0.1*GetDigitSignal(0); | |
234 | } | |
235 | if (GetRightNeighbour()) | |
236 | { | |
237 | err+=GetDigitSignal(fNDigits -1); | |
238 | } | |
239 | else | |
240 | { | |
241 | err+=0.1*GetDigitSignal(fNDigits -1); | |
242 | } | |
243 | return err; | |
244 | ||
245 | } | |
246 | ||
247 | /***********************************************************/ | |
248 | ||
249 | void AliITSclusterSSD::DelCross(Int_t index) | |
250 | { | |
251 | // comment to be written | |
252 | Int_t i,j; //iterators | |
253 | ||
254 | for(i =0;i<fNCrosses;i++) | |
255 | { | |
256 | if ((*fCrossedClusterIndexes)[i] == index) | |
257 | { | |
258 | for(j=i;j<fNCrosses-1;j++) | |
259 | { | |
260 | (*fCrossedClusterIndexes)[j]=(*fCrossedClusterIndexes)[j+1]; | |
261 | } | |
262 | fNCrosses--; | |
263 | return; | |
264 | } | |
265 | } | |
266 | ||
267 | } | |
268 | /***********************************************************/ | |
269 | ||
270 | Int_t *AliITSclusterSSD::GetTracks(Int_t &nt) | |
271 | { | |
272 | // comment to be written | |
273 | Int_t *tidx=0; | |
274 | Int_t i, bit; | |
275 | nt=0; | |
276 | ||
277 | ||
278 | ||
279 | fNTrack =0; | |
280 | for(i=0;i<10;i++) | |
281 | { | |
282 | fTrack[i] = 0; | |
283 | } | |
284 | ||
285 | tidx=GetDigit(0)->GetTracks(); | |
286 | ||
287 | for(i = 0; i<3;i++) | |
288 | { | |
289 | fTrack[i]=tidx[i]; | |
290 | if (fTrack[i] != 0) fNTrack++; | |
291 | } | |
292 | for(i = 1; i<fNDigits; i++) | |
293 | { | |
294 | tidx=GetDigit(i)->GetTracks(); | |
295 | Int_t j; | |
296 | for(j = 0; j<3;j++) | |
297 | { | |
298 | bit = 1; | |
299 | if (tidx[j]==0) break; | |
300 | Int_t k; | |
301 | for(k = 0; k < fNTrack;k++) | |
302 | { | |
303 | if (tidx[j]==fTrack[k]) bit =0; | |
304 | } | |
305 | if (bit) fTrack[fNTrack++]=tidx[j]; | |
306 | } | |
307 | } | |
308 | ||
309 | ||
310 | if (fNTrack > 10) | |
311 | { | |
312 | cout<<"\n\n Error AliITSclusterSSD::GetTracks OUT "<<fNDigits<<" "<<fNTrack<<"\n\n\n\n\n"; | |
313 | ||
314 | } | |
315 | ||
316 | ||
317 | nt = fNTrack; | |
318 | if(!nt) return 0; | |
319 | return &(fTrack[0]); | |
320 | } | |
321 | /***********************************************************/ | |
322 | ||
323 | Double_t AliITSclusterSSD::GetPosition() | |
324 | { | |
325 | // comment to be written | |
326 | Float_t ret; | |
327 | switch(fNDigits) | |
328 | { | |
329 | case 1: | |
330 | ret = GetDigitStripNo(0); | |
331 | break; | |
332 | case 2: | |
333 | ret = EtaAlgorithm(); | |
334 | break; | |
335 | default: | |
336 | ret = CentrOfGravity(); | |
337 | } | |
338 | return ret; | |
339 | } | |
340 | ||
341 | /***********************************************************/ | |
342 | ||
343 | Double_t AliITSclusterSSD::EtaAlgorithm() | |
344 | { | |
345 | // comment to be written | |
346 | if (fNDigits != 2) return -1; | |
347 | ||
348 | Int_t strip1 = GetDigit(0)->GetStripNumber(); | |
349 | Int_t strip2 = GetDigit(1)->GetStripNumber(); | |
350 | Int_t signal1 = GetDigit(0)->GetSignal(); | |
351 | Int_t signal2 = GetDigit(1)->GetSignal(); | |
352 | ||
353 | Double_t eta; | |
354 | ||
355 | ||
356 | if (strip1<strip2) | |
357 | { | |
358 | eta = ((Double_t)signal2)/((Double_t)(signal1+signal2)); | |
359 | if (eta<0.04) return strip1; | |
360 | if (eta>0.96) return strip2; | |
361 | return (strip1 + 0.43478261*eta + 0.2826087); | |
362 | } | |
363 | else | |
364 | { | |
365 | eta = ((Double_t)signal1)/((Double_t)(signal1+signal2)); | |
366 | if (eta<0.04) return strip2; | |
367 | if (eta>0.96) return strip1; | |
368 | return (strip2 + 0.43478261*eta + 0.2826087); | |
369 | } | |
370 | ||
371 | ||
372 | } | |
373 | ||
374 | Double_t AliITSclusterSSD::GetPositionError() | |
375 | { | |
376 | // comment to be written | |
377 | return (GetNumOfDigits()+1)/2; | |
378 | } | |
379 | ||
380 | Bool_t AliITSclusterSSD::IsCrossingWith(Int_t idx) | |
381 | { | |
382 | // comment to be written | |
383 | Int_t i; | |
384 | for(i =0; i< fNCrosses;i++) | |
385 | { | |
386 | if (GetCross(i) == idx) return kTRUE; | |
387 | } | |
388 | return kFALSE; | |
389 | } |