]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSRawStreamSPDErrorLog.h
Bug fix
[u/mrichter/AliRoot.git] / ITS / AliITSRawStreamSPDErrorLog.h
1 #ifndef ALIITSRAWSTREAMSPDERRORLOG_H
2 #define ALIITSRAWSTREAMSPDERRORLOG_H
3
4 /* $Id$ */
5
6 ///////////////////////////////////////////////////////////////////////
7 // Author: Henrik Tydesjo                                            //
8 // For easier handling of error messages from AliITSRawStreamSPD.    //
9 // The purpose of this class is to make possible the switch to the   //
10 // AliRoot raw data parsing routines in the onlinte monitoring       //
11 // programs, like SPD-MOOD, and still keep all the old functionality.//
12 ///////////////////////////////////////////////////////////////////////
13
14 #include <TH1F.h>
15 #include <TH2F.h>
16 #include <TGraph.h>
17 #include <TGText.h>
18
19 class AliITSRawStreamSPDErrorLog : public TObject {
20
21  public:
22   AliITSRawStreamSPDErrorLog();
23   AliITSRawStreamSPDErrorLog(const AliITSRawStreamSPDErrorLog& logger);
24   AliITSRawStreamSPDErrorLog& operator=(const AliITSRawStreamSPDErrorLog& logger);
25   virtual ~AliITSRawStreamSPDErrorLog();
26
27   enum    {kNrErrorCodes = 15};
28   enum    {kTotal = 0};
29
30   void    Reset();
31   void    ProcessError(UInt_t errorCode, UInt_t eq, Int_t bytesRead, Int_t headersRead, const Char_t *errMess);
32   void    AddMessage(const Char_t *errMess);
33   void    SummarizeEvent(UInt_t eventNum);
34
35   UInt_t  GetNrErrors(UInt_t errorCode, UInt_t eq);
36   UInt_t  GetNrErrorsAllEq(UInt_t errorCode);
37   UInt_t  GetNrErrorsTotal(UInt_t errorCode, UInt_t eq);
38   UInt_t  GetNrErrorsTotalAllEq(UInt_t errorCode);
39
40   void    SetPayloadSize(UInt_t eq, UInt_t size);
41   void    SetByteOffset(UInt_t eq, Int_t size);
42   void    SuppressErrorMessages(UInt_t errorCode, Bool_t suppr = kTRUE);
43   void    SuppressErrorEq(UInt_t eq, Bool_t suppr = kTRUE);
44
45   static  UInt_t GetNrErrorCodes(){return kNrErrorCodes;}
46
47   TGraph* GetConsErrEvent(UInt_t errorCode, UInt_t eq);
48   TH1F*   GetConsErrType(UInt_t eq);
49   TH1F*   GetConsErrFraction(UInt_t eq);        // NB!!! Take care of deleting returned object later
50   TH1F*   GetConsErrFractionUnScaled(UInt_t eq);
51   TH1F*   GetConsErrPos(UInt_t errorCode, UInt_t eq);
52   TGText* GetText() {return fText;}
53
54
55  private:
56   Int_t   fNErrors[kNrErrorCodes][20];          // number of errors for this event, for each code and eq
57   UInt_t  fNEvents[20];                         // number of events used, for each eq
58   UInt_t  fPayloadSize[20];                     // size of payload for this event, for each eq
59   Bool_t  fPayloadSizeSet[20];                  // was the payload size set for this eq?
60   UInt_t  fErrEventCounter[kNrErrorCodes][20];  // event counter used when filling graph
61   Int_t   fByteOffset[20];                      // offset: how many bytes in the equipment header, for each eq
62   Bool_t  fSuppressMess[kNrErrorCodes];         // do we suppress error messages for a specific error code?
63   Bool_t  fSuppressEq[20];                      // do we suppress error messages for a specific eq?
64
65   TGraph  *fConsErrEvent[kNrErrorCodes][20];    // graphs to display number of errors found in each event
66   TH1F    *fConsErrType[20];                    // histogram of how many errors for each error code
67   TH1F    *fConsErrFraction[20];                // histogram of rate of events with errors for each error code
68   TH1F    *fConsErrPos[kNrErrorCodes][20];      // histogram of where in payload the errors occur
69
70   TGText  *fText;                               // text buffer for all events analyzed so far
71   TGText  *fTextTmp[20];                        // text buffer for this event (defined error codes)
72   TGText  *fTextTmpGeneral;                     // text buffer for this event (general errors)
73
74   void    InitHistograms();
75   void    DeleteHistograms() const;
76
77   ClassDef(AliITSRawStreamSPDErrorLog, 1);
78 };
79
80 #endif