2 #include <evt/ShowerRecData.h>
3 #include <evt/ShowerSRecData.h>
5 #include <sevt/SEvent.h>
6 #include <sevt/SortCriteria.h>
8 #include <utl/ErrorLogger.h>
9 #include <utl/Branch.h>
10 #include <utl/AugerUnits.h>
12 #include <tst/Validatrix.h>
14 #include <fwk/CentralConfig.h>
15 #include <fwk/LocalCoordinateSystem.h>
25 using namespace tst::Validatrix;
28 namespace ValidationNS {
33 auto topB = CentralConfig::GetInstance()->GetTopBranch(
"Validation");
34 topB.GetChild(
"RefFilename").GetData(fRefFileName);
36 fResults =
new ofstream(fRefFileName +
".new");
46 ERROR(
"Event should contain an SEvent.");
51 const auto& sEvent =
event.GetSEvent();
53 const auto eventId =
event.GetHeader().GetId();
57 for (
const auto&
s : sEvent.StationsRange()) {
60 label <<
"E" << eventId <<
"_S" <<
s.GetId();
61 *fResults <<
BeLabel(label.str());
62 *fResults <<
BeCloseRel(
s.GetRecData().GetTotalSignal(), 0.05);
67 *fResults <<
BeLabel(
"Shower_rec");
71 ERROR(
"Event does not contain a RecShower");
73 const auto& showerRec =
event.GetRecShower();
74 if (!showerRec.HasSRecShower())
75 ERROR(
"RecShower does not have SRecShower");
77 *fResults <<
BeLabel(
"Shower_S_rec");
79 const auto& showerSRec = showerRec.GetSRecShower();
81 const auto& corePos = showerSRec.GetCorePosition();
84 const auto& coreCS = LocalCoordinateSystem::Create(corePos);
86 const auto& baryCS = LocalCoordinateSystem::Create(corePos);
90 const double tolerance = 1e-3;
92 label << eventId <<
"_ShowerSize";
93 *fResults <<
BeLabel(label.str());
94 *fResults <<
BeCloseRel(showerSRec.GetShowerSize(), tolerance);
97 label << eventId <<
"_ShowerSizeError";
98 *fResults <<
BeLabel(label.str());
99 *fResults <<
BeCloseRel(showerSRec.GetShowerSizeError(), tolerance);
105 label << eventId <<
"_LDFChi2";
106 *fResults <<
BeLabel(label.str());
107 *fResults <<
BeCloseRel(showerSRec.GetLDFChi2(), tolerance);
110 label << eventId <<
"_LDFNdof";
111 *fResults <<
BeLabel(label.str());
112 *fResults <<
BeEqual(showerSRec.GetLDFNdof());
115 label << eventId <<
"_Theta";
116 *fResults <<
BeLabel(label.str());
117 *fResults <<
BeCloseRel(showerSRec.GetAxis().GetTheta(coreCS), tolerance);
120 label << eventId <<
"_Phi";
121 *fResults <<
BeLabel(label.str());
122 *fResults <<
BeCloseRel(showerSRec.GetAxis().GetPhi(coreCS), tolerance);
125 label << eventId <<
"_ThetaError";
126 *fResults <<
BeLabel(label.str());
127 *fResults <<
BeCloseRel(showerSRec.GetThetaError(), tolerance);
130 label << eventId <<
"_PhiError";
131 *fResults <<
BeLabel(label.str());
132 *fResults <<
BeCloseRel(showerSRec.GetPhiError(), tolerance);
135 label << eventId <<
"_CoreX";
136 *fResults <<
BeLabel(label.str());
137 *fResults <<
BeCloseAbs(corePos.GetX(baryCS), tolerance);
140 label << eventId <<
"_CoreY";
141 *fResults <<
BeLabel(label.str());
142 *fResults <<
BeCloseAbs(corePos.GetY(baryCS), tolerance);
145 label << eventId <<
"_CoreZ";
146 *fResults <<
BeLabel(label.str());
147 *fResults <<
BeCloseAbs(corePos.GetZ(baryCS), tolerance);
150 label << eventId <<
"_CorrelationXY";
151 *fResults <<
BeLabel(label.str());
152 *fResults <<
BeCloseAbs(showerSRec.GetCorrelationXY(), tolerance);
171 label << eventId <<
"_CoreTSecond";
172 *fResults <<
BeLabel(label.str());
173 *fResults <<
BeCloseRel(showerSRec.GetCoreTime().GetGPSSecond(), tolerance);
176 label << eventId <<
"_CoreTNanoSecond";
177 *fResults <<
BeLabel(label.str());
178 *fResults <<
BeCloseRel(showerSRec.GetCoreTime().GetGPSNanoSecond(), tolerance);
181 label << eventId <<
"_CoreXError";
182 *fResults <<
BeLabel(label.str());
183 *fResults <<
BeCloseRel(showerSRec.GetCoreError().GetX(baryCS), tolerance);
186 label << eventId <<
"_CoreYError";
187 *fResults <<
BeLabel(label.str());
188 *fResults <<
BeCloseRel(showerSRec.GetCoreError().GetY(baryCS), tolerance);
191 label << eventId <<
"_CoreTError";
192 *fResults <<
BeLabel(label.str());
193 *fResults <<
BeCloseRel(showerSRec.GetCoreTimeError().GetInterval(), tolerance);
206 const bool comp =
Compare(fRefFileName, fRefFileName +
".new",
false);
std::string BeCloseRel(const T &value, const double tolerance=kDefaultTolerance)
bool HasRecShower() const
void Init()
Initialise the registry.
std::string BeCloseAbs(const T &value, const double tolerance=kDefaultTolerance)
bool Compare(const string &oldFilename, const string &newFilename, const bool failOnFirst)
std::string BeLabel(const string &tag)
std::string BeEqual(const T &value)
ResultFlag
Flag returned by module methods to the RunController.
#define ERROR(message)
Macro for logging error messages.