14#include <dqm/analysis/modules/DQMHistAnalysisRootFitExample.h>
15#include <RooRealVar.h>
32 setDescription(
"DQM histogram analysis example module featuring RooFit");
36 B2DEBUG(1,
"DQMHistAnalysisRooFitExample: Constructor done.");
41 B2INFO(
"DQMHistAnalysisRooFitExample: initialized.");
45 w =
new RooWorkspace(
"w");
46 w->factory(
"Gaussian::f(x[-20,20],mean[0,-5,5],sigma[3,1,10])");
49 m_c0 =
new TCanvas(
"example0");
55 B2INFO(
"DQMHistAnalysisRooFitExample: beginRun called.");
58 auto hh1 =
findHist(
"FirstDet/h_HitXPositionCh01");
63 data =
new RooDataHist(
"data",
"dataset with x", *
x, hh1);
75 B2WARNING(
"Histo not there ...");
84 hh1 =
findHist(
"FirstDet/h_HitXPositionCh01");
89 data =
new RooDataHist(
"data",
"dataset with x", *(
w->var(
"x")), hh1);
int registerEpicsPV(const std::string &pvname, const std::string &keyname="")
EPICS related Functions.
DQMHistAnalysisModule()
Constructor / Destructor.
void setEpicsPV(const std::string &keyname, double value)
Write value to a EPICS PV.
static TH1 * findHist(const std::string &dirname, const std::string &histname="", bool onlyIfUpdated=false)
Find histogram.
RooAbsPdf * model
The PDF for fitting.
void initialize(void) override final
Initializer.
RooDataHist * data
The data of histogram for fitting.
DQMHistAnalysisRooFitExampleModule()
Constructor.
RooFitResult * r
The fitting result.
RooRealVar * x
The fitting variable.
TCanvas * m_c0
The drawing canvas for plotting the fitting result.
RooPlot * plot
The plot of the fitting result.
RooWorkspace * w
The RooFit work space.
void beginRun(void) override final
Called when entering a new run.
void event(void) override final
This method is called for each event.
void setDescription(const std::string &description)
Sets the description of the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.