14 #include <dqm/analysis/modules/DQMHistAnalysisDeltaTest.h>
29 DQMHistAnalysisDeltaTestModule::DQMHistAnalysisDeltaTestModule()
33 setDescription(
"Testing module for using delta histogramming functionality.");
39 B2DEBUG(1,
"DQMHistAnalysisDeltaTest: Constructor done.");
47 if (ca_current_context()) ca_context_destroy();
54 B2DEBUG(1,
"DQMHistAnalysisDeltaTest: initialized.");
67 if (!ca_current_context()) SEVCHK(ca_context_create(ca_disable_preemptive_callback),
"ca_context_create");
68 SEVCHK(ca_create_channel((
m_pvPrefix +
"TEST1").data(), NULL, NULL, 10, &mychid[0]),
"ca_create_channel failure");
69 SEVCHK(ca_create_channel((
m_pvPrefix +
"TEST2").data(), NULL, NULL, 10, &mychid[1]),
"ca_create_channel failure");
71 SEVCHK(ca_pend_io(5.0),
"ca_pend_io failure");
78 B2DEBUG(1,
"DQMHistAnalysisDeltaTest: beginRun called.");
83 B2DEBUG(1,
"DQMHistAnalysisDeltaTest: endRun called.");
88 double data_Test1 = 0.0;
89 double data_Test2 = 0.0;
102 auto a = (TH1*)hh1->DrawClone(
"hist");
103 a->SetTitle(
"Hist always");
104 data_Test2 = hh1->GetMean();
110 auto a = (TH1*)hh2->DrawClone(
"hist");
111 a->SetTitle(
"Hist only if updated");
118 auto a = (TH1*)hd2->DrawClone(
"hist");
119 a->SetTitle(
"Delta always");
126 auto a = (TH1*)hd1->DrawClone(
"hist");
127 a->SetTitle(
"Delta only if updated");
128 data_Test1 = hd1->GetMean();
139 auto a = (TH1*)hh1->DrawClone(
"hist");
141 a->SetTitle(
"initial sampling");
150 for (
int i = 0; i < 99; i++) {
151 auto h =
getDelta(fullname, i,
false);
152 if (h ==
nullptr)
break;
156 h->SetLineColor(kBlue + 4 - i * 3);
165 auto h = it->second->m_lastHist;
167 auto a = (TH1*)h->DrawClone(
"hist");
168 a->SetTitle(
"last update histogram");
176 static int plot_count = 0;
191 SEVCHK(ca_put(DBR_DOUBLE, mychid[0], (
void*)&data_Test1),
"ca_set failure");
192 SEVCHK(ca_put(DBR_DOUBLE, mychid[1], (
void*)&data_Test2),
"ca_set failure");
194 SEVCHK(ca_pend_io(5.0),
"ca_pend_io failure");
202 B2DEBUG(1,
"DQMHistAnalysisDeltaTest: terminate called");
void terminate(void) override final
This method is called at the end of the event processing.
void initialize(void) override final
Initializer.
std::string m_histogramName
name of histogram
void endRun(void) override final
Called when run ends.
std::string m_pvPrefix
prefix for EPICS PVs
MonitoringObject * m_monObj
Monitoring Object.
TCanvas * m_cTest
Final Canvas.
std::string m_histogramDirectoryName
name of histogram directory
~DQMHistAnalysisDeltaTestModule()
Destructor.
void beginRun(void) override final
Called when entering a new run.
void event(void) override final
This method is called for each event.
The base class for the histogram analysis module.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
static const DeltaList & getDeltaList()
Get the list of the delta histograms.
TH1 * getDelta(const std::string &fullname, int n=0, bool onlyIfUpdated=true)
Get Delta histogram.
bool getUseEpics(void)
Getter for EPICS usage.
void UpdateCanvas(std::string name, bool updated=true)
Mark canvas as updated (or not)
static MonitoringObject * getMonitoringObject(const std::string &histname)
Get MonitoringObject with given name (new object is created if non-existing)
void setDescription(const std::string &description)
Sets the description 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 addCanvas(TCanvas *canv)
Add Canvas to monitoring object.
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.