57 if( (
GetData32()[0] & 0xf8000000) != 0x40000000)
58 std::cerr <<
"First word has wrong identifier; first word = 0x"
59 << std::hex <<
GetData32()[0] << std::dec << std::endl;
62 int found_trailer_word = -1;
65 uint32_t current_tdc_header =0;
66 int index_for_trailer = 0;
68 int numberEventsInBank = 0;
70 for(
int i = 0; i <
GetSize(); i++){
75 if( (word & 0xf8000000) == 0x40000000){
81 if( (word & 0xf8000000) == 0x08000000){
82 current_tdc_header = word;
85 if( (word & 0xf8000000) == 0x00000000){
90 if( (word & 0xf8000000) == 0x18000000){
93 for(
unsigned int i = index_for_trailer; i <
fMeasurements.size(); i++){
100 if( (word & 0xf8000000) == 0x20000000){
103 std::cout <<
"Error word: " << std::hex <<
"0x"<<word<< std::dec << std::endl;
104 for(
unsigned int i = index_for_trailer; i <
fMeasurements.size(); i++){
115 if( (word & 0xf8000000) == 0x80000000){
116 found_trailer_word = i;
118 fStatus.push_back( (word & 0x07000000) >> 24);
122 if( (word & 0xf8000000) == 0xc0000000)
continue;
126 if(found_trailer_word == -1){
127 std::cerr <<
"Error in decoding V1190 data; didn't find trailer." << std::endl;
128 std::cerr <<
"Bank dump: " << std::endl;
129 for(
int i = 0; i <
GetSize(); i++){
131 std::cout <<
"0x"<<std::hex << word << std::dec << std::endl;
135 std::cerr <<
"Error; did not find trailer on last word of bank. trailer word = " << found_trailer_word
136 <<
" last word = " <<
GetSize()-1 << std::endl;
141 std::cerr <<
"Error in decoding V1190 data; word count in all trailers ("<<
fWordCountTotal
142 <<
") doesn't match bank size ("<<
GetSize() <<
")." << std::endl;
150 std::cout <<
"V1190 decoder for bank " <<
GetName().c_str() << std::endl;
152 std::cout <<
"Number of events in this bank: " <<
GetEventsInBank() << std::endl;
154 std::cout <<
"Measurement: " <<
fMeasurements[i].GetMeasurement() <<
" for tdc/chan " <<
157 std::cout <<
" (leading edge meas)";
159 std::cout <<
" (trailing edge meas)";
161 std::cout <<
"[event_id = " <<
fMeasurements[i].GetEventID() <<
",bunch_id="
164 std::cout <<
"[errors=0x"<< std::hex <<
fMeasurements[i].GetErrors() << std::dec <<
"]";
165 std::cout << std::endl;
void SetTrailer(uint32_t trailer)
Set the trailer word.
uint32_t GetTDCNumber() const
Get the TDC number.
bool HasTDCHeader() const
Check if measurement has a TDC header.
uint32_t GetErrors() const
Get Errors.
uint32_t tdc_trailer_word
bool HasTDCTrailer() const
Check if measurement has a TDC trailer.
uint32_t tdc_header_word
Found fields to hold the header, measurement, trailer and error words.
bool HasTDCErrorWord() const
Check if measurement has a TDC error word.
uint32_t GetBunchID() const
Get Bunch ID.
uint32_t GetEventID() const
Get Event ID; this is event number defined by V1190 module.
std::string GetName() const
const uint32_t * GetData32() const
int GetEventsInBank()
Get the number of events in this bank.
std::vector< int > fExtendedTriggerTimeTag
TV1190Data(int bklen, int bktype, const char *name, void *pdata)
Constructor.
void Print()
Print the bank contents in a structured way.
std::vector< uint32_t > fGlobalHeader
The overall global header.
std::vector< uint32_t > fStatus
std::vector< TDCMeasurement > fMeasurements
Vector of TDC Measurements.
uint32_t GetEventCounter(int index=0) const
Get Event Counter.
uint32_t GetGeoAddress(int index=0) const
Get Geographical Address.