9 #include <framework/modules/core/EventInfoPrinterModule.h>
11 #include <boost/format.hpp>
27 EventInfoPrinterModule::EventInfoPrinterModule() :
Module()
30 setDescription(
"Prints the current event meta data information (exp, run, event numbers). LogLevel need to be set to INFO, at least for this module.");
32 addParam(
"printTime",
m_printTime,
"Print time in addition to exp/run/evt numbers.",
false);
44 B2INFO(
"========================================================================");
46 B2INFO(
"------------------------------------------------------------------------");
66 B2INFO(
"------------------------------------------------------------------------");
68 B2INFO(
"========================================================================");
73 using namespace chrono;
74 high_resolution_clock::time_point time(duration_cast<high_resolution_clock::duration>(nanoseconds(nsec)));
75 time_t ttime = high_resolution_clock::to_time_t(time);
76 tm* tm = gmtime(&ttime);
79 strftime(timeStr, 32,
"%F %T", tm);
80 unsigned int sec_decimals = (nsec / 1000) % 1000000;
82 return str(boost::format(
"%s.%06d") % timeStr % sec_decimals);
std::string formatDateTime(unsigned long long int)
Format date & time for output.
bool m_printTime
Print time in addition to exp/run/evt numbers.
virtual void initialize() override
initialization.
virtual void event() override
Prints the full information about the event, run and experiment number.
virtual void endRun() override
Prints a footer for each run which ended.
StoreObjPtr< EventMetaData > m_eventMetaData
EventMetaData.
virtual void beginRun() override
Prints a header for each new run.
virtual ~EventInfoPrinterModule()
Destructor of the module.
void setDescription(const std::string &description)
Sets the description of the module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.