8#include <daq/rawdata/modules/MonitorDataCOPPER.h>
9#include <framework/datastore/StoreArray.h>
10#include <rawdata/dataobjects/RawECL.h>
12#include <TDirectory.h>
41MonitorDataCOPPERModule::~MonitorDataCOPPERModule()
51 TDirectory* oldDir = gDirectory;
53 TDirectory* dirDAQ = NULL;
54 dirDAQ = oldDir->mkdir(
"DAQExample");
56 h_nevt =
new TH1F(
"h_nevt",
"Number of Events / COPPER; COPPER ID; # of Events", 20, 0, 20);
58 h_size =
new TH1F(
"h_size",
"Data size / COPPER; Data size [Byte]; entries", 50, 0, 10000);
60 h_rate =
new TH1F(
"h_rate",
"Event rate; Time [s]; Event Rate [Hz]", 1000, 0, 100000);
61 h_diff =
new TH1F(
"h_diff",
"Event inetrval; Event interval[s]; # of Events", 2000, 0, 0.2);
73double MonitorDataCOPPERModule::getTimeSec()
76 gettimeofday(&t, NULL);
77 return (t.tv_sec + t.tv_usec * 1.e-6);
104 for (
int j = 0; j < ncpr; j++) {
106 for (
int i = 0; i < raw_dblkarray[j]->GetNumEntries(); i++) {
108 temp_rawcopper.
SetBuffer(raw_dblkarray[j]->GetBuffer(i),
109 raw_dblkarray[j]->GetBlockNwords(i), 0, 1, 1);
111 if (j == 0 && i == 0) {
115 m_start_time = (double)m_tv.tv_sec;
118 int size_byte = raw_dblkarray[j]->GetBlockNwords(i) *
sizeof(int);
119 h_nevt->SetBinContent(j + 1, m_nevt);
120 h_size->SetBinContent(j + 1, h_size->GetBinContent(i + 1) + size_byte);
125 h_diff->Fill(m_tv.tv_sec - prev_tv.tv_sec + (m_tv.tv_usec - prev_tv.tv_usec) * 1.e-6);
129 int tdiff_cur = m_tv.tv_sec - (int)m_start_time;
131 if (
m_loop % 1000 == 99) {
134 if (tdiff_cur < 100000 && tdiff_cur > 0) {
135 h_rate->SetBinContent(tdiff_cur / 100, h_rate->GetBinContent(tdiff_cur / 100) + 0.01);
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
void initialize() override
Module functions to be called from main process.
void event() override
Module functions to be called from event process.
int m_loop
No. of sent events.
MonitorDataCOPPERModule()
Constructor / Destructor.
void defineHisto() override
Histogram definition.
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 )
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
void GetTTTimeVal(int n, struct timeval *tv)
Get timeval.
Abstract base class for different kinds of events.