16 #include <fwk/CentralConfig.h>
17 #include <fwk/RunController.h>
19 #include <det/Detector.h>
20 #include <sdet/SDetector.h>
22 #include <io/EventFileChain.h>
23 #include <io/OfflineROOTFile.h>
25 #include <evt/Header.h>
26 #include <evt/Event.h>
28 #include <sevt/SEvent.h>
29 #include <sevt/Header.h>
30 #include <sevt/EventTrigger.h>
32 #include <fevt/FEvent.h>
34 #include <fevt/EyeHeader.h>
36 #include <utl/ErrorLogger.h>
37 #include <utl/Reader.h>
38 #include <utl/TimeStamp.h>
39 #include <utl/config.h>
41 #include <revt/REvent.h>
42 #include <revt/Header.h>
44 #include <io/CDASToOfflineEventConverter.h>
45 #include <AugerEvent.h>
49 #include <mevt/MEvent.h>
50 #include <mevt/Header.h>
51 #include <mdet/MDetector.h>
53 #include <TStopwatch.h>
63 using namespace EventFileReaderOG;
68 namespace EventFileReaderOG {
73 EventFileReader::~EventFileReader()
83 CentralConfig::GetInstance()->
GetTopBranch(
"EventFileReader");
85 fReportFilenames = bool(topBranch.
GetChild(
"ReportFilenames"));
86 fIgnoreExpeptions = bool(topBranch.
GetChild(
"IgnoreExceptions"));
91 if (fIgnoreExpeptions)
94 fEventFiles =
nullptr;
96 fCurrentFilename =
"n/a";
103 EventFileReader::OpenFiles()
107 info <<
"No more data to read. ";
108 if (fReportFilenames) {
109 info <<
"Last file: '" << fCurrentFilename <<
"'";
118 fEventFiles->SetIgnoreExceptions(fIgnoreExpeptions);
119 fBranch = fBranch.GetNextSibling();
133 const io::Status status = fEventFiles->Read(event);
138 fEventFiles =
nullptr;
143 INFO(
"Failed to read event.");
148 INFO(
"Failed to read event, will skip it");
149 return eContinueLoop;
154 ++RunController::GetInstance().GetRunData().GetNamedCounters()[
"EventFileReader/TotalEvents"];
156 const string&
file = fEventFiles->GetCurrentFilename();
158 if (fCurrentFilename != file) {
160 if (fReportFilenames) {
162 info <<
"Switching to file '" << file <<
"'.";
165 fCurrentFilename =
file;
166 RunController::GetInstance().GetRunData().SetCurrentFilename(file);
167 ++RunController::GetInstance().GetRunData().GetNamedCounters()[
"EventFileReader/Files"];
173 io::Type fileType = fEventFiles->GetFileType();
188 det::Detector::GetInstance().Update(header.
GetTime());
192 if (event.
HasRawEvent() &&
event.GetRawEvent().HasSd()) {
193 event <<
event.GetRawEvent().Sd();
194 ++RunController::GetInstance().GetRunData().GetNamedCounters()[
"EventFileReader/SdEvents"];
197 if (event.
HasRawEvent() &&
event.GetRawEvent().HasMd()) {
198 event <<
event.GetRawEvent().Md();
199 ++RunController::GetInstance().GetRunData().GetNamedCounters()[
"EventFileReader/MdEvents"];
203 info <<
"Event id = '" << header.
GetId() <<
'\'';
211 EventFileReader::Finish()
214 info <<
"Read " << fEventsRead <<
" events";
217 const double realTime =
gStopwatch.RealTime();
220 info <<
" in " << realTime <<
" sec, " << (fEventsRead/realTime) <<
" ev/sec, with "
221 << (cpuTime/realTime*100) <<
"% cpu usage.";
225 fEventFiles =
nullptr;
232 EventFileReader::GetCurrentFilename()
235 return fEventFiles->GetCurrentFilename();
Branch GetTopBranch() const
conex file, with random access (NOT sequencial, NO EOF)
Interface class to access to the SD part of an event.
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
air shower radio simulations generated with EVA
Branch GetNextSibling() const
Get next sibling of this branch.
Class representing a document branch.
Status
Return code for seek operation.
A collection of EventFile.
ResultFlag
Flag returned by module methods to the RunController.
air shower radio simulations generated with ZHAireS
Detector description interface for SDetector-related data.
Branch GetFirstChild() const
Get first child of this Branch.
Type
The type of file that we are acutally opening.
air shower radio simulations generated with REAS