/////////////////////////////////////////////////////////////////////// // Author: Henrik Tydesjo // // For easier handling of error messages from AliITSRawStreamSPD. // // The purpose of this class is to make possible the switch to the // // AliRoot raw data parsing routines in the onlinte monitoring // // programs, like SPD-MOOD, and still keep all the old functionality.// /////////////////////////////////////////////////////////////////////// #include "AliITSRawStreamSPDErrorLog.h" #include "AliLog.h" ClassImp(AliITSRawStreamSPDErrorLog) //________________________________________________________________________________________________ AliITSRawStreamSPDErrorLog::AliITSRawStreamSPDErrorLog() : fText(NULL), fTextTmpGeneral(NULL) { // default constructor fText=new TGText(); fTextTmpGeneral=new TGText(); for (UInt_t eq=0; eq<20; eq++) { fTextTmp[eq] = new TGText(); fNEvents[eq] = 0; fPayloadSizeSet[eq] = kFALSE; fByteOffset[eq] = 0; fSuppressEq[eq] = kFALSE; for (UInt_t err=0; errDeleteHistograms(); for (UInt_t eq=0; eq<20; eq++) { for (UInt_t err=0; errSetXTitle("Error Code"); fConsErrType[eq]->SetYTitle("Nr Errors"); histName = Form("ConsErrFraction %d",eq); histTitle = Form("Fraction of events with errors, eq %d",eq); fConsErrFraction[eq]=new TH1F(histName.Data(),histTitle.Data(),kNrErrorCodes,-0.5,kNrErrorCodes-0.5); fConsErrFraction[eq]->SetXTitle("Error Code"); fConsErrFraction[eq]->SetYTitle("Fraction"); for (UInt_t err=0; errSetXTitle("Position [%]"); fConsErrPos[err][eq]->SetYTitle("Nr Errors"); } } } //________________________________________________________________________________________________ void AliITSRawStreamSPDErrorLog::DeleteHistograms() const { // delete histograms for (UInt_t eq=0; eq<20; eq++) { delete fConsErrType[eq]; delete fConsErrFraction[eq]; for (UInt_t err=0; errClear(); for (UInt_t eq=0; eq<20; eq++) { fTextTmp[eq]->Clear(); fConsErrType[eq]->Reset(); fConsErrFraction[eq]->Reset(); fNEvents[eq] = 0; fPayloadSizeSet[eq] = kFALSE; for (UInt_t err=0; errReset(); } } } //________________________________________________________________________________________________ void AliITSRawStreamSPDErrorLog::ProcessError(UInt_t errorCode, UInt_t eq, Int_t bytesRead, Int_t headersRead, const Char_t *errMess) { // Process an error if (eq>=20) { AliWarning(Form("Equipment number (%d) out of bounds",eq)); return; } // check if we want to exclude the error... if (!(fSuppressMess[errorCode] || fSuppressEq[eq])) { fNErrors[errorCode][eq]++; if (errorCode!=kTotal) fNErrors[kTotal][eq]++; if (fPayloadSizeSet) { fConsErrPos[errorCode][eq]->Fill(100.*bytesRead/fPayloadSize[eq]); if (errorCode!=kTotal) fConsErrPos[kTotal][eq]->Fill(100.*bytesRead/fPayloadSize[eq]); } TString msg; if (bytesRead<0) { msg = Form("%s",errMess); } else { msg = Form("%s (%d bytes read, %d chip headers read)",errMess,bytesRead+fByteOffset[eq],headersRead); } fTextTmp[eq]->InsLine(fTextTmp[eq]->RowCount(),msg.Data()); } } //________________________________________________________________________________________________ void AliITSRawStreamSPDErrorLog::AddMessage(const Char_t *errMess) { // add a general message to the buffer fTextTmpGeneral->InsLine(fTextTmpGeneral->RowCount(),errMess); } //________________________________________________________________________________________________ void AliITSRawStreamSPDErrorLog::SummarizeEvent(UInt_t eventNum) { // summarize the information for the current event TString msg; if (fText->RowCount()>5000) { fText->Clear(); msg = "*** previous errors cleared ***"; fText->InsLine(fText->RowCount(),msg.Data()); } if (fTextTmpGeneral->RowCount()>1) { msg = Form("*** Event %d , General Errors: ***",eventNum); fText->InsLine(fText->RowCount(),msg.Data()); fText->AddText(fTextTmpGeneral); fTextTmpGeneral->Clear(); } for (UInt_t eq=0; eq<20; eq++) { for (UInt_t err=0; errFill(err,fNErrors[err][eq]); if (fNErrors[err][eq]>0){ fConsErrEvent[err][eq]->SetPoint(fErrEventCounter[err][eq],eventNum,fNErrors[err][eq]); fErrEventCounter[err][eq]++; fConsErrFraction[eq]->Fill(err); } } fNEvents[eq]++; if (fNErrors[kTotal][eq]>0) { msg = Form("*** Event %d , Eq %d: ***",eventNum,eq); fText->InsLine(fText->RowCount(),msg.Data()); fText->AddText(fTextTmp[eq]); fText->InsLine(fText->RowCount()," "); } fPayloadSizeSet[eq]=kFALSE; fByteOffset[eq]=0; fTextTmp[eq]->Clear(); for (UInt_t err=0; errGetBinContent(errorCode+1); } else { AliWarning(Form("Error code (%d) or equipment (%d) out of range, returning 0",errorCode,eq)); return 0; } } //________________________________________________________________________________________________ UInt_t AliITSRawStreamSPDErrorLog::GetNrErrorsTotalAllEq(UInt_t errorCode) { // returns the total number of errors for a specific error code and for all equipment if (errorCodeGetBinContent(errorCode+1); } return returnval; } else { AliWarning(Form("Error code (%d) out of range, returning 0",errorCode)); return 0; } } //________________________________________________________________________________________________ TGraph* AliITSRawStreamSPDErrorLog::GetConsErrEvent(UInt_t errorCode, UInt_t eq) { // returns a pointer to the graph if (errorCodeClone()); if (fNEvents[eq]!=0) returnhisto->Scale(1./fNEvents[eq]); // returnhisto->SetMaximum(1.); return returnhisto; } else { AliWarning(Form("Eq nr (%d) out of bounds",eq)); return NULL; } } //________________________________________________________________________________________________ TH1F* AliITSRawStreamSPDErrorLog::GetConsErrPos(UInt_t errorCode, UInt_t eq) { // returns a pointer to the histogram if (errorCode