9#include <dqm/analysis/modules/DQMHistAnalysisTrackingHLT.h>
38 "Minimum Number of Events before scaring CR shifters. Will be taken from Epics by default, \
39 this value is only taken if Epics is not available!",
int(
m_statThreshold));
49 double buffMinEvents(NAN);
50 double dummyLowerAlarm, dummyUpperWarn, dummyUpperAlarm;
55 if (!std::isnan(buffMinEvents)) {
56 B2INFO(
getName() <<
": Setting min number of events threshold from EPICS. New minNoEvents " << buffMinEvents);
78 registerEpicsPV(
"trackingHLT:nVXDTracksPerEvent",
"nVXDTracksPerEvent");
79 registerEpicsPV(
"trackingHLT:nCDCTracksPerEvent",
"nCDCTracksPerEvent");
80 registerEpicsPV(
"trackingHLT:nVXDCDCTracksPerEvent",
"nVXDCDCTracksPerEvent");
88 TH2F* hAbortHER =
dynamic_cast<TH2F*
>(
findHist(
"TrackingHLTDQM/TrkAbortVsTimeHER"));
89 TH2F* hAllHER =
dynamic_cast<TH2F*
>(
findHist(
"TrackingHLTDQM/allEvtsVsTimeHER"));
90 if (hAbortHER !=
nullptr && hAllHER !=
nullptr) {
92 TH2F* hAbortRateHER =
new TH2F(*hAbortHER);
94 for (
int i = 0; i < hAbortRateHER->GetXaxis()->GetNbins(); i++)
95 for (
int j = 0; j < hAbortRateHER->GetYaxis()->GetNbins(); j++) {
96 int den = hAllHER->GetBinContent(i + 1, j + 1);
97 int num = hAbortHER->GetBinContent(i + 1, j + 1);
99 if (den > 0) hAbortRateHER->SetBinContent(i + 1, j + 1, num * 1. / den);
100 else hAbortRateHER->SetBinContent(i + 1, j + 1, 0);
105 hAbortRateHER->SetTitle(
"Fraction of Events with Tracking Aborts vs HER injection");
106 hAbortRateHER->GetZaxis()->SetTitle(
"Fraction of events / bin");
107 hAbortRateHER->Draw(
"colz");
118 TH2F* hAbortLER =
dynamic_cast<TH2F*
>(
findHist(
"TrackingHLTDQM/TrkAbortVsTimeLER"));
119 TH2F* hAllLER =
dynamic_cast<TH2F*
>(
findHist(
"TrackingHLTDQM/allEvtsVsTimeLER"));
121 if (hAbortLER !=
nullptr && hAllLER !=
nullptr) {
123 TH2F* hAbortRateLER =
new TH2F(*hAbortLER);
125 for (
int i = 0; i < hAbortRateLER->GetXaxis()->GetNbins(); i++)
126 for (
int j = 0; j < hAbortRateLER->GetYaxis()->GetNbins(); j++) {
127 int den = hAllLER->GetBinContent(i + 1, j + 1);
128 int num = hAbortLER->GetBinContent(i + 1, j + 1);
130 if (den > 0) hAbortRateLER->SetBinContent(i + 1, j + 1, num * 1. / den);
131 else hAbortRateLER->SetBinContent(i + 1, j + 1, 0);
136 hAbortRateLER->SetTitle(
"Fraction of Events with Tracking Aborts vs LER injection");
137 hAbortRateLER->GetZaxis()->SetTitle(
"Fraction of events / bin");
138 hAbortRateLER->Draw(
"colz");
147 TH1* hnTracks =
findHist(
"TrackingHLTDQM/NoOfTracks");
148 if (hnTracks !=
nullptr && hnTracks->GetEntries() >=
m_statThreshold) {
149 double averageNTracks = hnTracks->GetMean();
151 setEpicsPV(
"nTracksPerEvent", averageNTracks);
154 TH1* hnVXDTracks =
findHist(
"TrackingHLTDQM/NoOfTracksInVXDOnly");
155 if (hnVXDTracks !=
nullptr && hnVXDTracks->GetEntries() >=
m_statThreshold) {
156 double averageNVXDTracks = hnVXDTracks->GetMean();
158 setEpicsPV(
"nVXDTracksPerEvent", averageNVXDTracks);
161 TH1* hnCDCTracks =
findHist(
"TrackingHLTDQM/NoOfTracksInCDCOnly");
162 if (hnCDCTracks !=
nullptr && hnCDCTracks->GetEntries() >=
m_statThreshold) {
163 double averageNCDCTracks = hnCDCTracks->GetMean();
165 setEpicsPV(
"nCDCTracksPerEvent", averageNCDCTracks);
168 TH1* hnVXDCDCTracks =
findHist(
"TrackingHLTDQM/NoOfTracksInVXDCDC");
169 if (hnVXDCDCTracks !=
nullptr && hnVXDCDCTracks->GetEntries() >=
m_statThreshold) {
170 double averageNVXDCDCTracks = hnVXDCDCTracks->GetMean();
172 setEpicsPV(
"nVXDCDCTracksPerEvent", averageNVXDCDCTracks);
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)
void colorizeCanvas(TCanvas *canvas, EStatus status)
Helper function for Canvas colorization.
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.
@ c_StatusDefault
default for non-coloring
@ c_StatusTooFew
Not enough entries/event to judge.
int registerEpicsPV(std::string pvname, std::string keyname="")
EPICS related Functions.
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
MonitoringObject * m_monObj
Monitoring Object to be produced by this module, which contain defined canvases and monitoring variab...
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
DQMHistAnalysisTrackingHLTModule()
Constructor.
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.