14#include <dqm/analysis/modules/DQMHistAnalysisRootFitExample.h>
15#include <RooRealVar.h>
35 B2DEBUG(1,
"DQMHistAnalysisRooFitExample: Constructor done.");
44 B2INFO(
"DQMHistAnalysisRooFitExample: initialized.");
48 w =
new RooWorkspace(
"w");
49 w->factory(
"Gaussian::f(x[-20,20],mean[0,-5,5],sigma[3,1,10])");
52 m_c0 =
new TCanvas(
"example0");
58 B2INFO(
"DQMHistAnalysisRooFitExample: beginRun called.");
61 TH1* hh1 =
findHist(
"FirstDet/h_HitXPositionCh01");
66 data =
new RooDataHist(
"data",
"dataset with x", *
x, (
const TH1*) hh1);
78 B2WARNING(
"Histo not there ...");
87 hh1 =
findHist(
"FirstDet/h_HitXPositionCh01");
92 data =
new RooDataHist(
"data",
"dataset with x", *(
w->var(
"x")), hh1);
122 B2INFO(
"DQMHistAnalysisRooFitExample: endRun called");
128 B2INFO(
"DQMHistAnalysisRooFitExample: terminate called");
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.
RooAbsPdf * model
The PDF for fitting.
void terminate(void) override final
This method is called at the end of the event processing.
void initialize(void) override final
Initializer.
RooDataHist * data
The data of histogram for fitting.
void endRun(void) override final
This method is called if the current run ends.
~DQMHistAnalysisRooFitExampleModule()
Destructor.
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.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.