3 #include <fwk/CentralConfig.h>
4 #include <fwk/RunController.h>
6 #include <utl/config.h>
7 #include <utl/ErrorLogger.h>
8 #include <utl/Reader.h>
10 #include <evt/Event.h>
11 #include <revt/REvent.h>
12 #include <revt/Channel.h>
13 #include <revt/Station.h>
14 #include <revt/StationRecData.h>
30 topBranch.
GetChild(
"NumberOfSamplesToKeep").
GetData(fNumberOfSamplesToKeep);
31 topBranch.
GetChild(
"NumberOfSamplesToRemove").
GetData(fNumberOfSamplesToRemove);
35 if (fMethodTypeString ==
"RemoveSamplesFromFront") {
36 fMethod = eRemoveSamplesFromFront;
37 }
else if (fMethodTypeString ==
"RemoveSamplesFromBack") {
38 fMethod = eRemoveSamplesFromBack;
46 if ((fNumberOfSamplesToKeep > 0 && fNumberOfSamplesToRemove > 0) ||
47 (fNumberOfSamplesToKeep == 0 && fNumberOfSamplesToRemove == 0)) {
48 ERROR(
"One of the fields (NumberOfSamplesToKeep, NumberOfSamplesToRemove) must be zero to define the stragegy");
53 if (fNumberOfSamplesToKeep > 0) {
54 info <<
"Will set all the trace to a size of " << fNumberOfSamplesToKeep <<
" samples";
57 info <<
"Will remove " << fNumberOfSamplesToRemove <<
" samples from the trace";
70 INFO(
"No radio event found!");
74 REvent& rEvent =
event.GetREvent();
78 for (
auto& station : rEvent.StationsRange()) {
79 for (
auto& channel : station.ChannelsRange()) {
81 if (!channel.IsActive())
86 const int samplesInTrace = timeSeries.
GetSize();
88 if ((fMethod == eRemoveSamplesFromBack || fMethod == eRemoveSamplesFromFront) &&
89 samplesInTrace < fNumberOfSamplesToRemove && fNumberOfSamplesToKeep == 0) {
91 info <<
"Station "<< station.GetId() <<
" Channel " << channel.GetId()
92 <<
": You want to remove " << fNumberOfSamplesToRemove
93 <<
" samples which is more than the length of the time series: " << samplesInTrace
94 <<
", skip to next channel";
100 if ((fMethod == eRemoveSamplesFromBack || fMethod == eRemoveSamplesFromFront) &&
101 fNumberOfSamplesToKeep > 0 && fNumberOfSamplesToKeep > samplesInTrace) {
103 info <<
"Station " << station.GetId() <<
" Channel " << channel.GetId()
104 <<
": You want to keep " << fNumberOfSamplesToKeep
105 <<
" samples which is more than the length of the time series: " << samplesInTrace
106 <<
", skip to next channel";
112 if (fNumberOfSamplesToKeep != 0) {
113 fNumberOfSamplesToRemove = samplesInTrace - fNumberOfSamplesToKeep;
116 if (fInfoLevel > eInfoIntermediate) {
118 info <<
"get size: " << samplesInTrace <<
"\n"
119 <<
"fNumberOfSamplesToRemove = " << fNumberOfSamplesToRemove;
121 if (fNumberOfSamplesToKeep > 0)
122 info <<
"\nfNumberOfSamplesToKeep = " << fNumberOfSamplesToKeep;
130 case eRemoveSamplesFromBack:
132 for (
int i = 0; i < fNumberOfSamplesToRemove; ++i)
137 case eRemoveSamplesFromFront:
144 tempTimeSeries.
PushBack(timeSeries[i]);
146 timeSeries = tempTimeSeries;
149 const double newStartTime = station.GetRecData().GetParameter(eTraceStartTime) +
150 fNumberOfSamplesToRemove * timeSeries.
GetBinning();
151 station.GetRecData().SetParameter(eTraceStartTime, newStartTime,
false);
157 WARNING(
"Undefined ClippingMethod. No Clipping performed");
170 RdChannelTimeSeriesClipper::Finish()
Interface class to access to the Radio part of an event.
double GetBinning() const
size of one slot
#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.
#define INFOIntermediate(y)
Class representing a document branch.
std::vector< double >::size_type SizeType
void PopBack()
Remove one value at the end of the trace.
#define WARNING(message)
Macro for logging warning messages.
void GetData(bool &b) const
Overloads of the GetData member template function.
void SetBinning(const double binning)
ResultFlag
Flag returned by module methods to the RunController.
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
void PushBack(const T &value)
Insert a single value at the end.
#define ERROR(message)
Macro for logging error messages.
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)