GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TTdrDataParserException.cxx
Go to the documentation of this file.
2#include "TTdrDataParser.h"
3
5 : fParserState(state), fFailedWord(failedWord), fMultipleErrors(multipleErrors)
6{
7 /// default constructor for TTdrDataParserException, 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 TTdrDataParserException::what()
9 std::ostringstream stream;
10 stream << "TTdrDataParser 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 TTdrDataParser::EDataParserState::kGood: stream << "state is good, no idea what went wrong!" << std::endl; break;
20 stream << "bad header (either not high nibble 0x8 or an undefined bank)" << std::endl;
21 break;
22 case TTdrDataParser::EDataParserState::kMissingWords: stream << "missing scaler words" << std::endl; break;
24 stream << "bad scaler word with low time stamp bits (high nibble not 0xa)" << std::endl;
25 break;
27 stream << "bad scaler value (should never happen?)" << std::endl;
28 break;
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 TTdrDataParser::EDataParserState::kBadScalerType: stream << "undefined scaler type" << std::endl; break;
36 stream << "bad word with channel trigger ID (high nibble not 0x9)" << std::endl;
37 break;
39 stream << "bad word with low time stamp bits (high nibble not 0xa)" << std::endl;
40 break;
42 stream << "bad word with deadtime/high time stamp bits (high nibble not 0xb)" << std::endl;
43 break;
45 stream << "found a second header (w/o finding a footer first)" << std::endl;
46 break;
47 case TTdrDataParser::EDataParserState::kWrongNofWords: stream << "wrong number of words" << std::endl; break;
49 stream << "expected a single cfd word, got either none or multiple ones" << std::endl;
50 break;
52 stream << "number of charge, cfd, and integration length words doesn't match" << std::endl;
53 break;
55 stream << "bad footer (mismatch between lowest 14 bits of channel trigger ID)" << std::endl;
56 break;
58 stream << "found a fault word (high nibble 0xf) from the DAQ" << std::endl;
59 break;
60 case TTdrDataParser::EDataParserState::kMissingPsd: stream << "missing psd words" << std::endl; break;
62 stream << "missing the cfd word (second word w/o MSB set)" << std::endl;
63 break;
65 stream << "missing charge words (should be at least two words w/o MSB set" << std::endl;
66 break;
67 case TTdrDataParser::EDataParserState::kBadBank: stream << "undefined bank" << std::endl; break;
68 case TTdrDataParser::EDataParserState::kBadModuleType: stream << "undefined module type" << std::endl; break;
70 stream << "reached end of bank data but not end of fragment" << std::endl;
71 break;
73 stream << "undefined state, should not be possible?" << std::endl;
74 break;
75 default: break;
76 };
77
78 fMessage = stream.str();
79}
80
82{
83 /// default destructor
84}
85
86const char* TTdrDataParserException::what() const noexcept
87{
88 /// return message string built in default constructor
89 return fMessage.c_str();
90}
const char * what() const noexcept override
TTdrDataParserException(TTdrDataParser::EDataParserState state, int failedWord, bool multipleErrors)
TTdrDataParser::EDataParserState fParserState