11 #include <dqm/analysis/modules/DQMHistAnalysisCDCDedx.h>
12 #include <boost/format.hpp>
37 B2DEBUG(20,
"DQMHistAnalysisCDCDedx: Constructor done.");
41 DQMHistAnalysisCDCDedxModule::~DQMHistAnalysisCDCDedxModule() { }
43 void DQMHistAnalysisCDCDedxModule::initialize()
47 B2DEBUG(1,
"DQMHistAnalysisCDCDedx: initialized.");
54 tLine->SetLineColor(4);
55 tLine->SetLineStyle(9);
57 c_CDCdedxSigma =
new TCanvas(
"CDCDedx/c_CDCdedxSigma");
59 c_CDCdedxMean =
new TCanvas(
"CDCDedx/c_CDCdedxMean");
60 h_CDCdedxMean =
new TH1F(
"CDCDedx/h_CDCdedxMean",
"dEdx distribution", 200, 0.0, 2.0);
61 h_CDCdedxMean->SetDirectory(0);
62 h_CDCdedxMean->SetStats(
false);
64 f_fGaus =
new TF1(
"f_Gaus",
"gaus", 0.0, 2.0);
65 f_fGaus->SetParameter(1, 1.00);
66 f_fGaus->SetParameter(2, 0.06);
67 f_fGaus->SetLineColor(kRed);
71 void DQMHistAnalysisCDCDedxModule::beginRun()
73 B2DEBUG(1,
"DQMHistAnalysisCDCDedx: beginRun called.");
76 void DQMHistAnalysisCDCDedxModule::event()
78 computedEdxMeanSigma();
82 void DQMHistAnalysisCDCDedxModule::computedEdxMeanSigma()
88 TH1* hh1 = findHist(
"CDCDedx/hdEdx_PerRun");
90 c_CDCdedxMean->Clear();
93 h_CDCdedxMean->SetBins(
int(hh1->GetXaxis()->GetNbins()),
double(hh1->GetXaxis()->GetXmin()),
double(hh1->GetXaxis()->GetXmax()));
94 h_CDCdedxMean->SetTitle(hh1->GetTitle());
95 for (Int_t i = 1; i <= hh1->GetXaxis()->GetNbins(); i++) {
96 h_CDCdedxMean->SetBinContent(i, hh1->GetBinContent(i));
97 h_CDCdedxMean->SetBinError(i, hh1->GetBinError(i));
100 h_CDCdedxMean->Fit(f_fGaus,
"Q");
102 runnumber = h_CDCdedxMean->GetTitle();
103 runnumber = runnumber.substr(12, 5);
105 if (h_CDCdedxMean->GetEntries() < 100) {
106 dedxmean = 0.0; dedxsigma = 0.0;
107 runstatus =
"Low Stats";
109 if (h_CDCdedxMean->GetFunction(
"f_Gaus") == NULL || !h_CDCdedxMean->GetFunction(
"f_Gaus")->IsValid()) {
110 dedxmean = 0.0; dedxsigma = 0.0;
111 runstatus =
"Fit Failed";
113 dedxmean = h_CDCdedxMean->GetFunction(
"f_Gaus")->GetParameter(1);
114 dedxsigma = h_CDCdedxMean->GetFunction(
"f_Gaus")->GetParameter(2);
119 h_CDCdedxMean->GetXaxis()->SetRangeUser(0.0, 2.0);
120 h_CDCdedxMean->SetTitle(Form(
"Run ## %s, Status: %s, mean: %0.04f, sigma: %0.04f", runnumber.data(), runstatus.data(), dedxmean,
122 h_CDCdedxMean->SetFillColor(kYellow);
123 h_CDCdedxMean->Draw(
"hist");
125 f_fGaus->Draw(
"same");
127 tLine->SetX1(dedxmean);
128 tLine->SetX2(dedxmean);
130 tLine->SetY2(h_CDCdedxMean->GetMaximum());
131 tLine->DrawClone(
"same");
133 c_CDCdedxMean->Modified();
138 void DQMHistAnalysisCDCDedxModule::endRun()
140 B2DEBUG(20,
"DQMHistAnalysisCDCDedx : endRun called");
144 void DQMHistAnalysisCDCDedxModule::terminate()
146 B2DEBUG(20,
"terminate called");