+ if (errors) {
+ AliDebugF(2,"Channel %3d/0x%03x contain errors, "
+ "resetting index %d to %d", ddl, hwaddr, first, last);
+ if (first >= 0) {
+ for (Int_t i = first; i <= last; i++) {
+ AliFMDDigit* digit = static_cast<AliFMDDigit*>(array->At(i));
+ for (Int_t j = 0; j < fSampleRate[ddl]; j++) {
+ AliDebug(10,Form("Resetting strip %s=%d",
+ digit->GetName(),digit->Counts()));
+ digit->SetCount(j, kBadSignal);
+ }
+ }
+ }
+ }
+ // if (errors && (AliDebugLevel() > 0)) input.HexDumpChannel();
+ } // while (channel)
+ } // while (ddl)
+ if (fNErrors[0] > 0 || fNErrors[1] > 0 || fNErrors[2] > 0 ||
+ fNErrChanLen > 0 || fNErrAddress > 0) {
+ // AliLog::Flush();
+ AliLog::SetPrintRepetitions(false);
+ AliWarningF("R/O errors: FMD1=%d, FMD2=%d, FMD3=%d, "
+ "Channel Length=%d, address=%d",
+ fNErrors[0], fNErrors[1], fNErrors[2],
+ fNErrChanLen, fNErrAddress);
+ AliLog::SetPrintRepetitions(true);
+ }
+ if (fVerbose && fErrors.GetEntries() > 0) {
+ TString msg;
+ Int_t nErr = fErrors.GetEntries();
+ for (Int_t i = 0; i < nErr; i++) {
+ UInt_t where = fErrors.At(i)->GetUniqueID();
+ if (i % 6 == 0) msg.Append("\n");
+ msg.Append(Form(" %3d/0x%03x", (where >> 12) & 0xFF, (where & 0xFFF)));
+ }
+ // AliLog::Flush();
+ AliLog::SetPrintRepetitions(false);
+ AliWarningF("Got %d errors in channels %s", nErr, msg.Data());
+ AliLog::SetPrintRepetitions(true);
+ }
+ return kTRUE;
+}
+//____________________________________________________________________
+Bool_t
+AliFMDRawReader::ReadAdcs(AliFMDUShortMap& map)
+{
+ // Read ADC values from raw input into passed TClonesArray of AliFMDDigit
+ // objects.
+ AliDebug(3,Form("Reading ADC values into a map"));
+
+ // const UShort_t kUShortMax = (1 << 16) - 1;
+ for (Int_t ddl = 0; ddl < kNDDL; ddl++) fNErrors[ddl] = 0;
+
+ AliAltroRawStreamV3 input(fReader);
+ input.Reset();
+ input.SetCheckAltroPayload(false);
+ input.SelectRawData("FMD");
+
+ // Loop over input RORCs
+ while (input.NextDDL()) {
+ UShort_t det = 0;
+ Int_t ddl = NewDDL(input, det);
+ if (ddl < 0) break;
+ fNErrors[ddl] = 0;
+
+ while (input.NextChannel()) {
+ // Get the hardware address, and map that to detector coordinates
+ Char_t ring;
+ UShort_t sec;
+ Short_t strbase;
+ Int_t hwaddr = NewChannel(input, det, ring, sec, strbase);
+ if (hwaddr < 0) break;
+ if (hwaddr > 0xFFF) continue;
+
+ UShort_t start = 0x3FF;
+ Bool_t errors = false;
+ Int_t first = -1;
+ Int_t last = -1;
+ // Loop over bunches
+ while (input.NextBunch()) {
+ // Get Lenght of bunch, and pointer to the data
+ // const UShort_t* data = input.GetSignals();
+ UShort_t length;
+ if (!NewBunch(input, start, length)) {
+ errors = true;
+ break;
+ }
+
+
+ // Loop over the data and store it.
+ for (Int_t i = 0; i < length; i++) {
+ // Time
+ Short_t str;
+ UShort_t samp;
+ Int_t t = start - i;
+ Int_t adc = NewSample(input, i, t, sec, strbase, str, samp);
+ if (adc < 0) continue;
+ UShort_t counts = adc;
+
+ AliDebug(10, Form("FMD%d%c[%02d,%03d]-%d: %4d",
+ det, ring, sec, str, samp, counts));
+ if (SelectSample(samp, fSampleRate[ddl]))
+ map(det,ring,sec,str) = counts;
+ if (first < 0) first = str;
+ last = str;
+ } // for (i)
+ } // while (bunch)
+ if (errors) {
+ AliDebugF(2, "Channel %3d/0x%03x contain errors, "
+ "resetting strips %d to %d", ddl, hwaddr, first, last);
+ if (first >= 0) {
+ Int_t ds = first <= last ? 1 : -1;
+ for (Int_t i = first; i != last+ds; i += ds) {
+ AliDebug(10, Form("Resetting strip FMD%d%c[%02d,%03d]=%d",
+ det,ring,sec,i,map(det,ring,sec,i)));
+ map(det,ring,sec,i) = kBadSignal;
+ }
+ }
+ }