Belle II Software  release-08-01-10
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 
15 using namespace Belle2;
16 
17 REG_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  updateEpicsPVs(5.0);
34 
36 
37  B2DEBUG(20, "DQMHistAnalysisECLConnectedRegions: initialized.");
38 }
39 
41 {
42  B2DEBUG(20, "DQMHistAnalysisECLConnectedRegions: beginRun called.");
43 }
44 
46 {
47  //== Get DQM info
48  auto crystalsDistributionHist = (TH1F*)findHist("ECL/Crystals_distribution_in_largest_cr");
49  if (crystalsDistributionHist) {
50  m_largestCRAvgCrystalsNum = crystalsDistributionHist->GetMean();
51  }
52  auto localMaxDistributionHist = (TH1F*)findHist("ECL/LocalMaximum_distribution_in_largest_cr");
53  if (localMaxDistributionHist) {
54  m_largestCRLocalMaxNum = localMaxDistributionHist->GetMean();
55  }
56 
57  //== Set EPICS PVs
58  setEpicsPV("largest_cr_avg_crystals_num", m_largestCRAvgCrystalsNum);
59  setEpicsPV("largest_cr_localmax_num", m_largestCRLocalMaxNum);
60  updateEpicsPVs(5.0);
61 }
62 
64 {
65  B2DEBUG(20, "DQMHistAnalysisECLConnectedRegions: endRun called");
66  m_monObj->setVariable("largest_cr_avg_crystals_num", m_largestCRAvgCrystalsNum);
67  m_monObj->setVariable("largest_cr_localmax_num", m_largestCRLocalMaxNum);
68 }
69 
70 
72 {
73  B2DEBUG(20, "terminate called");
74 }
75 
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.
int registerEpicsPV(std::string pvname, std::string keyname="", bool update_pvs=true)
EPICS related Functions.
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.
static MonitoringObject * getMonitoringObject(const std::string &histname)
Get MonitoringObject with given name (new object is created if non-existing)
int updateEpicsPVs(float timeout)
Update all EPICS PV (flush to network)
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)
REG_MODULE(arichBtest)
Register the Module.
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
Abstract base class for different kinds of events.