- // Maximum found ?
- if (digitsOut->GetDataUnchecked(row,col,time) < 0.0)
- {
-
- for (iPad = 0; iPad < kNclus; iPad++)
- {
- Int_t iPadCol = col - 1 + iPad;
- clusterSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row,iPadCol,time));
- }
-
- // Count the number of pads in the cluster
- Int_t nPadCount = 0;
- Int_t ii;
- // Look to the left
- ii = 0;
- while (TMath::Abs(digitsOut->GetDataUnchecked(row,col-ii ,time)) >= sigThresh)
- {
- nPadCount++;
- ii++;
- if (col-ii < 0) break;
- }
- // Look to the right
- ii = 0;
- while (TMath::Abs(digitsOut->GetDataUnchecked(row,col+ii+1,time)) >= sigThresh)
- {
- nPadCount++;
- ii++;
- if (col+ii+1 >= nColMax) break;
- }
- nClusters++;
-
- // Look for 5 pad cluster with minimum in the middle
- Bool_t fivePadCluster = kFALSE;
- if (col < (nColMax - 3))
- {
- if (digitsOut->GetDataUnchecked(row,col+2,time) < 0)
- {
- fivePadCluster = kTRUE;
- }
- if ((fivePadCluster) && (col < (nColMax - 5)))
- {
- if (digitsOut->GetDataUnchecked(row,col+4,time) >= sigThresh)
- {
- fivePadCluster = kFALSE;
- }
- }
- if ((fivePadCluster) && (col > 1))
- {
- if (digitsOut->GetDataUnchecked(row,col-2,time) >= sigThresh)
- {
- fivePadCluster = kFALSE;
- }
- }
- }
-
- // 5 pad cluster
- // Modify the signal of the overlapping pad for the left part
- // of the cluster which remains from a previous unfolding
- if (iUnfold)
- {
- clusterSignal[0] *= ratioLeft;
- iUnfold = 0;
- }
-
- // Unfold the 5 pad cluster
- if (fivePadCluster)
- {
- for (iPad = 0; iPad < kNsig; iPad++)
- {
- padSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row
- ,col-1+iPad
- ,time));
- }
- // Unfold the two maxima and set the signal on
- // the overlapping pad to the ratio
- ratioRight = Unfold(kEpsilon,iplan,padSignal);
- ratioLeft = 1.0 - ratioRight;
- clusterSignal[2] *= ratioRight;
- iUnfold = 1;
- }
-
- // The position of the cluster in COL direction relative to the center pad (pad units)
- Double_t clusterPosCol = 0.0;
- if (recParam->LUTOn())
- {
- // Calculate the position of the cluster by using the
- // lookup table method
- clusterPosCol = recParam->LUTposition(iplan
- ,clusterSignal[0]
- ,clusterSignal[1]
- ,clusterSignal[2]);
- }
- else
- {
- // Calculate the position of the cluster by using the
- // center of gravity method
- for (Int_t i = 0; i < kNsig; i++)
- {
- padSignal[i] = 0.0;
- }
- padSignal[2] = TMath::Abs(digitsOut->GetDataUnchecked(row,col ,time)); // Central pad
- padSignal[1] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time)); // Left pad
- padSignal[3] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time)); // Right pad
- if ((col > 2) &&
- (TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time)) < padSignal[1]))
- {
- padSignal[0] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time));
- }
- if ((col < nColMax - 3) &&
- (TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time)) < padSignal[3]))
- {
- padSignal[4] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time));
- }
- clusterPosCol = GetCOG(padSignal);
- }
-
- // Store the amplitudes of the pads in the cluster for later analysis
- Short_t signals[7] = { 0, 0, 0, 0, 0, 0, 0 };
- for (Int_t jPad = col-3; jPad <= col+3; jPad++)
- {
- if ((jPad < 0) ||
- (jPad >= nColMax-1))
- {
- continue;
- }
- signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time)));
- }
-
- // Transform the local cluster coordinates into calibrated
- // space point positions defined in the local tracking system.
- // Here the calibration for T0, Vdrift and ExB is applied as well.
- Double_t clusterXYZ[6];
- clusterXYZ[0] = clusterPosCol;
- clusterXYZ[1] = clusterSignal[0];
- clusterXYZ[2] = clusterSignal[1];
- clusterXYZ[3] = clusterSignal[2];
- clusterXYZ[4] = 0.0;
- clusterXYZ[5] = 0.0;
- Int_t clusterRCT[3];
- clusterRCT[0] = row;
- clusterRCT[1] = col;
- clusterRCT[2] = 0;
-
- if (fTransform->Transform(clusterXYZ,clusterRCT,((UInt_t) time),0)) {
-
- // Add the cluster to the output array
- // The track indices will be stored later
- Float_t clusterPos[3];
- clusterPos[0] = clusterXYZ[0];
- clusterPos[1] = clusterXYZ[1];
- clusterPos[2] = clusterXYZ[2];
- Float_t clusterSig[2];
- clusterSig[0] = clusterXYZ[4];
- clusterSig[1] = clusterXYZ[5];
- Double_t clusterCharge = clusterXYZ[3];
- Char_t clusterTimeBin = ((Char_t) clusterRCT[2]);
- AliTRDcluster *cluster = new AliTRDcluster(idet
- ,clusterCharge
- ,clusterPos
- ,clusterSig
- ,0x0
- ,((Char_t) nPadCount)
- ,signals
- ,((UChar_t) col)
- ,((UChar_t) row)
- ,((UChar_t) time)
- ,clusterTimeBin
- ,clusterPosCol
- ,volid);
-
- // Temporarily store the row, column and time bin of the center pad
- // Used to later on assign the track indices
- cluster->SetLabel( row,0);
- cluster->SetLabel( col,1);
- cluster->SetLabel(time,2);
-
- RecPoints()->Add(cluster);
-
- // Store the index of the first cluster in the current ROC
- if (firstClusterROC < 0)
- {
- firstClusterROC = RecPoints()->GetEntriesFast() - 1;
- }
-
- // Count the number of cluster in the current ROC
- nClusterROC++;
-
- } // if: Transform ok ?
-
- } // if: Maximum found ?