2 #include <evt/ShowerRecData.h>
3 #include <evt/ShowerSRecData.h>
4 #include <evt/ShowerMRecData.h>
6 #include <sevt/SEvent.h>
7 #include <sevt/SortCriteria.h>
8 #include <sevt/PMTSimData.h>
9 #include <mevt/MEvent.h>
11 #include <utl/ErrorLogger.h>
12 #include <utl/Branch.h>
13 #include <utl/Particle.h>
14 #include <utl/AugerUnits.h>
16 #include <tst/Validatrix.h>
17 #include <fwk/CentralConfig.h>
27 using namespace tst::Validatrix;
29 namespace ValidationNS {
33 INFO(
"Doing the validation !!!!");
34 Branch topB = CentralConfig::GetInstance() -> GetTopBranch(
"Validation");
36 const string mode = topB.
GetChild(
"Mode").
Get <
string > ();
38 cout <<
"Validation mode = " << mode << endl;
40 fMode = (mode ==
"Create") ? Validation::eCreate : Validation::eCompare;
42 fResults =
new stringstream;
52 *fResults <<
BeLabel(
"Shower_rec");
55 ERROR(
"Event does not contain a RecShower");
60 ERROR(
"RecShower does not have SRecShower");
62 *fResults <<
BeLabel(
"Shower_S_rec");
73 ERROR(
"RecShower does not have MRecShower");
76 *fResults <<
BeLabel(
"Shower_M_rec");
82 *fResults <<
BeLabel(
"rho450e");
90 ERROR(
"Event should contain an SEvent.");
95 const SEvent & sEvent =
event.GetSEvent();
100 if (sIt -> HasRecData()) {
102 label <<
"Station_" << sIt -> GetId();
103 *fResults <<
BeLabel(label.str());
104 *fResults <<
BeEqual(sIt -> GetRecData().GetTotalSignal());
112 ERROR(
"Event should contain an MEvent.");
116 const MEvent & mEvent =
event.GetMEvent();
119 *fResults <<
BeLabel(
"MD_rec");
122 if (sIt -> HasRecData()) {
129 counterLabel =
"Counter_" + to_string(counter.
GetId());
132 vector<double> muonNumber(3, 0);
133 vector<double> muonNumberMC(3, 0);
138 int mId = mIt -> GetId();
140 if (mIt -> IsRejected()) {
141 muonNumberMC.at(mId - 1) = -1;
142 muonNumber.at(mId - 1) = -1;
148 if (sIt -> HasSimData()) {
154 if (mIt -> HasRecData()) {
165 muonNumber.at(mId - 1) = -1;
169 for (
size_t i = 0; i < muonNumber.size(); ++i) {
170 *fResults <<
BeLabel(counterLabel +
"_Module_" + to_string(i) +
"_rec");
171 *fResults <<
BeCloseAbs(muonNumber.at(i), 1e-4);
172 *fResults <<
BeLabel(counterLabel +
"_Module_" + to_string(i) +
"_MC");
173 *fResults <<
BeEqual(muonNumberMC.at(i));
183 Validation::Finish() {
186 if (fMode == Validation::eCreate) {
187 INFO(
"Writing reference file");
188 ofstream fout(fRefFileName.c_str());
189 fout << fResults -> str();
192 INFO(
"Comparing re-reconstruction results to reference file");
193 ifstream savedFile(fRefFileName.c_str());
194 comp =
Compare( * fResults, savedFile,
false);
198 string newRef = fRefFileName +
".after-rereconstruction";
199 ofstream fout(newRef.c_str());
200 fout << fResults -> str();
Module level reconstruction data. This class contains all data required by the muon reconstruction...
StationIterator StationsEnd()
End of all stations.
Interface class to access to the SD Reconstruction of a Shower.
Interface class to access Shower Reconstructed parameters.
Counter level event data.
bool HasRecShower() const
Interface class to access to the SD part of an event.
double GetNumberOfEstimatedMuons() const
#define INFO(message)
Macro for logging informational messages.
double GetShowerSize() const
void Init()
Initialise the registry.
bool IsRejected() const
Check if the counter is rejected.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
ShowerSRecData & GetSRecShower()
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)
InternalScintillatorCollection::ComponentConstIterator ScintillatorConstIterator
std::string BeLabel(const string &tag)
void GetData(bool &b) const
Overloads of the GetData member template function.
bool HasMRecShower() const
ModuleConstIterator ModulesBegin() const
std::string BeEqual(const T &value)
ShowerMRecData & GetMRecShower()
Scintillator level simulation data.
ResultFlag
Flag returned by module methods to the RunController.
int GetId() const
The id of the counter.
ModuleConstIterator ModulesEnd() const
StationIterator StationsBegin()
Beginning of all stations.
double GetShowerSizeError() const
InternalModuleCollection::ComponentConstIterator ModuleConstIterator
Counter & GetCounter(const int cId)
Interface class to access to the Muon Reconstruction of a Shower.
boost::indirect_iterator< InternalConstStationIterator, const Station & > ConstStationIterator
#define ERROR(message)
Macro for logging error messages.
bool HasSRecShower() const
Root of the Muon event hierarchy.
unsigned int GetNumberOfInjectedMuons() const
double GetNumberOfMuonsLowLimit() const