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