11 #include <fwk/CentralConfig.h>
13 #include <det/Detector.h>
15 #include <evt/Header.h>
16 #include <evt/Event.h>
17 #include <evt/ShowerSimData.h>
19 #include <utl/ErrorLogger.h>
20 #include <utl/Reader.h>
21 #include <utl/TimeStamp.h>
22 #include <utl/TabularStream.h>
23 #include <utl/TabulatedFunction.h>
24 #include <utl/AugerException.h>
30 using namespace MCShowerCheckerOG;
44 const string input = topBranch.
GetChild(
"ElectronNumberProfile").
Get<
string>();
45 fElectronNumberProfile = ToEnum(input);
49 << GetVersionInfo(VModule::eRevisionNumber) <<
"\n"
51 " electron number profile: " << ToText(fElectronNumberProfile)
83 if (text ==
"correct")
104 bool foundNeProblem =
false;
105 for (
unsigned int iPoint = 0; iPoint < chargeProfile.
GetNPoints(); ++iPoint) {
107 if (chargeProfile.
GetY(iPoint) < 0) {
109 foundNeProblem =
true;
111 switch (fElectronNumberProfile) {
113 ERROR(
"Found Monte Carlo shower information with negative entries in electron number profile!");
116 ++fNEventsWithElectronProfileProblem;
117 WARNING(
"Rejecting Monte Carlo shower: negative entries in electron number profile!");
118 return eContinueLoop;
122 info <<
"Correcting negative entries in electron profile of Monte Carlo shower: bin="
124 <<
" X=" << chargeProfile.
GetX(iPoint) / (
g/
cm2)
125 <<
" Ne=" << chargeProfile.
GetY(iPoint);
127 chargeProfile.
GetY(iPoint) = 0;
134 ++fNEventsWithElectronProfileProblem;
147 if (fNEventsProcessed) {
149 const int nDiscarded = fNEventsProcessed - fNEventsAccepted;
154 <<
"Events processed:" <<
endc << fNEventsProcessed <<
endc << 100 <<
endr
155 <<
"Events skipped:" <<
endc << nDiscarded <<
endc << int(nDiscarded*1000./fNEventsProcessed)/10. <<
endr
156 <<
"Ne-profile:" <<
endc << fNEventsWithElectronProfileProblem <<
endc
157 << int(fNEventsWithElectronProfileProblem*1000./fNEventsProcessed)/10.;
159 info <<
"\n\n" <<
tab;
163 INFO(
"No events processed.");
std::string ToText(const EHandle flag) const
Branch GetTopBranch() const
unsigned int GetNPoints() const
EHandle ToEnum(const std::string &text) const
Base class for exceptions arising because configuration data are not valid.
Class to hold collection (x,y) points and provide interpolation between them.
bool HasSimShower() const
#define INFO(message)
Macro for logging informational messages.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
fwk::VModule::ResultFlag Run(evt::Event &theEvent)
Run: invoked once per event.
Interface class to access Shower Simulated parameters.
Class representing a document branch.
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
class to format data in tabular form
#define WARNING(message)
Macro for logging warning messages.
void GetData(bool &b) const
Overloads of the GetData member template function.
const double & GetY(const unsigned int idx) const
ResultFlag
Flag returned by module methods to the RunController.
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
const double & GetX(const unsigned int idx) const
#define ERROR(message)
Macro for logging error messages.
bool HasLongitudinalProfile(const ProfileType type=eCharged) const
Check initialization of the longitudinal profile.
const utl::TabulatedFunction & GetLongitudinalProfile(const ProfileType type=eCharged) const
Get the longitudinal charge profile of the shower.