2 #include <fwk/CentralConfig.h>
3 #include <det/VManager.h>
4 #include <utl/Branch.h>
5 #include <utl/ErrorLogger.h>
6 #include <utl/String.h>
8 #include <sevt/SEvent.h>
9 #include <sevt/StationConstants.h>
19 using namespace SdBadStationRejectorKG;
25 auto topB = CentralConfig::GetInstance()->GetTopBranch(
"SdBadStationRejector");
30 info <<
"registered stations:";
31 for (
auto b = topB.GetFirstChild();
b;
b =
b.GetNextSibling()) {
32 const auto stationId = VManager::FindComponent<size_t>(
"id",
b.GetAttributes());
33 const auto reason = VManager::FindComponent<string>(
"reason",
b.GetAttributes());
35 const auto range =
b.Get<vector<utl::TimeStamp>>();
37 fRejectMap.insert(make_pair(range[0], make_pair(range[1], stationId)));
39 info <<
' ' << stationId <<
" [" << range[0] <<
", " << range[1] <<
')';
43 return fRejectMap.empty() ? eFailure :
eSuccess;
48 SdBadStationRejector::Run(
Event& event)
53 auto& sEvent =
event.GetSEvent();
55 const auto& time = det::Detector::GetInstance().GetTime();
57 const auto badIds = fRejectMap.GetBadStations(time);
60 for (
const auto& sId : badIds) {
61 if (sEvent.HasStation(sId)) {
62 infoList.push_back(sId);
68 if (!infoList.empty()) {
70 info <<
Join(
" ", infoList) <<
"rejected.";
79 SdBadStationRejector::Finish()
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
oss<< "0b";oss<< ((x >> i)&1);return oss.str();}template< class S, class V > std::string Join(const S &sep, const V &v)
ResultFlag
Flag returned by module methods to the RunController.