Line data Source code
1 : /**************************************************************************
2 : * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 : * *
4 : * Author: The ALICE Off-line Project. *
5 : * Contributors are mentioned in the code where appropriate. *
6 : * *
7 : * Permission to use, copy, modify and distribute this software and its *
8 : * documentation strictly for non-commercial purposes is hereby granted *
9 : * without fee, provided that the above copyright notice appears in all *
10 : * copies and that both the copyright notice and this permission notice *
11 : * appear in the supporting documentation. The authors make no claims *
12 : * about the suitability of this software for any purpose. It is *
13 : * provided "as is" without express or implied warranty. *
14 : **************************************************************************/
15 :
16 : /////////////////////////////////////////////////////////////////////
17 : // Implementation of AliRawDataErrorLog class //
18 : // //
19 : // class AliRawDataErrorLog //
20 : // This is a class for logging raw-data related errors. //
21 : // It is used to record and retrieve of the errors //
22 : // during the reading and reconstruction of raw-data and ESD //
23 : // analysis. //
24 : // Further description of the methods and functionality are given //
25 : // inline. //
26 : // //
27 : // cvetan.cheshkov@cern.ch //
28 : // //
29 : /////////////////////////////////////////////////////////////////////
30 :
31 : #include "AliRawDataErrorLog.h"
32 :
33 : #include <Riostream.h>
34 :
35 : using std::endl;
36 : using std::cout;
37 172 : ClassImp(AliRawDataErrorLog)
38 :
39 : //_____________________________________________________________________________
40 : AliRawDataErrorLog::AliRawDataErrorLog() :
41 40 : TNamed(),
42 40 : fEventNumber(-1),
43 40 : fDdlID(-1),
44 40 : fErrorLevel(AliRawDataErrorLog::kMinor),
45 40 : fErrorCode(0),
46 40 : fCount(0)
47 200 : {
48 : // Default constructor
49 80 : }
50 :
51 : //_____________________________________________________________________________
52 : AliRawDataErrorLog::AliRawDataErrorLog(Int_t eventNumber, Int_t ddlId,
53 : ERawDataErrorLevel errorLevel,
54 : Int_t errorCode,
55 : const char *message) :
56 27 : TNamed(message,""),
57 27 : fEventNumber(eventNumber),
58 27 : fDdlID(ddlId),
59 27 : fErrorLevel(errorLevel),
60 27 : fErrorCode(errorCode),
61 27 : fCount(1)
62 135 : {
63 : // Constructor that specifies
64 : // the event number, ddl id, error type and
65 : // custom message related to the error
66 54 : }
67 :
68 : //___________________________________________________________________________
69 : AliRawDataErrorLog::AliRawDataErrorLog(const AliRawDataErrorLog & source) :
70 27 : TNamed(source),
71 27 : fEventNumber(source.fEventNumber),
72 27 : fDdlID(source.fDdlID),
73 27 : fErrorLevel(source.fErrorLevel),
74 27 : fErrorCode(source.fErrorCode),
75 27 : fCount(source.fCount)
76 135 : {
77 : // Copy constructor
78 54 : }
79 :
80 : //___________________________________________________________________________
81 : AliRawDataErrorLog & AliRawDataErrorLog::operator=(const AliRawDataErrorLog &source)
82 : {
83 : // assignment operator
84 0 : if (this != &source) {
85 0 : TNamed::operator=(source);
86 :
87 0 : fEventNumber = source.GetEventNumber();
88 0 : fDdlID = source.GetDdlID();
89 0 : fErrorLevel = source.GetErrorLevel();
90 0 : fErrorCode = source.GetErrorCode();
91 0 : fCount = source.GetCount();
92 0 : }
93 0 : return *this;
94 : }
95 :
96 : void AliRawDataErrorLog::Copy(TObject &obj) const {
97 :
98 : // this overwrites the virtual TOBject::Copy()
99 : // to allow run time copying without casting
100 : // in AliESDEvent
101 :
102 0 : if(this==&obj)return;
103 0 : AliRawDataErrorLog *robj = dynamic_cast<AliRawDataErrorLog*>(&obj);
104 0 : if(!robj)return; // not an AliRawDataErrorLog
105 0 : *robj = *this;
106 :
107 0 : }
108 :
109 : //_____________________________________________________________________________
110 : Int_t AliRawDataErrorLog::Compare(const TObject *obj) const
111 : {
112 : // Compare the event numbers and DDL IDs
113 : // of two error log objects.
114 : // Used in the sorting of raw data error logs
115 : // during the raw data reading and reconstruction
116 0 : Int_t eventNumber = ((AliRawDataErrorLog*)obj)->GetEventNumber();
117 0 : Int_t ddlID = ((AliRawDataErrorLog*)obj)->GetDdlID();
118 :
119 0 : if (fEventNumber == eventNumber) {
120 0 : if (fDdlID == ddlID)
121 0 : return 0;
122 : else
123 0 : return ((fDdlID > ddlID) ? 1 : -1);
124 : }
125 : else
126 0 : return ((fEventNumber > eventNumber) ? 1 : -1);
127 0 : }
128 :
129 : //_____________________________________________________________________________
130 : const char*
131 : AliRawDataErrorLog::GetErrorLevelAsString() const
132 : {
133 0 : switch ( GetErrorLevel() )
134 : {
135 : case kMinor:
136 0 : return "MINOR";
137 : break;
138 : case kMajor:
139 0 : return "MAJOR";
140 : break;
141 : case kFatal:
142 0 : return "FATAL";
143 : break;
144 : default:
145 0 : return "INVALID";
146 : break;
147 : }
148 :
149 0 : }
150 :
151 : //_____________________________________________________________________________
152 : void
153 : AliRawDataErrorLog::Print(Option_t*) const
154 : {
155 0 : cout << Form("EventNumber %10d DdlID %5d ErrorLevel %10s ErrorCode %4d Occurence %5d",
156 0 : GetEventNumber(),GetDdlID(),
157 0 : GetErrorLevelAsString(),
158 0 : GetErrorCode(),
159 0 : GetCount()) << endl;
160 0 : cout << " " << GetMessage() << endl;
161 0 : }
|