- Double_t clusterSigmaY2 = (q1*(q0+q2)+4*q0*q2) /
- (clusterCharge*clusterCharge);
-
- // Calculate the position and the error
- Double_t colSize = padPlane->GetColSize(col);
- Double_t rowSize = padPlane->GetRowSize(row);
- Double_t clusterPos[3];
- clusterPos[0] = padPlane->GetColPos(col) + (clusterPads[1]-0.5)*colSize; // MI change
- clusterPos[1] = padPlane->GetRowPos(row) -0.5*rowSize; //MI change
- clusterPos[2] = clusterPads[2];
- Double_t clusterSig[2];
- clusterSig[0] = (clusterSigmaY2 + 1./12.) * colSize*colSize;
- clusterSig[1] = rowSize * rowSize / 12.;
- // Add the cluster to the output array
- AddCluster(clusterPos
- ,idet
- ,clusterCharge
- ,clusterTracks
- ,clusterSig
- ,iType,clusterPads[1]);
-
- }
- }
- }
- }
-
- // Compress the arrays
- digits->Compress(1,0);
- track0->Compress(1,0);
- track1->Compress(1,0);
- track2->Compress(1,0);
+ Double_t clusterSigmaY2 = (q1 * (q0 + q2) + 4.0 * q0 * q2)
+ / (clusterCharge*clusterCharge);
+
+ //
+ // Calculate the position and the error
+ //
+
+ // Correct for t0 (sum of chamber and pad wise values !!!)
+ Float_t calT0ROCValue = calT0ROC->GetValue(col,row);
+ Char_t clusterTimeBin = ((Char_t) TMath::Nint(time - (calT0DetValue + calT0ROCValue)));
+ Double_t colSize = padPlane->GetColSize(col);
+ Double_t rowSize = padPlane->GetRowSize(row);
+
+ Float_t clusterPos[3];
+ clusterPos[0] = padPlane->GetColPos(col) - (clusterPads[1] + 0.5) * colSize;
+ clusterPos[1] = padPlane->GetRowPos(row) - 0.5 * rowSize;
+ clusterPos[2] = CalcXposFromTimebin(clusterPads[2],idet,col,row);
+ Float_t clusterSig[2];
+ clusterSig[0] = (clusterSigmaY2 + 1.0/12.0) * colSize*colSize;
+ clusterSig[1] = rowSize * rowSize / 12.0;
+
+ // 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)));
+ }
+
+ // Add the cluster to the output array
+ // The track indices will be stored later
+ AliTRDcluster *cluster = new AliTRDcluster(idet
+ ,clusterCharge
+ ,clusterPos
+ ,clusterSig
+ ,0x0
+ ,((Char_t) nPadCount)
+ ,signals
+ ,((UChar_t) col)
+ ,clusterTimeBin
+ ,clusterPads[1]
+ ,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: Maximum found ?
+
+ } // loop: pad columns
+ } // loop: time bins
+ } // loop: pad rows
+
+ delete digitsOut;
+
+ //
+ // Add the track indices to the found clusters
+ //
+
+ // Temporary array to collect the track indices
+ Int_t *idxTracks = new Int_t[kNtrack*nClusterROC];
+
+ // Loop through the dictionary arrays one-by-one
+ // to keep memory consumption low
+ for (Int_t iDict = 0; iDict < kNdict; iDict++) {
+
+ tracksIn = fDigitsManager->GetDictionary(idet,iDict);
+ tracksIn->Expand();
+
+ // Loop though the clusters found in this ROC
+ for (iClusterROC = 0; iClusterROC < nClusterROC; iClusterROC++) {
+
+ AliTRDcluster *cluster = (AliTRDcluster *)
+ RecPoints()->UncheckedAt(firstClusterROC+iClusterROC);
+ row = cluster->GetLabel(0);
+ col = cluster->GetLabel(1);
+ time = cluster->GetLabel(2);
+
+ for (iPad = 0; iPad < kNclus; iPad++) {
+ Int_t iPadCol = col - 1 + iPad;
+ Int_t index = tracksIn->GetDataUnchecked(row,iPadCol,time) - 1;
+ idxTracks[3*iPad+iDict + iClusterROC*kNtrack] = index;
+ }
+
+ }
+
+ // Compress the arrays
+ tracksIn->Compress(1,0);
+
+ }
+
+ // Copy the track indices into the cluster
+ // Loop though the clusters found in this ROC
+ for (iClusterROC = 0; iClusterROC < nClusterROC; iClusterROC++) {
+
+ AliTRDcluster *cluster = (AliTRDcluster *)
+ RecPoints()->UncheckedAt(firstClusterROC+iClusterROC);
+ cluster->SetLabel(-9999,0);
+ cluster->SetLabel(-9999,1);
+ cluster->SetLabel(-9999,2);
+
+ cluster->AddTrackIndex(&idxTracks[iClusterROC*kNtrack]);
+
+ }
+
+ delete [] idxTracks;