3 #include <fwk/CentralConfig.h>
5 #include <utl/Branch.h>
6 #include <utl/ErrorLogger.h>
9 #include <revt/REvent.h>
10 #include <revt/Channel.h>
11 #include <revt/StationRecData.h>
23 namespace RdStationTimeWindowConsolidatorOG {
30 CentralConfig::GetInstance()->
GetTopBranch(
"RdStationTimeWindowConsolidator");
33 fRejectStationIfWindowTruncated =
34 (topBranch.
GetChild(
"RejectStationIfSignalSearchWindowTruncated").
Get<
string>() ==
"yes");
41 RdStationTimeWindowConsolidator::Run(
Event& event)
46 REvent& rEvent =
event.GetREvent();
48 for (
auto& station : rEvent.StationsRange()) {
49 if (!station.HasRecData())
56 err <<
"Trying to consolidate signal search window start-time for "
57 <<
"station id=" << station.GetId() <<
", but no signal search "
58 <<
"window information available in ParameterStorage!";
64 bool windowTruncated =
false;
67 double maximaltime = 0;
69 for(
const auto& channel : station.ChannelsRange()) {
70 if(!channel.IsActive())
73 const double tsstop = channel.GetChannelTimeSeries().GetStop()
74 * channel.GetChannelTimeSeries().GetBinning();
75 if(maximaltime < tsstop)
80 double searchWindowStart = recData.
GetParameter(eSignalSearchWindowStart);
81 double searchWindowStop = recData.
GetParameter(eSignalSearchWindowStop);
84 info <<
"Signal seach window of station " << station.GetId() <<
": "
85 << searchWindowStart <<
" to " << searchWindowStop;
89 if(searchWindowStart < 0) {
90 if(fRejectStationIfWindowTruncated) {
91 INFOFinal(
"eSignalSearchWindowStart < 0, rejecting station" + to_string(station.GetId()));
94 searchWindowStart = 0;
95 windowTruncated =
true;
100 if(searchWindowStop > maximaltime) {
101 if(fRejectStationIfWindowTruncated) {
102 INFOFinal(
"End of the signal window after trace end, rejecting station" +
103 to_string(station.GetId()));
107 info <<
"searchWindowStop ( " << searchWindowStop <<
" ) > maximaltime ( "
108 << maximaltime <<
" )";
111 searchWindowStop = maximaltime;
112 windowTruncated =
true;
117 if(searchWindowStart >= maximaltime || searchWindowStop <= 0) {
119 info <<
"No part of the signal search window (" << searchWindowStart /
ns
120 <<
" to " << searchWindowStop /
ns <<
" ns) is inside the trace."
121 <<
" Rejecting station " << station.GetId();
127 recData.
SetParameter(eSignalSearchWindowStart, searchWindowStart,
false);
128 recData.
SetParameter(eSignalSearchWindowStop, searchWindowStop,
false);
131 recData.
SetParameter(eSignalSearchWindowTruncated, windowTruncated);
134 fStationsWithTruncatedWindows++;
142 RdStationTimeWindowConsolidator::Finish()
145 info <<
"Found " << fStationsWithTruncatedWindows
146 <<
" stations with a truncated signal search window.";
Branch GetTopBranch() const
Class to access station level reconstructed data.
Interface class to access to the Radio part of an event.
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Class representing a document branch.
void GetData(bool &b) const
Overloads of the GetData member template function.
double GetParameter(const Parameter i) const
ResultFlag
Flag returned by module methods to the RunController.
bool HasParameter(const Parameter i) const
void SetParameter(Parameter i, double value, bool lock=true)
#define ERROR(message)
Macro for logging error messages.