Belle II Software  release-08-01-10
DQMHistAnalysisDAQMonObj.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 // Own header.
10 #include <dqm/analysis/modules/DQMHistAnalysisDAQMonObj.h>
11 #include <TH1F.h>
12 
13 using namespace std;
14 using namespace Belle2;
15 
16 //-----------------------------------------------------------------
17 // Register module
18 //-----------------------------------------------------------------
19 
20 REG_MODULE(DQMHistAnalysisDAQMonObj);
21 
22 DQMHistAnalysisDAQMonObjModule::DQMHistAnalysisDAQMonObjModule()
24 {
25  setDescription("Module to monitor DAQ information.");
26  B2DEBUG(20, "DQMHistAnalysisDAQMonObj: Constructor done.");
27 }
28 
30 {
31 }
32 
34 {
36  B2DEBUG(20, "DQMHistAnalysisDAQMonObj: initialized.");
37 }
38 
40 {
41  B2DEBUG(20, "DQMHistAnalysisDAQMonObj: beginRun called.");
42 }
43 
45 {
46  B2DEBUG(20, "DQMHistAnalysisDAQMonObj: event called.");
47 }
48 
50 {
51  B2DEBUG(20, "DQMHistAnalysisDAQMonObj: endRun called.");
52 
53  auto* PXDDataSize = (TH1F*)findHist("DAQ/PXDDataSize");
54  auto* SVDDataSize = (TH1F*)findHist("DAQ/SVDDataSize");
55  auto* CDCDataSize = (TH1F*)findHist("DAQ/CDCDataSize");
56  auto* TOPDataSize = (TH1F*)findHist("DAQ/TOPDataSize");
57  auto* ARICHDataSize = (TH1F*)findHist("DAQ/ARICHDataSize");
58  auto* ECLDataSize = (TH1F*)findHist("DAQ/ECLDataSize");
59  auto* KLMDataSize = (TH1F*)findHist("DAQ/KLMDataSize");
60  auto* TRGDataSize = (TH1F*)findHist("DAQ/TRGDataSize");
61  auto* HLTDataSize = (TH1F*)findHist("DAQ/HLTDataSize");
62  auto* TotalDataSize = (TH1F*)findHist("DAQ/TotalDataSize");
63 
64  m_monObj->setVariable("PXDEventSize", PXDDataSize ? PXDDataSize->GetMean() : 0,
65  PXDDataSize ? PXDDataSize->GetMeanError() : -1);
66  m_monObj->setVariable("SVDEventSize", SVDDataSize ? SVDDataSize->GetMean() : 0,
67  SVDDataSize ? SVDDataSize->GetMeanError() : -1);
68  m_monObj->setVariable("CDCEventSize", CDCDataSize ? CDCDataSize->GetMean() : 0,
69  CDCDataSize ? CDCDataSize->GetMeanError() : -1);
70  m_monObj->setVariable("TOPEventSize", TOPDataSize ? TOPDataSize->GetMean() : 0,
71  TOPDataSize ? TOPDataSize->GetMeanError() : -1);
72  m_monObj->setVariable("ARICHEventSize", ARICHDataSize ? ARICHDataSize->GetMean() : 0,
73  ARICHDataSize ? ARICHDataSize->GetMeanError() : -1);
74  m_monObj->setVariable("ECLEventSize", ECLDataSize ? ECLDataSize->GetMean() : 0,
75  ECLDataSize ? ECLDataSize->GetMeanError() : -1);
76  m_monObj->setVariable("KLMEventSize", KLMDataSize ? KLMDataSize->GetMean() : 0,
77  KLMDataSize ? KLMDataSize->GetMeanError() : -1);
78  m_monObj->setVariable("TRGEventSize", TRGDataSize ? TRGDataSize->GetMean() : 0,
79  TRGDataSize ? TRGDataSize->GetMeanError() : -1);
80  m_monObj->setVariable("HLTEventSize", HLTDataSize ? HLTDataSize->GetMean() : 0,
81  HLTDataSize ? HLTDataSize->GetMeanError() : -1);
82  m_monObj->setVariable("TotalEventSize", TotalDataSize ? TotalDataSize->GetMean() : 0,
83  TotalDataSize ? TotalDataSize->GetMeanError() : -1);
84 }
85 
87 {
88 
89  B2DEBUG(20, "terminate called");
90 }
91 
void initialize() override final
Initialize the Module.
MonitoringObject * m_monObj
monitoring object
void terminate() override final
Termination action.
void event() override final
This method is called for each event.
void endRun() override final
End-of-run action.
void beginRun() override final
Called when entering a new run.
The base class for the histogram analysis module.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
static MonitoringObject * getMonitoringObject(const std::string &histname)
Get MonitoringObject with given name (new object is created if non-existing)
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setVariable(const std::string &var, float val, float upErr=-1., float dwErr=-1)
set value to float variable (new variable is made if not yet existing)
#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.