-
-}
-
-//_____________________________________________________________________________
-void AliITSsimulationSDD::FindCluster(Int_t i,Int_t j,Int_t signal,
- Int_t minval,Bool_t &cond){
-//
-// Find clusters according to the online 2D zero-suppression algorithm
-//
-
- Bool_t do10to8=fResponse->Do10to8();
-
- Bool_t high=kFALSE;
-
- fHitMap2->FlagHit(i,j);
-//
-// check the online zero-suppression conditions
-//
- const Int_t maxNeighbours = 4;
-
- Int_t nn;
- Int_t dbx,tlx,thx;
- Int_t xList[maxNeighbours], yList[maxNeighbours];
- fSegmentation->Neighbours(i,j,&nn,xList,yList);
- Int_t in,ix,iy,qns;
- for (in=0; in<nn; in++) {
- ix=xList[in];
- iy=yList[in];
- if (fHitMap2->TestHit(ix,iy)==kUnused) {
- CompressionParam(ix,dbx,tlx,thx);
- Int_t qn = (Int_t)(fHitMap2->GetSignal(ix,iy));
- qn -= dbx; // if baseline eq. is done here
- if ((qn-tlx) < minval) {
- fHitMap2->FlagHit(ix,iy);
- continue;
- } else {
- if ((qn - thx) >= minval) high=kTRUE;
- if (cond) {
- if(do10to8) signal = Convert10to8(signal);
- AddDigit(i,j,signal);
- }
- if(do10to8) qns = Convert10to8(qn);
- else qns=qn;
- if (!high) AddDigit(ix,iy,qns);
- cond=kFALSE;
- if(!high) fHitMap2->FlagHit(ix,iy);
- }
- } // TestHit
- } // loop over neighbours
-
-}
-
-//____________________________________________
-void AliITSsimulationSDD::Init1D(){
- // this is just a copy-paste of input taken from 2D algo
- // Torino people should give input
- //
- // Read 1D zero-suppression parameters for SDD
- //
-
- if (!strstr(fParam,"file")) return;
-
- Int_t na,pos,tempTh;
- Float_t mu,sigma;
- Float_t *savemu = new Float_t [fNofMaps];
- Float_t *savesigma = new Float_t [fNofMaps];
- char input[100],basel[100],par[100];
- char *filtmp;
-
-
- Int_t minval = fResponse->MinVal();
- fResponse->Filenames(input,basel,par);
- fFileName=par;
-
-// set first the disable and tol param
- SetCompressParam();
-//
- filtmp = gSystem->ExpandPathName(fFileName.Data());
- FILE *param = fopen(filtmp,"r");
- na = 0;
-
- if (param) {
- fscanf(param,"%d %d %d %d ", &fT2[0], &fT2[1], &fTol[0], &fTol[1]);
- while(fscanf(param,"%d %f %f",&pos, &mu, &sigma) != EOF) {
- if (pos != na+1) {
- Error("Init1D ","Anode number not in increasing order!",
- filtmp);
- exit(1);
- }
- savemu[na]=mu;
- savesigma[na]=sigma;
- if ((2.*sigma) < mu) {
- fD[na] = (Int_t)floor(mu - 2.0*sigma + 0.5);
- mu = 2.0 * sigma;
- } else fD[na] = 0;
- tempTh = (Int_t)floor(mu+2.25*sigma+0.5) - minval;
- if (tempTh < 0) tempTh=0;
- fT1[na] = tempTh;
- na++;
- } // end while
- } else {
- Error("Init1D "," THE FILE %s DOES NOT EXIST !",
- filtmp);
- exit(1);
- } // end if(param)
-
- fclose(param);
- delete [] filtmp;
- delete [] savemu;
- delete [] savesigma;
-
-
-
-}
-
-//____________________________________________
-void AliITSsimulationSDD::Compress1D(){
- // 1D zero-suppression algorithm (from Gianluca A.)
-
- Int_t dis,tol,thres,decr,diff;
-
- UChar_t *str=fStream->Stream();
- Int_t counter=0;
-
- Bool_t do10to8=fResponse->Do10to8();
-
- Int_t last=0;
- Int_t k,i,j;
- for (k=0; k<2; k++) {
- tol = Tolerance(k);
- dis = Disable(k);
- for (i=0; i<fNofMaps/2; i++) {
- Bool_t firstSignal=kTRUE;
- Int_t idx=i+k*fNofMaps/2;
- CompressionParam(idx,decr,thres);
- for (j=0; j<fMaxNofSamples; j++) {
- Int_t signal=(Int_t)(fHitMap2->GetSignal(idx,j));
- signal -= decr; // if baseline eq.
- if(do10to8) signal = Convert10to8(signal);
- if (signal <= thres) {
- signal=0;
- diff=128;
- last=0;
- // write diff in the buffer for HuffT
- str[counter]=(UChar_t)diff;
- counter++;
- continue;
- }
- diff=signal-last;
- if (diff > 127) diff=127;
- if (diff < -128) diff=-128;
-
- if (signal < dis) {
- // tol has changed to 8 possible cases ? - one can write
- // this if(TMath::Abs(diff)<tol) ... else ...
- if(TMath::Abs(diff)<tol) diff=0;
- // or keep it as it was before
- /*
- if (tol==1 && (diff >= -2 && diff <= 1)) diff=0;
- if (tol==2 && (diff >= -4 && diff <= 3)) diff=0;
- if (tol==3 && (diff >= -16 && diff <= 15)) diff=0;
- */
- AddDigit(idx,j,last+diff);
- } else {
- AddDigit(idx,j,signal);
- }
-
- diff += 128;
- // write diff in the buffer used to compute Huffman tables
- if (firstSignal) str[counter]=(UChar_t)signal;
- else str[counter]=(UChar_t)diff;
- counter++;
-
- last=signal;
- firstSignal=kFALSE;
- } // loop time samples
- } // loop anodes one half of detector