49 auto posStart = mFileBuffStr.find(alias);
50 if (posStart == std::string::npos) {
51 LOG(info) << alias <<
" not found in LHC IF file";
54 auto posEnd = mFileBuffStr.find(
"\n", posStart);
55 LOG(
debug) <<
"posStart = " << posStart <<
", posEnd = " << posEnd;
56 if (posEnd == std::string::npos) {
57 posEnd = mFileBuffStr.size();
59 std::string subStr = mFileBuffStr.substr(posStart, posEnd - posStart);
62 LOG(
debug) <<
"size of tokensStr = " << tokensStr.size();
63 if (tokensStr.size() < 5) {
64 LOG(fatal) <<
"Number of tokens too small: " << tokensStr.size() <<
", should be at 5 (alias, type, nelements, value(s), timestamp(s)";
67 LOG(
debug) <<
"size of tokensStr_type = " << tokensStr_type.size();
69 type = tokensStr_type[0];
72 nele = std::stoi(tokensStr_type[1]);
73 nmeas = std::stoi(tokensStr[2]);
74 LOG(
debug) <<
"nele = " << nele <<
", nmeas = " << nmeas;
83 for (
int idx = 0; idx < nmeas; ++idx) {
86 if constexpr (std::is_same<T, int32_t>::value) {
88 for (
int iele = 0; iele < nele; ++iele) {
89 LOG(
debug) << alias <<
": value int/bool = " << tokensStr[shift + iele];
90 vect.emplace_back(std::stoi(tokensStr[shift + iele]));
93 LOG(fatal) <<
"templated function called with wrong type, should be int32_t or bool, but it is " <<
type;
95 }
else if constexpr (std::is_same<T, float>::value) {
97 for (
int iele = 0; iele < nele; ++iele) {
98 LOG(
debug) << alias <<
": value float = " << tokensStr[shift + iele];
99 vect.emplace_back(std::stof(tokensStr[shift + iele]));
102 LOG(fatal) <<
"templated function called with wrong type, should be float";
106 else if constexpr (std::is_same<T, std::string>::value) {
108 for (
int iele = 0; iele < nele; ++iele) {
109 LOG(
debug) << alias <<
": value string = " << tokensStr[shift + iele];
110 vect.emplace_back(tokensStr[shift + iele]);
113 LOG(fatal) <<
"templated function called with wrong type, should be string";
117 LOG(
debug) <<
"timestamp = " << std::stof(tokensStr[shift + nele]);
118 meas.emplace_back(std::stol(tokensStr[shift + nele]) * 1000, vect);