5 #include "EemcTwMask.h"
8 EemcTwMask::EemcTwMask()
15 EemcTwMask::~EemcTwMask() {
16 if (txtH)
delete txtH; txtH = 0;
20 void EemcTwMask::clear() {
21 for (
int i = 0;i < nCr;i++) {
26 if (txtH) txtH->Clear();
28 memset(crCh, 0,
sizeof(crCh));
32 bool useTwMask(
const Char_t *fname,
EemcTwMask *m) {
33 if (!(fname && fname[0] && m))
return false;
37 LOG_INFO <<
"EEqaPresenter::useTwMask(\"" << fname <<
"\") ..." << endm;
40 FILE *fd = fopen(fname,
"r");
43 m->txtH =
new TPaveText(0, 0., 1, 1);
44 TString myTxt =
"ETOW masked (cr-ch-name): ";
45 if (!fd)
goto abandon;
47 Char_t *ret = fgets(buf, mx, fd);
49 if (buf[0] ==
'#')
continue;
50 if (buf[0] ==
'\n')
continue;
53 int sec, isub, jeta, jphi;
54 int n = sscanf(buf,
"%d %d %s", &cr, &ch, name);
55 if (n != 3)
goto abandon;
56 if ((cr < 1) || (cr > m->nCr) || (ch < 0) || (ch >= m->nCh))
goto abandon;
57 if (name[2] !=
'T')
goto abandon;
60 jeta = atoi(name + 4);
61 jphi = (sec - 1) * 5 + isub;
64 m->crCh[cr-1][ch] = 1;
65 int jj = m->crG[cr - 1].GetN();
66 m->crG[cr - 1].SetPoint(jj, ch, 10);
67 m->crG2[cr - 1].SetPoint(jj, 250, ch);
68 m->crG2[cr - 1].SetPointError(jj, 250, 0.);
71 m->phiG.SetPoint(jj, jphi, jeta);
72 TString tt = Form(
"%d-%d-%s, ", cr, ch, name);
76 LOG_DEBUG << Form(
"mask ETOW cr=%d ch=%d =%s=",cr,ch,name) << endm;
78 m->txtH->AddText(myTxt);
83 m->txtH->AddText(myTxt);
84 m->txtH->AddText(
"--");
85 LOG_INFO <<
" got " << nok <<
" masked towers" << endm;
87 for (
int i = 0;i < 6;i++){
88 m->crG[i].SetMarkerStyle(23);
89 m->crG[i].SetMarkerColor(kRed);
90 m->crG2[i].SetMarkerStyle(1);
91 m->crG2[i].SetLineColor(kRed);
94 m->phiG.SetMarkerStyle(24);
99 m->txtH->AddText(
"List of ETOW hot towers not found");
100 m->txtH->AddText(
"--");
101 LOG_ERROR <<
" EEqaPresenter::useTwMask() FAILED" << endm;