9#include <rawdata/modules/PrintEventRate.h>
15#define EVENT_UNIT 75000
16#define BYTES_PER_WORD 4
70 B2INFO(
"PrintDataTemplate: initialize() started.");
77 B2INFO(
"PrintDataTemplate: initialize() done.");
90 unsigned int error_flag = 0;
91 error_flag = (
unsigned int)(raw_copper->
GetDataType(i));
93 printf(
"!!!!!!!!! ERROR (RawCOPPER hdr) !!!!!!!!!! : run %d sub %d event %u errflag %.8x nodeID %.8x\n",
123 localtime_r(&timer, &t_st);
126 printf(
"END %d/%d/%d/%d:%d:%d run %d sub %d Event %u Rate %lf [kHz] %lf [MB/s] RunTime %d [s] interval %d [s] total %lf [bytes] cpr %d s %d c %d to %d a %d e %d k %d tr %d other %d erreve %d errcpr %d\n",
127 t_st.tm_year + 1900, t_st.tm_mon + 1, t_st.tm_mday, t_st.tm_hour, t_st.tm_min, t_st.tm_sec,
131 m_cpr,
m_cpr_svd,
m_cpr_cdc,
m_cpr_top,
m_cpr_arich,
m_cpr_ecl,
m_cpr_klm,
m_cpr_trg,
m_cpr_others,
m_erreve,
m_errcpr);
134 printf(
"END %d/%d/%d/%d:%d:%d run %d sub %d Event %u Rate %lf [kHz] %lf [MB/s] RunTime %d [s] interval %d [s] total %lf [bytes] cpr %d s %d c %d to %d a %d e %d k %d tr %d other %d erreve %d errcpr %d\n",
135 t_st.tm_year + 1900, t_st.tm_mon + 1, t_st.tm_mday, t_st.tm_hour, t_st.tm_min, t_st.tm_sec,
138 m_cpr,
m_cpr_svd,
m_cpr_cdc,
m_cpr_top,
m_cpr_arich,
m_cpr_ecl,
m_cpr_klm,
m_cpr_trg,
m_cpr_others,
m_erreve,
m_errcpr);
159 int datablk_blknum = raw_datablkarray.
getEntries();
167 int arich_blknum = raw_aricharray.
getEntries();
210 for (
int i = 0; i < datablk_blknum; i++) {
211 for (
int j = 0; j < raw_datablkarray[ i ]->GetNumEntries(); j++) {
212 int* temp_buf = raw_datablkarray[ i ]->GetBuffer(j);
213 int nwords = raw_datablkarray[ i ]->GetBlockNwords(j);
217 if (raw_datablkarray[ i ]->CheckFTSWID(j)) {
219 }
else if (raw_datablkarray[ i ]->CheckTLUID(j)) {
225 temp_raw_copper.
SetBuffer(temp_buf, nwords, delete_flag, num_nodes, num_events);
232 for (
int i = 0; i < cpr_blknum; i++) {
233 for (
int j = 0; j < raw_cprarray[ i ]->GetNumEntries(); j++) {
238 for (
int i = 0; i < svd_blknum; i++) {
239 for (
int j = 0; j < raw_svdarray[ i ]->GetNumEntries(); j++) {
244 for (
int i = 0; i < cdc_blknum; i++) {
245 for (
int j = 0; j < raw_cdcarray[ i ]->GetNumEntries(); j++) {
250 for (
int i = 0; i < top_blknum; i++) {
251 for (
int j = 0; j < raw_toparray[ i ]->GetNumEntries(); j++) {
256 for (
int i = 0; i < arich_blknum; i++) {
257 for (
int j = 0; j < raw_aricharray[ i ]->GetNumEntries(); j++) {
262 for (
int i = 0; i < ecl_blknum; i++) {
263 for (
int j = 0; j < raw_eclarray[ i ]->GetNumEntries(); j++) {
268 for (
int i = 0; i < klm_blknum; i++) {
269 for (
int j = 0; j < raw_klmarray[ i ]->GetNumEntries(); j++) {
274 for (
int i = 0; i < trg_blknum; i++) {
275 for (
int j = 0; j < raw_trgarray[ i ]->GetNumEntries(); j++) {
281 printf(
"!!!!!!!!! ERROR (EventMetaData) !!!!!!!!!! : run %d sub %d event %d errflag %.8x\n",
294 localtime_r(&timer, &t_st);
296 printf(
"MID %d/%d/%d/%d:%d:%d run %d sub %d Event %u Rate %lf [kHz] %lf [MB/s] RunTime %d [s] interval %d [s] total %lf [bytes]\n",
297 t_st.tm_year + 1900, t_st.tm_mon + 1, t_st.tm_mday, t_st.tm_hour, t_st.tm_min, t_st.tm_sec,
virtual ~PrintEventRateModule()
Destructor.
unsigned int m_start_utime
unixtime at the beginning
int m_subrun
subrun number
unsigned int m_prev_event
previous event number
virtual void initialize() override
Module function to be called from main process.
unsigned int m_cur_utime
current unixtime
virtual void event() override
Module function to be called from event process.
double m_prev_tot_bytes
previous value of processed data size
virtual void endRun() override
Module function to be called after main process.
unsigned int m_start_event
the first event number
int m_first_evt
first event number
double m_tot_bytes
total processed data size
virtual void printCOPPEREvent(RawCOPPER *raw_array, int i)
print an event
unsigned int m_n_basf2evt
StoreObjPtr< EventMetaData > m_eventMetaDataPtr
Event Meta Data.
unsigned int m_cur_event
current event number
unsigned int m_prev_utime
previous unixtime
int m_print_interval
output interval
PrintEventRateModule()
Constructor.
The Raw COPPER class This class stores data received by COPPER via belle2linkt Data from all detector...
void SetBuffer(int *bufin, int nwords, int delete_flag, int num_events, int num_nodes) OVERRIDE_CPP17
set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
virtual int GetBlockNwords(int n)
get size of a data block
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
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.
unsigned int GetEveNo(int n)
get subrun #(8bit)
unsigned int GetTTUtime(int n)
Check if COPPER Magic words are correct.
int GetSubRunNo(int n)
get run # (14bit)
int GetDataType(int n)
get contents of header
unsigned int GetNodeID(int n)
get node-ID from data
int GetRunNo(int n)
Exp# (10bit) run# (14bit) restart # (8bit)
Abstract base class for different kinds of events.