]>
Commit | Line | Data |
---|---|---|
72b6c6b6 | 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 | ||
72090342 | 33 | #include <Riostream.h> |
34 | ||
72b6c6b6 | 35 | ClassImp(AliRawDataErrorLog) |
36 | ||
37 | //_____________________________________________________________________________ | |
38 | AliRawDataErrorLog::AliRawDataErrorLog() : | |
39 | TNamed(), | |
40 | fEventNumber(-1), | |
41 | fDdlID(-1), | |
9fc249d9 | 42 | fErrorLevel(AliRawDataErrorLog::kMinor), |
79dac785 | 43 | fErrorCode(0), |
44 | fCount(0) | |
72b6c6b6 | 45 | { |
46 | // Default constructor | |
47 | } | |
48 | ||
49 | //_____________________________________________________________________________ | |
50 | AliRawDataErrorLog::AliRawDataErrorLog(Int_t eventNumber, Int_t ddlId, | |
9fc249d9 | 51 | ERawDataErrorLevel errorLevel, |
52 | Int_t errorCode, | |
72b6c6b6 | 53 | const char *message) : |
54 | TNamed(message,""), | |
55 | fEventNumber(eventNumber), | |
56 | fDdlID(ddlId), | |
9fc249d9 | 57 | fErrorLevel(errorLevel), |
79dac785 | 58 | fErrorCode(errorCode), |
59 | fCount(1) | |
72b6c6b6 | 60 | { |
61 | // Constructor that specifies | |
62 | // the event number, ddl id, error type and | |
63 | // custom message related to the error | |
64 | } | |
65 | ||
66 | //___________________________________________________________________________ | |
67 | AliRawDataErrorLog::AliRawDataErrorLog(const AliRawDataErrorLog & source) : | |
68 | TNamed(source), | |
69 | fEventNumber(source.fEventNumber), | |
70 | fDdlID(source.fDdlID), | |
9fc249d9 | 71 | fErrorLevel(source.fErrorLevel), |
79dac785 | 72 | fErrorCode(source.fErrorCode), |
73 | fCount(source.fCount) | |
72b6c6b6 | 74 | { |
75 | // Copy constructor | |
76 | } | |
77 | ||
78 | //___________________________________________________________________________ | |
79 | AliRawDataErrorLog & AliRawDataErrorLog::operator=(const AliRawDataErrorLog &source) | |
80 | { | |
81 | // assignment operator | |
82 | if (this != &source) { | |
83 | TNamed::operator=(source); | |
84 | ||
85 | fEventNumber = source.GetEventNumber(); | |
86 | fDdlID = source.GetDdlID(); | |
9fc249d9 | 87 | fErrorLevel = source.GetErrorLevel(); |
88 | fErrorCode = source.GetErrorCode(); | |
79dac785 | 89 | fCount = source.GetCount(); |
72b6c6b6 | 90 | } |
91 | return *this; | |
92 | } | |
93 | ||
732a24fe | 94 | void AliRawDataErrorLog::Copy(TObject &obj) const { |
95 | ||
96 | // this overwrites the virtual TOBject::Copy() | |
97 | // to allow run time copying without casting | |
98 | // in AliESDEvent | |
99 | ||
100 | if(this==&obj)return; | |
101 | AliRawDataErrorLog *robj = dynamic_cast<AliRawDataErrorLog*>(&obj); | |
102 | if(!robj)return; // not an AliRawDataErrorLog | |
103 | *robj = *this; | |
104 | ||
105 | } | |
106 | ||
72b6c6b6 | 107 | //_____________________________________________________________________________ |
108 | Int_t AliRawDataErrorLog::Compare(const TObject *obj) const | |
109 | { | |
110 | // Compare the event numbers and DDL IDs | |
111 | // of two error log objects. | |
112 | // Used in the sorting of raw data error logs | |
113 | // during the raw data reading and reconstruction | |
114 | Int_t eventNumber = ((AliRawDataErrorLog*)obj)->GetEventNumber(); | |
115 | Int_t ddlID = ((AliRawDataErrorLog*)obj)->GetDdlID(); | |
116 | ||
117 | if (fEventNumber == eventNumber) { | |
118 | if (fDdlID == ddlID) | |
119 | return 0; | |
120 | else | |
121 | return ((fDdlID > ddlID) ? 1 : -1); | |
122 | } | |
123 | else | |
124 | return ((fEventNumber > eventNumber) ? 1 : -1); | |
125 | } | |
72090342 | 126 | |
127 | //_____________________________________________________________________________ | |
128 | const char* | |
129 | AliRawDataErrorLog::GetErrorLevelAsString() const | |
130 | { | |
131 | switch ( GetErrorLevel() ) | |
132 | { | |
133 | case kMinor: | |
134 | return "MINOR"; | |
135 | break; | |
136 | case kMajor: | |
137 | return "MAJOR"; | |
138 | break; | |
139 | case kFatal: | |
140 | return "FATAL"; | |
141 | break; | |
142 | default: | |
143 | return "INVALID"; | |
144 | break; | |
145 | } | |
146 | ||
147 | } | |
148 | ||
149 | //_____________________________________________________________________________ | |
150 | void | |
151 | AliRawDataErrorLog::Print(Option_t*) const | |
152 | { | |
153 | cout << Form("EventNumber %10d DdlID %5d ErrorLevel %10s ErrorCode %4d Occurence %5d", | |
154 | GetEventNumber(),GetDdlID(), | |
155 | GetErrorLevelAsString(), | |
156 | GetErrorCode(), | |
157 | GetCount()) << endl; | |
158 | cout << " " << GetMessage() << endl; | |
159 | } |