9#include <dqm/analysis/modules/DQMHistAnalysisEpicsExample.h>
36 B2DEBUG(20,
"DQMHistAnalysisEpicsExample: Constructor done.");
46 B2DEBUG(20,
"DQMHistAnalysisEpicsExample: initialized.");
50 a.ReplaceAll(
"/",
"_");
51 m_c1 =
new TCanvas(
"c_" + a);
53 m_f1->SetParameter(0, 1000);
54 m_f1->SetParameter(1, 0);
55 m_f1->SetParameter(2, 10);
56 m_f1->SetLineColor(4);
58 m_f1->SetNumberFitPoints(512);
60 m_line =
new TLine(0, 10, 0, 0);
86 aa =
m_f1->GetParName(i);
87 if (aa ==
"") aa = string(
"par") + string(TString::Itoa(i, 10).Data());
102 B2DEBUG(20,
"DQMHistAnalysisEpicsExample: beginRun called.");
109 B2DEBUG(20,
"Histo " <<
m_histoname <<
" not in memfile");
110 TDirectory* d = gROOT;
114 while (myl.Tokenize(tok, from,
"/")) {
118 if (myl.Tokenize(dummy, f,
"/")) {
119 auto e = d->GetDirectory(tok);
121 B2DEBUG(20,
"Cd Dir " << tok);
129 TObject* obj = d->FindObject(tok);
131 if (obj->IsA()->InheritsFrom(
"TH1")) {
132 B2DEBUG(20,
"Histo " <<
m_histoname <<
" found in mem");
136 B2DEBUG(20,
"Histo " <<
m_histoname <<
" NOT found in mem");
147 B2DEBUG(20,
"Histo " <<
m_histoname <<
" not found");
158 B2DEBUG(20,
"Histo " <<
m_histoname <<
" not in memfile");
159 TDirectory* d = gROOT;
163 while (myl.Tokenize(tok, from,
"/")) {
167 if (myl.Tokenize(dummy, f,
"/")) {
168 auto e = d->GetDirectory(tok);
170 B2DEBUG(20,
"Cd Dir " << tok);
178 TObject* obj = d->FindObject(tok);
180 if (obj->IsA()->InheritsFrom(
"TH1")) {
181 B2DEBUG(20,
"Histo " <<
m_histoname <<
" found in mem");
186 B2DEBUG(20,
"Histo " <<
m_histoname <<
" NOT found in mem");
192 double y1 = hh1->GetMaximum();
193 double y2 = hh1->GetMinimum();
194 m_line->SetY1(y1 + (y1 - y2) * 0.05);
200 double x =
m_f1->GetParameter(1);
212 B2DEBUG(20,
"Histo " <<
m_histoname <<
" not found");
218 data =
m_f1->GetParameter(i);
226 B2DEBUG(20,
"DQMHistAnalysisEpicsExample : endRun called");
232 B2DEBUG(20,
"DQMHistAnalysisEpicsExample: terminate called");
void initialize() override final
Initializer.
TF1 * m_f1
The fit function.
DQMHistAnalysisEpicsExampleModule()
Constructor.
TLine * m_line_hi
The line for the higher bound.
std::string m_pvPrefix
The prefix of PV.
void terminate() override final
This method is called at the end of the event processing.
Int_t m_parameters
The fit function parameters for EPICS.
void event() override final
This method is called for each event.
TCanvas * m_c1
The drawing canvas.
TLine * m_line_lo
The line for the lower bound.
void endRun() override final
This method is called if the current run ends.
~DQMHistAnalysisEpicsExampleModule()
Destructor.
std::string m_histoname
The name of the histogram.
void beginRun() override final
Called when entering a new run.
TLine * m_line
The line for the fitting result.
std::vector< std::string > mypv
list of pv names
std::string m_function
The definition of the fit function.
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).
void setEpicsPV(std::string keyname, double value)
Write value to a EPICS PV.
int registerEpicsPV(std::string pvname, std::string keyname="")
EPICS related Functions.
void setDescription(const std::string &description)
Sets the description of the module.
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.