Belle II Software development
DQMHistAnalysisECLSummary.h
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#pragma once
10
11//DQM
12#include <dqm/core/DQMHistAnalysis.h>
13
14//ROOT
15#include <TCanvas.h>
16#include <TH2F.h>
17#include <TText.h>
18#include <TExec.h>
19
20//std
21#include <set>
22
23//ECL
24#include <ecl/mapper/ECLChannelMapper.h>
25#include <ecl/geometry/ECLNeighbours.h>
26
27namespace Belle2 {
32
38
40
41 public:
42
45
47 void initialize() override final;
49 void beginRun() override final;
51 void event() override final;
53 void endRun() override final;
55 void terminate() override final;
56
71 std::map<int, int> getSuspiciousChannels(TH1* hist, double total_events,
72 const std::vector< std::vector<short> >& neighbours,
73 double max_deviation, bool occupancy_histogram);
74
75 private:
77 struct ECLAlarmType {
78 std::string name;
79 std::string title;
83 };
84
86 static const int c_max_masked_channels = 200;
89 dbr_short_t status;
90 dbr_short_t severity;
92 };
93
95 std::pair<int, ECLAlarmType> getAlarmByName(std::string name);
96
98 void updateAlarmConfig();
99
104 bool getMaskedChannels(std::map<std::string, dbr_sts_long_array>& mask_info);
105
106
110 std::vector< std::vector<int> > updateAlarmCounts(bool update_mirabelle = false);
111
115 std::map<int, int> getChannelsWithOccupancyProblems();
116
120 std::map<int, int> getChannelsWithChi2Problems();
121
123 void drawGrid(TH2* hist);
124
125 private:
129 std::string m_pvPrefix;
138
140 std::vector<ECLAlarmType> m_ecl_alarms;
141
143 std::map<std::string, std::set<int> > m_mask;
144
146 double m_total_events = 0;
147
149 TH2F* h_channels_summary = nullptr;
151 TCanvas* c_channels_summary = nullptr;
153 std::vector<TText*> m_labels;
155 TExec* m_ecl_style = nullptr;
157 TExec* m_default_style = nullptr;
162
164 TCanvas* c_occupancy = nullptr;
166 TCanvas* c_bad_chi2 = nullptr;
167 TH1F* h_bad_occ_overlay = nullptr;
168 TH1F* h_bad_chi2_overlay = nullptr;
169 TH1F* h_bad_occ_overlay_green = nullptr;
170 TH1F* h_bad_chi2_overlay_green = nullptr;
171
173 };
174
175} // end namespace Belle2
176
std::map< int, int > getSuspiciousChannels(TH1 *hist, double total_events, const std::vector< std::vector< short > > &neighbours, double max_deviation, bool occupancy_histogram)
Get outlier channels, ones with values (occupancy, errors, etc) that are much higher than the values ...
double m_total_events
Number of events with ECL data in the current run.
double m_maxDeviationForChi2
The higher this parameter, the larger differences in the number of hits with bad chi2 are allowed for...
TH1F * h_bad_occ_overlay
Overlay to indicate bad channels on occupancy histogram.
void initialize() override final
Initialize the module.
void updateAlarmConfig()
Set alarm limits in DQM based on EPICS PV limits.
std::vector< std::vector< int > > updateAlarmCounts(bool update_mirabelle=false)
Calculate and return number of problems per crate for all alarm categories.
std::vector< TText * > m_labels
Labels on the ECL alarms histogram.
ECL::ECLChannelMapper m_mapper
Object to map ECL crystal ID to ECL crate ID.
void drawGrid(TH2 *hist)
Draw grid with TLine primitives for the specified histogram.
TCanvas * c_channels_summary
TCanvas for ECL alarms regarding suspicious channels.
static const int c_max_masked_channels
Size of an array with masked channels.
std::pair< int, ECLAlarmType > getAlarmByName(std::string name)
Returns index of the specific alarm type and detailed information.
TH2F * h_channels_summary
Summarized information about ECL channels.
double m_maxDeviationForOccupancy
The higher this parameter, the larger differences in occupancy are allowed for adjacent channels.
ECL::ECLNeighbours m_neighbours_obj
Object to get ECL crystal neighbours.
TCanvas * c_occupancy
ECL occupancy histogram with highlighted suspicious channels.
TExec * m_ecl_style
Special object to specify style parameters.
std::string m_pvPrefix
Prefix to use for PVs registered by this module.
MonitoringObject * m_monObj
MiraBelle monitoring object.
void event() override final
Event processor.
TCanvas * c_bad_chi2
ECL bad chi2 histogram with highlighted suspicious channels.
TH1F * h_bad_chi2_overlay
Overlay to indicate bad channels on chi2 histogram.
void endRun() override final
Call when a run ends.
bool m_onlyIfUpdated
If true (default), update EPICS PVs only if there were changes in the histograms.
TH1F * h_bad_chi2_overlay_green
Overlay to indicate masked bad channels on chi2 histogram.
void beginRun() override final
Call when a run begins.
DQMHistAnalysisECLSummaryModule()
< derived from DQMHistAnalysisModule class.
TExec * m_default_style
Special object to revert changes done by ecl_style.
TH1F * h_bad_occ_overlay_green
Overlay to indicate masked bad channels on occupancy histogram.
std::map< std::string, std::set< int > > m_mask
List of masked Cell IDs for each alarm type.
bool getMaskedChannels(std::map< std::string, dbr_sts_long_array > &mask_info)
Get the array of masked channels for each type of alarm case monitored by this module.
bool m_useChannelMask
If true, mask Cell IDs based on DQM:ECL:channels_info:{alarm_type} PV info.
std::vector< ECLAlarmType > m_ecl_alarms
Different alarms monitored in h_channels_summary.
DQMHistAnalysisModule()
Constructor / Destructor.
This class provides access to ECL channel map that is either a) Loaded from the database (see ecl/dbo...
Class to get the neighbours for a given cell id.
MonitoringObject is a basic object to hold data for the run-dependency monitoring Run summary TCanvas...
Abstract base class for different kinds of events.
int warning_limit
If value > warning_limit, show warning.
double required_statistics
Minimum number of events for this alarm to be active.
structure to get an array of long values from EPICS