Belle II Software development
DQMHistAnalysisECLConnectedRegions.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//THIS MODULE
10#include <dqm/analysis/modules/DQMHistAnalysisECLConnectedRegions.h>
11
12//ROOT
13#include <TProfile.h>
14
15using namespace Belle2;
16
17REG_MODULE(DQMHistAnalysisECLConnectedRegions);
18
21{
22 B2DEBUG(20, "DQMHistAnalysisECLConnectedRegions: Constructor done.");
23
24 addParam("pvPrefix", m_pvPrefix, "Prefix to use for PVs registered by this module",
25 std::string("ECL:"));
26}
27
29{
30 for (auto& pv_name : {"largest_cr_avg_crystals_num", "largest_cr_localmax_num"}) {
31 registerEpicsPV(m_pvPrefix + pv_name, pv_name);
32 }
33
35
36 B2DEBUG(20, "DQMHistAnalysisECLConnectedRegions: initialized.");
37}
38
40{
41 B2DEBUG(20, "DQMHistAnalysisECLConnectedRegions: beginRun called.");
42}
43
45{
46 //== Get DQM info
47 auto crystalsDistributionHist = (TH1F*)findHist("ECL/Crystals_distribution_in_largest_cr");
48 if (crystalsDistributionHist) {
49 m_largestCRAvgCrystalsNum = crystalsDistributionHist->GetMean();
50 }
51 auto localMaxDistributionHist = (TH1F*)findHist("ECL/LocalMaximum_distribution_in_largest_cr");
52 if (localMaxDistributionHist) {
53 m_largestCRLocalMaxNum = localMaxDistributionHist->GetMean();
54 }
55
56 //== Set EPICS PVs
57 setEpicsPV("largest_cr_avg_crystals_num", m_largestCRAvgCrystalsNum);
58 setEpicsPV("largest_cr_localmax_num", m_largestCRLocalMaxNum);
59}
60
62{
63 B2DEBUG(20, "DQMHistAnalysisECLConnectedRegions: endRun called");
64 m_monObj->setVariable("largest_cr_avg_crystals_num", m_largestCRAvgCrystalsNum);
65 m_monObj->setVariable("largest_cr_localmax_num", m_largestCRLocalMaxNum);
66}
67
68
70{
71 B2DEBUG(20, "terminate called");
72}
73
DQMHistAnalysisECLConnectedRegionsModule()
< derived from DQMHistAnalysisModule class.
std::string m_pvPrefix
Prefix to use for PVs registered by this module.
double m_largestCRLocalMaxNum
Average number local maximum in largest ECL CR.
double m_largestCRAvgCrystalsNum
Average number of crystals in largest ECL CR.
The base class for the histogram analysis module.
static MonitoringObject * getMonitoringObject(const std::string &name)
Get MonitoringObject with given name (new object is created if non-existing)
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
void setEpicsPV(std::string keyname, double value)
Write value to a EPICS PV.
int registerEpicsPV(std::string pvname, std::string keyname="")
EPICS related Functions.
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)
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#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.