9#include <dqm/analysis/modules/DQMHistAnalysisEpicsExample.h>
36 B2DEBUG(20,
"DQMHistAnalysisEpicsExample: Constructor done.");
41 B2DEBUG(20,
"DQMHistAnalysisEpicsExample: initialized.");
45 a.ReplaceAll(
"/",
"_");
46 m_c1 =
new TCanvas(
"c_" + a);
48 m_f1->SetParameter(0, 1000);
49 m_f1->SetParameter(1, 0);
50 m_f1->SetParameter(2, 10);
51 m_f1->SetLineColor(4);
53 m_f1->SetNumberFitPoints(512);
55 m_line =
new TLine(0, 10, 0, 0);
81 aa =
m_f1->GetParName(i);
82 if (aa ==
"") aa = string(
"par") + string(TString::Itoa(i, 10).Data());
97 B2DEBUG(20,
"DQMHistAnalysisEpicsExample: beginRun called.");
104 B2DEBUG(20,
"Histo " <<
m_histoname <<
" not in memfile");
105 TDirectory* d = gROOT;
109 while (myl.Tokenize(tok, from,
"/")) {
113 if (myl.Tokenize(dummy, f,
"/")) {
114 auto e = d->GetDirectory(tok);
116 B2DEBUG(20,
"Cd Dir " << tok);
124 TObject* obj = d->FindObject(tok);
126 if (obj->IsA()->InheritsFrom(
"TH1")) {
127 B2DEBUG(20,
"Histo " <<
m_histoname <<
" found in mem");
131 B2DEBUG(20,
"Histo " <<
m_histoname <<
" NOT found in mem");
142 B2DEBUG(20,
"Histo " <<
m_histoname <<
" not found");
153 B2DEBUG(20,
"Histo " <<
m_histoname <<
" not in memfile");
154 TDirectory* d = gROOT;
158 while (myl.Tokenize(tok, from,
"/")) {
162 if (myl.Tokenize(dummy, f,
"/")) {
163 auto e = d->GetDirectory(tok);
165 B2DEBUG(20,
"Cd Dir " << tok);
173 TObject* obj = d->FindObject(tok);
175 if (obj->IsA()->InheritsFrom(
"TH1")) {
176 B2DEBUG(20,
"Histo " <<
m_histoname <<
" found in mem");
181 B2DEBUG(20,
"Histo " <<
m_histoname <<
" NOT found in mem");
187 double y1 = hh1->GetMaximum();
188 double y2 = hh1->GetMinimum();
189 m_line->SetY1(y1 + (y1 - y2) * 0.05);
195 double x =
m_f1->GetParameter(1);
207 B2DEBUG(20,
"Histo " <<
m_histoname <<
" not found");
213 data =
m_f1->GetParameter(i);
221 B2DEBUG(20,
"DQMHistAnalysisEpicsExample : endRun called");
227 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.
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.
int registerEpicsPV(const std::string &pvname, const std::string &keyname="")
EPICS related Functions.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
DQMHistAnalysisModule()
Constructor / Destructor.
void setEpicsPV(const std::string &keyname, double value)
Write value to a EPICS PV.
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.