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