]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSClusterFinderSDD.cxx
Bug fix (Vladimir Pospisil)
[u/mrichter/AliRoot.git] / ITS / AliITSClusterFinderSDD.cxx
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 /*
16   $Id$
17  */
18 /////////////////////////////////////////////////////////////////////////// 
19 //  Cluster finder                                                       //
20 //  for Silicon                                                          //
21 //  Drift Detector                                                       //
22 ////////////////////////////////////////////////////////////////////////// 
23
24
25 #include "AliITSClusterFinderSDD.h"
26 #include "AliITSMapA1.h"
27 #include "AliITSRawClusterSDD.h"
28 #include "AliITSRecPoint.h"
29 #include "AliITSdigitSDD.h"
30 #include "AliITSDetTypeRec.h"
31 #include "AliITSCalibrationSDD.h"
32 #include "AliITSsegmentationSDD.h"
33 #include "AliITSgeom.h"
34 #include "AliLog.h"
35
36 ClassImp(AliITSClusterFinderSDD)
37
38 //______________________________________________________________________
39 AliITSClusterFinderSDD::AliITSClusterFinderSDD():
40 AliITSClusterFinder(),
41 fNclusters(0),
42 fDAnode(0.0),
43 fDTime(0.0),
44 fTimeCorr(0.0),
45 fCutAmplitude(0),
46 fMinPeak(0),
47 fMinCharge(0),
48 fMinNCells(0),
49 fMaxNCells(0){
50     // default constructor
51 }
52 //______________________________________________________________________
53 AliITSClusterFinderSDD::AliITSClusterFinderSDD(AliITSDetTypeRec* dettyp,
54                                                TClonesArray *digits,
55                                                TClonesArray *recp):
56 AliITSClusterFinder(dettyp),
57 fNclusters(0),
58 fDAnode(0.0),
59 fDTime(0.0),
60 fTimeCorr(0.0),
61 fCutAmplitude(0),
62 fMinPeak(0),
63 fMinCharge(0),
64 fMinNCells(0),
65 fMaxNCells(0){
66     // standard constructor
67
68     SetDigits(digits);
69     SetClusters(recp);
70     SetCutAmplitude(fDetTypeRec->GetITSgeom()->GetStartSDD());
71     SetDAnode();
72     SetDTime();
73     SetMinPeak((Int_t)((AliITSCalibrationSDD*)GetResp(fDetTypeRec->GetITSgeom()->GetStartSDD()))->GetNoiseAfterElectronics(0)*5);
74     SetMinNCells();
75     SetMaxNCells();
76     SetTimeCorr();
77     SetMinCharge();
78     SetMap(new AliITSMapA1(GetSeg(),Digits(),fCutAmplitude));
79 }
80 //______________________________________________________________________
81 void AliITSClusterFinderSDD::SetCutAmplitude(Int_t mod,Double_t nsigma){
82     // set the signal threshold for cluster finder
83     Double_t baseline,noiseAfterEl;
84
85     AliITSresponseSDD* res  = (AliITSresponseSDD*)((AliITSCalibrationSDD*)GetResp(mod))->GetResponse();
86     const char *option=res->ZeroSuppOption();
87     Int_t nanodes = GetResp(mod)->Wings()*GetResp(mod)->Channels()*GetResp(mod)->Chips();
88     fCutAmplitude.Set(nanodes);
89     for(Int_t ian=0;ian<nanodes;ian++){
90       noiseAfterEl = ((AliITSCalibrationSDD*)GetResp(mod))->GetNoiseAfterElectronics(ian);
91       if((strstr(option,"1D")) || (strstr(option,"2D"))){ 
92         fCutAmplitude[ian] = (Int_t)(nsigma*noiseAfterEl);
93       }
94       else{
95         baseline=GetResp(mod)->GetBaseline(ian);
96         fCutAmplitude[ian] = (Int_t)((baseline + nsigma*noiseAfterEl));
97       } 
98     }
99 }
100 //______________________________________________________________________
101 void AliITSClusterFinderSDD::Find1DClusters(){
102     // find 1D clusters
103   
104     // retrieve the parameters 
105     Int_t fNofMaps       = GetSeg()->Npz();
106     Int_t fMaxNofSamples = GetSeg()->Npx();
107     Int_t fNofAnodes     = fNofMaps/2;
108     Int_t dummy          = 0;
109     Double_t fTimeStep    = GetSeg()->Dpx(dummy);
110     Double_t fSddLength   = GetSeg()->Dx();
111     AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule);
112     AliITSresponseSDD* res  = (AliITSresponseSDD*)((AliITSCalibrationSDD*)GetResp(fModule))->GetResponse();
113     const char *option=res->ZeroSuppOption();
114
115     // map the signal
116     Map()->ClearMap();
117     Map()->SetThresholdArr(fCutAmplitude);
118     Map()->FillMap2();
119   
120     Int_t nofFoundClusters = 0;
121     Int_t i;
122     Double_t **dfadc = new Double_t*[fNofAnodes];
123     for(i=0;i<fNofAnodes;i++) dfadc[i] = new Double_t[fMaxNofSamples];
124     Double_t fadc  = 0.;
125     Double_t fadc1 = 0.;
126     Double_t fadc2 = 0.;
127     Int_t j,k,idx,l,m;
128     for(j=0;j<2;j++) {
129         for(k=0;k<fNofAnodes;k++) {
130             idx = j*fNofAnodes+k;
131             // signal (fadc) & derivative (dfadc)
132             dfadc[k][255]=0.;
133             for(l=0; l<fMaxNofSamples; l++) {
134                 fadc2=(Double_t)Map()->GetSignal(idx,l);
135                 if(l>0) fadc1=(Double_t)Map()->GetSignal(idx,l-1);
136                 if(l>0) dfadc[k][l-1] = fadc2-fadc1;
137             } // samples
138         } // anodes
139
140         for(k=0;k<fNofAnodes;k++) {
141             AliDebug(5,Form("Anode: %d, Wing: %d",k+1,j+1));
142             idx = j*fNofAnodes+k;
143             Int_t imax  = 0;
144             Int_t imaxd = 0;
145             Int_t it    = 0;
146             while(it <= fMaxNofSamples-3) {
147                 imax  = it;
148                 imaxd = it;
149                 // maximum of signal          
150                 Double_t fadcmax  = 0.;
151                 Double_t dfadcmax = 0.;
152                 Int_t lthrmina   = 1;
153                 Int_t lthrmint   = 3;
154                 Int_t lthra      = 1;
155                 Int_t lthrt      = 0;
156                 for(m=0;m<20;m++) {
157                     Int_t id = it+m;
158                     if(id>=fMaxNofSamples) break;
159                     fadc=(float)Map()->GetSignal(idx,id);
160                     if(fadc > fadcmax) { fadcmax = fadc; imax = id;}
161                     if(fadc > (float)fCutAmplitude[idx])lthrt++; 
162                     if(dfadc[k][id] > dfadcmax) {
163                         dfadcmax = dfadc[k][id];
164                         imaxd    = id;
165                     } // end if
166                 } // end for m
167                 it = imaxd;
168                 if(Map()->TestHit(idx,imax) == kEmpty) {it++; continue;}
169                 // cluster charge
170                 Int_t tstart = it-2;
171                 if(tstart < 0) tstart = 0;
172                 Bool_t ilcl = 0;
173                 if(lthrt >= lthrmint && lthra >= lthrmina) ilcl = 1;
174                 if(ilcl) {
175                     nofFoundClusters++;
176                     Int_t tstop      = tstart;
177                     Double_t dfadcmin = 10000.;
178                     Int_t ij;
179                     for(ij=0; ij<20; ij++) {
180                         if(tstart+ij > 255) { tstop = 255; break; }
181                         fadc=(float)Map()->GetSignal(idx,tstart+ij);
182                         if((dfadc[k][tstart+ij] < dfadcmin) && 
183                            (fadc > fCutAmplitude[idx])) {
184                             tstop = tstart+ij+5;
185                             if(tstop > 255) tstop = 255;
186                             dfadcmin = dfadc[k][it+ij];
187                         } // end if
188                     } // end for ij
189
190                     Double_t clusterCharge = 0.;
191                     Double_t clusterAnode  = k+0.5;
192                     Double_t clusterTime   = 0.;
193                     Int_t   clusterMult   = 0;
194                     Double_t clusterPeakAmplitude = 0.;
195                     Int_t its,peakpos     = -1;
196                                    
197                     for(its=tstart; its<=tstop; its++) {
198                         fadc=(float)Map()->GetSignal(idx,its);
199                         if(!((strstr(option,"1D")) || (strstr(option,"2D")))){
200                           Double_t baseline=GetResp(fModule)->GetBaseline(idx);
201                           if(fadc>baseline) fadc -= baseline;
202                           else fadc = 0.;
203                         }
204                         clusterCharge += fadc;
205                         // as a matter of fact we should take the peak
206                         // pos before FFT
207                         // to get the list of tracks !!!
208                         if(fadc > clusterPeakAmplitude) {
209                             clusterPeakAmplitude = fadc;
210                             //peakpos=Map()->GetHitIndex(idx,its);
211                             Int_t shift = (int)(fTimeCorr/fTimeStep);
212                             if(its>shift && its<(fMaxNofSamples-shift))
213                                 peakpos  = Map()->GetHitIndex(idx,its+shift);
214                             else peakpos = Map()->GetHitIndex(idx,its);
215                             if(peakpos<0) peakpos =Map()->GetHitIndex(idx,its);
216                         } // end if
217                         clusterTime += fadc*its;
218                         if(fadc > 0) clusterMult++;
219                         if(its == tstop) {
220                             clusterTime /= (clusterCharge/fTimeStep);   // ns
221                             if(clusterTime>fTimeCorr) clusterTime -=fTimeCorr;
222                             //ns
223                         } // end if
224                     } // end for its
225                     Float_t theAnode=clusterAnode+j*fNofAnodes;
226                     Double_t clusteranodePath = GetSeg()->GetLocalZFromAnode(theAnode);
227                     Double_t clusterDriftPath = (Double_t)cal->GetDriftPath(clusterTime,clusteranodePath);
228                     clusterDriftPath = fSddLength-clusterDriftPath;
229                     if(clusterCharge <= 0.) break;
230                     AliITSRawClusterSDD clust(j+1,//i
231                                               clusterAnode,clusterTime,//ff
232                                               clusterCharge, //f
233                                               clusterPeakAmplitude, //f
234                                               peakpos, //i
235                                               0.,0.,clusterDriftPath,//fff
236                                               clusteranodePath, //f
237                                               clusterMult, //i
238                                               0,0,0,0,0,0,0);//7*i
239                     fDetTypeRec->AddCluster(1,&clust);
240                     it = tstop;
241                 } // ilcl
242                 it++;
243             } // while (samples)
244         } // anodes
245     } // detectors (2)
246
247     for(i=0;i<fNofAnodes;i++) delete[] dfadc[i];
248     delete [] dfadc;
249
250     return;
251 }
252 //______________________________________________________________________
253 void AliITSClusterFinderSDD::Find1DClustersE(){
254     // find 1D clusters
255     // retrieve the parameters 
256     Int_t fNofMaps = GetSeg()->Npz();
257     Int_t fMaxNofSamples = GetSeg()->Npx();
258     Int_t fNofAnodes = fNofMaps/2;
259     Int_t dummy=0;
260     Double_t fTimeStep = GetSeg()->Dpx( dummy );
261     Double_t fSddLength = GetSeg()->Dx();
262     AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule);
263     Map()->ClearMap();
264     Map()->SetThresholdArr( fCutAmplitude );
265     Map()->FillMap2();
266
267     AliITSresponseSDD* res  = (AliITSresponseSDD*)cal->GetResponse();
268     const char *option=res->ZeroSuppOption();
269
270     Int_t nClu = 0;
271     //        cout << "Search  cluster... "<< endl;
272     for( Int_t j=0; j<2; j++ ){
273         for( Int_t k=0; k<fNofAnodes; k++ ){
274             Int_t idx = j*fNofAnodes+k;     
275             Bool_t on = kFALSE;
276             Int_t start = 0;
277             Int_t nTsteps = 0;
278             Double_t fmax = 0.;
279             Int_t lmax = 0;
280             Double_t charge = 0.;
281             Double_t time = 0.;
282             Double_t anode = k+0.5;
283             Int_t peakpos = -1;
284             for( Int_t l=0; l<fMaxNofSamples; l++ ){
285                 Double_t fadc = (Double_t)Map()->GetSignal( idx, l );
286                 if( fadc > 0.0 ){
287                     if( on == kFALSE && l<fMaxNofSamples-4){
288                         // star RawCluster (reset var.)
289                         Double_t fadc1 = (Double_t)Map()->GetSignal( idx, l+1 );
290                         if( fadc1 < fadc ) continue;
291                         start = l;
292                         fmax = 0.;
293                         lmax = 0;
294                         time = 0.;
295                         charge = 0.; 
296                         on = kTRUE; 
297                         nTsteps = 0;
298                     } // end if on...
299                     nTsteps++ ;
300                     if(!((strstr(option,"1D")) || (strstr(option,"2D")))){
301                       Double_t baseline=GetResp(fModule)->GetBaseline(idx);
302                       if( fadc > baseline ) fadc -= baseline;
303                       else fadc=0.;
304                     }
305                     charge += fadc;
306                     time += fadc*l;
307                     if( fadc > fmax ){ 
308                         fmax = fadc; 
309                         lmax = l; 
310                         Int_t shift = (Int_t)(fTimeCorr/fTimeStep + 0.5);
311                         if( l > shift && l < (fMaxNofSamples-shift) )  
312                             peakpos = Map()->GetHitIndex( idx, l+shift );
313                         else
314                             peakpos = Map()->GetHitIndex( idx, l );
315                         if( peakpos < 0) peakpos = Map()->GetHitIndex(idx,l);
316                     } // end if fadc
317                 }else{ // end fadc>0
318                     if( on == kTRUE ){        
319                         if( nTsteps > 2 ){
320                             //  min # of timesteps for a RawCluster
321                             // Found a RawCluster...
322                             Int_t stop = l-1;
323                             time /= (charge/fTimeStep);   // ns
324                                 // time = lmax*fTimeStep;   // ns
325                             if( time > fTimeCorr ) time -= fTimeCorr;   // ns
326                             Float_t theAnode=anode+j*fNofAnodes;
327                             Double_t anodePath =GetSeg()->GetLocalZFromAnode(theAnode);
328                             Double_t driftPath = (Double_t)cal->GetDriftPath(time,anode);
329                             driftPath = fSddLength-driftPath;
330                             AliITSRawClusterSDD clust(j+1,anode,time,charge,
331                                                       fmax, peakpos,0.,0.,
332                                                       driftPath,anodePath,
333                                                       nTsteps,start,stop,
334                                                       start, stop, 1, k, k );
335                             fDetTypeRec->AddCluster( 1, &clust );
336                             if(AliDebugLevel()>=5) clust.PrintInfo();
337                             nClu++;
338                         } // end if nTsteps
339                         on = kFALSE;
340                     } // end if on==kTRUE
341                 } // end if fadc>0
342             } // samples
343         } // anodes
344     } // wings
345     AliDebug(3,Form("# Rawclusters %d",nClu));         
346     return; 
347 }
348 //_______________________________________________________________________
349 Int_t AliITSClusterFinderSDD::SearchPeak(Double_t *spect,Int_t xdim,Int_t zdim,
350                                          Int_t *peakX, Int_t *peakZ, 
351                                          Double_t *peakAmp, Double_t minpeak ){
352     // search peaks on a 2D cluster
353     Int_t npeak = 0;    // # peaks
354     Int_t i,j;
355     // search peaks
356     for( Int_t z=1; z<zdim-1; z++ ){
357         for( Int_t x=1; x<xdim-2; x++ ){
358             Double_t sxz = spect[x*zdim+z];
359             Double_t sxz1 = spect[(x+1)*zdim+z];
360             Double_t sxz2 = spect[(x-1)*zdim+z];
361             // search a local max. in s[x,z]
362             if( sxz < minpeak || sxz1 <= 0 || sxz2 <= 0 ) continue;
363             if( sxz >= spect[(x+1)*zdim+z  ] && sxz >= spect[(x-1)*zdim+z  ] &&
364                 sxz >= spect[x*zdim    +z+1] && sxz >= spect[x*zdim    +z-1] &&
365                 sxz >= spect[(x+1)*zdim+z+1] && sxz >= spect[(x+1)*zdim+z-1] &&
366                 sxz >= spect[(x-1)*zdim+z+1] && sxz >= spect[(x-1)*zdim+z-1] ){
367                 // peak found
368                 peakX[npeak] = x;
369                 peakZ[npeak] = z;
370                 peakAmp[npeak] = sxz;
371                 npeak++;
372             } // end if ....
373         } // end for x
374     } // end for z
375     // search groups of peaks with same amplitude.
376     Int_t *flag = new Int_t[npeak];
377     for( i=0; i<npeak; i++ ) flag[i] = 0;
378     for( i=0; i<npeak; i++ ){
379         for( j=0; j<npeak; j++ ){
380             if( i==j) continue;
381             if( flag[j] > 0 ) continue;
382             if( peakAmp[i] == peakAmp[j] && 
383                 TMath::Abs(peakX[i]-peakX[j])<=1 && 
384                 TMath::Abs(peakZ[i]-peakZ[j])<=1 ){
385                 if( flag[i] == 0) flag[i] = i+1;
386                 flag[j] = flag[i];
387             } // end if ...
388         } // end for j
389     } // end for i
390     // make average of peak groups        
391     for( i=0; i<npeak; i++ ){
392         Int_t nFlag = 1;
393         if( flag[i] <= 0 ) continue;
394         for( j=0; j<npeak; j++ ){
395             if( i==j ) continue;
396             if( flag[j] != flag[i] ) continue;
397             peakX[i] += peakX[j];
398             peakZ[i] += peakZ[j];
399             nFlag++;
400             npeak--;
401             for( Int_t k=j; k<npeak; k++ ){
402                 peakX[k] = peakX[k+1];
403                 peakZ[k] = peakZ[k+1];
404                 peakAmp[k] = peakAmp[k+1];
405                 flag[k] = flag[k+1];
406             } // end for k        
407             j--;
408         } // end for j
409         if( nFlag > 1 ){
410             peakX[i] /= nFlag;
411             peakZ[i] /= nFlag;
412         } // end fi nFlag
413     } // end for i
414     delete [] flag;
415     return( npeak );
416 }
417 //______________________________________________________________________
418 void AliITSClusterFinderSDD::PeakFunc( Int_t xdim, Int_t zdim, Double_t *par,
419                                        Double_t *spe, Double_t *integral){
420     // function used to fit the clusters
421     // par -> parameters..
422     // par[0]  number of peaks.
423     // for each peak i=1, ..., par[0]
424     //                 par[i] = Ampl.
425     //                 par[i+1] = xpos
426     //                 par[i+2] = zpos
427     //                 par[i+3] = tau
428     //                 par[i+4] = sigma.
429     Int_t electronics = GetResp(fModule)->GetElectronics(); // 1 = PASCAL, 2 = OLA
430     const Int_t knParam = 5;
431     Int_t npeak = (Int_t)par[0];
432
433     memset( spe, 0, sizeof( Double_t )*zdim*xdim );
434
435     Int_t k = 1;
436     for( Int_t i=0; i<npeak; i++ ){
437         if( integral != 0 ) integral[i] = 0.;
438         Double_t sigmaA2 = par[k+4]*par[k+4]*2.;
439         Double_t t2 = par[k+3];   // PASCAL
440         if( electronics == 2 ) { t2 *= t2; t2 *= 2; } // OLA
441         for( Int_t z=0; z<zdim; z++ ){
442             for( Int_t x=0; x<xdim; x++ ){
443                 Double_t z2 = (z-par[k+2])*(z-par[k+2])/sigmaA2;
444                 Double_t x2 = 0.;
445                 Double_t signal = 0.;
446                 if( electronics == 1 ){ // PASCAL
447                     x2 = (x-par[k+1]+t2)/t2;
448                     signal = (x2>0.) ? par[k]*x2*exp(-x2+1.-z2) :0.0; // RCCR2
449                 //  signal =(x2>0.) ? par[k]*x2*x2*exp(-2*x2+2.-z2 ):0.0;//RCCR
450                 }else if( electronics == 2 ) { // OLA
451                     x2 = (x-par[k+1])*(x-par[k+1])/t2;
452                     signal = par[k]  * exp( -x2 - z2 );
453                 } else {
454                     Warning("PeakFunc","Wrong SDD Electronics = %d",
455                             electronics);
456                     // exit( 1 );
457                 } // end if electronicx
458                 spe[x*zdim+z] += signal;
459                 if( integral != 0 ) integral[i] += signal;
460             } // end for x
461         } // end for z
462         k += knParam;
463     } // end for i
464     return;
465 }
466 //__________________________________________________________________________
467 Double_t AliITSClusterFinderSDD::ChiSqr( Int_t xdim, Int_t zdim, Double_t *spe,
468                                         Double_t *speFit ) const{
469     // EVALUATES UNNORMALIZED CHI-SQUARED
470     Double_t chi2 = 0.;
471     for( Int_t z=0; z<zdim; z++ ){
472         for( Int_t x=1; x<xdim-1; x++ ){
473             Int_t index = x*zdim+z;
474             Double_t tmp = spe[index] - speFit[index];
475             chi2 += tmp*tmp;
476         } // end for x
477     } // end for z
478     return( chi2 );
479 }
480 //_______________________________________________________________________
481 void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Double_t *param,
482                                     Double_t *prm0,Double_t *steprm,
483                                     Double_t *chisqr,Double_t *spe,
484                                     Double_t *speFit ){
485     // 
486     Int_t   k, nnn, mmm, i;
487     Double_t p1, delta, d1, chisq1, p2, chisq2, t, p3, chisq3, a, b, p0, chisqt;
488     const Int_t knParam = 5;
489     Int_t npeak = (Int_t)param[0];
490     for( k=1; k<(npeak*knParam+1); k++ ) prm0[k] = param[k];
491     for( k=1; k<(npeak*knParam+1); k++ ){
492         p1 = param[k];
493         delta = steprm[k];
494         d1 = delta;
495         // ENSURE THAT STEP SIZE IS SENSIBLY LARGER THAN MACHINE ROUND OFF
496         if( TMath::Abs( p1 ) > 1.0E-6 ) 
497             if ( TMath::Abs( delta/p1 ) < 1.0E-4 ) delta = p1/1000;
498             else  delta = (Double_t)1.0E-4;
499         //  EVALUATE CHI-SQUARED AT FIRST TWO SEARCH POINTS
500         PeakFunc( xdim, zdim, param, speFit );
501         chisq1 = ChiSqr( xdim, zdim, spe, speFit );
502         p2 = p1+delta;
503         param[k] = p2;
504         PeakFunc( xdim, zdim, param, speFit );
505         chisq2 = ChiSqr( xdim, zdim, spe, speFit );
506         if( chisq1 < chisq2 ){
507             // REVERSE DIRECTION OF SEARCH IF CHI-SQUARED IS INCREASING
508             delta = -delta;
509             t = p1;
510             p1 = p2;
511             p2 = t;
512             t = chisq1;
513             chisq1 = chisq2;
514             chisq2 = t;
515         } // end if
516         i = 1; nnn = 0;
517         do {   // INCREMENT param(K) UNTIL CHI-SQUARED STARTS TO INCREASE
518             nnn++;
519             p3 = p2 + delta;
520             mmm = nnn - (nnn/5)*5;  // multiplo de 5
521             if( mmm == 0 ){
522                 d1 = delta;
523                 // INCREASE STEP SIZE IF STEPPING TOWARDS MINIMUM IS TOO SLOW 
524                 delta *= 5;
525             } // end if
526             param[k] = p3;
527             // Constrain paramiters
528             Int_t kpos = (k-1) % knParam;
529             switch( kpos ){
530             case 0 :
531                 if( param[k] <= 20 ) param[k] = fMinPeak;
532                 break;
533             case 1 :
534                 if( TMath::Abs( param[k] - prm0[k] ) > 1.5 ) param[k] = prm0[k];
535                 break;
536             case 2 :
537                 if( TMath::Abs( param[k] - prm0[k] ) > 1. ) param[k] = prm0[k];
538                 break;
539             case 3 :
540                 if( param[k] < .5 ) param[k] = .5;        
541                 break;
542             case 4 :
543                 if( param[k] < .288 ) param[k] = .288;// 1/sqrt(12) = 0.288
544                 if( param[k] > zdim*.5 ) param[k] = zdim*.5;
545                 break;
546             }; // end switch
547             PeakFunc( xdim, zdim, param, speFit );
548             chisq3 = ChiSqr( xdim, zdim, spe, speFit );
549             if( chisq3 < chisq2 && nnn < 50 ){
550                 p1 = p2;
551                 p2 = p3;
552                 chisq1 = chisq2;
553                 chisq2 = chisq3;
554             }else i=0;
555         } while( i );
556         // FIND MINIMUM OF PARABOLA DEFINED BY LAST THREE POINTS
557         a = chisq1*(p2-p3)+chisq2*(p3-p1)+chisq3*(p1-p2);
558         b = chisq1*(p2*p2-p3*p3)+chisq2*(p3*p3-p1*p1)+chisq3*(p1*p1-p2*p2);
559         if( a!=0 ) p0 = (Double_t)(0.5*b/a);
560         else p0 = 10000;
561         //--IN CASE OF NEARLY EQUAL CHI-SQUARED AND TOO SMALL STEP SIZE PREVENT
562         //   ERRONEOUS EVALUATION OF PARABOLA MINIMUM
563         //---NEXT TWO LINES CAN BE OMITTED FOR HIGHER PRECISION MACHINES
564         //dp = (Double_t) max (TMath::Abs(p3-p2), TMath::Abs(p2-p1));
565         //if( TMath::Abs( p2-p0 ) > dp ) p0 = p2;
566         param[k] = p0;
567         // Constrain paramiters
568         Int_t kpos = (k-1) % knParam;
569         switch( kpos ){
570         case 0 :
571             if( param[k] <= 20 ) param[k] = fMinPeak;   
572             break;
573         case 1 :
574             if( TMath::Abs( param[k] - prm0[k] ) > 1.5 ) param[k] = prm0[k];
575             break;
576         case 2 :
577             if( TMath::Abs( param[k] - prm0[k] ) > 1. ) param[k] = prm0[k];
578             break;
579         case 3 :
580             if( param[k] < .5 ) param[k] = .5;        
581             break;
582         case 4 :
583             if( param[k] < .288 ) param[k] = .288;  // 1/sqrt(12) = 0.288
584             if( param[k] > zdim*.5 ) param[k] = zdim*.5;
585             break;
586         }; // end switch
587         PeakFunc( xdim, zdim, param, speFit );
588         chisqt = ChiSqr( xdim, zdim, spe, speFit );
589         // DO NOT ALLOW ERRONEOUS INTERPOLATION
590         if( chisqt <= *chisqr ) *chisqr = chisqt;
591         else param[k] = prm0[k];
592         // OPTIMIZE SEARCH STEP FOR EVENTUAL NEXT CALL OF MINIM
593         steprm[k] = (param[k]-prm0[k])/5;
594         if( steprm[k] >= d1 ) steprm[k] = d1/5;
595     } // end for k
596     // EVALUATE FIT AND CHI-SQUARED FOR OPTIMIZED PARAMETERS
597     PeakFunc( xdim, zdim, param, speFit );
598     *chisqr = ChiSqr( xdim, zdim, spe, speFit );
599     return;
600 }
601 //_________________________________________________________________________
602 Int_t AliITSClusterFinderSDD::NoLinearFit( Int_t xdim, Int_t zdim, 
603                                            Double_t *param, Double_t *spe, 
604                                            Int_t *niter, Double_t *chir ){
605     // fit method from Comput. Phys. Commun 46(1987) 149
606     const Double_t kchilmt = 0.01;  //        relative accuracy           
607     const Int_t   knel = 3;        //        for parabolic minimization  
608     const Int_t   knstop = 50;     //        Max. iteration number          
609     const Int_t   knParam = 5;
610     Int_t npeak = (Int_t)param[0];
611     // RETURN IF NUMBER OF DEGREES OF FREEDOM IS NOT POSITIVE 
612     if( (xdim*zdim - npeak*knParam) <= 0 ) return( -1 );
613     Double_t degFree = (xdim*zdim - npeak*knParam)-1;
614     Int_t   n, k, iterNum = 0;
615     Double_t *prm0 = new Double_t[npeak*knParam+1];
616     Double_t *step = new Double_t[npeak*knParam+1];
617     Double_t *schi = new Double_t[npeak*knParam+1]; 
618     Double_t *sprm[3];
619     sprm[0] = new Double_t[npeak*knParam+1];
620     sprm[1] = new Double_t[npeak*knParam+1];
621     sprm[2] = new Double_t[npeak*knParam+1];
622     Double_t  chi0, chi1, reldif, a, b, prmin, dp;
623     Double_t *speFit = new Double_t[ xdim*zdim ];
624     PeakFunc( xdim, zdim, param, speFit );
625     chi0 = ChiSqr( xdim, zdim, spe, speFit );
626     chi1 = chi0;
627     for( k=1; k<(npeak*knParam+1); k++) prm0[k] = param[k];
628         for( k=1 ; k<(npeak*knParam+1); k+=knParam ){
629             step[k] = param[k] / 20.0 ;
630             step[k+1] = param[k+1] / 50.0;
631             step[k+2] = param[k+2] / 50.0;                 
632             step[k+3] = param[k+3] / 20.0;                 
633             step[k+4] = param[k+4] / 20.0;                 
634         } // end for k
635     Int_t out = 0;
636     do{
637         iterNum++;
638             chi0 = chi1;
639             Minim( xdim, zdim, param, prm0, step, &chi1, spe, speFit );
640             reldif = ( chi1 > 0 ) ? ((Double_t) TMath::Abs( chi1-chi0)/chi1 ) : 0;
641         // EXIT conditions
642         if( reldif < (float) kchilmt ){
643             *chir  = (chi1>0) ? (float) TMath::Sqrt (chi1/degFree) :0;
644             *niter = iterNum;
645             out = 0;
646             break;
647         } // end if
648         if( (reldif < (float)(5*kchilmt)) && (iterNum > knstop) ){
649             *chir = (chi1>0) ?(float) TMath::Sqrt (chi1/degFree):0;
650             *niter = iterNum;
651             out = 0;
652             break;
653         } // end if
654         if( iterNum > 5*knstop ){
655             *chir  = (chi1>0) ?(float) TMath::Sqrt (chi1/degFree):0;
656             *niter = iterNum;
657             out = 1;
658             break;
659         } // end if
660         if( iterNum <= knel ) continue;
661         n = iterNum - (iterNum/knel)*knel; // EXTRAPOLATION LIMIT COUNTER N
662         if( n > 3 || n == 0 ) continue;
663         schi[n-1] = chi1;
664         for( k=1; k<(npeak*knParam+1); k++ ) sprm[n-1][k] = param[k];
665         if( n != 3 ) continue;
666         // -EVALUATE EXTRAPOLATED VALUE OF EACH PARAMETER BY FINDING MINIMUM OF
667         //    PARABOLA DEFINED BY LAST THREE CALLS OF MINIM
668         for( k=1; k<(npeak*knParam+1); k++ ){
669             Double_t tmp0 = sprm[0][k];
670             Double_t tmp1 = sprm[1][k];
671             Double_t tmp2 = sprm[2][k];
672             a  = schi[0]*(tmp1-tmp2) + schi[1]*(tmp2-tmp0);
673             a += (schi[2]*(tmp0-tmp1));
674             b  = schi[0]*(tmp1*tmp1-tmp2*tmp2);
675             b += (schi[1]*(tmp2*tmp2-tmp0*tmp0)+(schi[2]*
676                                              (tmp0*tmp0-tmp1*tmp1)));
677             if ((double)a < 1.0E-6) prmin = 0;
678             else prmin = (float) (0.5*b/a);
679             dp = 5*(tmp2-tmp0);
680             if( TMath::Abs(prmin-tmp2) > TMath::Abs(dp) ) prmin = tmp2+dp;
681             param[k] = prmin;
682             step[k]  = dp/10; // OPTIMIZE SEARCH STEP
683         } // end for k
684     } while( kTRUE );
685     delete [] prm0;
686     delete [] step;
687     delete [] schi; 
688     delete [] sprm[0];
689     delete [] sprm[1];
690     delete [] sprm[2];
691     delete [] speFit;
692     return( out );
693 }
694
695 //______________________________________________________________________
696 void AliITSClusterFinderSDD::ResolveClusters(){
697     // The function to resolve clusters if the clusters overlapping exists
698     Int_t i;
699     // get number of clusters for this module
700     Int_t nofClusters = NClusters();
701     nofClusters -= fNclusters;
702     Int_t fNofMaps = GetSeg()->Npz();
703     Int_t fNofAnodes = fNofMaps/2;
704     //Int_t fMaxNofSamples = GetSeg()->Npx();
705     Int_t dummy=0;
706     Double_t fTimeStep = GetSeg()->Dpx( dummy );
707     Double_t fSddLength = GetSeg()->Dx();
708     Double_t anodePitch = GetSeg()->Dpz( dummy );
709     Int_t electronics =GetResp(fModule)->GetElectronics(); // 1 = PASCAL, 2 = OLA
710     AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule);
711     AliITSresponseSDD* res  = (AliITSresponseSDD*)cal->GetResponse();
712     const char *option=res->ZeroSuppOption();
713     
714
715     for( Int_t j=0; j<nofClusters; j++ ){ 
716         // get cluster information
717         AliITSRawClusterSDD *clusterJ=(AliITSRawClusterSDD*) Cluster(j);
718         Int_t astart = clusterJ->Astart();
719         Int_t astop = clusterJ->Astop();
720         Int_t tstart = clusterJ->Tstartf();
721         Int_t tstop = clusterJ->Tstopf();
722         Int_t wing = (Int_t)clusterJ->W();
723         if( wing == 2 ){
724             astart += fNofAnodes; 
725             astop  += fNofAnodes;
726         } // end if 
727         Int_t xdim = tstop-tstart+3;
728         Int_t zdim = astop-astart+3;
729         if( xdim > 50 || zdim > 30 ) { 
730             Warning("ResolveClusters","xdim: %d , zdim: %d ",xdim,zdim);
731             continue;
732         }
733         Double_t *sp = new Double_t[ xdim*zdim+1 ];
734         memset( sp, 0, sizeof(Double_t)*(xdim*zdim+1) );
735         
736         // make a local map from cluster region
737         for( Int_t ianode=astart; ianode<=astop; ianode++ ){
738             for( Int_t itime=tstart; itime<=tstop; itime++ ){
739                 Double_t fadc = Map()->GetSignal( ianode, itime );             
740                 if(!((strstr(option,"1D")) || (strstr(option,"2D")))){
741                   Double_t baseline=GetResp(fModule)->GetBaseline(ianode);
742                   if( fadc > baseline ) fadc -= (Double_t)baseline;
743                   else fadc = 0.;
744                 }
745                 Int_t index = (itime-tstart+1)*zdim+(ianode-astart+1);
746                 sp[index] = fadc;
747             } // time loop
748         } // anode loop
749         
750         // search peaks on cluster
751         const Int_t kNp = 150;
752         Int_t peakX1[kNp];
753         Int_t peakZ1[kNp];
754         Double_t peakAmp1[kNp];
755         Int_t npeak = SearchPeak(sp,xdim,zdim,peakX1,peakZ1,peakAmp1,fMinPeak);
756
757         // if multiple peaks, split cluster
758         if( npeak >= 1 ){
759             //        cout << "npeak " << npeak << endl;
760             //        clusterJ->PrintInfo();
761             Double_t *par = new Double_t[npeak*5+1];
762             par[0] = (Double_t)npeak;                
763             // Initial parameters in cell dimentions
764             Int_t k1 = 1;
765             for( i=0; i<npeak; i++ ){
766                 par[k1] = peakAmp1[i];
767                 par[k1+1] = peakX1[i]; // local time pos. [timebin]
768                 par[k1+2] = peakZ1[i]; // local anode pos. [anodepitch]
769                 if( electronics == 1 ) par[k1+3] = 2.; // PASCAL
770                 else if(electronics==2) par[k1+3] = 0.7;//tau [timebin] OLA 
771                 par[k1+4] = .4;    // sigma        [anodepich]
772                 k1 += 5;
773             } // end for i                        
774             Int_t niter;
775             Double_t chir;                        
776             NoLinearFit( xdim, zdim, par, sp, &niter, &chir );
777             Double_t peakX[kNp];
778             Double_t peakZ[kNp];
779             Double_t sigma[kNp];
780             Double_t tau[kNp];
781             Double_t peakAmp[kNp];
782             Double_t integral[kNp];
783             //get integrals => charge for each peak
784             PeakFunc( xdim, zdim, par, sp, integral );
785             k1 = 1;
786             for( i=0; i<npeak; i++ ){
787                 peakAmp[i] = par[k1];
788                 peakX[i]   = par[k1+1];
789                 peakZ[i]   = par[k1+2];
790                 tau[i]     = par[k1+3];
791                 sigma[i]   = par[k1+4];
792                 k1+=5;
793             } // end for i
794             // calculate parameter for new clusters
795             for( i=0; i<npeak; i++ ){
796                 AliITSRawClusterSDD clusterI( *clusterJ );
797             
798                 Int_t newAnode = peakZ1[i]-1 + astart;
799
800             //    Int_t newiTime = peakX1[i]-1 + tstart;
801             //    Int_t shift = (Int_t)(fTimeCorr/fTimeStep + 0.5);
802             //    if( newiTime > shift && newiTime < (fMaxNofSamples-shift) ) 
803             //        shift = 0;
804             //    Int_t peakpos = Map()->GetHitIndex(newAnode,newiTime+shift );
805             //    clusterI.SetPeakPos( peakpos );
806             
807                 clusterI.SetPeakAmpl( peakAmp1[i] );
808                 Double_t newAnodef = peakZ[i] - 0.5 + astart;
809                 Double_t newiTimef = peakX[i] - 1 + tstart;
810                 if( wing == 2 ) newAnodef -= fNofAnodes; 
811                 Double_t anodePath = (newAnodef - fNofAnodes/2)*anodePitch;
812                 newiTimef *= fTimeStep;
813                 if( newiTimef > fTimeCorr ) newiTimef -= fTimeCorr;
814                 if( electronics == 1 ){
815                 //    newiTimef *= 0.999438;    // PASCAL
816                 //    newiTimef += (6./fDriftSpeed - newiTimef/3000.);
817                 }else if( electronics == 2 )
818                     newiTimef *= 0.99714;    // OLA
819                     
820                 Int_t timeBin = (Int_t)(newiTimef/fTimeStep+0.5);    
821                 Int_t peakpos = Map()->GetHitIndex( newAnode, timeBin );
822                 if( peakpos < 0 ) { 
823                     for( Int_t ii=0; ii<3; ii++ ) {
824                         peakpos = Map()->GetHitIndex( newAnode, timeBin+ii );
825                         if( peakpos > 0 ) break;
826                         peakpos = Map()->GetHitIndex( newAnode, timeBin-ii );
827                         if( peakpos > 0 ) break;
828                     }
829                 }
830                 
831                 if( peakpos < 0 ) { 
832                     //Warning("ResolveClusters",
833                     //        "Digit not found for cluster");
834                     //if(AliDebugLevel()>=3) clusterI.PrintInfo(); 
835                    continue;
836                 }
837                 clusterI.SetPeakPos( peakpos ); 
838                 Float_t dp = cal->GetDriftPath(newiTimef,newAnodef);
839                 Float_t driftPath = fSddLength - (Double_t)dp;
840                 Float_t sign = ( wing == 1 ) ? -1. : 1.;
841                 Float_t xcoord = driftPath*sign * 0.0001;
842                 Float_t zcoord = anodePath * 0.0001;
843                 Float_t corrx=0, corrz=0;
844                 cal->GetCorrections(zcoord,xcoord,corrz,corrx,GetSeg());
845                 xcoord+=corrx;
846                 zcoord+=corrz;
847                 clusterI.SetX( xcoord );        
848                 clusterI.SetZ( zcoord );
849                 clusterI.SetAnode( newAnodef );
850                 clusterI.SetTime( newiTimef );
851                 clusterI.SetAsigma( sigma[i]*anodePitch );
852                 clusterI.SetTsigma( tau[i]*fTimeStep );
853                 clusterI.SetQ( integral[i] );
854                 
855                 fDetTypeRec->AddCluster( 1, &clusterI );
856             } // end for i
857             Clusters()->RemoveAt( j );
858             delete [] par;
859         } else {  // something odd
860             Warning( "ResolveClusters",
861                      "--- Peak not found!!!!  minpeak=%d ,cluster peak= %f"
862                      " , module= %d",
863                      fMinPeak, clusterJ->PeakAmpl(),GetModule()); 
864             clusterJ->PrintInfo();
865             Warning( "ResolveClusters"," xdim= %d zdim= %d", xdim-2, zdim-2 );
866         }
867         delete [] sp;
868     } // cluster loop
869     Clusters()->Compress();
870 //    Map()->ClearMap(); 
871 }
872 //________________________________________________________________________
873 void  AliITSClusterFinderSDD::GroupClusters(){
874     // group clusters
875     Int_t dummy=0;
876     Double_t fTimeStep = GetSeg()->Dpx(dummy);
877     // get number of clusters for this module
878     Int_t nofClusters = NClusters();
879     nofClusters -= fNclusters;
880     AliITSRawClusterSDD *clusterI;
881     AliITSRawClusterSDD *clusterJ;
882     Int_t *label = new Int_t [nofClusters];
883     Int_t i,j;
884     for(i=0; i<nofClusters; i++) label[i] = 0;
885     for(i=0; i<nofClusters; i++) { 
886         if(label[i] != 0) continue;
887         for(j=i+1; j<nofClusters; j++) { 
888             if(label[j] != 0) continue;
889             clusterI = (AliITSRawClusterSDD*) Cluster(i);
890             clusterJ = (AliITSRawClusterSDD*) Cluster(j);
891             // 1.3 good
892             if(clusterI->T() < fTimeStep*60) fDAnode = 4.2;  // TB 3.2  
893             if(clusterI->T() < fTimeStep*10) fDAnode = 1.5;  // TB 1.
894             Bool_t pair = clusterI->Brother(clusterJ,fDAnode,fDTime);
895             if(!pair) continue;
896             if(AliDebugLevel()>=4){
897                 clusterI->PrintInfo();
898                 clusterJ->PrintInfo();
899             } // end if AliDebugLevel
900             clusterI->Add(clusterJ);
901             label[j] = 1;
902             Clusters()->RemoveAt(j);
903             j=i; // <- Ernesto
904         } // J clusters  
905         label[i] = 1;
906     } // I clusters
907     Clusters()->Compress();
908
909     delete [] label;
910     return;
911 }
912 //________________________________________________________________________
913 void AliITSClusterFinderSDD::SelectClusters(){
914     // get number of clusters for this module
915     Int_t nofClusters = NClusters();
916
917     nofClusters -= fNclusters;
918     Int_t i;
919     for(i=0; i<nofClusters; i++) { 
920         AliITSRawClusterSDD *clusterI =(AliITSRawClusterSDD*) Cluster(i);
921         Int_t rmflg = 0;
922         Double_t wy = 0.;
923         if(clusterI->Anodes() != 0.) {
924             wy = ((Double_t) clusterI->Samples())/clusterI->Anodes();
925         } // end if
926         Int_t amp = (Int_t) clusterI->PeakAmpl();
927         Int_t cha = (Int_t) clusterI->Q();
928         if(amp < fMinPeak) rmflg = 1;  
929         if(cha < fMinCharge) rmflg = 1;
930         if(wy < fMinNCells) rmflg = 1;
931         //if(wy > fMaxNCells) rmflg = 1;
932         if(rmflg) Clusters()->RemoveAt(i);
933     } // I clusters
934     Clusters()->Compress();
935     return;
936 }
937
938 //______________________________________________________________________
939 void AliITSClusterFinderSDD::GetRecPoints(AliITSCalibrationSDD* cal){
940     // get rec points
941   
942     // get number of clusters for this module
943     Int_t nofClusters = NClusters();
944     nofClusters -= fNclusters;
945     const Double_t kconvGeV = 1.e-6; // GeV -> KeV
946     const Double_t kconv = 1.0e-4; 
947     const Double_t kcmToMicrons = 10000.;
948     const Double_t kRMSx = 38.0*kconv; // microns->cm ITS TDR Table 1.3
949     const Double_t kRMSz = 28.0*kconv; // microns->cm ITS TDR Table 1.3
950     Int_t nAnodes=GetSeg()->NpzHalf();
951     Int_t i;
952     Int_t ix, iz, idx=-1;
953     AliITSdigitSDD *dig=0;
954     Int_t ndigits=NDigits();
955
956     Int_t lay,lad,det;
957     fDetTypeRec->GetITSgeom()->GetModuleId(fModule,lay,lad,det);
958     Int_t ind=(lad-1)*fDetTypeRec->GetITSgeom()->GetNdetectors(lay)+(det-1);
959     Int_t lyr=(lay-1);
960
961
962     for(i=0; i<nofClusters; i++) { 
963         AliITSRawClusterSDD *clusterI = (AliITSRawClusterSDD*)Cluster(i);
964         if(!clusterI) Error("SDD: GetRecPoints","i clusterI ",i,clusterI);
965         if(clusterI) idx=clusterI->PeakPos();
966         if(idx>ndigits) Error("SDD: GetRecPoints","idx ndigits",idx,ndigits);
967         // try peak neighbours - to be done 
968         if(idx&&idx<= ndigits) dig =(AliITSdigitSDD*)GetDigit(idx);
969         if(!dig) {
970             // try cog
971             Float_t xMicrons=clusterI->X()*kcmToMicrons;
972             Float_t zMicrons=clusterI->Z()*kcmToMicrons;
973             Float_t zAnode=zMicrons/GetSeg()->Dpz(0)+nAnodes/2;
974             Float_t driftSpeed=cal->GetDriftSpeedAtAnode(zAnode);           
975             Float_t driftPath=GetSeg()->Dx()-TMath::Abs(xMicrons);
976             ix=1+(Int_t)(driftPath/driftSpeed/GetSeg()->Dpx(0));
977             iz=1+(Int_t)zAnode;
978             if(xMicrons>0) iz+=nAnodes;
979             dig = (AliITSdigitSDD*)Map()->GetHit(iz-1,ix-1);
980             // if null try neighbours
981             if (!dig) dig = (AliITSdigitSDD*)Map()->GetHit(iz-1,ix); 
982             if (!dig) dig = (AliITSdigitSDD*)Map()->GetHit(iz-1,ix+1); 
983             if (!dig) printf("SDD: cannot assign the track number!\n");
984         } //  end if !dig
985
986         Int_t lab[4] = {-3141593,-3141593,-3141593,ind};
987         if (dig) {
988           lab[0] = dig->GetTrack(0);
989           lab[1] = dig->GetTrack(1);
990           lab[2] = dig->GetTrack(2);
991         }
992         Float_t hit[5] = {clusterI->X(),clusterI->Z(),kRMSx*kRMSx,kRMSz*kRMSz,clusterI->Q()};
993         Int_t info[3] = {0,0,lyr};
994
995         AliITSRecPoint rnew(lab,hit,info,kTRUE);
996         rnew.SetdEdX(kconvGeV*clusterI->Q());
997
998         fDetTypeRec->AddRecPoint(rnew);        
999     } // I clusters
1000 //    Map()->ClearMap();
1001 }
1002 //______________________________________________________________________
1003 void AliITSClusterFinderSDD::FindRawClusters(Int_t mod){
1004     // find raw clusters
1005     
1006     SetModule(mod);
1007     SetCutAmplitude(mod);
1008     AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(mod);
1009     Int_t nanodes=GetSeg()->Npz();
1010     Int_t noise=0;
1011     for(Int_t i=0;i<nanodes;i++){
1012       noise+=(Int_t)cal->GetNoiseAfterElectronics(i);
1013     }    
1014     SetMinPeak((noise/nanodes)*5);
1015     Find1DClustersE();
1016     GroupClusters();
1017     SelectClusters();
1018     ResolveClusters();
1019     GetRecPoints(cal);
1020 }
1021 //_______________________________________________________________________
1022 void AliITSClusterFinderSDD::PrintStatus() const{
1023     // Print SDD cluster finder Parameters
1024
1025     cout << "**************************************************" << endl;
1026     cout << " Silicon Drift Detector Cluster Finder Parameters " << endl;
1027     cout << "**************************************************" << endl;
1028     cout << "Number of Clusters: " << fNclusters << endl;
1029     cout << "Anode Tolerance: " << fDAnode << endl;
1030     cout << "Time  Tolerance: " << fDTime << endl;
1031     cout << "Time  correction (electronics): " << fTimeCorr << endl;
1032     cout << "Cut Amplitude (threshold): " << fCutAmplitude[0] << endl;
1033     cout << "Minimum Amplitude: " << fMinPeak << endl;
1034     cout << "Minimum Charge: " << fMinCharge << endl;
1035     cout << "Minimum number of cells/clusters: " << fMinNCells << endl;
1036     cout << "Maximum number of cells/clusters: " << fMaxNCells << endl;
1037     cout << "**************************************************" << endl;
1038 }
1039
1040