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.
2 #include "TGRSIDataParser.h"
3 
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;
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;
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 TGRSIDataParser::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 TGRSIDataParser::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 TGRSIDataParser::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 TGRSIDataParser::EDataParserState::kBadBank: stream<<"undefined bank"<<std::endl; break;
68  case TGRSIDataParser::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 
86 const char* TGRSIDataParserException::what() const noexcept
87 {
88  /// return message string built in default constructor
89  return fMessage.c_str();
90 }
TGRSIDataParser::EDataParserState fParserState
TGRSIDataParserException(TGRSIDataParser::EDataParserState state, int failedWord, bool multipleErrors)
const char * what() const noexcept override