7 #define PTLUT_SIZE (1<<30) 24 std::cout <<
"EMTF emulator: attempting to read pT LUT binary file from local area" << std::endl;
26 std::cout <<
"Non-standard operation; if it fails, now you know why" << std::endl;
27 std::cout <<
"Be sure to check that the 'scale_pt' function still matches this LUT" << std::endl;
28 std::cout <<
"Loading LUT, this might take a while..." << std::endl;
30 std::ifstream infile(lut_full_path, std::ios::binary);
33 snprintf(what,
sizeof(what),
"Fail to open %s", lut_full_path.c_str());
34 throw std::invalid_argument(what);
40 full_word_t full_word;
41 full_word_t sub_word[4] = {0, 0, 0, 0};
43 while (infile.read(reinterpret_cast<char*>(&full_word),
sizeof(full_word_t))) {
44 sub_word[0] = (full_word>>0) & 0x1FF;
45 sub_word[1] = (full_word>>9) & 0x1FF;
46 sub_word[2] = (full_word>>32) & 0x1FF;
47 sub_word[3] = (full_word>>(32+9)) & 0x1FF;
49 ptlut_.push_back(sub_word[0]);
50 ptlut_.push_back(sub_word[1]);
51 ptlut_.push_back(sub_word[2]);
52 ptlut_.push_back(sub_word[3]);
58 snprintf(what,
sizeof(what),
"ptlut_.size() is %lu != %i",
ptlut_.size(),
PTLUT_SIZE);
59 throw std::invalid_argument(what);
void read(const std::string &lut_full_path)
unsigned long long uint64_t
content_t lookup(const address_t &address) const