2 #include <evt/ShowerRecData.h>
4 #include <utl/ErrorLogger.h>
5 #include <utl/Branch.h>
6 #include <utl/Particle.h>
7 #include <utl/AugerUnits.h>
9 #include <fwk/CentralConfig.h>
11 #include <revt/REvent.h>
12 #include <revt/Header.h>
13 #include <revt/Station.h>
14 #include <revt/StationRecData.h>
15 #include <revt/StationRRecDataQuantities.h>
16 #include <evt/ShowerRecData.h>
17 #include <evt/ShowerRRecData.h>
19 #include <utl/Trace.h>
20 #include <utl/TraceAlgorithm.h>
21 #include <utl/ErrorLogger.h>
22 #include <utl/Reader.h>
23 #include <utl/config.h>
24 #include <utl/AugerUnits.h>
25 #include <utl/CoordinateSystemPtr.h>
26 #include <utl/CoordinateSystem.h>
27 #include <fwk/LocalCoordinateSystem.h>
28 #include <fwk/CoordinateSystemRegistry.h>
31 #include <tst/Validatrix.h>
41 using namespace tst::Validatrix;
44 namespace VerificationRadio {
52 const string csString = topB.
GetChild(
"coordinateSystemId").
Get<
string>();
58 unsigned long parameterId = 0;
60 bool useAbsoluteTolerance =
false;
63 if (
b.GetName() ==
"StationQuantity") {
64 b.GetChild(
"ParameterId").GetData(parameterId);
65 b.GetChild(
"ParameterName").GetData(parameterName);
66 b.GetChild(
"UseAbsoluteTolerance").GetData(useAbsoluteTolerance);
67 b.GetChild(
"Tolerance").GetData(tolerance);
68 fStationTests.push_back(TestInformation(parameterId, parameterName, useAbsoluteTolerance, tolerance));
69 }
else if (
b.GetName() ==
"ShowerQuantity") {
70 b.GetChild(
"ParameterId").GetData(parameterId);
71 b.GetChild(
"ParameterName").GetData(parameterName);
72 b.GetChild(
"UseAbsoluteTolerance").GetData(useAbsoluteTolerance);
73 b.GetChild(
"Tolerance").GetData(tolerance);
74 fShowerTests.push_back(TestInformation(parameterId, parameterName, useAbsoluteTolerance, tolerance));
84 fTestResults =
new ofstream(fRefFileName +
".new");
86 return fTestResults->is_open() ?
eSuccess : eFailure;
94 info <<
"Run validation for radio event E" <<
event.GetREvent().GetHeader().GetId();
97 *fTestResults <<
BeLabel(
"Verification for Radio:");
100 *fTestResults <<
BeLabel(
"No radio event found! Test failed");
101 ERROR(
"No radio event found! Test failed");
104 REvent& rEvent =
event.GetREvent();
107 *fTestResults <<
BeLabel(
"No reconstructed shower found! Test failed");
108 ERROR(
"No reconstructed shower found! Test failed");
113 *fTestResults <<
BeLabel(
"No reconstructed radio shower found! Test failed");
114 ERROR(
"No reconstructed radio shower found! Test failed");
120 *fTestResults <<
BeLabel(
"Run number:")
126 *fTestResults <<
BeLabel(
"Tests on radio shower level:");
128 for (
const auto& info : fShowerTests) {
131 *fTestResults <<
BeLabel(label.str());
132 if (rRecShower.
HasParameter(ShowerRRecDataQuantities(info.fParameterId))) {
133 if (info.fUseAbsoluteTolerance)
134 *fTestResults <<
BeCloseAbs(rRecShower.
GetParameter(ShowerRRecDataQuantities(info.fParameterId)), info.fTolerance);
136 *fTestResults <<
BeCloseRel(rRecShower.
GetParameter(ShowerRRecDataQuantities(info.fParameterId)), info.fTolerance);
141 *fTestResults <<
BeLabel(label.str());
143 if (info.fUseAbsoluteTolerance)
153 *fTestResults <<
BeLabel(
"Tests on radio station level:");
158 *fTestResults <<
BeLabel(
"No radio reconstructed data on station level found! Test failed");
159 ERROR(
"No radio reconstructed data on station level found! Test failed");
163 for (
const auto& info : fStationTests) {
166 *fTestResults <<
BeLabel(label.str());
168 if (info.fUseAbsoluteTolerance)
176 *fTestResults <<
BeLabel(label.str());
178 if (info.fUseAbsoluteTolerance)
193 Verification::Finish()
196 fTestResults =
nullptr;
198 INFO(
"Comparing radio reconstruction results to reference file");
200 const auto comp =
Compare(fRefFileName, fRefFileName +
".new",
false);
Branch GetTopBranch() const
bool HasParameter(const Parameter i) const
std::string BeCloseRel(const T &value, const double tolerance=kDefaultTolerance)
bool HasParameterError(const Parameter i) const
StationRecData & GetRecData()
Get station level reconstructed data.
bool HasRecShower() const
Interface class to access to the Radio part of an event.
ShowerRecData & GetRecShower()
Interface class to access to the RD Reconstruction of a Shower.
double GetParameterError(const Parameter i) const
bool HasParameterError(const Parameter i1) const
#define INFO(message)
Macro for logging informational messages.
StationIterator StationsEnd()
StationIterator StationsBegin()
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
boost::filter_iterator< StationFilter, AllStationIterator > StationIterator
Iterator over all (non-exculded) stations.
std::string BeCloseAbs(const T &value, const double tolerance=kDefaultTolerance)
Class representing a document branch.
bool Compare(const string &oldFilename, const string &newFilename, const bool failOnFirst)
class to hold data at the radio Station level.
std::string BeLabel(const string &tag)
bool HasRRecShower() const
Header & GetHeader()
access to REvent Header
void GetData(bool &b) const
Overloads of the GetData member template function.
int GetId() const
Get the station Id.
std::string BeEqual(const T &value)
double GetParameter(const Parameter i) const
ResultFlag
Flag returned by module methods to the RunController.
bool HasParameter(const Parameter i) const
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
double GetParameter(const Parameter i) const
Branch GetFirstChild() const
Get first child of this Branch.
bool HasRecData() const
Check whether station reconstructed data exists.
#define ERROR(message)
Macro for logging error messages.
double GetParameterError(const Parameter i) const