From 79dac78592d79d38fcce92f0554f4718034bd733 Mon Sep 17 00:00:00 2001 From: cvetan Date: Mon, 16 Apr 2007 14:33:41 +0000 Subject: [PATCH] Combine same consequtive raw-data reading errors into one error --- RAW/AliRawReader.cxx | 30 ++++++++++++++++++++++++------ RAW/AliRawReader.h | 1 + STEER/AliRawDataErrorLog.cxx | 10 +++++++--- STEER/AliRawDataErrorLog.h | 6 +++++- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/RAW/AliRawReader.cxx b/RAW/AliRawReader.cxx index 9fc30ef6d2e..c244221bf90 100644 --- a/RAW/AliRawReader.cxx +++ b/RAW/AliRawReader.cxx @@ -143,6 +143,7 @@ AliRawReader::~AliRawReader() // initialized if (fEquipmentIdsIn) delete fEquipmentIdsIn; if (fEquipmentIdsOut) delete fEquipmentIdsOut; + fErrorLogs.Delete(); } Int_t AliRawReader::GetMappedEquipmentId() const @@ -473,10 +474,27 @@ void AliRawReader::AddErrorLog(AliRawDataErrorLog::ERawDataErrorLevel level, return; } - new (fErrorLogs[fErrorLogs.GetEntriesFast()]) - AliRawDataErrorLog(fEventNumber, - ddlId, - level, - code, - message); + Int_t prevEventNumber = -1; + Int_t prevDdlId = -1; + Int_t prevErrorCode = -1; + AliRawDataErrorLog *prevLog = (AliRawDataErrorLog *)fErrorLogs.Last(); + if (prevLog) { + prevEventNumber = prevLog->GetEventNumber(); + prevDdlId = prevLog->GetDdlID(); + prevErrorCode = prevLog->GetErrorCode(); + } + + if ((prevEventNumber != fEventNumber) || + (prevDdlId != ddlId) || + (prevErrorCode != code)) { + new (fErrorLogs[fErrorLogs.GetEntriesFast()]) + AliRawDataErrorLog(fEventNumber, + ddlId, + level, + code, + message); + } + else + if (prevLog) prevLog->AddCount(); + } diff --git a/RAW/AliRawReader.h b/RAW/AliRawReader.h index b70645257da..d3e41d74a26 100644 --- a/RAW/AliRawReader.h +++ b/RAW/AliRawReader.h @@ -125,6 +125,7 @@ class AliRawReader: public TObject { return AddErrorLog(AliRawDataErrorLog::kFatal,code,message); } Int_t GetNumberOfErrorLogs() const { return fErrorLogs.GetEntriesFast(); } + const TClonesArray &GetAllErrorLogs() const { return fErrorLogs; } AliRawDataErrorLog *GetErrorLog(Int_t i) const { return (AliRawDataErrorLog *)fErrorLogs.UncheckedAt(i); } diff --git a/STEER/AliRawDataErrorLog.cxx b/STEER/AliRawDataErrorLog.cxx index 3fedca3eedd..95a40ae9ae3 100644 --- a/STEER/AliRawDataErrorLog.cxx +++ b/STEER/AliRawDataErrorLog.cxx @@ -38,7 +38,8 @@ AliRawDataErrorLog::AliRawDataErrorLog() : fEventNumber(-1), fDdlID(-1), fErrorLevel(AliRawDataErrorLog::kMinor), - fErrorCode(0) + fErrorCode(0), + fCount(0) { // Default constructor } @@ -52,7 +53,8 @@ AliRawDataErrorLog::AliRawDataErrorLog(Int_t eventNumber, Int_t ddlId, fEventNumber(eventNumber), fDdlID(ddlId), fErrorLevel(errorLevel), - fErrorCode(errorCode) + fErrorCode(errorCode), + fCount(1) { // Constructor that specifies // the event number, ddl id, error type and @@ -65,7 +67,8 @@ AliRawDataErrorLog::AliRawDataErrorLog(const AliRawDataErrorLog & source) : fEventNumber(source.fEventNumber), fDdlID(source.fDdlID), fErrorLevel(source.fErrorLevel), - fErrorCode(source.fErrorCode) + fErrorCode(source.fErrorCode), + fCount(source.fCount) { // Copy constructor } @@ -81,6 +84,7 @@ AliRawDataErrorLog & AliRawDataErrorLog::operator=(const AliRawDataErrorLog &sou fDdlID = source.GetDdlID(); fErrorLevel = source.GetErrorLevel(); fErrorCode = source.GetErrorCode(); + fCount = source.GetCount(); } return *this; } diff --git a/STEER/AliRawDataErrorLog.h b/STEER/AliRawDataErrorLog.h index 330c3a28d8e..495973362a9 100644 --- a/STEER/AliRawDataErrorLog.h +++ b/STEER/AliRawDataErrorLog.h @@ -44,18 +44,22 @@ class AliRawDataErrorLog: public TNamed { ERawDataErrorLevel GetErrorLevel() const { return fErrorLevel; } Int_t GetErrorCode() const { return fErrorCode; } const char * GetMessage() const { return fName.Data(); } + Int_t GetCount() const { return fCount; } Bool_t IsSortable() const {return kTRUE;} Int_t Compare(const TObject* obj) const; + void AddCount() { fCount++; } + private: Int_t fEventNumber; // Event number as it appears in the input raw-data file Int_t fDdlID; // ID of the DLL in which the error occured ERawDataErrorLevel fErrorLevel; // Level of the raw data error Int_t fErrorCode; // Code of the raw data error (detector-specific) + Int_t fCount; // Counter of identical errors (occurances) - ClassDef(AliRawDataErrorLog, 2) + ClassDef(AliRawDataErrorLog, 3) }; #endif -- 2.43.0