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;
26 using namespace ValidationNS;
35 fResults =
new ofstream((fRefFileName +
string(
".new")).c_str());
46 ERROR(
"Event should contain an SEvent.");
51 const auto& sEvent =
event.GetSEvent();
53 const double tolerance = 0.02;
57 for (
const auto& station : sEvent.StationsRange()) {
58 if (station.HasRecData()) {
60 label <<
"Station_" << station.GetId();
61 *fResults <<
BeLabel(label.str());
62 *fResults <<
BeCloseRel(station.GetRecData().GetTotalSignal(), tolerance);
66 *fResults <<
BeLabel(
"Shower_rec");
70 ERROR(
"Event does not contain a RecShower");
71 const auto& showerRec =
event.GetRecShower();
75 if (!showerRec.HasSRecShower())
76 ERROR(
"RecShower does not have SRecShower");
78 *fResults <<
BeLabel(
"Shower_S_rec");
80 const auto& showerSRec = showerRec.GetSRecShower();
82 const auto& corePos = showerSRec.GetCorePosition();
83 const auto& baryPos = showerSRec.GetBarycenter();
84 const auto& coreCS = LocalCoordinateSystem::Create(corePos);
85 const auto& baryCS = LocalCoordinateSystem::Create(baryPos);
87 #define SCOMPARE(item, eps) \
88 *fResults << BeLabel(#item); \
89 *fResults << BeCloseRel(showerSRec.Get##item(), eps)
93 SCOMPARE(ShowerSizeError, tolerance);
97 *fResults <<
BeLabel(
"LDFNdof");
98 *fResults <<
BeEqual(showerSRec.GetLDFNdof());
101 *fResults <<
BeCloseRel(showerSRec.GetAxis().GetTheta(coreCS), tolerance);
103 *fResults <<
BeCloseRel(showerSRec.GetAxis().GetPhi(coreCS), tolerance);
108 *fResults <<
BeCloseRel(corePos.GetX(baryCS), tolerance);
110 *fResults <<
BeCloseRel(corePos.GetY(baryCS), tolerance);
111 *fResults <<
BeLabel(
"CoreXError");
112 *fResults <<
BeCloseRel(showerSRec.GetCoreError().GetX(baryCS), tolerance);
113 *fResults <<
BeLabel(
"CoreYError");
114 *fResults <<
BeCloseRel(showerSRec.GetCoreError().GetY(baryCS), tolerance);
127 ifstream newFile((fRefFileName +
string(
".new")).c_str());
128 ifstream oldFile(fRefFileName.c_str());
130 const bool comp =
Compare(oldFile, newFile,
true);
Branch GetTopBranch() const
std::string BeCloseRel(const T &value, const double tolerance=kDefaultTolerance)
bool HasRecShower() const
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.
bool Compare(const string &oldFilename, const string &newFilename, const bool failOnFirst)
std::string BeLabel(const string &tag)
#define SCOMPARE(item, eps)
void GetData(bool &b) const
Overloads of the GetData member template function.
std::string BeEqual(const T &value)
ResultFlag
Flag returned by module methods to the RunController.
#define ERROR(message)
Macro for logging error messages.