GRSISort
Created by P.C. Bender
Developement Team: P.C. Bender, R. Dunlop, V. Bildstein
An extension of the ROOT analysis Framework
TGRSIDataParserException.cxx
Go to the documentation of this file.
1
#include "
TGRSIDataParserException.h
"
2
#include "
TGRSIDataParser.h
"
3
4
TGRSIDataParserException::TGRSIDataParserException
(
TGRSIDataParser::EDataParserState
state,
int
failedWord,
bool
multipleErrors)
5
: fParserState(state), fFailedWord(failedWord), fMultipleErrors(multipleErrors)
6
{
7
/// default constructor for TGRSIDataParserException, stores the data parser state and the word the parser failed on
8
/// and creates a message based on them that can be accessed via TGRSIDataParserException::what()
9
std::ostringstream stream;
10
stream<<
"TGRSIDataParser failed "
;
11
if
(
fMultipleErrors
) {
12
stream<<
"on multiple words, first was "
;
13
}
else
{
14
stream<<
"only on "
;
15
}
16
stream<<
fFailedWord
<<
". word: "
;
17
switch
(
fParserState
) {
18
case
TGRSIDataParser::EDataParserState::kGood
: stream<<
"state is good, no idea what went wrong!"
<<std::endl;
break
;
19
case
TGRSIDataParser::EDataParserState::kBadHeader
:
20
stream<<
"bad header (either not high nibble 0x8 or an undefined bank)"
<<std::endl;
21
break
;
22
case
TGRSIDataParser::EDataParserState::kMissingWords
: stream<<
"missing scaler words"
<<std::endl;
break
;
23
case
TGRSIDataParser::EDataParserState::kBadScalerLowTS
:
24
stream<<
"bad scaler word with low time stamp bits (high nibble not 0xa)"
<<std::endl;
25
break
;
26
case
TGRSIDataParser::EDataParserState::kBadScalerValue
:
27
stream<<
"bad scaler value (should never happen?)"
<<std::endl;
28
break
;
29
case
TGRSIDataParser::EDataParserState::kBadScalerHighTS
:
30
stream<<
"bad scaler word with high time stamp bits (either high nibble not 0xe or the 8 LSB don't match the 8 "
31
"LSB of time stamp)"
32
<<std::endl;
33
break
;
34
case
TGRSIDataParser::EDataParserState::kBadScalerType
: stream<<
"undefined scaler type"
<<std::endl;
break
;
35
case
TGRSIDataParser::EDataParserState::kBadTriggerId
:
36
stream<<
"bad word with channel trigger ID (high nibble not 0x9)"
<<std::endl;
37
break
;
38
case
TGRSIDataParser::EDataParserState::kBadLowTS
:
39
stream<<
"bad word with low time stamp bits (high nibble not 0xa)"
<<std::endl;
40
break
;
41
case
TGRSIDataParser::EDataParserState::kBadHighTS
:
42
stream<<
"bad word with deadtime/high time stamp bits (high nibble not 0xb)"
<<std::endl;
43
break
;
44
case
TGRSIDataParser::EDataParserState::kSecondHeader
:
45
stream<<
"found a second header (w/o finding a footer first)"
<<std::endl;
46
break
;
47
case
TGRSIDataParser::EDataParserState::kWrongNofWords
: stream<<
"wrong number of words"
<<std::endl;
break
;
48
case
TGRSIDataParser::EDataParserState::kNotSingleCfd
:
49
stream<<
"expected a single cfd word, got either none or multiple ones"
<<std::endl;
50
break
;
51
case
TGRSIDataParser::EDataParserState::kSizeMismatch
:
52
stream<<
"number of charge, cfd, and integration length words doesn't match"
<<std::endl;
53
break
;
54
case
TGRSIDataParser::EDataParserState::kBadFooter
:
55
stream<<
"bad footer (mismatch between lowest 14 bits of channel trigger ID)"
<<std::endl;
56
break
;
57
case
TGRSIDataParser::EDataParserState::kFault
:
58
stream<<
"found a fault word (high nibble 0xf) from the DAQ"
<<std::endl;
59
break
;
60
case
TGRSIDataParser::EDataParserState::kMissingPsd
: stream<<
"missing psd words"
<<std::endl;
break
;
61
case
TGRSIDataParser::EDataParserState::kMissingCfd
:
62
stream<<
"missing the cfd word (second word w/o MSB set)"
<<std::endl;
63
break
;
64
case
TGRSIDataParser::EDataParserState::kMissingCharge
:
65
stream<<
"missing charge words (should be at least two words w/o MSB set"
<<std::endl;
66
break
;
67
case
TGRSIDataParser::EDataParserState::kBadBank
: stream<<
"undefined bank"
<<std::endl;
break
;
68
case
TGRSIDataParser::EDataParserState::kBadModuleType
: stream<<
"undefined module type"
<<std::endl;
break
;
69
case
TGRSIDataParser::EDataParserState::kEndOfData
:
70
stream<<
"reached end of bank data but not end of fragment"
<<std::endl;
71
break
;
72
case
TGRSIDataParser::EDataParserState::kUndefined
:
73
stream<<
"undefined state, should not be possible?"
<<std::endl;
74
break
;
75
default
:
break
;
76
};
77
78
fMessage
= stream.str();
79
}
80
81
TGRSIDataParserException::~TGRSIDataParserException
()
82
{
83
/// default destructor
84
}
85
86
const
char
*
TGRSIDataParserException::what
() const noexcept
87
{
88
/// return message string built in default constructor
89
return
fMessage
.c_str();
90
}
TGRSIDataParserException::fParserState
TGRSIDataParser::EDataParserState fParserState
Definition:
TGRSIDataParserException.h:27
TGRSIDataParser::EDataParserState::kBadBank
TGRSIDataParser::EDataParserState::kBadScalerType
TGRSIDataParser::EDataParserState::kFault
TGRSIDataParser::EDataParserState::kWrongNofWords
TGRSIDataParser::EDataParserState
EDataParserState
Definition:
TGRSIDataParser.h:52
TGRSIDataParser::EDataParserState::kBadHeader
TGRSIDataParser::EDataParserState::kSizeMismatch
TGRSIDataParserException::fMultipleErrors
bool fMultipleErrors
Definition:
TGRSIDataParserException.h:29
TGRSIDataParser::EDataParserState::kUndefined
TGRSIDataParser::EDataParserState::kBadTriggerId
TGRSIDataParserException::fMessage
std::string fMessage
Definition:
TGRSIDataParserException.h:30
TGRSIDataParser::EDataParserState::kBadLowTS
TGRSIDataParser::EDataParserState::kMissingPsd
TGRSIDataParser::EDataParserState::kBadScalerHighTS
TGRSIDataParser::EDataParserState::kBadScalerValue
TGRSIDataParser::EDataParserState::kMissingCfd
TGRSIDataParserException::~TGRSIDataParserException
~TGRSIDataParserException() override
Definition:
TGRSIDataParserException.cxx:81
TGRSIDataParser.h
TGRSIDataParserException::TGRSIDataParserException
TGRSIDataParserException(TGRSIDataParser::EDataParserState state, int failedWord, bool multipleErrors)
Definition:
TGRSIDataParserException.cxx:4
TGRSIDataParser::EDataParserState::kBadFooter
TGRSIDataParser::EDataParserState::kEndOfData
TGRSIDataParser::EDataParserState::kSecondHeader
TGRSIDataParser::EDataParserState::kMissingCharge
TGRSIDataParser::EDataParserState::kNotSingleCfd
TGRSIDataParserException.h
TGRSIDataParser::EDataParserState::kBadHighTS
TGRSIDataParser::EDataParserState::kGood
TGRSIDataParser::EDataParserState::kMissingWords
TGRSIDataParserException::what
const char * what() const noexcept override
Definition:
TGRSIDataParserException.cxx:86
TGRSIDataParser::EDataParserState::kBadScalerLowTS
TGRSIDataParserException::fFailedWord
int fFailedWord
Definition:
TGRSIDataParserException.h:28
TGRSIDataParser::EDataParserState::kBadModuleType