Belle II Software  release-05-01-25
DQMHistAnalysisMonObj.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Luka Santelj *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 // Own include
12 #include <dqm/analysis/modules/DQMHistAnalysisMonObj.h>
13 
14 //DQM
15 #include <dqm/analysis/modules/DQMHistAnalysis.h>
16 
17 #include <TH1F.h>
18 
19 using namespace std;
20 using namespace Belle2;
21 
22 //-----------------------------------------------------------------
23 // Register module
24 //-----------------------------------------------------------------
25 
26 REG_MODULE(DQMHistAnalysisMonObj);
27 
28 DQMHistAnalysisMonObjModule::DQMHistAnalysisMonObjModule()
30 {
31  // set module description (e.g. insert text)
32  setDescription("Example module for making MonitoringObject in DQMHistAnalysis module");
34 }
35 
37 {
38 }
39 
41 {
42  // make monitoring object related to this module (use arich as an example)
43  // if monitoring object already exists this will return pointer to it
44  m_monObj = getMonitoringObject("arich");
45 
46  // make canvases to be added to MonitoringObject
47  m_c_main = new TCanvas("main");
48  m_c_mask = new TCanvas("mask");
49 
50  // add canvases to MonitoringObject
53 }
54 
56 {
57 }
58 
60 {
61  // can put the analysis code here or in endRun() function
62  // for the start tests we will store output only end of run so better to put code there
63 }
64 
66 {
67 
68  // get existing histograms produced by DQM modules
69  TH1* hits = findHist("ARICH/hitsPerEvent");
70  TH1* bits = findHist("ARICH/bits");
71 
72  // set the content of main canvas
73  m_c_main->Clear(); // clear existing content
74  m_c_main->Divide(2, 1);
75  m_c_main->cd(1);
76  if (hits) hits->Draw();
77  m_c_main->cd(2);
78  if (bits) bits->Draw();
79 
80  // set values of monitoring variables (if variable already exists this will change its value, otherwise it will insert new variable)
81  // with error (also asymmetric error can be used as m_monObj->setVariable(name, value, upError, downError))
82  m_monObj->setVariable("hitsPerEvent", hits ? hits->GetMean() : 0, hits ? hits->GetMeanError() : -1);
83  // without error
84  m_monObj->setVariable("bitsMean", bits ? bits->GetMean() : 0);
85 
86  // set string variable
87  m_monObj->setVariable("mode", "nominal");
88 
89 
90  B2DEBUG(20, "DQMHistAnalysisMonObj : endRun called");
91 }
92 
94 {
95 
96  B2DEBUG(20, "terminate called");
97 }
Belle2::DQMHistAnalysisMonObjModule::terminate
virtual void terminate() override
Termination action.
Definition: DQMHistAnalysisMonObj.cc:93
Belle2::DQMHistAnalysisMonObjModule::endRun
virtual void endRun() override
End-of-run action.
Definition: DQMHistAnalysisMonObj.cc:65
Belle2::Module::setDescription
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:216
Belle2::DQMHistAnalysisMonObjModule::event
virtual void event() override
Event processor.
Definition: DQMHistAnalysisMonObj.cc:59
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::Module::c_ParallelProcessingCertified
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:82
Belle2::DQMHistAnalysisMonObjModule::m_c_mask
TCanvas * m_c_mask
Canvas with histograms related to channel masking.
Definition: DQMHistAnalysisMonObj.h:76
Belle2::DQMHistAnalysisMonObjModule::initialize
virtual void initialize() override
Initialize the Module.
Definition: DQMHistAnalysisMonObj.cc:40
Belle2::DQMHistAnalysisModule::findHist
static TH1 * findHist(const std::string &histname)
Find histogram.
Definition: DQMHistAnalysis.cc:83
Belle2::Module::setPropertyFlags
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:210
Belle2::DQMHistAnalysisMonObjModule::m_monObj
MonitoringObject * m_monObj
MonitoringObject to be produced by this module.
Definition: DQMHistAnalysisMonObj.h:78
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::MonitoringObject::addCanvas
void addCanvas(TCanvas *canv)
Add Canvas to monitoring object.
Definition: MonitoringObject.h:58
Belle2::MonitoringObject::setVariable
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)
Definition: MonitoringObject.h:134
Belle2::DQMHistAnalysisMonObjModule::~DQMHistAnalysisMonObjModule
virtual ~DQMHistAnalysisMonObjModule()
Destructor.
Definition: DQMHistAnalysisMonObj.cc:36
Belle2::DQMHistAnalysisMonObjModule::beginRun
virtual void beginRun() override
Begin run function.
Definition: DQMHistAnalysisMonObj.cc:55
Belle2::DQMHistAnalysisMonObjModule::m_c_main
TCanvas * m_c_main
Canvas with main run summary histograms.
Definition: DQMHistAnalysisMonObj.h:75
Belle2::DQMHistAnalysisModule::getMonitoringObject
static MonitoringObject * getMonitoringObject(const std::string &histname)
Get MonitoringObject with given name (new object is created if non-existing)
Definition: DQMHistAnalysis.cc:55
Belle2::DQMHistAnalysisModule
The base class for the histogram analysis module.
Definition: DQMHistAnalysis.h:27