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; err<kNrErrorCodes; err++) {
fNErrors[err][eq] = 0;
+ fNErrorsTotal[err][eq] = 0;
}
}
for (UInt_t err=0; err<kNrErrorCodes; err++) {
for (UInt_t eq=0; eq<20; eq++) {
for (UInt_t err=0; err<kNrErrorCodes; err++) {
fNErrors[err][eq] = logger.fNErrors[err][eq];
+ fNErrorsTotal[err][eq] = logger.fNErrorsTotal[err][eq];
fErrEventCounter[err][eq] = logger.fErrEventCounter[err][eq];
}
fNEvents[eq] = logger.fNEvents[eq];
- fPayloadSize[eq] = logger.fPayloadSize[eq];
- fPayloadSizeSet[eq] = logger.fPayloadSizeSet[eq];
fByteOffset[eq] = logger.fByteOffset[eq];
fSuppressEq[eq] = logger.fSuppressEq[eq];
}
for (UInt_t eq=0; eq<20; eq++) {
for (UInt_t err=0; err<kNrErrorCodes; err++) {
fConsErrEvent[err][eq] = new TGraph(*logger.fConsErrEvent[err][eq]);
- fConsErrPos[err][eq] = new TH1F(*logger.fConsErrPos[err][eq]);
+ fConsErrPos[err][eq] = new TGraph(*logger.fConsErrPos[err][eq]);
}
fConsErrType[eq] = new TH1F(*logger.fConsErrType[eq]);
+ fConsErrType[eq]->SetDirectory(0);
fConsErrFraction[eq] = new TH1F(*logger.fConsErrFraction[eq]);
+ fConsErrFraction[eq]->SetDirectory(0);
}
}
if (this!=&logger) {
delete fText;
delete fTextTmpGeneral;
- delete[] fTextTmp;
+ for(Int_t eq=0; eq<20;eq++){
+ delete fTextTmp[eq];
+ }
this->DeleteHistograms();
for (UInt_t eq=0; eq<20; eq++) {
for (UInt_t err=0; err<kNrErrorCodes; err++) {
fNErrors[err][eq] = logger.fNErrors[err][eq];
+ fNErrorsTotal[err][eq] = logger.fNErrorsTotal[err][eq];
fErrEventCounter[err][eq] = logger.fErrEventCounter[err][eq];
}
fNEvents[eq] = logger.fNEvents[eq];
- fPayloadSize[eq] = logger.fPayloadSize[eq];
- fPayloadSizeSet[eq] = logger.fPayloadSizeSet[eq];
fByteOffset[eq] = logger.fByteOffset[eq];
fSuppressEq[eq] = logger.fSuppressEq[eq];
}
for (UInt_t eq=0; eq<20; eq++) {
for (UInt_t err=0; err<kNrErrorCodes; err++) {
fConsErrEvent[err][eq] = new TGraph(*logger.fConsErrEvent[err][eq]);
- fConsErrPos[err][eq] = new TH1F(*logger.fConsErrPos[err][eq]);
+ fConsErrPos[err][eq] = new TGraph(*logger.fConsErrPos[err][eq]);
}
fConsErrType[eq] = new TH1F(*logger.fConsErrType[eq]);
+ fConsErrType[eq]->SetDirectory(0);
fConsErrFraction[eq] = new TH1F(*logger.fConsErrFraction[eq]);
+ fConsErrFraction[eq]->SetDirectory(0);
}
}
DeleteHistograms();
delete fText;
delete fTextTmpGeneral;
- delete[] fTextTmp;
+ for(Int_t eq=0; eq<20; eq++){
+ delete fTextTmp[eq];
+ }
}
//________________________________________________________________________________________________
void AliITSRawStreamSPDErrorLog::InitHistograms() {
histName = Form("ConsErrType %d",eq);
histTitle = Form("Distribution of errors, eq %d",eq);
fConsErrType[eq]=new TH1F(histName.Data(),histTitle.Data(),kNrErrorCodes,-0.5,kNrErrorCodes-0.5);
+ fConsErrType[eq]->SetDirectory(0);
fConsErrType[eq]->SetXTitle("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]->SetDirectory(0);
fConsErrFraction[eq]->SetXTitle("Error Code");
fConsErrFraction[eq]->SetYTitle("Fraction");
for (UInt_t err=0; err<kNrErrorCodes; err++) {
fConsErrEvent[err][eq]=new TGraph();
+ fConsErrPos[err][eq]=new TGraph();
+ fConsErrPosTMP[err][eq]=new TGraph();
fErrEventCounter[err][eq] = 0;
- histName = Form("ConsErrPos %d %d",err,eq);
- histTitle = Form("Position in event, eq %d , error code %d",eq,err);
- fConsErrPos[err][eq]=new TH1F(histName.Data(),histTitle.Data(),200,0,100);
- fConsErrPos[err][eq]->SetXTitle("Position [%]");
- fConsErrPos[err][eq]->SetYTitle("Nr Errors");
+ fErrPosCounter[err][eq] = 0;
+ fErrPosTMPCounter[err][eq] = 0;
}
}
}
//________________________________________________________________________________________________
-void AliITSRawStreamSPDErrorLog::DeleteHistograms() const {
+void AliITSRawStreamSPDErrorLog::DeleteHistograms() {
// delete histograms
for (UInt_t eq=0; eq<20; eq++) {
delete fConsErrType[eq];
for (UInt_t err=0; err<kNrErrorCodes; err++) {
delete fConsErrEvent[err][eq];
delete fConsErrPos[err][eq];
+ delete fConsErrPosTMP[err][eq];
}
}
}
void AliITSRawStreamSPDErrorLog::Reset() {
// Reset
fText->Clear();
+ fTextTmpGeneral->Clear();
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; err<kNrErrorCodes; err++) {
fNErrors[err][eq] = 0;
+ fNErrorsTotal[err][eq] = 0;
delete fConsErrEvent[err][eq];
+ delete fConsErrPos[err][eq];
+ delete fConsErrPosTMP[err][eq];
fErrEventCounter[err][eq] = 0;
+ fErrPosCounter[err][eq] = 0;
+ fErrPosTMPCounter[err][eq] = 0;
fConsErrEvent[err][eq] = new TGraph();
- fConsErrPos[err][eq]->Reset();
+ fConsErrPos[err][eq] = new TGraph();
+ fConsErrPosTMP[err][eq] = new TGraph();
}
}
}
// check if we want to exclude the error...
if (!(fSuppressMess[errorCode] || fSuppressEq[eq])) {
fNErrors[errorCode][eq]++;
- if (errorCode!=kTotal) fNErrors[kTotal][eq]++;
+ fNErrorsTotal[errorCode][eq]++;
+ if (errorCode!=kTotal) {
+ fNErrors[kTotal][eq]++;
+ fNErrorsTotal[kTotal][eq]++;
+ }
- if (fPayloadSizeSet[eq]) {
- fConsErrPos[errorCode][eq]->Fill(100.*bytesRead/fPayloadSize[eq]);
- if (errorCode!=kTotal) fConsErrPos[kTotal][eq]->Fill(100.*bytesRead/fPayloadSize[eq]);
+ if (bytesRead>=0) {
+ fConsErrPosTMP[errorCode][eq]->SetPoint(fErrPosTMPCounter[errorCode][eq],0,bytesRead+fByteOffset[eq]);
+ fErrPosTMPCounter[errorCode][eq]++;
+ if (errorCode!=kTotal) {
+ fConsErrPosTMP[kTotal][eq]->SetPoint(fErrPosTMPCounter[kTotal][eq],0,bytesRead+fByteOffset[eq]);
+ fErrPosTMPCounter[kTotal][eq]++;
+ }
}
TString msg;
fTextTmpGeneral->InsLine(fTextTmpGeneral->RowCount(),errMess);
}
//________________________________________________________________________________________________
-void AliITSRawStreamSPDErrorLog::SummarizeEvent(UInt_t eventNum) {
- // summarize the information for the current event
+void AliITSRawStreamSPDErrorLog::ResetEvent() {
+ // reset error counters for current event
+ for (UInt_t eq=0; eq<20; eq++) {
+ for (UInt_t err=0; err<kNrErrorCodes; err++) {
+ fNErrors[err][eq]=0;
+ }
+ fByteOffset[eq]=0;
+ fTextTmpGeneral->Clear();
+ fTextTmp[eq]->Clear();
+ }
+
+ for (UInt_t eq=0; eq<20; eq++) {
+ for (UInt_t err=0; err<kNrErrorCodes; err++) {
+ delete fConsErrPosTMP[err][eq];
+ fErrPosTMPCounter[err][eq] = 0;
+ fConsErrPosTMP[err][eq] = new TGraph();
+ }
+ }
+}
+//________________________________________________________________________________________________
+void AliITSRawStreamSPDErrorLog::AddErrorMessagesFromCurrentEvent(UInt_t eventNum) {
TString msg;
if (fText->RowCount()>5000) {
fText->Clear();
msg = Form("*** Event %d , General Errors: ***",eventNum);
fText->InsLine(fText->RowCount(),msg.Data());
fText->AddText(fTextTmpGeneral);
- fTextTmpGeneral->Clear();
+ // fTextTmpGeneral->Clear();
}
+
for (UInt_t eq=0; eq<20; eq++) {
- for (UInt_t err=0; err<kNrErrorCodes; err++) {
- fConsErrType[eq]->Fill(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();
+ // fTextTmp[eq]->Clear();
+ }
+}
+//________________________________________________________________________________________________
+void AliITSRawStreamSPDErrorLog::ProcessEvent(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();
+// }
+
+ AddErrorMessagesFromCurrentEvent(eventNum);
+
+ for (UInt_t eq=0; eq<20; eq++) {
for (UInt_t err=0; err<kNrErrorCodes; err++) {
- fNErrors[err][eq]=0;
+ fConsErrType[eq]->Fill(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);
+ }
+ for (UInt_t pind=0; pind<fErrPosTMPCounter[err][eq]; pind++) {
+ Double_t x,y;
+ fConsErrPosTMP[err][eq]->GetPoint(pind,x,y);
+ fConsErrPos[err][eq]->SetPoint(fErrPosCounter[err][eq],eventNum,y);
+ fErrPosCounter[err][eq]++;
+ }
}
+
+ 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()," ");
+// }
+// fByteOffset[eq]=0;
+// fTextTmp[eq]->Clear();
}
+
}
//________________________________________________________________________________________________
-void AliITSRawStreamSPDErrorLog::SetPayloadSize(UInt_t eq, UInt_t size) {
- // set the payload size for this event
- if (eq<20) {
- fPayloadSize[eq]=size;
- fPayloadSizeSet[eq]=kTRUE;
- }
- else {
- AliWarning(Form("Equipment number (%d) out of range",eq));
- }
+void AliITSRawStreamSPDErrorLog::SummarizeEvent(UInt_t eventNum) {
+ // summarize the information for the current event
+ ProcessEvent(eventNum);
+ ResetEvent();
}
//________________________________________________________________________________________________
void AliITSRawStreamSPDErrorLog::SetByteOffset(UInt_t eq, Int_t size) {
UInt_t AliITSRawStreamSPDErrorLog::GetNrErrorsTotal(UInt_t errorCode, UInt_t eq) {
// returns the total number of errors for a specific error code and equipment
if (errorCode<kNrErrorCodes && eq<20) {
- return (UInt_t) fConsErrType[eq]->GetBinContent(errorCode+1);
+ return fNErrorsTotal[errorCode][eq];
+ // return (UInt_t) fConsErrType[eq]->GetBinContent(errorCode+1);
}
else {
AliWarning(Form("Error code (%d) or equipment (%d) out of range, returning 0",errorCode,eq));
}
//________________________________________________________________________________________________
UInt_t AliITSRawStreamSPDErrorLog::GetNrErrorsTotalAllEq(UInt_t errorCode) {
- // returns the total number of errors for a specific error code and for all equipment
+ // returns the total number of errors for a specific error code and for all equipments
if (errorCode<kNrErrorCodes) {
UInt_t returnval=0;
for (UInt_t eq=0; eq<20; eq++) {
- returnval += (UInt_t) fConsErrType[eq]->GetBinContent(errorCode+1);
+ returnval += fNErrorsTotal[errorCode][eq];
+ // returnval += (UInt_t) fConsErrType[eq]->GetBinContent(errorCode+1);
}
return returnval;
}
}
}
//________________________________________________________________________________________________
-TH1F* AliITSRawStreamSPDErrorLog::GetConsErrPos(UInt_t errorCode, UInt_t eq) {
+TGraph* AliITSRawStreamSPDErrorLog::GetConsErrPos(UInt_t errorCode, UInt_t eq) {
// returns a pointer to the histogram
if (errorCode<kNrErrorCodes && eq<20) return fConsErrPos[errorCode][eq];
else {
return NULL;
}
}
+//________________________________________________________________________________________________
+UInt_t AliITSRawStreamSPDErrorLog::GetEventErrPosCounter(UInt_t errorCode, UInt_t eq) {
+ // returns the number of errors with bytes information for current event
+ if (errorCode<kNrErrorCodes && eq<20) return fErrPosTMPCounter[errorCode][eq];
+ else {
+ AliError(Form("Error code (%d) or equipment (%d) out of range, returning 0",errorCode,eq));
+ return 0;
+ }
+}
+//________________________________________________________________________________________________
+UInt_t AliITSRawStreamSPDErrorLog::GetEventErrPos(UInt_t index, UInt_t errorCode, UInt_t eq) {
+ // returns the bytes read for the index'th error of current event
+ if (errorCode<kNrErrorCodes && eq<20) {
+ if (index<fErrPosTMPCounter[errorCode][eq]) {
+ Double_t x,y;
+ fConsErrPosTMP[errorCode][eq]->GetPoint(index,x,y);
+ return (UInt_t) y;
+ }
+ else {
+ AliError(Form("Index %d out of range, returning 0",index));
+ return 0;
+ }
+ }
+ else {
+ AliError(Form("Error code (%d) or equipment (%d) out of range, returning 0",errorCode,eq));
+ return 0;
+ }
+
+}
+