+void AliTPCclustererMI::ProcessSectorData(){
+ //
+ // Process the data for the current sector
+ //
+
+ AliTPCCalPad * pedestalTPC = AliTPCcalibDB::Instance()->GetPedestals();
+ AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise();
+ AliTPCCalROC * pedestalROC = pedestalTPC->GetCalROC(fSector); // pedestal per given sector
+ AliTPCCalROC * noiseROC = noiseTPC->GetCalROC(fSector); // noise per given sector
+ //check the presence of the calibration
+ if (!noiseROC ||!pedestalROC ) {
+ AliError(Form("Missing calibration per sector\t%d\n",fSector));
+ return;
+ }
+ Int_t nRows=fParam->GetNRow(fSector);
+ Bool_t calcPedestal = fRecoParam->GetCalcPedestal();
+ Int_t zeroSup = fParam->GetZeroSup();
+ // if (calcPedestal) {
+ if (kFALSE ) {
+ for (Int_t iRow = 0; iRow < nRows; iRow++) {
+ Int_t maxPad = fParam->GetNPads(fSector, iRow);
+
+ for (Int_t iPad = 3; iPad < maxPad + 3; iPad++) {
+ //
+ // Temporary fix for data production - !!!! MARIAN
+ // The noise calibration should take mean and RMS - currently the Gaussian fit used
+ // In case of double peak - the pad should be rejected
+ //
+ // Line mean - if more than given digits over threshold - make a noise calculation
+ // and pedestal substration
+ if (!calcPedestal && fAllBins[iRow][iPad*fMaxTime+0]<50) continue;
+ //
+ if (fAllBins[iRow][iPad*fMaxTime+0] <1 ) continue; // no data
+ Float_t *p = &fAllBins[iRow][iPad*fMaxTime+3];
+ //Float_t pedestal = TMath::Median(fMaxTime, p);
+ Int_t id[3] = {fSector, iRow, iPad-3};
+ // calib values
+ Double_t rmsCalib= noiseROC->GetValue(iRow,iPad-3);
+ Double_t pedestalCalib = pedestalROC->GetValue(iRow,iPad-3);
+ Double_t rmsEvent = rmsCalib;
+ Double_t pedestalEvent = pedestalCalib;
+ ProcesSignal(p, fMaxTime, id, rmsEvent, pedestalEvent);
+ if (rmsEvent<rmsCalib) rmsEvent = rmsCalib; // take worst scenario
+ if (TMath::Abs(pedestalEvent-pedestalCalib)<1.0) pedestalEvent = pedestalCalib;
+
+ //
+ for (Int_t iTimeBin = 0; iTimeBin < fMaxTime; iTimeBin++) {
+ Int_t bin = iPad*fMaxTime+iTimeBin;
+ fAllBins[iRow][bin] -= pedestalEvent;
+ if (iTimeBin < fRecoParam->GetFirstBin())
+ fAllBins[iRow][bin] = 0;
+ if (iTimeBin > fRecoParam->GetLastBin())
+ fAllBins[iRow][bin] = 0;
+ if (fAllBins[iRow][iPad*fMaxTime+iTimeBin] < zeroSup)
+ fAllBins[iRow][bin] = 0;
+ if (fAllBins[iRow][bin] < 3.0*rmsEvent) // 3 sigma cut on RMS
+ fAllBins[iRow][bin] = 0;
+ if (fAllBins[iRow][bin]) fAllSigBins[iRow][fAllNSigBins[iRow]++] = bin;
+ }
+ }
+ }
+ }
+
+ if (AliTPCReconstructor::StreamLevel()>5) {
+ for (Int_t iRow = 0; iRow < nRows; iRow++) {
+ Int_t maxPad = fParam->GetNPads(fSector,iRow);
+
+ for (Int_t iPad = 3; iPad < maxPad + 3; iPad++) {
+ for (Int_t iTimeBin = 0; iTimeBin < fMaxTime; iTimeBin++) {
+ Int_t bin = iPad*fMaxTime+iTimeBin;
+ Float_t signal = fAllBins[iRow][bin];
+ if (AliTPCReconstructor::StreamLevel()>3 && signal>3) {
+ Double_t x[]={iRow,iPad-3,iTimeBin-3};
+ Int_t i[]={fSector};
+ AliTPCTransform trafo;
+ trafo.Transform(x,i,0,1);
+ Double_t gx[3]={x[0],x[1],x[2]};
+ trafo.RotatedGlobal2Global(fSector,gx);
+ // fAllSigBins[iRow][fAllNSigBins[iRow]++]
+ Int_t rowsigBins = fAllNSigBins[iRow];
+ Int_t first=fAllSigBins[iRow][0];
+ Int_t last= 0;
+ // if (rowsigBins>0) fAllSigBins[iRow][fAllNSigBins[iRow]-1];
+
+ if (AliTPCReconstructor::StreamLevel()>5) {
+ (*fDebugStreamer)<<"Digits"<<
+ "sec="<<fSector<<
+ "row="<<iRow<<
+ "pad="<<iPad<<
+ "time="<<iTimeBin<<
+ "sig="<<signal<<
+ "x="<<x[0]<<
+ "y="<<x[1]<<
+ "z="<<x[2]<<
+ "gx="<<gx[0]<<
+ "gy="<<gx[1]<<
+ "gz="<<gx[2]<<
+ //
+ "rowsigBins="<<rowsigBins<<
+ "first="<<first<<
+ "last="<<last<<
+ "\n";
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Now loop over rows and find clusters
+ for (fRow = 0; fRow < nRows; fRow++) {
+ fRowCl->SetID(fParam->GetIndex(fSector, fRow));
+ if (fOutput) fOutput->GetBranch("Segment")->SetAddress(&fRowCl);
+
+ fRx = fParam->GetPadRowRadii(fSector, fRow);
+ fPadLength = fParam->GetPadPitchLength(fSector, fRow);
+ fPadWidth = fParam->GetPadPitchWidth();
+ fMaxPad = fParam->GetNPads(fSector,fRow);
+ fMaxBin = fMaxTime*(fMaxPad+6); // add 3 virtual pads before and 3 after
+
+ fBins = fAllBins[fRow];
+ fSigBins = fAllSigBins[fRow];
+ fNSigBins = fAllNSigBins[fRow];
+
+ FindClusters(noiseROC);
+
+ FillRow();
+ if(fBClonesArray == kFALSE) fRowCl->GetArray()->Clear("C");
+ fNclusters += fNcluster;
+
+ } // End of loop to find clusters
+}
+
+