- Float_t pedM = param->GetPedestal(digit->Detector(),
- digit->Ring(),
- digit->Sector(),
- digit->Strip());
- AliDebug(10, Form("Subtracting pedestal %f from signal %d",
- pedM, digit->Counts()));
- if (digit->Count3() > 0) counts = digit->Count3();
- else if (digit->Count2() > 0) counts = digit->Count2();
- else counts = digit->Count1();
- counts = TMath::Max(Int_t(counts - pedM), 0);
- if (counts > 0) AliDebug(10, "Got a hit strip");
+ Float_t ped = (zsEnabled ? 0 :
+ param->GetPedestal(det, rng, sec, str));
+ Float_t noise = param->GetPedestalWidth(det, rng, sec, str);
+ if(ped < 0 || noise < 0) {
+ AliWarningClass(Form("Invalid pedestal (%f) or noise (%f) "
+ "for FMD%d%c[%02d,%03d]",
+ ped, noise, det, rng, sec, str));
+ return USHRT_MAX;
+ }
+ AliDebugClass(15, Form("Subtracting pedestal for FMD%d%c[%2d,%3d]=%4d "
+ "(%s w/factor %d, noise factor %f, "
+ "pedestal %8.2f+/-%8.2f)",
+ det, rng, sec, str, adc,
+ (zsEnabled ? "zs'ed" : "straight"),
+ zsNoiseFactor, noiseFactor, ped, noise));
+
+ Int_t counts = adc + Int_t(zsEnabled ? zsNoiseFactor * noise : - ped);
+ counts = TMath::Max(Int_t(counts), 0);
+ // Calculate the noise factor for suppressing remenants of the noise
+ // peak. If we have done on-line zero suppression, we only check
+ // for noise signals that are larger than the suppressed noise. If
+ // the noise factor used on line is larger than the factor used
+ // here, we do not do this check at all.
+ //
+ // For example:
+ // Online factor | Read factor | Result
+ // ---------------+--------------+-------------------------------
+ // 2 | 3 | Check if signal > 1 * noise
+ // 3 | 3 | Check if signal > 0
+ // 3 | 2 | Check if signal > 0
+ //
+ // In this way, we make sure that we do not suppress away too much
+ // data, and that the read-factor is the most stringent cut.
+ Float_t nf = TMath::Max(0.F, noiseFactor - (zsEnabled ? zsNoiseFactor : 0));
+ if (counts < noise * nf) counts = 0;
+ if (counts > 0) AliDebugClass(15, "Got a hit strip");
+
+ UShort_t ret = counts < 0 ? 0 : counts;
+ return ret;
+}
+
+
+//____________________________________________________________________
+UShort_t
+AliFMDReconstructor::SubtractPedestal(UShort_t det,
+ Char_t rng,
+ UShort_t sec,
+ UShort_t str,
+ Short_t adc) const
+{
+ // Member function to subtract the pedestal from a digit
+ //
+ // Parameters:
+ // det Detector ID
+ // rng Ring ID
+ // sec Sector ID
+ // rng Strip ID
+ // adc # of ADC counts
+ // Return:
+ // Pedestal subtracted signal or USHRT_MAX in case of problems
+ //
+ UShort_t counts = SubtractPedestal(det, rng, sec, str, adc,
+ fNoiseFactor, fZS[det-1],
+ fZSFactor[det-1]);
+ if (fDiagStep1) fDiagStep1->Fill(adc, counts);