10 #include <dqm/analysis/modules/DQMHistAnalysisPXDFits.h>
13 #include <boost/format.hpp>
33 addParam(
"histogramDirectoryName", m_histogramDirectoryName,
"Name of the directory where histograms were placed",
34 std::string(
"PXDRAW"));
36 for (
auto i = 0, j = 0; i < 64; i++) {
37 auto layer = (((i >> 5) & 0x1) + 1);
38 auto ladder = ((i >> 1) & 0xF);
39 if (ladder == 0)
continue;
40 if (layer == 1 && ladder > 8)
continue;
41 if (layer == 2 && ladder > 12)
continue;
45 if (j == NUM_MODULES)
break;
47 for (
auto i = 0; i < NUM_MODULES; i++) {
48 m_hSignal[i] =
nullptr;
49 m_hCommon[i] =
nullptr;
50 m_hCounts[i] =
nullptr;
51 m_cSignal[i] =
nullptr;
52 m_cCommon[i] =
nullptr;
53 m_cCounts[i] =
nullptr;
55 B2DEBUG(1,
"DQMHistAnalysisPXDFits: Constructor done.");
58 void DQMHistAnalysisPXDFitsModule::initialize()
60 B2DEBUG(1,
"DQMHistAnalysisPXDFits: initialized.");
66 a =
"pxdraw/hSignalAll";
67 a.ReplaceAll(
"/",
"_");
68 m_cSignalAll =
new TCanvas((m_histogramDirectoryName +
"/c_").data() + a);
69 m_hSignalAll =
new TH1F(a, a, NUM_MODULES, 0, NUM_MODULES);
70 m_hSignalAll->SetDirectory(0);
71 m_hSignalAll->SetStats(
false);
73 a =
"pxdraw/hCommonAll";
74 a.ReplaceAll(
"/",
"_");
75 m_cCommonAll =
new TCanvas((m_histogramDirectoryName +
"/c_").data() + a);
76 m_hCommonAll =
new TH1F(a, a, NUM_MODULES, 0, NUM_MODULES);
77 m_hCommonAll->SetDirectory(0);
78 m_hCommonAll->SetStats(
false);
80 a =
"pxdraw/hCountsAll";
81 a.ReplaceAll(
"/",
"_");
82 m_cCountsAll =
new TCanvas((m_histogramDirectoryName +
"/c_").data() + a);
83 m_hCountsAll =
new TH1F(a, a, NUM_MODULES, 0, NUM_MODULES);
84 m_hCountsAll->SetDirectory(0);
85 m_hCountsAll->SetStats(
false);
87 a =
"pxdraw/hOccupancyAll";
88 a.ReplaceAll(
"/",
"_");
89 m_cOccupancyAll =
new TCanvas((m_histogramDirectoryName +
"/c_").data() + a);
90 m_hOccupancyAll =
new TH1F(a, a, NUM_MODULES, 0, NUM_MODULES);
91 m_hOccupancyAll->SetDirectory(0);
92 m_hOccupancyAll->SetStats(
false);
94 for (
auto i = 0; i < NUM_MODULES; i++) {
95 auto id = m_inx_to_id[i];
96 auto layer = (((
id >> 5) & 0x1) + 1);
97 auto ladder = ((
id >> 1) & 0xF);
98 auto sensor = ((
id & 0x1) + 1);
99 string s2 = str(format(
"_%d.%d.%d") % layer % ladder % sensor);
101 m_hSignalAll->GetXaxis()->SetBinLabel(i + 1, TString(s2));
102 m_hCommonAll->GetXaxis()->SetBinLabel(i + 1, TString(s2));
103 m_hCountsAll->GetXaxis()->SetBinLabel(i + 1, TString(s2));
104 m_hOccupancyAll->GetXaxis()->SetBinLabel(i + 1, TString(s2));
106 a =
"pxdraw/hSignal";
107 a.ReplaceAll(
"/",
"_");
110 m_cSignal[i] =
new TCanvas((m_histogramDirectoryName +
"/c_").data() + a);
111 m_hSignal[i] =
new TH2F(a, a, 6, 0, 6, 4, 0, 4);
112 m_hSignal[i]->SetDirectory(0);
113 m_hSignal[i]->SetStats(
false);
114 m_hSignal[i]->SetMinimum(0);
115 m_hSignal[i]->SetMaximum(64);
117 a =
"pxdraw/hCommon";
118 a.ReplaceAll(
"/",
"_");
120 m_cCommon[i] =
new TCanvas((m_histogramDirectoryName +
"/c_").data() + a);
121 m_hCommon[i] =
new TH2F(a, a, 6, 0, 6, 4, 0, 4);
122 m_hCommon[i]->SetDirectory(0);
123 m_hCommon[i]->SetStats(
false);
124 m_hCommon[i]->SetMinimum(0);
125 m_hCommon[i]->SetMaximum(256);
127 a =
"pxdraw/hCounts";
128 a.ReplaceAll(
"/",
"_");
130 m_cCounts[i] =
new TCanvas((m_histogramDirectoryName +
"/c_").data() + a);
131 m_hCounts[i] =
new TH2F(a, a, 6, 0, 6, 4, 0, 4);
132 m_hCounts[i]->SetDirectory(0);
133 m_hCounts[i]->SetStats(
false);
136 m_fLandau =
new TF1(
"f_Landau",
"landau", 0, 256);
137 m_fLandau->SetParameter(0, 1000);
138 m_fLandau->SetParameter(1, 0);
139 m_fLandau->SetParameter(2, 10);
140 m_fLandau->SetLineColor(4);
141 m_fLandau->SetNpx(256);
142 m_fLandau->SetNumberFitPoints(256);
144 m_fGaus =
new TF1(
"f_Gaus",
"gaus", 0, 8096);
145 m_fGaus->SetParameter(0, 1000);
146 m_fGaus->SetParameter(1, 0);
147 m_fGaus->SetParameter(2, 10);
148 m_fGaus->SetLineColor(4);
149 m_fGaus->SetNpx(256);
150 m_fGaus->SetNumberFitPoints(256);
154 void DQMHistAnalysisPXDFitsModule::beginRun()
156 B2DEBUG(1,
"DQMHistAnalysisPXDFits: beginRun called.");
159 for (
auto i = 0; i < NUM_MODULES; i++) {
160 m_cSignal[i]->Clear();
161 m_cCommon[i]->Clear();
162 m_cCounts[i]->Clear();
167 void DQMHistAnalysisPXDFitsModule::event()
171 m_hSignalAll->Reset();
172 m_hCommonAll->Reset();
173 m_hCountsAll->Reset();
174 m_hOccupancyAll->Reset();
176 for (
auto i = 0; i < NUM_MODULES; i++) {
177 auto id = m_inx_to_id[i];
178 auto layer = (((
id >> 5) & 0x1) + 1);
179 auto ladder = ((
id >> 1) & 0xF);
180 auto sensor = ((
id & 0x1) + 1);
182 m_hSignal[i]->Reset();
183 m_hCommon[i]->Reset();
184 m_hCounts[i]->Reset();
186 for (
auto j = 0; j < 6; j++) {
187 for (
auto k = 0; k < 4; k++) {
189 string s2 = str(format(
"_%d.%d.%d_%d_%d") % layer % ladder % sensor % j % k);
191 std::string name =
"hrawPxdHitsCharge" + s2;
192 TH1* hh1 = findHist(name);
194 hh1 = findHist(m_histogramDirectoryName, name);
205 m_hSignal[i]->Fill(j, k, hh1->GetMean());
206 m_hSignalAll->Fill(i, hh1->GetMean());
208 B2INFO(
"Histo " << name <<
" not found");
211 name =
"hrawPxdHitsCommonMode" + s2;
212 hh1 = findHist(name);
214 hh1 = findHist(m_histogramDirectoryName, name);
225 m_hCommon[i]->Fill(j, k, hh1->GetMean());
226 m_hCommonAll->Fill(i, hh1->GetMean());
228 B2INFO(
"Histo " << name <<
" not found");
231 name =
"hrawPxdCount" + s2;
232 hh1 = findHist(name);
234 hh1 = findHist(m_histogramDirectoryName, name);
245 m_hCounts[i]->Fill(j, k, hh1->GetMean());
246 m_hCountsAll->Fill(i, hh1->GetMean());
247 m_hOccupancyAll->Fill(i, hh1->GetMean() / (250 * 768 / 24));
249 B2INFO(
"Histo " << name <<
" not found");
255 if (m_hSignal[i]) m_hSignal[i]->Draw(
"colz");
256 m_cSignal[i]->Modified();
257 m_cSignal[i]->Update();
261 if (m_hCommon[i]) m_hCommon[i]->Draw(
"colz");
262 m_cCommon[i]->Modified();
263 m_cCommon[i]->Update();
267 if (m_hCounts[i]) m_hCounts[i]->Draw(
"colz");
268 m_cCounts[i]->Modified();
269 m_cCounts[i]->Update();
275 m_hSignalAll->Scale(1.0 / 24.0);
276 m_hSignalAll->Draw();
278 m_cSignalAll->Modified();
279 m_cSignalAll->Update();
284 m_hCommonAll->Scale(1.0 / 24.0);
285 m_hCommonAll->Draw();
287 m_cCommonAll->Modified();
288 m_cCommonAll->Update();
295 m_hCountsAll->Draw();
297 m_cCountsAll->Modified();
298 m_cCountsAll->Update();
300 if (m_cOccupancyAll) {
301 m_cOccupancyAll->cd();
302 if (m_hOccupancyAll) {
303 m_hOccupancyAll->Scale(1.0 / 24.0);
304 m_hOccupancyAll->Draw();
306 m_cOccupancyAll->Modified();
307 m_cOccupancyAll->Update();
311 void DQMHistAnalysisPXDFitsModule::endRun()
313 B2DEBUG(1,
"DQMHistAnalysisPXDFits : endRun called");
317 void DQMHistAnalysisPXDFitsModule::terminate()
319 B2DEBUG(1,
"DQMHistAnalysisPXDFits: terminate called");