3 #include <sevt/SEvent.h>
4 #include <sevt/EventTrigger.h>
5 #include <utl/String.h>
13 namespace SdStationCheckerOG {
16 MakeInfo(
const vector<int>& ids,
const string& message)
31 auto& sEvent =
event.GetSEvent();
33 vector<int> randomTrigger;
34 vector<int> badCompression;
37 const bool isCommsCrisis = kCommsCrisis.IsInRange(det::Detector::GetInstance().GetTime());
40 for (
auto& station : sEvent.StationsRange()) {
42 if (!station.HasTriggerData()) {
49 if (!station.IsT2Life())
51 if (isCommsCrisis && !station.IsT2Life120())
54 const auto& trig = station.GetTriggerData();
55 if (trig.GetErrorCode() & 0xff) {
56 if (trig.IsSilent() && !station.IsRejected())
63 if (trig.IsRandom()) {
64 randomTrigger.push_back(station.GetId());
69 if (!station.HasCalibData()) {
75 if (station.GetCalibData().GetVersion() > 32000) {
77 warn <<
"Station " << station.GetId() <<
" has LS calibration version "
78 << station.GetCalibData().GetVersion() <<
'!';
84 if (!station.HasGPSData()) {
92 if (sEvent.HasTrigger()) {
93 const int trigSecond = sEvent.GetTrigger().GetTime().GetGPSSecond();
94 const int timeDiff = int(station.GetGPSData().GetSecond()) - trigSecond;
95 if (
abs(timeDiff) > 1) {
98 const int sId = station.GetId();
99 badCompression.push_back(sId);
101 info <<
"Bad compress data: station " << sId <<
" has " << timeDiff
102 <<
" sec of time difference to event trigger.";
110 MakeInfo(randomTrigger,
"with random trigger rejected.");
111 MakeInfo(badCompression,
"with bad compression data rejected.");
147 const unsigned int tick = gpsData.
GetTick();
148 const int currentST = gpsData.GetCurrentST();
149 const int next100 = gpsData.GetNext100();
150 const int nextST = gpsData.GetNextST();
153 const unsigned int tickFall = gpsData.GetTickFall();
154 const int offset = gpsData.GetOffset();
157 (
unsigned int)((tick * (1e9 + nextST - currentST) / next100) + currentST +
158 0.01 * short(offset & 0xffff)) - 100 * (tickFall == tick);
160 const unsigned int nanosecond =
161 (
unsigned int)((tick * (1e9 + nextST - currentST) / next100) + currentST);
164 gpsData.SetCorrectedNanosecond(nanosecond);
#define INFO(message)
Macro for logging informational messages.
void ApplyTimeCorrection(StationGPSData &gpsData)
const char * Plural(const T n)
unsigned int GetTick() const
class to hold data at Station level
constexpr double nanosecond
double abs(const SVector< n, T > &v)
sevt::StationGPSData & GetGPSData()
Get GPS data for the station.
#define WARNING(message)
Macro for logging warning messages.
void MakeInfo(const vector< int > &ids, const string &message)
ResultFlag
Flag returned by module methods to the RunController.
string OfSortedIds(vector< int > ids)