Belle II Software  release-08-01-10
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 <TExec.h>
18 
19 //std
20 #include <set>
21 
22 //ECL
23 #include <ecl/mapper/ECLChannelMapper.h>
24 #include <ecl/geometry/ECLNeighbours.h>
25 
26 namespace Belle2 {
40  public:
41 
44 
47 
49  void initialize() override final;
51  void beginRun() override final;
53  void event() override final;
55  void endRun() override final;
57  void terminate() override final;
58 
73  std::map<int, int> getSuspiciousChannels(TH1* hist, double total_events,
74  const std::vector< std::vector<short> >& neighbours,
75  double max_deviation, bool occupancy_histogram);
76 
77  private:
79  struct ECLAlarmType {
80  std::string name;
81  std::string title;
85  };
86 
88  static const int c_max_masked_channels = 200;
91  dbr_short_t status;
92  dbr_short_t severity;
94  };
95 
97  std::pair<int, ECLAlarmType> getAlarmByName(std::string name);
98 
100  void updateAlarmConfig();
101 
106  bool getMaskedChannels(std::map<std::string, dbr_sts_long_array>& mask_info);
107 
108 
112  std::vector< std::vector<int> > updateAlarmCounts(bool update_mirabelle = false);
113 
117  std::map<int, int> getChannelsWithOccupancyProblems();
118 
122  std::map<int, int> getChannelsWithChi2Problems();
123 
125  void drawGrid(TH2* hist);
126 
127  private:
131  std::string m_pvPrefix;
140 
142  std::vector<ECLAlarmType> m_ecl_alarms;
143 
145  std::map<std::string, std::set<int> > m_mask;
146 
148  double m_total_events = 0;
149 
151  TH2F* h_channels_summary = nullptr;
153  TCanvas* c_channels_summary = nullptr;
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;
173  };
175 } // end namespace Belle2
176 
This module provides a high-level display to show which ECLCollectors have channels with various type...
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.
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.
The base class for the histogram analysis module.
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.
Definition: ECLNeighbours.h:25
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
dbr_long_t value[c_max_masked_channels]
current value