]>
Commit | Line | Data |
---|---|---|
b0f5e3fc | 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 | **************************************************************************/ | |
48058160 | 15 | /* |
16 | $Id$ | |
17 | $Log$ | |
bf3f2830 | 18 | Revision 1.29 2002/10/25 18:54:22 barbera |
19 | Various improvements and updates from B.S.Nilsen and T. Virgili | |
20 | ||
f8d9a5b8 | 21 | Revision 1.28 2002/10/22 14:45:29 alibrary |
22 | Introducing Riostream.h | |
23 | ||
4ae5bbc4 | 24 | Revision 1.27 2002/10/14 14:57:00 hristov |
25 | Merging the VirtualMC branch to the main development branch (HEAD) | |
26 | ||
b9d0a01d | 27 | Revision 1.23.4.2 2002/10/14 13:14:07 hristov |
28 | Updating VirtualMC to v3-09-02 | |
29 | ||
30 | Revision 1.26 2002/09/09 17:23:28 nilsen | |
31 | Minor changes in support of changes to AliITSdigitS?D class'. | |
32 | ||
ee86d557 | 33 | Revision 1.25 2002/05/10 22:29:40 nilsen |
34 | Change my Massimo Masera in the default constructor to bring things into | |
35 | compliance. | |
36 | ||
355ccb70 | 37 | Revision 1.24 2002/04/24 22:02:31 nilsen |
38 | New SDigits and Digits routines, and related changes, (including new | |
39 | noise values). | |
40 | ||
48058160 | 41 | */ |
bf3f2830 | 42 | // |
43 | // Cluster finder | |
44 | // for Silicon | |
45 | // Drift Detector | |
46 | // | |
4ae5bbc4 | 47 | #include <Riostream.h> |
bf3f2830 | 48 | |
a1f090e0 | 49 | #include <TMath.h> |
50 | #include <math.h> | |
b0f5e3fc | 51 | |
52 | #include "AliITSClusterFinderSDD.h" | |
e8189707 | 53 | #include "AliITSMapA1.h" |
54 | #include "AliITS.h" | |
78a228db | 55 | #include "AliITSdigit.h" |
56 | #include "AliITSRawCluster.h" | |
57 | #include "AliITSRecPoint.h" | |
58 | #include "AliITSsegmentation.h" | |
5dd4cc39 | 59 | #include "AliITSresponseSDD.h" |
b0f5e3fc | 60 | #include "AliRun.h" |
61 | ||
b0f5e3fc | 62 | ClassImp(AliITSClusterFinderSDD) |
63 | ||
42da2935 | 64 | //______________________________________________________________________ |
65 | AliITSClusterFinderSDD::AliITSClusterFinderSDD(AliITSsegmentation *seg, | |
50d05d7b | 66 | AliITSresponse *response, |
67 | TClonesArray *digits, | |
68 | TClonesArray *recp){ | |
42da2935 | 69 | // standard constructor |
78a228db | 70 | |
b48af428 | 71 | fSegmentation = seg; |
72 | fResponse = response; | |
73 | fDigits = digits; | |
74 | fClusters = recp; | |
75 | fNclusters = fClusters->GetEntriesFast(); | |
b0f5e3fc | 76 | SetCutAmplitude(); |
77 | SetDAnode(); | |
78 | SetDTime(); | |
355ccb70 | 79 | SetMinPeak((Int_t)(((AliITSresponseSDD*)fResponse)->GetNoiseAfterElectronics()*5)); |
80 | // SetMinPeak(); | |
78a228db | 81 | SetMinNCells(); |
82 | SetMaxNCells(); | |
83 | SetTimeCorr(); | |
a1f090e0 | 84 | SetMinCharge(); |
b48af428 | 85 | fMap = new AliITSMapA1(fSegmentation,fDigits,fCutAmplitude); |
b0f5e3fc | 86 | } |
42da2935 | 87 | //______________________________________________________________________ |
88 | AliITSClusterFinderSDD::AliITSClusterFinderSDD(){ | |
89 | // default constructor | |
b0f5e3fc | 90 | |
b48af428 | 91 | fSegmentation = 0; |
92 | fResponse = 0; | |
93 | fDigits = 0; | |
94 | fClusters = 0; | |
95 | fNclusters = 0; | |
96 | fMap = 0; | |
97 | fCutAmplitude = 0; | |
355ccb70 | 98 | fDAnode = 0; |
99 | fDTime = 0; | |
100 | fMinPeak = 0; | |
101 | fMinNCells = 0; | |
102 | fMaxNCells = 0; | |
103 | fTimeCorr = 0; | |
104 | fMinCharge = 0; | |
105 | /* | |
b0f5e3fc | 106 | SetDAnode(); |
107 | SetDTime(); | |
48058160 | 108 | SetMinPeak((Int_t)(((AliITSresponseSDD*)fResponse)->GetNoiseAfterElectronics()*5)); |
78a228db | 109 | SetMinNCells(); |
110 | SetMaxNCells(); | |
111 | SetTimeCorr(); | |
a1f090e0 | 112 | SetMinCharge(); |
355ccb70 | 113 | */ |
b0f5e3fc | 114 | } |
42da2935 | 115 | //____________________________________________________________________________ |
116 | AliITSClusterFinderSDD::~AliITSClusterFinderSDD(){ | |
e8189707 | 117 | // destructor |
118 | ||
119 | if(fMap) delete fMap; | |
e8189707 | 120 | } |
42da2935 | 121 | //______________________________________________________________________ |
122 | void AliITSClusterFinderSDD::SetCutAmplitude(Float_t nsigma){ | |
123 | // set the signal threshold for cluster finder | |
bf3f2830 | 124 | Float_t baseline,noise,noiseAfterEl; |
42da2935 | 125 | |
126 | fResponse->GetNoiseParam(noise,baseline); | |
bf3f2830 | 127 | noiseAfterEl = ((AliITSresponseSDD*)fResponse)->GetNoiseAfterElectronics(); |
128 | fCutAmplitude = (Int_t)((baseline + nsigma*noiseAfterEl)); | |
5dd4cc39 | 129 | } |
42da2935 | 130 | //______________________________________________________________________ |
131 | void AliITSClusterFinderSDD::Find1DClusters(){ | |
132 | // find 1D clusters | |
b48af428 | 133 | static AliITS *iTS = (AliITS*)gAlice->GetModule("ITS"); |
a1f090e0 | 134 | |
42da2935 | 135 | // retrieve the parameters |
b48af428 | 136 | Int_t fNofMaps = fSegmentation->Npz(); |
42da2935 | 137 | Int_t fMaxNofSamples = fSegmentation->Npx(); |
b48af428 | 138 | Int_t fNofAnodes = fNofMaps/2; |
139 | Int_t dummy = 0; | |
140 | Float_t fTimeStep = fSegmentation->Dpx(dummy); | |
141 | Float_t fSddLength = fSegmentation->Dx(); | |
142 | Float_t fDriftSpeed = fResponse->DriftSpeed(); | |
143 | Float_t anodePitch = fSegmentation->Dpz(dummy); | |
42da2935 | 144 | |
145 | // map the signal | |
50d05d7b | 146 | fMap->ClearMap(); |
42da2935 | 147 | fMap->SetThreshold(fCutAmplitude); |
148 | fMap->FillMap(); | |
a1f090e0 | 149 | |
42da2935 | 150 | Float_t noise; |
151 | Float_t baseline; | |
152 | fResponse->GetNoiseParam(noise,baseline); | |
a1f090e0 | 153 | |
42da2935 | 154 | Int_t nofFoundClusters = 0; |
155 | Int_t i; | |
156 | Float_t **dfadc = new Float_t*[fNofAnodes]; | |
157 | for(i=0;i<fNofAnodes;i++) dfadc[i] = new Float_t[fMaxNofSamples]; | |
b48af428 | 158 | Float_t fadc = 0.; |
42da2935 | 159 | Float_t fadc1 = 0.; |
160 | Float_t fadc2 = 0.; | |
161 | Int_t j,k,idx,l,m; | |
162 | for(j=0;j<2;j++) { | |
50d05d7b | 163 | for(k=0;k<fNofAnodes;k++) { |
164 | idx = j*fNofAnodes+k; | |
165 | // signal (fadc) & derivative (dfadc) | |
166 | dfadc[k][255]=0.; | |
167 | for(l=0; l<fMaxNofSamples; l++) { | |
168 | fadc2=(Float_t)fMap->GetSignal(idx,l); | |
169 | if(l>0) fadc1=(Float_t)fMap->GetSignal(idx,l-1); | |
170 | if(l>0) dfadc[k][l-1] = fadc2-fadc1; | |
171 | } // samples | |
172 | } // anodes | |
42da2935 | 173 | |
50d05d7b | 174 | for(k=0;k<fNofAnodes;k++) { |
175 | //cout << "Anode: " << k+1 << ", Wing: " << j+1 << endl; | |
176 | idx = j*fNofAnodes+k; | |
177 | Int_t imax = 0; | |
178 | Int_t imaxd = 0; | |
179 | Int_t it = 0; | |
180 | while(it <= fMaxNofSamples-3) { | |
181 | imax = it; | |
182 | imaxd = it; | |
183 | // maximum of signal | |
184 | Float_t fadcmax = 0.; | |
185 | Float_t dfadcmax = 0.; | |
186 | Int_t lthrmina = 1; | |
187 | Int_t lthrmint = 3; | |
188 | Int_t lthra = 1; | |
189 | Int_t lthrt = 0; | |
190 | for(m=0;m<20;m++) { | |
191 | Int_t id = it+m; | |
192 | if(id>=fMaxNofSamples) break; | |
193 | fadc=(float)fMap->GetSignal(idx,id); | |
194 | if(fadc > fadcmax) { fadcmax = fadc; imax = id;} | |
195 | if(fadc > (float)fCutAmplitude) { | |
196 | lthrt++; | |
197 | } // end if | |
198 | if(dfadc[k][id] > dfadcmax) { | |
199 | dfadcmax = dfadc[k][id]; | |
200 | imaxd = id; | |
201 | } // end if | |
202 | } // end for m | |
203 | it = imaxd; | |
204 | if(fMap->TestHit(idx,imax) == kEmpty) {it++; continue;} | |
205 | // cluster charge | |
206 | Int_t tstart = it-2; | |
207 | if(tstart < 0) tstart = 0; | |
208 | Bool_t ilcl = 0; | |
209 | if(lthrt >= lthrmint && lthra >= lthrmina) ilcl = 1; | |
210 | if(ilcl) { | |
211 | nofFoundClusters++; | |
212 | Int_t tstop = tstart; | |
213 | Float_t dfadcmin = 10000.; | |
214 | Int_t ij; | |
215 | for(ij=0; ij<20; ij++) { | |
216 | if(tstart+ij > 255) { tstop = 255; break; } | |
217 | fadc=(float)fMap->GetSignal(idx,tstart+ij); | |
218 | if((dfadc[k][tstart+ij] < dfadcmin) && | |
219 | (fadc > fCutAmplitude)) { | |
220 | tstop = tstart+ij+5; | |
221 | if(tstop > 255) tstop = 255; | |
222 | dfadcmin = dfadc[k][it+ij]; | |
223 | } // end if | |
224 | } // end for ij | |
42da2935 | 225 | |
50d05d7b | 226 | Float_t clusterCharge = 0.; |
227 | Float_t clusterAnode = k+0.5; | |
228 | Float_t clusterTime = 0.; | |
229 | Int_t clusterMult = 0; | |
230 | Float_t clusterPeakAmplitude = 0.; | |
231 | Int_t its,peakpos = -1; | |
232 | Float_t n, baseline; | |
233 | fResponse->GetNoiseParam(n,baseline); | |
234 | for(its=tstart; its<=tstop; its++) { | |
235 | fadc=(float)fMap->GetSignal(idx,its); | |
236 | if(fadc>baseline) fadc -= baseline; | |
237 | else fadc = 0.; | |
238 | clusterCharge += fadc; | |
239 | // as a matter of fact we should take the peak | |
240 | // pos before FFT | |
241 | // to get the list of tracks !!! | |
242 | if(fadc > clusterPeakAmplitude) { | |
243 | clusterPeakAmplitude = fadc; | |
244 | //peakpos=fMap->GetHitIndex(idx,its); | |
245 | Int_t shift = (int)(fTimeCorr/fTimeStep); | |
246 | if(its>shift && its<(fMaxNofSamples-shift)) | |
247 | peakpos = fMap->GetHitIndex(idx,its+shift); | |
248 | else peakpos = fMap->GetHitIndex(idx,its); | |
249 | if(peakpos<0) peakpos =fMap->GetHitIndex(idx,its); | |
250 | } // end if | |
251 | clusterTime += fadc*its; | |
252 | if(fadc > 0) clusterMult++; | |
253 | if(its == tstop) { | |
254 | clusterTime /= (clusterCharge/fTimeStep); // ns | |
255 | if(clusterTime>fTimeCorr) clusterTime -=fTimeCorr; | |
256 | //ns | |
257 | } // end if | |
258 | } // end for its | |
42da2935 | 259 | |
50d05d7b | 260 | Float_t clusteranodePath = (clusterAnode - fNofAnodes/2)* |
261 | anodePitch; | |
262 | Float_t clusterDriftPath = clusterTime*fDriftSpeed; | |
263 | clusterDriftPath = fSddLength-clusterDriftPath; | |
264 | if(clusterCharge <= 0.) break; | |
265 | AliITSRawClusterSDD clust(j+1,//i | |
266 | clusterAnode,clusterTime,//ff | |
267 | clusterCharge, //f | |
268 | clusterPeakAmplitude, //f | |
269 | peakpos, //i | |
270 | 0.,0.,clusterDriftPath,//fff | |
271 | clusteranodePath, //f | |
272 | clusterMult, //i | |
273 | 0,0,0,0,0,0,0);//7*i | |
274 | iTS->AddCluster(1,&clust); | |
275 | it = tstop; | |
276 | } // ilcl | |
277 | it++; | |
278 | } // while (samples) | |
279 | } // anodes | |
42da2935 | 280 | } // detectors (2) |
42da2935 | 281 | |
282 | for(i=0;i<fNofAnodes;i++) delete[] dfadc[i]; | |
283 | delete [] dfadc; | |
a1f090e0 | 284 | |
42da2935 | 285 | return; |
a1f090e0 | 286 | } |
50d05d7b | 287 | |
288 | ||
289 | ||
42da2935 | 290 | //______________________________________________________________________ |
291 | void AliITSClusterFinderSDD::Find1DClustersE(){ | |
24a1c341 | 292 | // find 1D clusters |
42da2935 | 293 | static AliITS *iTS=(AliITS*)gAlice->GetModule("ITS"); |
294 | // retrieve the parameters | |
295 | Int_t fNofMaps = fSegmentation->Npz(); | |
296 | Int_t fMaxNofSamples = fSegmentation->Npx(); | |
297 | Int_t fNofAnodes = fNofMaps/2; | |
298 | Int_t dummy=0; | |
299 | Float_t fTimeStep = fSegmentation->Dpx( dummy ); | |
300 | Float_t fSddLength = fSegmentation->Dx(); | |
301 | Float_t fDriftSpeed = fResponse->DriftSpeed(); | |
302 | Float_t anodePitch = fSegmentation->Dpz( dummy ); | |
303 | Float_t n, baseline; | |
304 | fResponse->GetNoiseParam( n, baseline ); | |
305 | // map the signal | |
50d05d7b | 306 | fMap->ClearMap(); |
42da2935 | 307 | fMap->SetThreshold( fCutAmplitude ); |
308 | fMap->FillMap(); | |
50d05d7b | 309 | |
42da2935 | 310 | Int_t nClu = 0; |
50d05d7b | 311 | // cout << "Search cluster... "<< endl; |
42da2935 | 312 | for( Int_t j=0; j<2; j++ ){ |
50d05d7b | 313 | for( Int_t k=0; k<fNofAnodes; k++ ){ |
314 | Int_t idx = j*fNofAnodes+k; | |
315 | Bool_t on = kFALSE; | |
316 | Int_t start = 0; | |
317 | Int_t nTsteps = 0; | |
318 | Float_t fmax = 0.; | |
319 | Int_t lmax = 0; | |
320 | Float_t charge = 0.; | |
321 | Float_t time = 0.; | |
322 | Float_t anode = k+0.5; | |
323 | Int_t peakpos = -1; | |
324 | for( Int_t l=0; l<fMaxNofSamples; l++ ){ | |
325 | Float_t fadc = (Float_t)fMap->GetSignal( idx, l ); | |
326 | if( fadc > 0.0 ){ | |
327 | if( on == kFALSE && l<fMaxNofSamples-4){ | |
328 | // star RawCluster (reset var.) | |
329 | Float_t fadc1 = (Float_t)fMap->GetSignal( idx, l+1 ); | |
330 | if( fadc1 < fadc ) continue; | |
331 | start = l; | |
332 | fmax = 0.; | |
333 | lmax = 0; | |
334 | time = 0.; | |
335 | charge = 0.; | |
336 | on = kTRUE; | |
337 | nTsteps = 0; | |
338 | } // end if on... | |
339 | nTsteps++ ; | |
340 | if( fadc > baseline ) fadc -= baseline; | |
341 | else fadc=0.; | |
342 | charge += fadc; | |
343 | time += fadc*l; | |
344 | if( fadc > fmax ){ | |
345 | fmax = fadc; | |
346 | lmax = l; | |
347 | Int_t shift = (Int_t)(fTimeCorr/fTimeStep + 0.5); | |
348 | if( l > shift && l < (fMaxNofSamples-shift) ) | |
349 | peakpos = fMap->GetHitIndex( idx, l+shift ); | |
350 | else | |
351 | peakpos = fMap->GetHitIndex( idx, l ); | |
352 | if( peakpos < 0) peakpos = fMap->GetHitIndex( idx, l ); | |
353 | } // end if fadc | |
354 | }else{ // end fadc>0 | |
355 | if( on == kTRUE ){ | |
356 | if( nTsteps > 2 ){ | |
357 | // min # of timesteps for a RawCluster | |
358 | // Found a RawCluster... | |
359 | Int_t stop = l-1; | |
360 | time /= (charge/fTimeStep); // ns | |
361 | // time = lmax*fTimeStep; // ns | |
362 | if( time > fTimeCorr ) time -= fTimeCorr; // ns | |
363 | Float_t anodePath = (anode - fNofAnodes/2)*anodePitch; | |
364 | Float_t driftPath = time*fDriftSpeed; | |
365 | driftPath = fSddLength-driftPath; | |
366 | AliITSRawClusterSDD clust(j+1,anode,time,charge, | |
367 | fmax, peakpos,0.,0., | |
368 | driftPath,anodePath, | |
369 | nTsteps,start,stop, | |
370 | start, stop, 1, k, k ); | |
371 | iTS->AddCluster( 1, &clust ); | |
372 | // clust.PrintInfo(); | |
373 | nClu++; | |
374 | } // end if nTsteps | |
375 | on = kFALSE; | |
376 | } // end if on==kTRUE | |
377 | } // end if fadc>0 | |
378 | } // samples | |
379 | } // anodes | |
42da2935 | 380 | } // wings |
50d05d7b | 381 | // cout << "# Rawclusters " << nClu << endl; |
42da2935 | 382 | return; |
a1f090e0 | 383 | } |
42da2935 | 384 | //_______________________________________________________________________ |
385 | Int_t AliITSClusterFinderSDD::SearchPeak(Float_t *spect,Int_t xdim,Int_t zdim, | |
50d05d7b | 386 | Int_t *peakX, Int_t *peakZ, |
387 | Float_t *peakAmp, Float_t minpeak ){ | |
42da2935 | 388 | // search peaks on a 2D cluster |
389 | Int_t npeak = 0; // # peaks | |
56fff130 | 390 | Int_t i,j; |
42da2935 | 391 | // search peaks |
392 | for( Int_t z=1; z<zdim-1; z++ ){ | |
48058160 | 393 | for( Int_t x=1; x<xdim-2; x++ ){ |
50d05d7b | 394 | Float_t sxz = spect[x*zdim+z]; |
395 | Float_t sxz1 = spect[(x+1)*zdim+z]; | |
396 | Float_t sxz2 = spect[(x-1)*zdim+z]; | |
397 | // search a local max. in s[x,z] | |
398 | if( sxz < minpeak || sxz1 <= 0 || sxz2 <= 0 ) continue; | |
399 | if( sxz >= spect[(x+1)*zdim+z ] && sxz >= spect[(x-1)*zdim+z ] && | |
400 | sxz >= spect[x*zdim +z+1] && sxz >= spect[x*zdim +z-1] && | |
401 | sxz >= spect[(x+1)*zdim+z+1] && sxz >= spect[(x+1)*zdim+z-1] && | |
402 | sxz >= spect[(x-1)*zdim+z+1] && sxz >= spect[(x-1)*zdim+z-1] ){ | |
403 | // peak found | |
404 | peakX[npeak] = x; | |
405 | peakZ[npeak] = z; | |
406 | peakAmp[npeak] = sxz; | |
407 | npeak++; | |
408 | } // end if .... | |
409 | } // end for x | |
42da2935 | 410 | } // end for z |
411 | // search groups of peaks with same amplitude. | |
412 | Int_t *flag = new Int_t[npeak]; | |
413 | for( i=0; i<npeak; i++ ) flag[i] = 0; | |
414 | for( i=0; i<npeak; i++ ){ | |
50d05d7b | 415 | for( j=0; j<npeak; j++ ){ |
416 | if( i==j) continue; | |
417 | if( flag[j] > 0 ) continue; | |
418 | if( peakAmp[i] == peakAmp[j] && | |
419 | TMath::Abs(peakX[i]-peakX[j])<=1 && | |
420 | TMath::Abs(peakZ[i]-peakZ[j])<=1 ){ | |
421 | if( flag[i] == 0) flag[i] = i+1; | |
422 | flag[j] = flag[i]; | |
423 | } // end if ... | |
424 | } // end for j | |
42da2935 | 425 | } // end for i |
50d05d7b | 426 | // make average of peak groups |
42da2935 | 427 | for( i=0; i<npeak; i++ ){ |
50d05d7b | 428 | Int_t nFlag = 1; |
429 | if( flag[i] <= 0 ) continue; | |
430 | for( j=0; j<npeak; j++ ){ | |
431 | if( i==j ) continue; | |
432 | if( flag[j] != flag[i] ) continue; | |
433 | peakX[i] += peakX[j]; | |
434 | peakZ[i] += peakZ[j]; | |
435 | nFlag++; | |
436 | npeak--; | |
437 | for( Int_t k=j; k<npeak; k++ ){ | |
438 | peakX[k] = peakX[k+1]; | |
439 | peakZ[k] = peakZ[k+1]; | |
440 | peakAmp[k] = peakAmp[k+1]; | |
441 | flag[k] = flag[k+1]; | |
442 | } // end for k | |
443 | j--; | |
444 | } // end for j | |
445 | if( nFlag > 1 ){ | |
446 | peakX[i] /= nFlag; | |
447 | peakZ[i] /= nFlag; | |
448 | } // end fi nFlag | |
42da2935 | 449 | } // end for i |
450 | delete [] flag; | |
451 | return( npeak ); | |
a1f090e0 | 452 | } |
42da2935 | 453 | //______________________________________________________________________ |
454 | void AliITSClusterFinderSDD::PeakFunc( Int_t xdim, Int_t zdim, Float_t *par, | |
50d05d7b | 455 | Float_t *spe, Float_t *integral){ |
24a1c341 | 456 | // function used to fit the clusters |
50d05d7b | 457 | // par -> parameters.. |
24a1c341 | 458 | // par[0] number of peaks. |
459 | // for each peak i=1, ..., par[0] | |
50d05d7b | 460 | // par[i] = Ampl. |
461 | // par[i+1] = xpos | |
462 | // par[i+2] = zpos | |
463 | // par[i+3] = tau | |
464 | // par[i+4] = sigma. | |
24a1c341 | 465 | Int_t electronics = fResponse->Electronics(); // 1 = PASCAL, 2 = OLA |
466 | const Int_t knParam = 5; | |
467 | Int_t npeak = (Int_t)par[0]; | |
42da2935 | 468 | |
24a1c341 | 469 | memset( spe, 0, sizeof( Float_t )*zdim*xdim ); |
42da2935 | 470 | |
24a1c341 | 471 | Int_t k = 1; |
42da2935 | 472 | for( Int_t i=0; i<npeak; i++ ){ |
24a1c341 | 473 | if( integral != 0 ) integral[i] = 0.; |
474 | Float_t sigmaA2 = par[k+4]*par[k+4]*2.; | |
bf3f2830 | 475 | Float_t t2 = par[k+3]; // PASCAL |
476 | if( electronics == 2 ) { t2 *= t2; t2 *= 2; } // OLA | |
42da2935 | 477 | for( Int_t z=0; z<zdim; z++ ){ |
478 | for( Int_t x=0; x<xdim; x++ ){ | |
24a1c341 | 479 | Float_t z2 = (z-par[k+2])*(z-par[k+2])/sigmaA2; |
480 | Float_t x2 = 0.; | |
481 | Float_t signal = 0.; | |
42da2935 | 482 | if( electronics == 1 ){ // PASCAL |
bf3f2830 | 483 | x2 = (x-par[k+1]+t2)/t2; |
42da2935 | 484 | signal = (x2>0.) ? par[k]*x2*exp(-x2+1.-z2) :0.0; // RCCR2 |
485 | // signal =(x2>0.) ? par[k]*x2*x2*exp(-2*x2+2.-z2 ):0.0;//RCCR | |
486 | }else if( electronics == 2 ) { // OLA | |
bf3f2830 | 487 | x2 = (x-par[k+1])*(x-par[k+1])/t2; |
50d05d7b | 488 | signal = par[k] * exp( -x2 - z2 ); |
489 | } else { | |
bf3f2830 | 490 | Warning("PeakFunc","Wrong SDD Electronics = %d",electronics); |
50d05d7b | 491 | // exit( 1 ); |
492 | } // end if electronicx | |
24a1c341 | 493 | spe[x*zdim+z] += signal; |
494 | if( integral != 0 ) integral[i] += signal; | |
42da2935 | 495 | } // end for x |
496 | } // end for z | |
24a1c341 | 497 | k += knParam; |
42da2935 | 498 | } // end for i |
24a1c341 | 499 | return; |
a1f090e0 | 500 | } |
42da2935 | 501 | //__________________________________________________________________________ |
502 | Float_t AliITSClusterFinderSDD::ChiSqr( Int_t xdim, Int_t zdim, Float_t *spe, | |
bf3f2830 | 503 | Float_t *speFit ) const{ |
42da2935 | 504 | // EVALUATES UNNORMALIZED CHI-SQUARED |
505 | Float_t chi2 = 0.; | |
506 | for( Int_t z=0; z<zdim; z++ ){ | |
50d05d7b | 507 | for( Int_t x=1; x<xdim-1; x++ ){ |
508 | Int_t index = x*zdim+z; | |
509 | Float_t tmp = spe[index] - speFit[index]; | |
510 | chi2 += tmp*tmp; | |
511 | } // end for x | |
42da2935 | 512 | } // end for z |
513 | return( chi2 ); | |
a1f090e0 | 514 | } |
42da2935 | 515 | //_______________________________________________________________________ |
516 | void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Float_t *param, | |
50d05d7b | 517 | Float_t *prm0,Float_t *steprm, |
518 | Float_t *chisqr,Float_t *spe, | |
519 | Float_t *speFit ){ | |
42da2935 | 520 | // |
521 | Int_t k, nnn, mmm, i; | |
522 | Float_t p1, delta, d1, chisq1, p2, chisq2, t, p3, chisq3, a, b, p0, chisqt; | |
523 | const Int_t knParam = 5; | |
524 | Int_t npeak = (Int_t)param[0]; | |
525 | for( k=1; k<(npeak*knParam+1); k++ ) prm0[k] = param[k]; | |
526 | for( k=1; k<(npeak*knParam+1); k++ ){ | |
50d05d7b | 527 | p1 = param[k]; |
528 | delta = steprm[k]; | |
529 | d1 = delta; | |
530 | // ENSURE THAT STEP SIZE IS SENSIBLY LARGER THAN MACHINE ROUND OFF | |
531 | if( fabs( p1 ) > 1.0E-6 ) | |
532 | if ( fabs( delta/p1 ) < 1.0E-4 ) delta = p1/1000; | |
533 | else delta = (Float_t)1.0E-4; | |
534 | // EVALUATE CHI-SQUARED AT FIRST TWO SEARCH POINTS | |
535 | PeakFunc( xdim, zdim, param, speFit ); | |
536 | chisq1 = ChiSqr( xdim, zdim, spe, speFit ); | |
537 | p2 = p1+delta; | |
538 | param[k] = p2; | |
539 | PeakFunc( xdim, zdim, param, speFit ); | |
540 | chisq2 = ChiSqr( xdim, zdim, spe, speFit ); | |
541 | if( chisq1 < chisq2 ){ | |
542 | // REVERSE DIRECTION OF SEARCH IF CHI-SQUARED IS INCREASING | |
543 | delta = -delta; | |
544 | t = p1; | |
545 | p1 = p2; | |
546 | p2 = t; | |
547 | t = chisq1; | |
548 | chisq1 = chisq2; | |
549 | chisq2 = t; | |
550 | } // end if | |
551 | i = 1; nnn = 0; | |
552 | do { // INCREMENT param(K) UNTIL CHI-SQUARED STARTS TO INCREASE | |
553 | nnn++; | |
554 | p3 = p2 + delta; | |
555 | mmm = nnn - (nnn/5)*5; // multiplo de 5 | |
556 | if( mmm == 0 ){ | |
557 | d1 = delta; | |
558 | // INCREASE STEP SIZE IF STEPPING TOWARDS MINIMUM IS TOO SLOW | |
559 | delta *= 5; | |
560 | } // end if | |
561 | param[k] = p3; | |
562 | // Constrain paramiters | |
563 | Int_t kpos = (k-1) % knParam; | |
564 | switch( kpos ){ | |
565 | case 0 : | |
566 | if( param[k] <= 20 ) param[k] = fMinPeak; | |
567 | break; | |
568 | case 1 : | |
569 | if( fabs( param[k] - prm0[k] ) > 1.5 ) param[k] = prm0[k]; | |
570 | break; | |
571 | case 2 : | |
572 | if( fabs( param[k] - prm0[k] ) > 1. ) param[k] = prm0[k]; | |
573 | break; | |
574 | case 3 : | |
575 | if( param[k] < .5 ) param[k] = .5; | |
576 | break; | |
577 | case 4 : | |
578 | if( param[k] < .288 ) param[k] = .288; // 1/sqrt(12) = 0.288 | |
579 | if( param[k] > zdim*.5 ) param[k] = zdim*.5; | |
580 | break; | |
581 | }; // end switch | |
582 | PeakFunc( xdim, zdim, param, speFit ); | |
583 | chisq3 = ChiSqr( xdim, zdim, spe, speFit ); | |
584 | if( chisq3 < chisq2 && nnn < 50 ){ | |
585 | p1 = p2; | |
586 | p2 = p3; | |
587 | chisq1 = chisq2; | |
588 | chisq2 = chisq3; | |
589 | }else i=0; | |
590 | } while( i ); | |
591 | // FIND MINIMUM OF PARABOLA DEFINED BY LAST THREE POINTS | |
592 | a = chisq1*(p2-p3)+chisq2*(p3-p1)+chisq3*(p1-p2); | |
593 | b = chisq1*(p2*p2-p3*p3)+chisq2*(p3*p3-p1*p1)+chisq3*(p1*p1-p2*p2); | |
594 | if( a!=0 ) p0 = (Float_t)(0.5*b/a); | |
595 | else p0 = 10000; | |
596 | //--IN CASE OF NEARLY EQUAL CHI-SQUARED AND TOO SMALL STEP SIZE PREVENT | |
597 | // ERRONEOUS EVALUATION OF PARABOLA MINIMUM | |
598 | //---NEXT TWO LINES CAN BE OMITTED FOR HIGHER PRECISION MACHINES | |
599 | //dp = (Float_t) max (fabs(p3-p2), fabs(p2-p1)); | |
600 | //if( fabs( p2-p0 ) > dp ) p0 = p2; | |
601 | param[k] = p0; | |
602 | // Constrain paramiters | |
603 | Int_t kpos = (k-1) % knParam; | |
604 | switch( kpos ){ | |
605 | case 0 : | |
606 | if( param[k] <= 20 ) param[k] = fMinPeak; | |
607 | break; | |
608 | case 1 : | |
609 | if( fabs( param[k] - prm0[k] ) > 1.5 ) param[k] = prm0[k]; | |
610 | break; | |
611 | case 2 : | |
612 | if( fabs( param[k] - prm0[k] ) > 1. ) param[k] = prm0[k]; | |
613 | break; | |
614 | case 3 : | |
615 | if( param[k] < .5 ) param[k] = .5; | |
616 | break; | |
617 | case 4 : | |
618 | if( param[k] < .288 ) param[k] = .288; // 1/sqrt(12) = 0.288 | |
619 | if( param[k] > zdim*.5 ) param[k] = zdim*.5; | |
620 | break; | |
621 | }; // end switch | |
622 | PeakFunc( xdim, zdim, param, speFit ); | |
623 | chisqt = ChiSqr( xdim, zdim, spe, speFit ); | |
624 | // DO NOT ALLOW ERRONEOUS INTERPOLATION | |
625 | if( chisqt <= *chisqr ) *chisqr = chisqt; | |
626 | else param[k] = prm0[k]; | |
627 | // OPTIMIZE SEARCH STEP FOR EVENTUAL NEXT CALL OF MINIM | |
628 | steprm[k] = (param[k]-prm0[k])/5; | |
629 | if( steprm[k] >= d1 ) steprm[k] = d1/5; | |
42da2935 | 630 | } // end for k |
631 | // EVALUATE FIT AND CHI-SQUARED FOR OPTIMIZED PARAMETERS | |
632 | PeakFunc( xdim, zdim, param, speFit ); | |
633 | *chisqr = ChiSqr( xdim, zdim, spe, speFit ); | |
634 | return; | |
a1f090e0 | 635 | } |
42da2935 | 636 | //_________________________________________________________________________ |
637 | Int_t AliITSClusterFinderSDD::NoLinearFit( Int_t xdim, Int_t zdim, | |
50d05d7b | 638 | Float_t *param, Float_t *spe, |
639 | Int_t *niter, Float_t *chir ){ | |
42da2935 | 640 | // fit method from Comput. Phys. Commun 46(1987) 149 |
50d05d7b | 641 | const Float_t kchilmt = 0.01; // relative accuracy |
642 | const Int_t knel = 3; // for parabolic minimization | |
643 | const Int_t knstop = 50; // Max. iteration number | |
42da2935 | 644 | const Int_t knParam = 5; |
645 | Int_t npeak = (Int_t)param[0]; | |
646 | // RETURN IF NUMBER OF DEGREES OF FREEDOM IS NOT POSITIVE | |
647 | if( (xdim*zdim - npeak*knParam) <= 0 ) return( -1 ); | |
648 | Float_t degFree = (xdim*zdim - npeak*knParam)-1; | |
649 | Int_t n, k, iterNum = 0; | |
650 | Float_t *prm0 = new Float_t[npeak*knParam+1]; | |
651 | Float_t *step = new Float_t[npeak*knParam+1]; | |
652 | Float_t *schi = new Float_t[npeak*knParam+1]; | |
653 | Float_t *sprm[3]; | |
654 | sprm[0] = new Float_t[npeak*knParam+1]; | |
655 | sprm[1] = new Float_t[npeak*knParam+1]; | |
656 | sprm[2] = new Float_t[npeak*knParam+1]; | |
657 | Float_t chi0, chi1, reldif, a, b, prmin, dp; | |
658 | Float_t *speFit = new Float_t[ xdim*zdim ]; | |
659 | PeakFunc( xdim, zdim, param, speFit ); | |
660 | chi0 = ChiSqr( xdim, zdim, spe, speFit ); | |
661 | chi1 = chi0; | |
662 | for( k=1; k<(npeak*knParam+1); k++) prm0[k] = param[k]; | |
50d05d7b | 663 | for( k=1 ; k<(npeak*knParam+1); k+=knParam ){ |
664 | step[k] = param[k] / 20.0 ; | |
665 | step[k+1] = param[k+1] / 50.0; | |
666 | step[k+2] = param[k+2] / 50.0; | |
667 | step[k+3] = param[k+3] / 20.0; | |
668 | step[k+4] = param[k+4] / 20.0; | |
669 | } // end for k | |
42da2935 | 670 | Int_t out = 0; |
671 | do{ | |
50d05d7b | 672 | iterNum++; |
673 | chi0 = chi1; | |
674 | Minim( xdim, zdim, param, prm0, step, &chi1, spe, speFit ); | |
675 | reldif = ( chi1 > 0 ) ? ((Float_t) fabs( chi1-chi0)/chi1 ) : 0; | |
676 | // EXIT conditions | |
677 | if( reldif < (float) kchilmt ){ | |
678 | *chir = (chi1>0) ? (float) TMath::Sqrt (chi1/degFree) :0; | |
679 | *niter = iterNum; | |
680 | out = 0; | |
681 | break; | |
682 | } // end if | |
683 | if( (reldif < (float)(5*kchilmt)) && (iterNum > knstop) ){ | |
684 | *chir = (chi1>0) ?(float) TMath::Sqrt (chi1/degFree):0; | |
685 | *niter = iterNum; | |
686 | out = 0; | |
687 | break; | |
688 | } // end if | |
689 | if( iterNum > 5*knstop ){ | |
690 | *chir = (chi1>0) ?(float) TMath::Sqrt (chi1/degFree):0; | |
691 | *niter = iterNum; | |
692 | out = 1; | |
693 | break; | |
694 | } // end if | |
695 | if( iterNum <= knel ) continue; | |
696 | n = iterNum - (iterNum/knel)*knel; // EXTRAPOLATION LIMIT COUNTER N | |
697 | if( n > 3 || n == 0 ) continue; | |
698 | schi[n-1] = chi1; | |
699 | for( k=1; k<(npeak*knParam+1); k++ ) sprm[n-1][k] = param[k]; | |
700 | if( n != 3 ) continue; | |
701 | // -EVALUATE EXTRAPOLATED VALUE OF EACH PARAMETER BY FINDING MINIMUM OF | |
702 | // PARABOLA DEFINED BY LAST THREE CALLS OF MINIM | |
703 | for( k=1; k<(npeak*knParam+1); k++ ){ | |
704 | Float_t tmp0 = sprm[0][k]; | |
705 | Float_t tmp1 = sprm[1][k]; | |
706 | Float_t tmp2 = sprm[2][k]; | |
707 | a = schi[0]*(tmp1-tmp2) + schi[1]*(tmp2-tmp0); | |
708 | a += (schi[2]*(tmp0-tmp1)); | |
709 | b = schi[0]*(tmp1*tmp1-tmp2*tmp2); | |
710 | b += (schi[1]*(tmp2*tmp2-tmp0*tmp0)+(schi[2]* | |
711 | (tmp0*tmp0-tmp1*tmp1))); | |
712 | if ((double)a < 1.0E-6) prmin = 0; | |
713 | else prmin = (float) (0.5*b/a); | |
714 | dp = 5*(tmp2-tmp0); | |
715 | if( fabs(prmin-tmp2) > fabs(dp) ) prmin = tmp2+dp; | |
716 | param[k] = prmin; | |
717 | step[k] = dp/10; // OPTIMIZE SEARCH STEP | |
718 | } // end for k | |
42da2935 | 719 | } while( kTRUE ); |
720 | delete [] prm0; | |
721 | delete [] step; | |
722 | delete [] schi; | |
723 | delete [] sprm[0]; | |
724 | delete [] sprm[1]; | |
725 | delete [] sprm[2]; | |
726 | delete [] speFit; | |
727 | return( out ); | |
a1f090e0 | 728 | } |
50d05d7b | 729 | |
42da2935 | 730 | //______________________________________________________________________ |
731 | void AliITSClusterFinderSDD::ResolveClustersE(){ | |
732 | // The function to resolve clusters if the clusters overlapping exists | |
24a1c341 | 733 | Int_t i; |
42da2935 | 734 | static AliITS *iTS = (AliITS*)gAlice->GetModule( "ITS" ); |
735 | // get number of clusters for this module | |
736 | Int_t nofClusters = fClusters->GetEntriesFast(); | |
737 | nofClusters -= fNclusters; | |
738 | Int_t fNofMaps = fSegmentation->Npz(); | |
739 | Int_t fNofAnodes = fNofMaps/2; | |
740 | Int_t fMaxNofSamples = fSegmentation->Npx(); | |
741 | Int_t dummy=0; | |
742 | Double_t fTimeStep = fSegmentation->Dpx( dummy ); | |
743 | Double_t fSddLength = fSegmentation->Dx(); | |
744 | Double_t fDriftSpeed = fResponse->DriftSpeed(); | |
745 | Double_t anodePitch = fSegmentation->Dpz( dummy ); | |
746 | Float_t n, baseline; | |
747 | fResponse->GetNoiseParam( n, baseline ); | |
748 | Int_t electronics = fResponse->Electronics(); // 1 = PASCAL, 2 = OLA | |
50d05d7b | 749 | |
42da2935 | 750 | for( Int_t j=0; j<nofClusters; j++ ){ |
50d05d7b | 751 | // get cluster information |
752 | AliITSRawClusterSDD *clusterJ=(AliITSRawClusterSDD*) fClusters->At(j); | |
753 | Int_t astart = clusterJ->Astart(); | |
754 | Int_t astop = clusterJ->Astop(); | |
755 | Int_t tstart = clusterJ->Tstartf(); | |
756 | Int_t tstop = clusterJ->Tstopf(); | |
757 | Int_t wing = (Int_t)clusterJ->W(); | |
758 | if( wing == 2 ){ | |
759 | astart += fNofAnodes; | |
760 | astop += fNofAnodes; | |
761 | } // end if | |
762 | Int_t xdim = tstop-tstart+3; | |
763 | Int_t zdim = astop-astart+3; | |
bf3f2830 | 764 | if(xdim > 50 || zdim > 30) { |
765 | Warning("ResolveClustersE","xdim: %d , zdim: %d ",xdim,zdim); | |
766 | continue; | |
767 | } | |
50d05d7b | 768 | Float_t *sp = new Float_t[ xdim*zdim+1 ]; |
769 | memset( sp, 0, sizeof(Float_t)*(xdim*zdim+1) ); | |
770 | ||
771 | // make a local map from cluster region | |
772 | for( Int_t ianode=astart; ianode<=astop; ianode++ ){ | |
773 | for( Int_t itime=tstart; itime<=tstop; itime++ ){ | |
774 | Float_t fadc = fMap->GetSignal( ianode, itime ); | |
775 | if( fadc > baseline ) fadc -= (Double_t)baseline; | |
776 | else fadc = 0.; | |
777 | Int_t index = (itime-tstart+1)*zdim+(ianode-astart+1); | |
778 | sp[index] = fadc; | |
779 | } // time loop | |
780 | } // anode loop | |
781 | ||
782 | // search peaks on cluster | |
783 | const Int_t kNp = 150; | |
784 | Int_t peakX1[kNp]; | |
785 | Int_t peakZ1[kNp]; | |
786 | Float_t peakAmp1[kNp]; | |
787 | Int_t npeak = SearchPeak(sp,xdim,zdim,peakX1,peakZ1,peakAmp1,fMinPeak); | |
788 | ||
789 | // if multiple peaks, split cluster | |
790 | if( npeak >= 1 ) | |
791 | { | |
792 | // cout << "npeak " << npeak << endl; | |
793 | // clusterJ->PrintInfo(); | |
794 | Float_t *par = new Float_t[npeak*5+1]; | |
795 | par[0] = (Float_t)npeak; | |
48058160 | 796 | // Initial parameters in cell dimentions |
50d05d7b | 797 | Int_t k1 = 1; |
798 | for( i=0; i<npeak; i++ ){ | |
799 | par[k1] = peakAmp1[i]; | |
800 | par[k1+1] = peakX1[i]; // local time pos. [timebin] | |
801 | par[k1+2] = peakZ1[i]; // local anode pos. [anodepitch] | |
802 | if( electronics == 1 ) | |
803 | par[k1+3] = 2.; // PASCAL | |
804 | else if( electronics == 2 ) | |
805 | par[k1+3] = 0.7; // tau [timebin] OLA | |
806 | par[k1+4] = .4; // sigma [anodepich] | |
807 | k1+=5; | |
808 | } // end for i | |
809 | Int_t niter; | |
810 | Float_t chir; | |
811 | NoLinearFit( xdim, zdim, par, sp, &niter, &chir ); | |
812 | Float_t peakX[kNp]; | |
813 | Float_t peakZ[kNp]; | |
814 | Float_t sigma[kNp]; | |
815 | Float_t tau[kNp]; | |
816 | Float_t peakAmp[kNp]; | |
817 | Float_t integral[kNp]; | |
818 | //get integrals => charge for each peak | |
819 | PeakFunc( xdim, zdim, par, sp, integral ); | |
820 | k1 = 1; | |
821 | for( i=0; i<npeak; i++ ){ | |
822 | peakAmp[i] = par[k1]; | |
823 | peakX[i] = par[k1+1]; | |
824 | peakZ[i] = par[k1+2]; | |
825 | tau[i] = par[k1+3]; | |
826 | sigma[i] = par[k1+4]; | |
827 | k1+=5; | |
828 | } // end for i | |
829 | // calculate parameter for new clusters | |
830 | for( i=0; i<npeak; i++ ){ | |
831 | AliITSRawClusterSDD clusterI( *clusterJ ); | |
832 | Int_t newAnode = peakZ1[i]-1 + astart; | |
833 | Int_t newiTime = peakX1[i]-1 + tstart; | |
834 | Int_t shift = (Int_t)(fTimeCorr/fTimeStep + 0.5); | |
835 | if( newiTime > shift && newiTime < (fMaxNofSamples-shift) ) | |
836 | shift = 0; | |
837 | Int_t peakpos = fMap->GetHitIndex( newAnode, newiTime+shift ); | |
838 | clusterI.SetPeakPos( peakpos ); | |
839 | clusterI.SetPeakAmpl( peakAmp1[i] ); | |
840 | Float_t newAnodef = peakZ[i] - 0.5 + astart; | |
841 | Float_t newiTimef = peakX[i] - 1 + tstart; | |
842 | if( wing == 2 ) newAnodef -= fNofAnodes; | |
843 | Float_t anodePath = (newAnodef - fNofAnodes/2)*anodePitch; | |
844 | newiTimef *= fTimeStep; | |
845 | if( newiTimef > fTimeCorr ) newiTimef -= fTimeCorr; | |
846 | if( electronics == 1 ){ | |
48058160 | 847 | // newiTimef *= 0.999438; // PASCAL |
848 | // newiTimef += (6./fDriftSpeed - newiTimef/3000.); | |
50d05d7b | 849 | }else if( electronics == 2 ) |
850 | newiTimef *= 0.99714; // OLA | |
851 | Float_t driftPath = fSddLength - newiTimef * fDriftSpeed; | |
852 | Float_t sign = ( wing == 1 ) ? -1. : 1.; | |
853 | clusterI.SetX( driftPath*sign * 0.0001 ); | |
854 | clusterI.SetZ( anodePath * 0.0001 ); | |
855 | clusterI.SetAnode( newAnodef ); | |
856 | clusterI.SetTime( newiTimef ); | |
857 | clusterI.SetAsigma( sigma[i]*anodePitch ); | |
858 | clusterI.SetTsigma( tau[i]*fTimeStep ); | |
859 | clusterI.SetQ( integral[i] ); | |
48058160 | 860 | // clusterI.PrintInfo(); |
50d05d7b | 861 | iTS->AddCluster( 1, &clusterI ); |
862 | } // end for i | |
863 | fClusters->RemoveAt( j ); | |
864 | delete [] par; | |
48058160 | 865 | } else { // something odd |
bf3f2830 | 866 | Warning("ResolveClustersE","--- Peak not found!!!! minpeak=%d ,cluster peak= %f , module= %d",fMinPeak,clusterJ->PeakAmpl(),fModule); |
867 | clusterJ->PrintInfo(); | |
868 | Warning("ResolveClustersE"," xdim= %d zdim= %d",xdim-2,zdim-2); | |
50d05d7b | 869 | } |
870 | delete [] sp; | |
42da2935 | 871 | } // cluster loop |
872 | fClusters->Compress(); | |
50d05d7b | 873 | // fMap->ClearMap(); |
a1f090e0 | 874 | } |
50d05d7b | 875 | |
876 | ||
42da2935 | 877 | //________________________________________________________________________ |
878 | void AliITSClusterFinderSDD::GroupClusters(){ | |
879 | // group clusters | |
880 | Int_t dummy=0; | |
881 | Float_t fTimeStep = fSegmentation->Dpx(dummy); | |
882 | // get number of clusters for this module | |
883 | Int_t nofClusters = fClusters->GetEntriesFast(); | |
884 | nofClusters -= fNclusters; | |
885 | AliITSRawClusterSDD *clusterI; | |
886 | AliITSRawClusterSDD *clusterJ; | |
887 | Int_t *label = new Int_t [nofClusters]; | |
888 | Int_t i,j; | |
889 | for(i=0; i<nofClusters; i++) label[i] = 0; | |
890 | for(i=0; i<nofClusters; i++) { | |
50d05d7b | 891 | if(label[i] != 0) continue; |
892 | for(j=i+1; j<nofClusters; j++) { | |
893 | if(label[j] != 0) continue; | |
894 | clusterI = (AliITSRawClusterSDD*) fClusters->At(i); | |
895 | clusterJ = (AliITSRawClusterSDD*) fClusters->At(j); | |
896 | // 1.3 good | |
897 | if(clusterI->T() < fTimeStep*60) fDAnode = 4.2; // TB 3.2 | |
898 | if(clusterI->T() < fTimeStep*10) fDAnode = 1.5; // TB 1. | |
899 | Bool_t pair = clusterI->Brother(clusterJ,fDAnode,fDTime); | |
900 | if(!pair) continue; | |
901 | // clusterI->PrintInfo(); | |
902 | // clusterJ->PrintInfo(); | |
903 | clusterI->Add(clusterJ); | |
904 | label[j] = 1; | |
905 | fClusters->RemoveAt(j); | |
906 | j=i; // <- Ernesto | |
907 | } // J clusters | |
908 | label[i] = 1; | |
42da2935 | 909 | } // I clusters |
910 | fClusters->Compress(); | |
911 | ||
912 | delete [] label; | |
913 | return; | |
b0f5e3fc | 914 | } |
42da2935 | 915 | //________________________________________________________________________ |
916 | void AliITSClusterFinderSDD::SelectClusters(){ | |
917 | // get number of clusters for this module | |
918 | Int_t nofClusters = fClusters->GetEntriesFast(); | |
b0f5e3fc | 919 | |
42da2935 | 920 | nofClusters -= fNclusters; |
921 | Int_t i; | |
922 | for(i=0; i<nofClusters; i++) { | |
50d05d7b | 923 | AliITSRawClusterSDD *clusterI =(AliITSRawClusterSDD*) fClusters->At(i); |
924 | Int_t rmflg = 0; | |
925 | Float_t wy = 0.; | |
926 | if(clusterI->Anodes() != 0.) { | |
927 | wy = ((Float_t) clusterI->Samples())/clusterI->Anodes(); | |
928 | } // end if | |
929 | Int_t amp = (Int_t) clusterI->PeakAmpl(); | |
930 | Int_t cha = (Int_t) clusterI->Q(); | |
931 | if(amp < fMinPeak) rmflg = 1; | |
932 | if(cha < fMinCharge) rmflg = 1; | |
933 | if(wy < fMinNCells) rmflg = 1; | |
934 | //if(wy > fMaxNCells) rmflg = 1; | |
935 | if(rmflg) fClusters->RemoveAt(i); | |
42da2935 | 936 | } // I clusters |
937 | fClusters->Compress(); | |
938 | return; | |
b0f5e3fc | 939 | } |
42da2935 | 940 | //__________________________________________________________________________ |
941 | void AliITSClusterFinderSDD::ResolveClusters(){ | |
942 | // The function to resolve clusters if the clusters overlapping exists | |
943 | /* AliITS *iTS=(AliITS*)gAlice->GetModule("ITS"); | |
944 | // get number of clusters for this module | |
945 | Int_t nofClusters = fClusters->GetEntriesFast(); | |
946 | nofClusters -= fNclusters; | |
947 | //cout<<"Resolve Cl: nofClusters, fNclusters ="<<nofClusters<<"," | |
948 | // <<fNclusters<<endl; | |
949 | Int_t fNofMaps = fSegmentation->Npz(); | |
950 | Int_t fNofAnodes = fNofMaps/2; | |
951 | Int_t dummy=0; | |
952 | Double_t fTimeStep = fSegmentation->Dpx(dummy); | |
953 | Double_t fSddLength = fSegmentation->Dx(); | |
954 | Double_t fDriftSpeed = fResponse->DriftSpeed(); | |
955 | Double_t anodePitch = fSegmentation->Dpz(dummy); | |
956 | Float_t n, baseline; | |
957 | fResponse->GetNoiseParam(n,baseline); | |
958 | Float_t dzz_1A = anodePitch * anodePitch / 12; | |
959 | // fill Map of signals | |
a1f090e0 | 960 | fMap->FillMap(); |
42da2935 | 961 | Int_t j,i,ii,ianode,anode,itime; |
962 | Int_t wing,astart,astop,tstart,tstop,nanode; | |
963 | Double_t fadc,ClusterTime; | |
964 | Double_t q[400],x[400],z[400]; // digit charges and coordinates | |
965 | for(j=0; j<nofClusters; j++) { | |
50d05d7b | 966 | AliITSRawClusterSDD *clusterJ=(AliITSRawClusterSDD*) fClusters->At(j); |
967 | Int_t ndigits = 0; | |
968 | astart=clusterJ->Astart(); | |
969 | astop=clusterJ->Astop(); | |
970 | tstart=clusterJ->Tstartf(); | |
971 | tstop=clusterJ->Tstopf(); | |
972 | nanode=clusterJ->Anodes(); // <- Ernesto | |
973 | wing=(Int_t)clusterJ->W(); | |
974 | if(wing == 2) { | |
975 | astart += fNofAnodes; | |
976 | astop += fNofAnodes; | |
977 | } // end if | |
978 | // cout<<"astart,astop,tstart,tstop ="<<astart<<","<<astop<<"," | |
979 | // <<tstart<<","<<tstop<<endl; | |
980 | // clear the digit arrays | |
981 | for(ii=0; ii<400; ii++) { | |
982 | q[ii] = 0.; | |
983 | x[ii] = 0.; | |
984 | z[ii] = 0.; | |
985 | } // end for ii | |
42da2935 | 986 | |
50d05d7b | 987 | for(ianode=astart; ianode<=astop; ianode++) { |
988 | for(itime=tstart; itime<=tstop; itime++) { | |
989 | fadc=fMap->GetSignal(ianode,itime); | |
990 | if(fadc>baseline) { | |
991 | fadc-=(Double_t)baseline; | |
992 | q[ndigits] = fadc*(fTimeStep/160); // KeV | |
993 | anode = ianode; | |
994 | if(wing == 2) anode -= fNofAnodes; | |
995 | z[ndigits] = (anode + 0.5 - fNofAnodes/2)*anodePitch; | |
996 | ClusterTime = itime*fTimeStep; | |
997 | if(ClusterTime > fTimeCorr) ClusterTime -= fTimeCorr;// ns | |
998 | x[ndigits] = fSddLength - ClusterTime*fDriftSpeed; | |
999 | if(wing == 1) x[ndigits] *= (-1); | |
1000 | // cout<<"ianode,itime,fadc ="<<ianode<<","<<itime<<"," | |
1001 | // <<fadc<<endl; | |
1002 | // cout<<"wing,anode,ndigits,charge ="<<wing<<"," | |
1003 | // <<anode<<","<<ndigits<<","<<q[ndigits]<<endl; | |
1004 | ndigits++; | |
1005 | continue; | |
1006 | } // end if | |
1007 | fadc=0; | |
1008 | // cout<<"fadc=0, ndigits ="<<ndigits<<endl; | |
1009 | } // time loop | |
1010 | } // anode loop | |
1011 | // cout<<"for new cluster ndigits ="<<ndigits<<endl; | |
1012 | // Fit cluster to resolve for two separate ones -------------------- | |
1013 | Double_t qq=0., xm=0., zm=0., xx=0., zz=0., xz=0.; | |
1014 | Double_t dxx=0., dzz=0., dxz=0.; | |
1015 | Double_t scl = 0., tmp, tga, elps = -1.; | |
1016 | Double_t xfit[2], zfit[2], qfit[2]; | |
1017 | Double_t pitchz = anodePitch*1.e-4; // cm | |
1018 | Double_t pitchx = fTimeStep*fDriftSpeed*1.e-4; // cm | |
1019 | Double_t sigma2; | |
1020 | Int_t nfhits; | |
1021 | Int_t nbins = ndigits; | |
1022 | Int_t separate = 0; | |
1023 | // now, all lengths are in microns | |
1024 | for (ii=0; ii<nbins; ii++) { | |
1025 | qq += q[ii]; | |
1026 | xm += x[ii]*q[ii]; | |
1027 | zm += z[ii]*q[ii]; | |
1028 | xx += x[ii]*x[ii]*q[ii]; | |
1029 | zz += z[ii]*z[ii]*q[ii]; | |
1030 | xz += x[ii]*z[ii]*q[ii]; | |
1031 | } // end for ii | |
1032 | xm /= qq; | |
1033 | zm /= qq; | |
1034 | xx /= qq; | |
1035 | zz /= qq; | |
1036 | xz /= qq; | |
1037 | dxx = xx - xm*xm; | |
1038 | dzz = zz - zm*zm; | |
1039 | dxz = xz - xm*zm; | |
42da2935 | 1040 | |
50d05d7b | 1041 | // shrink the cluster in the time direction proportionaly to the |
1042 | // dxx/dzz, which lineary depends from the drift path | |
1043 | // new Ernesto........ | |
1044 | if( nanode == 1 ){ | |
1045 | dzz = dzz_1A; // for one anode cluster dzz = anode**2/12 | |
1046 | scl = TMath::Sqrt( 7.2/(-0.57*xm*1.e-3+71.8) ); | |
1047 | } // end if | |
1048 | if( nanode == 2 ){ | |
1049 | scl = TMath::Sqrt( (-0.18*xm*1.e-3+21.3)/(-0.57*xm*1.e-3+71.8) ); | |
1050 | } // end if | |
1051 | if( nanode == 3 ){ | |
1052 | scl = TMath::Sqrt( (-0.5*xm*1.e-3+34.5)/(-0.57*xm*1.e-3+71.8) ); | |
1053 | } // end if | |
1054 | if( nanode > 3 ){ | |
1055 | scl = TMath::Sqrt( (1.3*xm*1.e-3+49.)/(-0.57*xm*1.e-3+71.8) ); | |
1056 | } // end if | |
1057 | // cout<<"1 microns: zm,dzz,xm,dxx,dxz,qq ="<<zm<<","<<dzz<<"," | |
1058 | // <<xm<<","<<dxx<<","<<dxz<<","<<qq<<endl; | |
1059 | // old Boris......... | |
1060 | // tmp=29730. - 585.*fabs(xm/1000.); | |
1061 | // scl=TMath::Sqrt(tmp/130000.); | |
a1f090e0 | 1062 | |
50d05d7b | 1063 | xm *= scl; |
1064 | xx *= scl*scl; | |
1065 | xz *= scl; | |
42da2935 | 1066 | |
50d05d7b | 1067 | dxx = xx - xm*xm; |
1068 | // dzz = zz - zm*zm; | |
1069 | dxz = xz - xm*zm; | |
1070 | // cout<<"microns: zm,dzz,xm,dxx,xz,dxz,qq ="<<zm<<","<<dzz<<"," | |
1071 | // <<xm<<","<<dxx<<","<<xz<<","<<dxz<<","<<qq<<endl; | |
1072 | // if(dzz < 7200.) dzz=7200.;//for one anode cluster dzz = anode**2/12 | |
a1f090e0 | 1073 | |
50d05d7b | 1074 | if (dxx < 0.) dxx=0.; |
1075 | // the data if no cluster overlapping (the coordunates are in cm) | |
1076 | nfhits = 1; | |
1077 | xfit[0] = xm*1.e-4; | |
1078 | zfit[0] = zm*1.e-4; | |
1079 | qfit[0] = qq; | |
1080 | // if(nbins < 7) cout<<"**** nbins ="<<nbins<<endl; | |
a1f090e0 | 1081 | |
50d05d7b | 1082 | if (nbins >= 7) { |
1083 | if (dxz==0.) tga=0.; | |
1084 | else { | |
1085 | tmp=0.5*(dzz-dxx)/dxz; | |
1086 | tga = (dxz<0.) ? tmp-TMath::Sqrt(tmp*tmp+1) : | |
1087 | tmp+TMath::Sqrt(tmp*tmp+1); | |
1088 | } // end if dxz | |
1089 | elps=(tga*tga*dxx-2*tga*dxz+dzz)/(dxx+2*tga*dxz+tga*tga*dzz); | |
1090 | // change from microns to cm | |
1091 | xm *= 1.e-4; | |
1092 | zm *= 1.e-4; | |
1093 | zz *= 1.e-8; | |
1094 | xx *= 1.e-8; | |
1095 | xz *= 1.e-8; | |
1096 | dxz *= 1.e-8; | |
1097 | dxx *= 1.e-8; | |
1098 | dzz *= 1.e-8; | |
1099 | // cout<<"cm: zm,dzz,xm,dxx,xz,dxz,qq ="<<zm<<","<<dzz<<"," | |
1100 | // <<xm<<","<<dxx<<","<<xz<<","<<dxz<<","<<qq<<endl; | |
1101 | for (i=0; i<nbins; i++) { | |
1102 | x[i] = x[i] *= scl; | |
1103 | x[i] = x[i] *= 1.e-4; | |
1104 | z[i] = z[i] *= 1.e-4; | |
1105 | } // end for i | |
1106 | // cout<<"!!! elps ="<<elps<<endl; | |
1107 | if (elps < 0.3) { // try to separate hits | |
1108 | separate = 1; | |
1109 | tmp=atan(tga); | |
1110 | Double_t cosa=cos(tmp),sina=sin(tmp); | |
1111 | Double_t a1=0., x1=0., xxx=0.; | |
1112 | for (i=0; i<nbins; i++) { | |
1113 | tmp=x[i]*cosa + z[i]*sina; | |
1114 | if (q[i] > a1) { | |
1115 | a1=q[i]; | |
1116 | x1=tmp; | |
1117 | } // end if | |
1118 | xxx += tmp*tmp*tmp*q[i]; | |
1119 | } // end for i | |
1120 | xxx /= qq; | |
1121 | Double_t z12=-sina*xm + cosa*zm; | |
1122 | sigma2=(sina*sina*xx-2*cosa*sina*xz+cosa*cosa*zz) - z12*z12; | |
1123 | xm=cosa*xm + sina*zm; | |
1124 | xx=cosa*cosa*xx + 2*cosa*sina*xz + sina*sina*zz; | |
1125 | Double_t x2=(xx - xm*x1 - sigma2)/(xm - x1); | |
1126 | Double_t r=a1*2*TMath::ACos(-1.)*sigma2/(qq*pitchx*pitchz); | |
1127 | for (i=0; i<33; i++) { // solve a system of equations | |
1128 | Double_t x1_old=x1, x2_old=x2, r_old=r; | |
1129 | Double_t c11=x1-x2; | |
1130 | Double_t c12=r; | |
1131 | Double_t c13=1-r; | |
1132 | Double_t c21=x1*x1 - x2*x2; | |
1133 | Double_t c22=2*r*x1; | |
1134 | Double_t c23=2*(1-r)*x2; | |
1135 | Double_t c31=3*sigma2*(x1-x2) + x1*x1*x1 - x2*x2*x2; | |
1136 | Double_t c32=3*r*(sigma2 + x1*x1); | |
1137 | Double_t c33=3*(1-r)*(sigma2 + x2*x2); | |
1138 | Double_t f1=-(r*x1 + (1-r)*x2 - xm); | |
1139 | Double_t f2=-(r*(sigma2+x1*x1)+(1-r)*(sigma2+x2*x2)- xx); | |
1140 | Double_t f3=-(r*x1*(3*sigma2+x1*x1)+(1-r)*x2* | |
1141 | (3*sigma2+x2*x2)-xxx); | |
1142 | Double_t d=c11*c22*c33+c21*c32*c13+c12*c23*c31- | |
1143 | c31*c22*c13 - c21*c12*c33 - c32*c23*c11; | |
1144 | if (d==0.) { | |
1145 | cout<<"*********** d=0 ***********\n"; | |
1146 | break; | |
1147 | } // end if | |
1148 | Double_t dr=f1*c22*c33 + f2*c32*c13 + c12*c23*f3 - | |
1149 | f3*c22*c13 - f2*c12*c33 - c32*c23*f1; | |
1150 | Double_t d1=c11*f2*c33 + c21*f3*c13 + f1*c23*c31 - | |
1151 | c31*f2*c13 - c21*f1*c33 - f3*c23*c11; | |
1152 | Double_t d2=c11*c22*f3 + c21*c32*f1 + c12*f2*c31 - | |
1153 | c31*c22*f1 - c21*c12*f3 - c32*f2*c11; | |
1154 | r += dr/d; | |
1155 | x1 += d1/d; | |
1156 | x2 += d2/d; | |
1157 | if (fabs(x1-x1_old) > 0.0001) continue; | |
1158 | if (fabs(x2-x2_old) > 0.0001) continue; | |
1159 | if (fabs(r-r_old)/5 > 0.001) continue; | |
1160 | a1=r*qq*pitchx*pitchz/(2*TMath::ACos(-1.)*sigma2); | |
1161 | Double_t a2=a1*(1-r)/r; | |
1162 | qfit[0]=a1; xfit[0]=x1*cosa - z12*sina; zfit[0]=x1*sina + | |
1163 | z12*cosa; | |
1164 | qfit[1]=a2; xfit[1]=x2*cosa - z12*sina; zfit[1]=x2*sina + | |
1165 | z12*cosa; | |
1166 | nfhits=2; | |
1167 | break; // Ok ! | |
1168 | } // end for i | |
1169 | if (i==33) cerr<<"No more iterations ! "<<endl; | |
1170 | } // end of attempt to separate overlapped clusters | |
1171 | } // end of nbins cut | |
1172 | if(elps < 0.) cout<<" elps=-1 ="<<elps<<endl; | |
1173 | if(elps >0. && elps< 0.3 && nfhits == 1) cout<<" small elps, nfh=1 =" | |
1174 | <<elps<<","<<nfhits<<endl; | |
1175 | if(nfhits == 2) cout<<" nfhits=2 ="<<nfhits<<endl; | |
1176 | for (i=0; i<nfhits; i++) { | |
1177 | xfit[i] *= (1.e+4/scl); | |
1178 | if(wing == 1) xfit[i] *= (-1); | |
1179 | zfit[i] *= 1.e+4; | |
1180 | // cout<<" --------- i,xfiti,zfiti,qfiti ="<<i<<"," | |
1181 | // <<xfit[i]<<","<<zfit[i]<<","<<qfit[i]<<endl; | |
1182 | } // end for i | |
1183 | Int_t ncl = nfhits; | |
1184 | if(nfhits == 1 && separate == 1) { | |
1185 | cout<<"!!!!! no separate"<<endl; | |
1186 | ncl = -2; | |
1187 | } // end if | |
1188 | if(nfhits == 2) { | |
1189 | cout << "Split cluster: " << endl; | |
1190 | clusterJ->PrintInfo(); | |
1191 | cout << " in: " << endl; | |
1192 | for (i=0; i<nfhits; i++) { | |
1193 | // AliITSRawClusterSDD *clust = new AliITSRawClusterSDD(wing, | |
42da2935 | 1194 | -1,-1,(Float_t)qfit[i],ncl,0,0, |
1195 | (Float_t)xfit[i], | |
1196 | (Float_t)zfit[i],0,0,0,0, | |
1197 | tstart,tstop,astart,astop); | |
50d05d7b | 1198 | // AliITSRawClusterSDD *clust = new AliITSRawClusterSDD(wing,-1, |
1199 | // -1,(Float_t)qfit[i],0,0,0, | |
1200 | // (Float_t)xfit[i], | |
1201 | // (Float_t)zfit[i],0,0,0,0, | |
1202 | // tstart,tstop,astart,astop,ncl); | |
1203 | // ??????????? | |
1204 | // if(wing == 1) xfit[i] *= (-1); | |
1205 | Float_t Anode = (zfit[i]/anodePitch+fNofAnodes/2-0.5); | |
1206 | Float_t Time = (fSddLength - xfit[i])/fDriftSpeed; | |
1207 | Float_t clusterPeakAmplitude = clusterJ->PeakAmpl(); | |
1208 | Float_t peakpos = clusterJ->PeakPos(); | |
1209 | Float_t clusteranodePath = (Anode - fNofAnodes/2)*anodePitch; | |
1210 | Float_t clusterDriftPath = Time*fDriftSpeed; | |
1211 | clusterDriftPath = fSddLength-clusterDriftPath; | |
1212 | AliITSRawClusterSDD *clust = new AliITSRawClusterSDD(wing,Anode, | |
1213 | Time,qfit[i], | |
42da2935 | 1214 | clusterPeakAmplitude,peakpos, |
1215 | 0.,0.,clusterDriftPath, | |
1216 | clusteranodePath,clusterJ->Samples()/2 | |
50d05d7b | 1217 | ,tstart,tstop,0,0,0,astart,astop); |
1218 | clust->PrintInfo(); | |
1219 | iTS->AddCluster(1,clust); | |
1220 | // cout<<"new cluster added: tstart,tstop,astart,astop,x,ncl =" | |
1221 | // <<tstart<<","<<tstop<<","<<astart<<","<<astop<<","<<xfit[i] | |
1222 | // <<","<<ncl<<endl; | |
1223 | delete clust; | |
1224 | }// nfhits loop | |
1225 | fClusters->RemoveAt(j); | |
42da2935 | 1226 | } // if nfhits = 2 |
1227 | } // cluster loop | |
1228 | fClusters->Compress(); | |
1229 | fMap->ClearMap(); | |
1230 | */ | |
1231 | return; | |
a1f090e0 | 1232 | } |
42da2935 | 1233 | //______________________________________________________________________ |
1234 | void AliITSClusterFinderSDD::GetRecPoints(){ | |
1235 | // get rec points | |
1236 | static AliITS *iTS=(AliITS*)gAlice->GetModule("ITS"); | |
1237 | // get number of clusters for this module | |
1238 | Int_t nofClusters = fClusters->GetEntriesFast(); | |
1239 | nofClusters -= fNclusters; | |
1240 | const Float_t kconvGeV = 1.e-6; // GeV -> KeV | |
1241 | const Float_t kconv = 1.0e-4; | |
1242 | const Float_t kRMSx = 38.0*kconv; // microns->cm ITS TDR Table 1.3 | |
1243 | const Float_t kRMSz = 28.0*kconv; // microns->cm ITS TDR Table 1.3 | |
ee86d557 | 1244 | Int_t i,j; |
42da2935 | 1245 | Int_t ix, iz, idx=-1; |
1246 | AliITSdigitSDD *dig=0; | |
1247 | Int_t ndigits=fDigits->GetEntriesFast(); | |
1248 | for(i=0; i<nofClusters; i++) { | |
50d05d7b | 1249 | AliITSRawClusterSDD *clusterI = (AliITSRawClusterSDD*)fClusters->At(i); |
1250 | if(!clusterI) Error("SDD: GetRecPoints","i clusterI ",i,clusterI); | |
1251 | if(clusterI) idx=clusterI->PeakPos(); | |
1252 | if(idx>ndigits) Error("SDD: GetRecPoints","idx ndigits",idx,ndigits); | |
1253 | // try peak neighbours - to be done | |
1254 | if(idx&&idx<= ndigits) dig =(AliITSdigitSDD*)fDigits->UncheckedAt(idx); | |
1255 | if(!dig) { | |
1256 | // try cog | |
1257 | fSegmentation->GetPadIxz(clusterI->X(),clusterI->Z(),ix,iz); | |
1258 | dig = (AliITSdigitSDD*)fMap->GetHit(iz-1,ix-1); | |
1259 | // if null try neighbours | |
1260 | if (!dig) dig = (AliITSdigitSDD*)fMap->GetHit(iz-1,ix); | |
1261 | if (!dig) dig = (AliITSdigitSDD*)fMap->GetHit(iz-1,ix+1); | |
1262 | if (!dig) printf("SDD: cannot assign the track number!\n"); | |
1263 | } // end if !dig | |
1264 | AliITSRecPoint rnew; | |
1265 | rnew.SetX(clusterI->X()); | |
1266 | rnew.SetZ(clusterI->Z()); | |
1267 | rnew.SetQ(clusterI->Q()); // in KeV - should be ADC | |
1268 | rnew.SetdEdX(kconvGeV*clusterI->Q()); | |
1269 | rnew.SetSigmaX2(kRMSx*kRMSx); | |
1270 | rnew.SetSigmaZ2(kRMSz*kRMSz); | |
ee86d557 | 1271 | if(dig){ |
1272 | rnew.fTracks[0] = dig->fTracks[0]; | |
1273 | rnew.fTracks[1] = -3; | |
1274 | rnew.fTracks[2] = -3; | |
1275 | j=1; | |
1276 | while(rnew.fTracks[0]==dig->fTracks[j] && | |
1277 | j<dig->GetNTracks()) j++; | |
1278 | if(j<dig->GetNTracks()){ | |
1279 | rnew.fTracks[1] = dig->fTracks[j]; | |
f8d9a5b8 | 1280 | while((rnew.fTracks[0]==dig->fTracks[j] || |
1281 | rnew.fTracks[1]==dig->fTracks[j] )&& | |
ee86d557 | 1282 | j<dig->GetNTracks()) j++; |
1283 | if(j<dig->GetNTracks()) rnew.fTracks[2] = dig->fTracks[j]; | |
1284 | } // end if | |
1285 | } // end if | |
50d05d7b | 1286 | //printf("SDD: i %d track1 track2 track3 %d %d %d x y %f %f\n", |
1287 | // i,rnew.fTracks[0],rnew.fTracks[1],rnew.fTracks[2],c | |
1288 | // lusterI->X(),clusterI->Z()); | |
1289 | iTS->AddRecPoint(rnew); | |
42da2935 | 1290 | } // I clusters |
50d05d7b | 1291 | // fMap->ClearMap(); |
b0f5e3fc | 1292 | } |
42da2935 | 1293 | //______________________________________________________________________ |
1294 | void AliITSClusterFinderSDD::FindRawClusters(Int_t mod){ | |
1295 | // find raw clusters | |
50d05d7b | 1296 | |
1297 | fModule = mod; | |
1298 | ||
a1f090e0 | 1299 | Find1DClustersE(); |
b0f5e3fc | 1300 | GroupClusters(); |
1301 | SelectClusters(); | |
a1f090e0 | 1302 | ResolveClustersE(); |
b0f5e3fc | 1303 | GetRecPoints(); |
1304 | } | |
42da2935 | 1305 | //_______________________________________________________________________ |
bf3f2830 | 1306 | void AliITSClusterFinderSDD::Print() const{ |
42da2935 | 1307 | // Print SDD cluster finder Parameters |
1308 | ||
1309 | cout << "**************************************************" << endl; | |
1310 | cout << " Silicon Drift Detector Cluster Finder Parameters " << endl; | |
1311 | cout << "**************************************************" << endl; | |
1312 | cout << "Number of Clusters: " << fNclusters << endl; | |
1313 | cout << "Anode Tolerance: " << fDAnode << endl; | |
1314 | cout << "Time Tolerance: " << fDTime << endl; | |
1315 | cout << "Time correction (electronics): " << fTimeCorr << endl; | |
1316 | cout << "Cut Amplitude (threshold): " << fCutAmplitude << endl; | |
1317 | cout << "Minimum Amplitude: " << fMinPeak << endl; | |
1318 | cout << "Minimum Charge: " << fMinCharge << endl; | |
1319 | cout << "Minimum number of cells/clusters: " << fMinNCells << endl; | |
1320 | cout << "Maximum number of cells/clusters: " << fMaxNCells << endl; | |
1321 | cout << "**************************************************" << endl; | |
a1f090e0 | 1322 | } |