Commit 8d67d6d0 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

TPX3reader: go back to read "SPDR" as int and compare directly. No mess with char arrays

parent a153471c
Pipeline #238189 failed with stages
in 1 minute and 37 seconds
......@@ -145,13 +145,12 @@ void Timepix3EventLoader::initialise() {
LOG(DEBUG) << "Opened data file for " << detectorID << ": " << filename;
// The header is repeated in every new data file, thus skip it for all.
char buffer[4];
if(!new_file->read(reinterpret_cast<char*>(&buffer), sizeof 4)) {
uint32_t headerID;
if(!new_file->read(reinterpret_cast<char*>(&headerID), sizeof headerID)) {
throw AlgorithmError("Cannot read header ID for " + detectorID + " in file " + filename);
}
std::string headerID(buffer);
if(headerID != "SPDR") {
throw AlgorithmError("Incorrect header ID for " + detectorID + " in file " + filename + ": " + headerID);
if(headerID != 1380208723) {
throw AlgorithmError("Incorrect header ID for " + detectorID + " in file " + filename + ": " + std::to_string(headerID));
}
LOG(TRACE) << "Header ID: \"" << headerID << "\"";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment