9 #include <dqm/analysis/modules/DQMHistAnalysisTrackingHLT.h>
31 DQMHistAnalysisTrackingHLTModule::DQMHistAnalysisTrackingHLTModule()
38 "Maximum Fraction of Events in which Tracking Aborts before turning Canvas to Red. Will be taken from Epics by default, \
41 "Minimum Number of Events before scaring CR shifters. Will be taken from Epics by default, \
42 this value is only taken if Epics is not available!",
int(
m_statThreshold));
52 double buffThreshold(NAN);
53 double buffMinEvents(NAN);
54 double dummy_lowerAlarm, dummy_lowerWarn, dummy_upperWarn, dummy_upperAlarm;
59 if (!std::isnan(buffThreshold)) {
60 B2INFO(
getName() <<
": Setting failure rate threshold from EPICS. New failureRateThreshold " << buffThreshold);
63 if (!std::isnan(buffMinEvents)) {
64 B2INFO(
getName() <<
": Setting min number of events threshold from EPICS. New minNoEvents " << buffMinEvents);
74 m_cAbortRate =
new TCanvas(
"TrackingAnalysis/c_AbortRate");
82 registerEpicsPV(
"TRACKING:failureRateThreshold",
"failureRateThreshold");
90 TH1* hAbort =
findHist(
"TrackingHLTDQM/NumberTrackingErrorFlags");
91 if (hAbort !=
nullptr) {
93 bool hasError =
false;
94 int nEvents = hAbort->GetEntries();
95 double abortRate = hAbort->GetMean();
96 hAbort->SetTitle(Form(
"Fraction of Events in which Tracking aborts = %.4f %%", abortRate * 100));
112 B2WARNING(
"Histogram TrackingHLTDQM/NumberTrackingErrorFlags from Tracking DQM not found!");
125 TH2F* hAbortHER =
dynamic_cast<TH2F*
>(
findHist(
"TrackingHLTDQM/TrkAbortVsTimeHER"));
126 TH2F* hAllHER =
dynamic_cast<TH2F*
>(
findHist(
"TrackingHLTDQM/allEvtsVsTimeHER"));
127 if (hAbortHER !=
nullptr && hAllHER !=
nullptr) {
129 TH2F* hAbortRateHER =
new TH2F(*hAbortHER);
131 for (
int i = 0; i < hAbortRateHER->GetXaxis()->GetNbins(); i++)
132 for (
int j = 0; j < hAbortRateHER->GetYaxis()->GetNbins(); j++) {
133 int den = hAllHER->GetBinContent(i + 1, j + 1);
134 int num = hAbortHER->GetBinContent(i + 1, j + 1);
136 if (den > 0) hAbortRateHER->SetBinContent(i + 1, j + 1, num * 1. / den);
137 else hAbortRateHER->SetBinContent(i + 1, j + 1, 0);
141 hAbortRateHER->Draw(
"colz");
145 B2WARNING(
"Histograms TrackingHLTDQM/TrkAbortVsTimeHER or allEvtsVsTimeHER from Tracking DQM not found!");
153 TH2F* hAbortLER =
dynamic_cast<TH2F*
>(
findHist(
"TrackingHLTDQM/TrkAbortVsTimeLER"));
154 TH2F* hAllLER =
dynamic_cast<TH2F*
>(
findHist(
"TrackingHLTDQM/allEvtsVsTimeLER"));
155 if (hAbortLER !=
nullptr && hAllLER !=
nullptr) {
157 TH2F* hAbortRateLER =
new TH2F(*hAbortLER);
159 for (
int i = 0; i < hAbortRateLER->GetXaxis()->GetNbins(); i++)
160 for (
int j = 0; j < hAbortRateLER->GetYaxis()->GetNbins(); j++) {
161 int den = hAllLER->GetBinContent(i + 1, j + 1);
162 int num = hAbortLER->GetBinContent(i + 1, j + 1);
164 if (den > 0) hAbortRateLER->SetBinContent(i + 1, j + 1, num * 1. / den);
165 else hAbortRateLER->SetBinContent(i + 1, j + 1, 0);
169 hAbortRateLER->Draw(
"colz");
172 B2WARNING(
"Histograms TrackingHLTDQM/TrkAbortVsTimeLER or allEvtsVsTimeLER from Tracking DQM not found!");
179 TH1* hnTracks =
findHist(
"TrackingHLTDQM/NoOfTracks");
180 if (hnTracks !=
nullptr) {
181 double averageNTracks = hnTracks->GetMean();
185 TH1* hnVXDTracks =
findHist(
"TrackingHLTDQM/NoOfTracksInVXDOnly");
186 if (hnVXDTracks !=
nullptr) {
187 double averageNVXDTracks = hnVXDTracks->GetMean();
191 TH1* hnCDCTracks =
findHist(
"TrackingHLTDQM/NoOfTracksInCDCOnly");
192 if (hnCDCTracks !=
nullptr) {
193 double averageNCDCTracks = hnCDCTracks->GetMean();
197 TH1* hnVXDCDCTracks =
findHist(
"TrackingHLTDQM/NoOfTracksInVXDCDC");
198 if (hnVXDCDCTracks !=
nullptr) {
199 double averageNVXDCDCTracks = hnVXDCDCTracks->GetMean();
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).
static MonitoringObject * getMonitoringObject(const std::string &histname)
Get MonitoringObject with given name (new object is created if non-existing)
bool requestLimitsFromEpicsPVs(chid id, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
Get Alarm Limits from EPICS PV.
void initialize() override final
Module function initialize.
int m_statThreshold
minimal number of events to judge
double m_failureRateThreshold
above this rate, there is maybe a problem?
MonitoringObject * m_monObj
Monitoring Object to be produced by this module, which contain defined canvases and monitoring variab...
TCanvas * m_cAbortRate
canvas for the abort rate plot
void event() override final
Module function event.
TCanvas * m_cAbortRateHER
canvas for the 2D abort rate plot for HER
TCanvas * m_cAbortRateLER
canvas for the 2D abort rate plot for LER
bool m_printCanvas
if true print the pdf of the canvases
void beginRun() override final
Module function doing stuff at beginning of a run.
void setDescription(const std::string &description)
Sets the description of the module.
const std::string & getName() const
Returns the name of the module.
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 ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.