8 #include <daq/rawdata/modules/MonitorDataCOPPER.h>
9 #include <framework/datastore/StoreArray.h>
10 #include <rawdata/dataobjects/RawECL.h>
12 #include <TDirectory.h>
33 setDescription(
"Monitor Raw Data");
34 setPropertyFlags(c_ParallelProcessingCertified);
41 MonitorDataCOPPERModule::~MonitorDataCOPPERModule()
45 void MonitorDataCOPPERModule::defineHisto()
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);
75 void MonitorDataCOPPERModule::initialize()
81 void MonitorDataCOPPERModule::beginRun()
89 void MonitorDataCOPPERModule::endRun()
97 void MonitorDataCOPPERModule::terminate()
102 double MonitorDataCOPPERModule::getTimeSec()
105 gettimeofday(&t, NULL);
106 return (t.tv_sec + t.tv_usec * 1.e-6);
116 void MonitorDataCOPPERModule::event()
133 for (
int j = 0; j < ncpr; j++) {
135 for (
int i = 0; i < raw_dblkarray[j]->GetNumEntries(); i++) {
137 temp_rawcopper.
SetBuffer(raw_dblkarray[j]->GetBuffer(i),
138 raw_dblkarray[j]->GetBlockNwords(i), 0, 1, 1);
140 if (j == 0 && i == 0) {
144 m_start_time = (double)m_tv.tv_sec;
147 int size_byte = raw_dblkarray[j]->GetBlockNwords(i) *
sizeof(int);
148 h_nevt->SetBinContent(j + 1, m_nevt);
149 h_size->SetBinContent(j + 1, h_size->GetBinContent(i + 1) + size_byte);
154 h_diff->Fill(m_tv.tv_sec - prev_tv.tv_sec + (m_tv.tv_usec - prev_tv.tv_usec) * 1.e-6);
158 int tdiff_cur = m_tv.tv_sec - (int)m_start_time;
160 if (m_loop % 1000 == 99) {
163 if (tdiff_cur < 100000 && tdiff_cur > 0) {
164 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...
A class definition of an input module for Sequential ROOT I/O.
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.