#include "TMHistogrammingEventDumpPayloadErrorOnly.h"
#include "AliITSRawStreamSPDErrorLog.h"

//_____________________________________________________________________
TMHistogrammingEventDumpPayloadErrorOnly::TMHistogrammingEventDumpPayloadErrorOnly() :
  TMHistogrammingEventDump() 
{
}
//_____________________________________________________________________
TMHistogrammingEventDumpPayloadErrorOnly::~TMHistogrammingEventDumpPayloadErrorOnly() {
}
//_____________________________________________________________________
void TMHistogrammingEventDumpPayloadErrorOnly::EndEvent(AliITSRawStreamSPD *str, UInt_t globalEventNumber) {
  if (fEventAccept) {

    if (str->GetAdvancedErrorLog()->GetNrErrorsAllEq(0)>0) {
      TString newEv = Form("______________________________________________________EVENT %d (PHYSICS EVENT)______________________________________________________",globalEventNumber);
      if (DumpThis(newEv.Data())) {
	DumpPayload(fEvent);
	DumpThis(" ");
	fNeedRedump=kTRUE;
      }
    }
    else {
      fEventAccept = kFALSE;
    }

  }

  TMHistogramming::EndEvent(str, globalEventNumber);
}
