2 #include <evt/ShowerRecData.h>
3 #include <evt/ShowerSRecData.h>
4 #include <evt/ShowerSimData.h>
6 #include <sevt/SEvent.h>
7 #include <sevt/PMTSimData.h>
8 #include <sevt/SortCriteria.h>
10 #include <fevt/FEvent.h>
12 #include <fevt/Telescope.h>
13 #include <fevt/EyeRecData.h>
14 #include <fevt/TelescopeRecData.h>
16 #include <evt/ShowerFRecData.h>
18 #include <utl/ErrorLogger.h>
19 #include <utl/Branch.h>
20 #include <utl/Particle.h>
21 #include <utl/AugerUnits.h>
22 #include <utl/Point.h>
23 #include <fwk/CoordinateSystemRegistry.h>
25 #include <tst/Validatrix.h>
27 #include <fwk/CentralConfig.h>
39 using namespace tst::Validatrix;
40 using namespace ValidationNS;
46 INFO(
"Doing the validation !!!!");
52 cout <<
"Validation mode = " << mode << endl;
54 fMode = mode ==
"Create" ? Validation::eCreate : Validation::eCompare;
67 ERROR(
"Event should contain an SEvent.");
71 SEvent& sEvent =
event.GetSEvent();
84 if (sIt->HasRecData()) {
86 label <<
"Station_" << sIt->GetId();
87 fResults <<
BeLabel(label.str());
88 fResults <<
BeCloseRel(sIt->GetRecData().GetTotalSignal(), 0.05);
94 ERROR(
"Event should contain an FEvent.");
98 const FEvent& fEvent =
event.GetFEvent();
103 eIt != fEvent.
EyesEnd(ComponentSelector::eHasData); ++eIt) {
105 if (eIt->HasRecData()) {
107 label <<
"Eye_" << eIt->GetId();
108 fResults <<
BeLabel(label.str());
110 const ShowerFRecData& showerRec = eIt->GetRecData().GetFRecShower();
111 fResults <<
BeLabel(
"Stations_in_fit");
112 fResults <<
BeEqual(showerRec.GetStationIds());
114 fResults <<
BeLabel(
"TotalEnergy(EeV)");
115 fResults <<
BeCloseRel(showerRec.GetTotalEnergy()/
EeV, 1e-5);
117 fResults <<
BeLabel(
"TotalEnergyError(EeV)");
118 fResults <<
BeCloseRel(showerRec.GetTotalEnergyError()/
EeV, 1e-1);
120 fResults <<
BeLabel(
"Xmax(g/cm2)");
123 fResults <<
BeLabel(
"Xmax2Error");
124 fResults <<
BeCloseRel(showerRec.GetGHParameters().GetXMaxError()/
gram*
cm2, 1e-1);
128 tIt != eIt->TelescopesEnd(ComponentSelector::eHasData); ++tIt) {
130 if (tIt->HasRecData()) {
132 label <<
"Telescope_" << tIt->GetId();
133 fResults <<
BeLabel(label.str());
138 fResults <<
BeLabel(
"photon_trace_start_sec");
139 fResults <<
BeEqual(tRec.GetPhotonsStartTime().GetGPSSecond());
140 fResults <<
BeLabel(
"photon_trace_start_ns");
141 fResults <<
BeCloseAbs(tRec.GetPhotonsStartTime().GetGPSNanoSecond(), 50*
ns);
146 fResults <<
BeLabel(
"Shower_rec");
150 ERROR(
"Event does not contain a RecShower");
156 ERROR(
"RecShower does not have SRecShower");
158 fResults <<
BeLabel(
"Shower_S_rec");
168 ERROR(
"Event does not have ShowerSimData");
176 fResults <<
BeLabel(
"core position (pampa CS)");
190 if (fMode == Validation::eCreate) {
191 INFO(
"Writing reference file");
192 ofstream fout(fRefFileName.c_str());
193 fout << fResults.str();
196 INFO(
"Comparing re-reconstruction results to reference file");
197 ifstream savedFile(fRefFileName.c_str());
198 comp =
Compare(fResults, savedFile,
false);
202 const string newRef = fRefFileName +
".after-rereconstruction";
203 ofstream fout(newRef.c_str());
204 fout << fResults.str();
Branch GetTopBranch() const
StationIterator StationsEnd()
End of all stations.
std::string BeCloseRel(const T &value, const double tolerance=kDefaultTolerance)
Interface class to access to the SD Reconstruction of a Shower.
boost::filter_iterator< ComponentSelector, ConstAllEyeIterator > ConstEyeIterator
Interface class to access Shower Reconstructed parameters.
bool HasRecShower() const
Interface class to access to the SD part of an event.
bool HasSimShower() const
EyeIterator EyesEnd(const ComponentSelector::Status status)
#define INFO(message)
Macro for logging informational messages.
double GetShowerSize() const
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
void SortStations(const OrderingCriterion ord) const
Sort the list of stations by the criterion specified in an OrderingCriterion object.
ShowerSRecData & GetSRecShower()
std::string BeCloseAbs(const T &value, const double tolerance=kDefaultTolerance)
Interface class to access Shower Simulated parameters.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Class representing a document branch.
bool Compare(const string &oldFilename, const string &newFilename, const bool failOnFirst)
double GetX(const CoordinateSystemPtr &coordinateSystem) const
std::string BeLabel(const string &tag)
const utl::Point & GetPosition() const
Get the position of the shower core.
EyeIterator EyesBegin(const ComponentSelector::Status status)
Telescope-specific shower reconstruction data.
void GetData(bool &b) const
Overloads of the GetData member template function.
Top of Fluorescence Detector event hierarchy.
std::string BeEqual(const T &value)
double GetY(const CoordinateSystemPtr &coordinateSystem) const
ResultFlag
Flag returned by module methods to the RunController.
StationIterator StationsBegin()
Beginning of all stations.
Interface class to access to Fluorescence reconstruction of a Shower.
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
boost::indirect_iterator< InternalConstStationIterator, const Station & > ConstStationIterator
#define ERROR(message)
Macro for logging error messages.
bool HasSRecShower() const
boost::filter_iterator< ComponentSelector, ConstAllTelescopeIterator > ConstTelescopeIterator