14 #include <dqm/analysis/modules/DQMHistAnalysisRootFitExample.h>
15 #include <RooRealVar.h>
35 B2DEBUG(1,
"DQMHistAnalysisRooFitExample: Constructor done.");
38 DQMHistAnalysisRooFitExampleModule::~DQMHistAnalysisRooFitExampleModule()
41 if (ca_current_context()) ca_context_destroy();
45 void DQMHistAnalysisRooFitExampleModule::initialize()
47 B2INFO(
"DQMHistAnalysisRooFitExample: initialized.");
50 if (!ca_current_context()) SEVCHK(ca_context_create(ca_disable_preemptive_callback),
"ca_context_create");
51 SEVCHK(ca_create_channel(
"fit_value", NULL, NULL, 10, &mychid),
"ca_create_channel failure");
52 SEVCHK(ca_pend_io(5.0),
"ca_pend_io failure");
55 w =
new RooWorkspace(
"w");
56 w->factory(
"Gaussian::f(x[-20,20],mean[0,-5,5],sigma[3,1,10])");
59 m_c0 =
new TCanvas(
"example0");
63 void DQMHistAnalysisRooFitExampleModule::beginRun()
66 B2INFO(
"DQMHistAnalysisRooFitExample: beginRun called.");
69 TH1* hh1 = findHist(
"FirstDet/h_HitXPositionCh01");
74 data =
new RooDataHist(
"data",
"dataset with x", *x, (
const TH1*) hh1);
76 r = model->fitTo(*data);
86 B2FATAL(
"Histo now there ... -> zero pointer crash");
91 void DQMHistAnalysisRooFitExampleModule::event()
96 hh1 = findHist(
"FirstDet/h_HitXPositionCh01");
99 if (data)
delete data;
101 data =
new RooDataHist(
"data",
"dataset with x", *(w->var(
"x")), hh1);
103 r = model->fitTo(*data);
128 SEVCHK(ca_put(DBR_DOUBLE, mychid, (
void*)&fitdata),
"ca_set failure");
129 SEVCHK(ca_pend_io(5.0),
"ca_pend_io failure");
133 void DQMHistAnalysisRooFitExampleModule::endRun()
135 B2INFO(
"DQMHistAnalysisRooFitExample: endRun called");
139 void DQMHistAnalysisRooFitExampleModule::terminate()
142 SEVCHK(ca_clear_channel(mychid),
"ca_clear_channel failure");
143 SEVCHK(ca_pend_io(5.0),
"ca_pend_io failure");
145 B2INFO(
"DQMHistAnalysisRooFitExample: terminate called");
The base class for the histogram analysis module.
Class definition for the output module of Sequential ROOT I/O.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.