17 #include "TPaveStats.h"
32 EcalTPGLinearizationConstPlot()
37 bool fill(
const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs)
override {
38 TH2F** barrel_m =
new TH2F*[
kGains];
39 TH2F** endc_p_m =
new TH2F*[
kGains];
40 TH2F** endc_m_m =
new TH2F*[
kGains];
41 TH2F** barrel_r =
new TH2F*[
kGains];
42 TH2F** endc_p_r =
new TH2F*[
kGains];
43 TH2F** endc_m_r =
new TH2F*[
kGains];
107 auto iov = iovs.front();
109 unsigned int run = std::get<0>(iov);
112 int thesign =
sign == 1 ? 1 : -1;
120 float val = (*payload)[
id.rawId()].mult_x12;
126 val = (*payload)[
id.rawId()].shift_x12;
132 val = (*payload)[
id.rawId()].mult_x6;
138 val = (*payload)[
id.rawId()].shift_x6;
144 val = (*payload)[
id.rawId()].mult_x1;
150 val = (*payload)[
id.rawId()].shift_x1;
159 for (
int ix = 0; ix <
IX_MAX; ix++) {
160 for (
int iy = 0; iy <
IY_MAX; iy++) {
164 float val = (*payload)[
id.rawId()].mult_x12;
166 endc_p_m[0]->Fill(ix + 1, iy + 1,
val);
168 endc_m_m[0]->Fill(ix + 1, iy + 1,
val);
173 val = (*payload)[
id.rawId()].shift_x12;
175 endc_p_r[0]->Fill(ix + 1, iy + 1,
val);
177 endc_m_r[0]->Fill(ix + 1, iy + 1,
val);
182 val = (*payload)[
id.rawId()].mult_x6;
184 endc_p_m[1]->Fill(ix + 1, iy + 1,
val);
186 endc_m_m[1]->Fill(ix + 1, iy + 1,
val);
191 val = (*payload)[
id.rawId()].shift_x6;
193 endc_p_r[1]->Fill(ix + 1, iy + 1,
val);
195 endc_m_r[1]->Fill(ix + 1, iy + 1,
val);
200 val = (*payload)[
id.rawId()].mult_x1;
202 endc_p_m[2]->Fill(ix + 1, iy + 1,
val);
204 endc_m_m[2]->Fill(ix + 1, iy + 1,
val);
209 val = (*payload)[
id.rawId()].shift_x1;
211 endc_p_r[2]->Fill(ix + 1, iy + 1,
val);
213 endc_m_r[2]->Fill(ix + 1, iy + 1,
val);
228 gStyle->SetPalette(1);
229 gStyle->SetOptStat(0);
230 TCanvas
canvas(
"CC map",
"CC map", 1200, 1800);
234 t1.SetTextSize(0.05);
235 t1.DrawLatex(0.5, 0.96, Form(
"Ecal Gain TPGLinearizationConst, IOV %i",
run));
237 float xmi[3] = {0.0, 0.22, 0.78};
238 float xma[3] = {0.22, 0.78, 1.00};
239 TPad*** pad =
new TPad**[6];
240 for (
int gId = 0; gId < 6; gId++) {
241 pad[gId] =
new TPad*[3];
243 float yma = 0.94 - (0.16 * gId);
244 float ymi = yma - 0.14;
245 pad[gId][
obj] =
new TPad(Form(
"p_%i_%i",
obj, gId), Form(
"p_%i_%i",
obj, gId), xmi[
obj], ymi, xma[
obj], yma);
246 pad[gId][
obj]->Draw();
250 for (
int gId = 0; gId <
kGains; gId++) {
252 DrawEE(endc_m_m[gId], mEEmin[gId], mEEmax[gId]);
253 pad[gId + 3][0]->cd();
254 DrawEE(endc_m_r[gId], rEEmin[gId], rEEmax[gId]);
256 DrawEB(barrel_m[gId], mEBmin[gId], mEBmax[gId]);
257 pad[gId + 3][1]->cd();
258 DrawEB(barrel_r[gId], rEBmin[gId], rEBmax[gId]);
260 DrawEE(endc_p_m[gId], mEEmin[gId], mEEmax[gId]);
261 pad[gId + 3][2]->cd();
262 DrawEE(endc_p_r[gId], rEEmin[gId], rEEmax[gId]);
266 canvas.SaveAs(ImageName.c_str());
276 EcalTPGLinearizationConstDiff()
281 bool fill(
const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs)
override {
282 TH2F** barrel_m =
new TH2F*[
kGains];
283 TH2F** endc_p_m =
new TH2F*[
kGains];
284 TH2F** endc_m_m =
new TH2F*[
kGains];
285 TH2F** barrel_r =
new TH2F*[
kGains];
286 TH2F** endc_p_r =
new TH2F*[
kGains];
287 TH2F** endc_m_r =
new TH2F*[
kGains];
350 unsigned int run[2], irun = 0;
352 for (
auto const& iov : iovs) {
354 run[irun] = std::get<0>(iov);
357 int thesign =
sign == 1 ? 1 : -1;
362 int hashindex =
id.hashedIndex();
366 float val = (*payload)[
id.rawId()].mult_x12;
368 mEB[0][hashindex] =
val;
370 float diff =
val - mEB[0][hashindex];
372 if (
diff < mEBmin[0])
374 if (
diff > mEBmax[0])
377 val = (*payload)[
id.rawId()].shift_x12;
379 rEB[0][hashindex] =
val;
381 float diff =
val - rEB[0][hashindex];
383 if (
diff < rEBmin[0])
385 if (
diff > rEBmax[0])
388 val = (*payload)[
id.rawId()].mult_x6;
390 mEB[1][hashindex] =
val;
392 float diff =
val - mEB[1][hashindex];
394 if (
diff < mEBmin[1])
396 if (
diff > mEBmax[1])
399 val = (*payload)[
id.rawId()].shift_x6;
401 rEB[1][hashindex] =
val;
403 float diff =
val - rEB[1][hashindex];
405 if (
diff < rEBmin[1])
407 if (
diff > rEBmax[1])
410 val = (*payload)[
id.rawId()].mult_x1;
412 mEB[2][hashindex] =
val;
414 float diff =
val - mEB[2][hashindex];
416 if (
diff < mEBmin[2])
418 if (
diff > mEBmax[2])
421 val = (*payload)[
id.rawId()].shift_x1;
423 rEB[2][hashindex] =
val;
425 float diff =
val - rEB[2][hashindex];
427 if (
diff < rEBmin[2])
429 if (
diff > rEBmax[2])
435 for (
int ix = 0; ix <
IX_MAX; ix++) {
436 for (
int iy = 0; iy <
IY_MAX; iy++) {
440 int hashindex =
id.hashedIndex();
441 float val = (*payload)[
id.rawId()].mult_x12;
443 mEE[0][hashindex] =
val;
445 float diff =
val - mEE[0][hashindex];
447 endc_p_m[0]->Fill(ix + 1, iy + 1,
diff);
449 endc_m_m[0]->Fill(ix + 1, iy + 1,
diff);
450 if (
diff < mEEmin[0])
452 if (
diff > mEEmax[0])
455 val = (*payload)[
id.rawId()].shift_x12;
457 rEE[0][hashindex] =
val;
459 float diff =
val - rEE[0][hashindex];
461 endc_p_r[0]->Fill(ix + 1, iy + 1,
diff);
463 endc_m_r[0]->Fill(ix + 1, iy + 1,
diff);
464 if (
diff < rEEmin[0])
466 if (
diff > rEEmax[0])
469 val = (*payload)[
id.rawId()].mult_x6;
471 mEE[1][hashindex] =
val;
473 float diff =
val - mEE[1][hashindex];
475 endc_p_m[1]->Fill(ix + 1, iy + 1,
diff);
477 endc_m_m[1]->Fill(ix + 1, iy + 1,
diff);
478 if (
diff < mEEmin[1])
480 if (
diff > mEEmax[1])
483 val = (*payload)[
id.rawId()].shift_x6;
485 rEE[1][hashindex] =
val;
487 float diff =
val - rEE[1][hashindex];
489 endc_p_r[1]->Fill(ix + 1, iy + 1,
diff);
491 endc_m_r[1]->Fill(ix + 1, iy + 1,
diff);
492 if (
diff < rEEmin[1])
494 if (
diff > rEEmax[1])
497 val = (*payload)[
id.rawId()].mult_x1;
499 mEE[2][hashindex] =
val;
501 float diff =
val - mEE[2][hashindex];
503 endc_p_m[2]->Fill(ix + 1, iy + 1,
diff);
505 endc_m_m[2]->Fill(ix + 1, iy + 1,
diff);
506 if (
diff < mEEmin[2])
508 if (
diff > mEEmax[2])
511 val = (*payload)[
id.rawId()].shift_x1;
513 rEE[2][hashindex] =
val;
515 float diff =
val - rEE[2][hashindex];
517 endc_p_r[2]->Fill(ix + 1, iy + 1,
diff);
519 endc_m_r[2]->Fill(ix + 1, iy + 1,
diff);
520 if (
diff < rEEmin[2])
522 if (
diff > rEEmax[2])
535 gStyle->SetPalette(1);
536 gStyle->SetOptStat(0);
537 TCanvas
canvas(
"CC map",
"CC map", 1200, 1800);
541 t1.SetTextSize(0.05);
542 t1.DrawLatex(0.5, 0.96, Form(
"Ecal TPGLinearizationConst, IOV %i - %i",
run[1],
run[0]));
544 float xmi[3] = {0.0, 0.22, 0.78};
545 float xma[3] = {0.22, 0.78, 1.00};
546 TPad*** pad =
new TPad**[6];
547 for (
int gId = 0; gId < 6; gId++) {
548 pad[gId] =
new TPad*[3];
550 float yma = 0.94 - (0.16 * gId);
551 float ymi = yma - 0.14;
552 pad[gId][
obj] =
new TPad(Form(
"p_%i_%i",
obj, gId), Form(
"p_%i_%i",
obj, gId), xmi[
obj], ymi, xma[
obj], yma);
553 pad[gId][
obj]->Draw();
557 for (
int gId = 0; gId <
kGains; gId++) {
559 DrawEE(endc_m_m[gId], mEEmin[gId], mEEmax[gId]);
560 pad[gId + 3][0]->cd();
561 DrawEE(endc_m_r[gId], rEEmin[gId], rEEmax[gId]);
563 DrawEB(barrel_m[gId], mEBmin[gId], mEBmax[gId]);
564 pad[gId + 3][1]->cd();
565 DrawEB(barrel_r[gId], rEBmin[gId], rEBmax[gId]);
567 DrawEE(endc_p_m[gId], mEEmin[gId], mEEmax[gId]);
568 pad[gId + 3][2]->cd();
569 DrawEE(endc_p_r[gId], rEEmin[gId], rEEmax[gId]);
573 canvas.SaveAs(ImageName.c_str());