]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/ESD/AliRawDataErrorLog.cxx
split of VVtrack and Vtrack interfaces, update of AliFlat classes (only partially...
[u/mrichter/AliRoot.git] / STEER / ESD / AliRawDataErrorLog.cxx
CommitLineData
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
66b0310c 35using std::endl;
36using std::cout;
72b6c6b6 37ClassImp(AliRawDataErrorLog)
38
39//_____________________________________________________________________________
40AliRawDataErrorLog::AliRawDataErrorLog() :
41 TNamed(),
42 fEventNumber(-1),
43 fDdlID(-1),
9fc249d9 44 fErrorLevel(AliRawDataErrorLog::kMinor),
79dac785 45 fErrorCode(0),
46 fCount(0)
72b6c6b6 47{
48 // Default constructor
49}
50
51//_____________________________________________________________________________
52AliRawDataErrorLog::AliRawDataErrorLog(Int_t eventNumber, Int_t ddlId,
9fc249d9 53 ERawDataErrorLevel errorLevel,
54 Int_t errorCode,
72b6c6b6 55 const char *message) :
56 TNamed(message,""),
57 fEventNumber(eventNumber),
58 fDdlID(ddlId),
9fc249d9 59 fErrorLevel(errorLevel),
79dac785 60 fErrorCode(errorCode),
61 fCount(1)
72b6c6b6 62{
63 // Constructor that specifies
64 // the event number, ddl id, error type and
65 // custom message related to the error
66}
67
68//___________________________________________________________________________
69AliRawDataErrorLog::AliRawDataErrorLog(const AliRawDataErrorLog & source) :
70 TNamed(source),
71 fEventNumber(source.fEventNumber),
72 fDdlID(source.fDdlID),
9fc249d9 73 fErrorLevel(source.fErrorLevel),
79dac785 74 fErrorCode(source.fErrorCode),
75 fCount(source.fCount)
72b6c6b6 76{
77 // Copy constructor
78}
79
80//___________________________________________________________________________
81AliRawDataErrorLog & AliRawDataErrorLog::operator=(const AliRawDataErrorLog &source)
82{
83 // assignment operator
84 if (this != &source) {
85 TNamed::operator=(source);
86
87 fEventNumber = source.GetEventNumber();
88 fDdlID = source.GetDdlID();
9fc249d9 89 fErrorLevel = source.GetErrorLevel();
90 fErrorCode = source.GetErrorCode();
79dac785 91 fCount = source.GetCount();
72b6c6b6 92 }
93 return *this;
94}
95
732a24fe 96void 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 if(this==&obj)return;
103 AliRawDataErrorLog *robj = dynamic_cast<AliRawDataErrorLog*>(&obj);
104 if(!robj)return; // not an AliRawDataErrorLog
105 *robj = *this;
106
107}
108
72b6c6b6 109//_____________________________________________________________________________
110Int_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 Int_t eventNumber = ((AliRawDataErrorLog*)obj)->GetEventNumber();
117 Int_t ddlID = ((AliRawDataErrorLog*)obj)->GetDdlID();
118
119 if (fEventNumber == eventNumber) {
120 if (fDdlID == ddlID)
121 return 0;
122 else
123 return ((fDdlID > ddlID) ? 1 : -1);
124 }
125 else
126 return ((fEventNumber > eventNumber) ? 1 : -1);
127}
72090342 128
129//_____________________________________________________________________________
130const char*
131AliRawDataErrorLog::GetErrorLevelAsString() const
132{
133 switch ( GetErrorLevel() )
134 {
135 case kMinor:
136 return "MINOR";
137 break;
138 case kMajor:
139 return "MAJOR";
140 break;
141 case kFatal:
142 return "FATAL";
143 break;
144 default:
145 return "INVALID";
146 break;
147 }
148
149}
150
151//_____________________________________________________________________________
152void
153AliRawDataErrorLog::Print(Option_t*) const
154{
155 cout << Form("EventNumber %10d DdlID %5d ErrorLevel %10s ErrorCode %4d Occurence %5d",
156 GetEventNumber(),GetDdlID(),
157 GetErrorLevelAsString(),
158 GetErrorCode(),
159 GetCount()) << endl;
160 cout << " " << GetMessage() << endl;
161}