7 #define PTLUT_SIZE (1 << 30)
17 std::cout <<
"EMTF emulator: attempting to read pT LUT binary file from local area" << std::endl;
19 std::cout <<
"Non-standard operation; if it fails, now you know why" << std::endl;
20 std::cout <<
"Be sure to check that the 'scale_pt' function still matches this LUT" << std::endl;
21 std::cout <<
"Loading LUT, this might take a while..." << std::endl;
23 std::ifstream
infile(lut_full_path, std::ios::binary);
26 snprintf(what,
sizeof(what),
"Fail to open %s", lut_full_path.c_str());
27 throw std::invalid_argument(what);
33 full_word_t full_word;
34 full_word_t sub_word[4] = {0, 0, 0, 0};
36 while (
infile.read(reinterpret_cast<char*>(&full_word),
sizeof(full_word_t))) {
37 sub_word[0] = (full_word >> 0) & 0x1FF;
38 sub_word[1] = (full_word >> 9) & 0x1FF;
39 sub_word[2] = (full_word >> 32) & 0x1FF;
40 sub_word[3] = (full_word >> (32 + 9)) & 0x1FF;
42 ptlut_.push_back(sub_word[0]);
43 ptlut_.push_back(sub_word[1]);
44 ptlut_.push_back(sub_word[2]);
45 ptlut_.push_back(sub_word[3]);
51 snprintf(what,
sizeof(what),
"ptlut_.size() is %lu != %i",
ptlut_.size(),
PTLUT_SIZE);
52 throw std::invalid_argument(what);