Belle II Software  release-06-00-14
DAQMonitor.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 //+
9 // File : DAQMonitor.cc
10 // Description : Module to monitor raw data
11 //-
12 
13 /* Own header. */
14 #include <dqm/modules/DAQMonitor.h>
15 
16 /* ROOT headers. */
17 #include <TDirectory.h>
18 
19 using namespace Belle2;
20 
21 REG_MODULE(DAQMonitor)
22 
24 {
25  setDescription("This module produces general DAQ DQM histograms.");
26  setPropertyFlags(c_ParallelProcessingCertified);
27 }
28 
30 {
31  TDirectory* oldDir = gDirectory;
32  oldDir->mkdir("DAQ");
33  oldDir->cd("DAQ");
34  h_nEvt = new TH1F("Nevent", "Total Number of Events", 3, 0.0, 2.0);
35  h_pxdSize = new TH1F("PXDDataSize", "PXD Data Size;Size [kB];", 100, 0.0, 100.0);
36  h_svdSize = new TH1F("SVDDataSize", "SVD Data Size;Size [kB];", 100, 0.0, 100.0);
37  h_cdcSize = new TH1F("CDCDataSize", "CDC Data Size;Size [kB];", 100, 0.0, 100.0);
38  h_topSize = new TH1F("TOPDataSize", "TOP Data Size;Size [kB];", 100, 0.0, 100.0);
39  h_arichSize = new TH1F("ARICHDataSize", "ARICH Data Size;Size [kB];", 100, 0.0, 40.0);
40  h_eclSize = new TH1F("ECLDataSize", "ECL Data Size;Size [kB];", 100, 0.0, 100.0);
41  h_klmSize = new TH1F("KLMDataSize", "KLM Data Size;Size [kB];", 100, 0.0, 40.0);
42  h_trgSize = new TH1F("TRGDataSize", "TRG Data Size;Size [kB];", 100, 0.0, 40.0);
43  h_hltSize = new TH1F("HLTDataSize", "HLT (Total - PXD) Data Size;Size [kB];", 100, 0.0, 300.0);
44  h_totalSize = new TH1F("TotalDataSize", "Total (HLT + PXD) Data Size;Size [kB];", 100, 0.0, 300.0);
45  oldDir->cd();
46 }
47 
49 {
50  REG_HISTOGRAM;
51  m_pxdRaw.isOptional();
52  m_svdRaw.isOptional();
53  m_cdcRaw.isOptional();
54  m_topRaw.isOptional();
55  m_arichRaw.isOptional();
56  m_eclRaw.isOptional();
57  m_klmRaw.isOptional();
58  m_trgRaw.isOptional();
59 }
60 
62 {
63  h_nEvt->Reset();
64  h_pxdSize->Reset();
65  h_svdSize->Reset();
66  h_cdcSize->Reset();
67  h_topSize->Reset();
68  h_arichSize->Reset();
69  h_eclSize->Reset();
70  h_klmSize->Reset();
71  h_trgSize->Reset();
72  h_hltSize->Reset();
73  h_totalSize->Reset();
74 }
75 
77 {
78  // Total number of events: just fill the histogram with 1
79  h_nEvt->Fill(1.0);
80 
81  // Since sizeof returns the size in bytes (B),
82  // if we divide it by 1000 we obtain kilobytes (kB).
83 
84  // PXD
85  int pxdSize{0};
86  for (RawPXD& pxdRaw : m_pxdRaw)
87  pxdSize += (pxdRaw.size()) * sizeof(unsigned int);
88  h_pxdSize->Fill(static_cast<float>(pxdSize) / 1000.);
89 
90  // SVD
91  int svdSize{0};
92  for (RawSVD& svdRaw : m_svdRaw) // Loop over COPPERs
93  svdSize += svdRaw.GetBlockNwords(0) * sizeof(unsigned int);
94  h_svdSize->Fill(static_cast<float>(svdSize) / 1000.);
95 
96  // CDC
97  int cdcSize{0};
98  for (RawCDC& cdcRaw : m_cdcRaw) // Loop over COPPERs
99  cdcSize += cdcRaw.GetBlockNwords(0) * sizeof(unsigned int);
100  h_cdcSize->Fill(static_cast<float>(cdcSize) / 1000.);
101 
102  // TOP
103  int topSize{0};
104  for (RawTOP& topRaw : m_topRaw) // Loop over COPPERs
105  topSize += topRaw.GetBlockNwords(0) * sizeof(unsigned int);
106  h_topSize->Fill(static_cast<float>(topSize) / 1000.);
107 
108  // ARICH
109  int arichSize{0};
110  for (RawARICH& arichRaw : m_arichRaw) // Loop over COPPERs
111  arichSize += arichRaw.GetBlockNwords(0) * sizeof(unsigned int);
112  h_arichSize->Fill(static_cast<float>(arichSize) / 1000.);
113 
114  // ECL
115  int eclSize{0};
116  for (RawECL& eclRaw : m_eclRaw) // Loop over COPPERs
117  eclSize += eclRaw.GetBlockNwords(0) * sizeof(unsigned int);
118  h_eclSize->Fill(static_cast<float>(eclSize) / 1000.);
119 
120  // KLM
121  int klmSize{0};
122  for (RawKLM& klmRaw : m_klmRaw) // Loop over COPPERs
123  klmSize += klmRaw.GetBlockNwords(0) * sizeof(unsigned int);
124  h_klmSize->Fill(static_cast<float>(klmSize) / 1000.);
125 
126  // TRG
127  int trgSize{0};
128  for (RawTRG& trgRaw : m_trgRaw) // Loop over COPPERs
129  trgSize += trgRaw.GetBlockNwords(0) * sizeof(unsigned int);
130  h_trgSize->Fill(static_cast<float>(trgSize) / 1000.);
131 
132  // HLT size and total (HLT + PXD) size
133  int hltSize = svdSize + cdcSize + topSize + arichSize + eclSize + klmSize + trgSize;
134  h_hltSize->Fill(static_cast<float>(hltSize) / 1000.);
135  int totalSize = pxdSize + hltSize;
136  h_totalSize->Fill(static_cast<float>(totalSize) / 1000.);
137 }
A module for producing general DAQ DQM histograms.
Definition: DAQMonitor.h:37
TH1F * h_hltSize
Histogram for HLT data size.
Definition: DAQMonitor.h:89
void initialize() override final
Initialize.
Definition: DAQMonitor.cc:48
StoreArray< RawARICH > m_arichRaw
ARICH raw data.
Definition: DAQMonitor.h:107
TH1F * h_totalSize
Histogram for total data size.
Definition: DAQMonitor.h:92
StoreArray< RawSVD > m_svdRaw
SVD raw data.
Definition: DAQMonitor.h:98
StoreArray< RawTOP > m_topRaw
TOP raw data.
Definition: DAQMonitor.h:104
StoreArray< RawKLM > m_klmRaw
KLM raw data.
Definition: DAQMonitor.h:113
void defineHisto() override final
Histograms definition.
Definition: DAQMonitor.cc:29
TH1F * h_nEvt
Histogram for total number of events.
Definition: DAQMonitor.h:62
StoreArray< RawPXD > m_pxdRaw
PXD raw data.
Definition: DAQMonitor.h:95
TH1F * h_cdcSize
Histogram for CDC data size.
Definition: DAQMonitor.h:71
TH1F * h_arichSize
Histogram for ARICH data size.
Definition: DAQMonitor.h:77
void event() override final
Event.
Definition: DAQMonitor.cc:76
TH1F * h_svdSize
Histogram for SVD data size.
Definition: DAQMonitor.h:68
TH1F * h_pxdSize
Histogram for PXD data size.
Definition: DAQMonitor.h:65
void beginRun() override final
Begin run.
Definition: DAQMonitor.cc:61
TH1F * h_trgSize
Histogram for TRG data size.
Definition: DAQMonitor.h:86
TH1F * h_eclSize
Histogram for ECL data size.
Definition: DAQMonitor.h:80
StoreArray< RawTRG > m_trgRaw
TRG raw data.
Definition: DAQMonitor.h:116
TH1F * h_klmSize
Histogram for KLM data size.
Definition: DAQMonitor.h:83
StoreArray< RawECL > m_eclRaw
ECL raw data.
Definition: DAQMonitor.h:110
StoreArray< RawCDC > m_cdcRaw
CDC raw data.
Definition: DAQMonitor.h:101
TH1F * h_topSize
Histogram for TOP data size.
Definition: DAQMonitor.h:74
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
The Raw ARICH class Class for RawCOPPER class data taken by ARICH Currently, this class is almost sam...
Definition: RawARICH.h:27
The Raw CDC class Class for RawCOPPER class data taken by CDC Currently, this class is almost same as...
Definition: RawCDC.h:27
The Raw ECL class Class for RawCOPPER class data taken by ECL Currently, this class is almost same as...
Definition: RawECL.h:26
The Raw KLM class Class for RawCOPPER class data taken by KLM.
Definition: RawKLM.h:27
The Raw PXD class.
Definition: RawPXD.h:27
The Raw SVD class Class for RawCOPPER class data taken by SVD Currently, this class is almost same as...
Definition: RawSVD.h:26
The Raw TOP class Class for RawCOPPER class data taken by TOP Currently, this class is almost same as...
Definition: RawTOP.h:27
The Raw TOP class Class for RawCOPPER class data taken by TOP Currently, this class is almost same as...
Definition: RawTRG.h:27
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.