|
18 | 18 | #include <regex> |
19 | 19 | #include "CommonUtils/StringUtils.h" |
20 | 20 | #include <fairlogger/Logger.h> |
| 21 | + |
21 | 22 | using namespace o2::ctp; |
22 | 23 | /// |
23 | 24 | /// Active run to keep cfg and saclers of active runs |
@@ -232,10 +233,44 @@ int CTPRunManager::processMessage(std::string& topic, const std::string& message |
232 | 233 | return 0; |
233 | 234 | } |
234 | 235 | if (topic.find("soxorbit") != std::string::npos) { |
235 | | - return 0; |
| 236 | + std::vector<std::string> tokens = o2::utils::Str::tokenize(message, ' '); |
| 237 | + int ret = 0; |
| 238 | + if (tokens.size() == 3) { |
| 239 | + long timestamp = std::stol(tokens[0]); |
| 240 | + uint32_t runnumber = std::stoul(tokens[1]); |
| 241 | + uint32_t orbit = std::stoul(tokens[2]); |
| 242 | + ret = saveSoxOrbit(runnumber, orbit, timestamp); |
| 243 | + std::string logmessage; |
| 244 | + if (ret) { |
| 245 | + logmessage = "Failed to update CCDB with SOX orbit."; |
| 246 | + } else { |
| 247 | + logmessage = "CCDB updated with SOX orbit."; |
| 248 | + } |
| 249 | + LOG(important) << logmessage << " run:" << runnumber << " sox orbit:" << orbit << " ts:" << timestamp; |
| 250 | + } else { |
| 251 | + LOG(error) << "Topic soxorbit dize !=3: " << message << " token size:" << tokens.size(); |
| 252 | + ret = 1; |
| 253 | + } |
| 254 | + return ret; |
236 | 255 | } |
237 | 256 | if (topic.find("orbitreset") != std::string::npos) { |
238 | | - return 0; |
| 257 | + std::vector<std::string> tokens = o2::utils::Str::tokenize(message, ' '); |
| 258 | + int ret = 0; |
| 259 | + if (tokens.size() == 1) { |
| 260 | + long timestamp = std::stol(tokens[0]); |
| 261 | + ret = saveOrbitReset(timestamp); |
| 262 | + std::string logmessage; |
| 263 | + if (ret) { |
| 264 | + logmessage = "Failed to update CCDB with orbitreset. "; |
| 265 | + } else { |
| 266 | + logmessage = "CCDB updated with orbitreset. "; |
| 267 | + } |
| 268 | + LOG(important) << logmessage << timestamp; |
| 269 | + } else { |
| 270 | + LOG(error) << "Topic orbit reset != 2: " << message << " token size:" << tokens.size(); |
| 271 | + ret = 1; |
| 272 | + } |
| 273 | + return ret; |
239 | 274 | } |
240 | 275 | static int nerror = 0; |
241 | 276 | if (topic.find("sox") != std::string::npos) { |
|
0 commit comments