28 vector<std::string> HltPaths_;
29 int StatusBadChannel = 1;
31 int N_GoodChannels = 224;
32 int EtowerLastModule = 5;
37 : castorChannelQualityToken_{
39 fVerbosity = ps.getUntrackedParameter<
int>(
"debug", 0);
40 subsystemname_ = ps.getUntrackedParameter<
std::string>(
"subSystemFolder",
"Castor");
41 EtowerLastModule = ps.getUntrackedParameter<
int>(
"towerLastModule", 6);
42 RatioThresh1 = ps.getUntrackedParameter<
double>(
"ratioThreshold", 0.9);
43 Qrms_DEAD = ps.getUntrackedParameter<
double>(
"QrmsDead", 0.01);
44 HltPaths_ = ps.getParameter<vector<string>>(
"HltPaths");
46 Qrms_DEAD = Qrms_DEAD * Qrms_DEAD;
47 TS_MAX = ps.getUntrackedParameter<
double>(
"qieTSmax", 6);
50 LogPrint(
"CastorDigi") <<
"enum CastorChannelStatus::StatusBit::BAD=" << StatusBadChannel
51 <<
"EtowerLastModule = " << EtowerLastModule << endl;
62 LogPrint(
"CastorMonitorModule") <<
"Digi bookHist(start)";
67 sprintf(sTileIndex,
"Cell(=moduleZ*16+sector#phi)");
73 "average E(digi) in BX",
"Castor average E (digi);Event.BX;fC", 3601, -0.5, 3600.5, 0., 1.e10,
"");
76 string trname = HltPaths_[0];
78 "Castor average E (digi) trigger:'" + trname +
"';Event.BX;fC",
88 "E(digi)vsTriggerIndex",
"Castor average E(digi) by triggerIndex;triggerIndex;fC", 512, 0., 512, 0., 1.e10,
"");
94 h2digierr = ibooker.
bookProfile2D(
s2,
s2, 14, 0., 14., 16, 0., 16., 100, 0, 1.e10,
"");
101 sprintf(
s,
"CASTORreportSummaryMap");
102 h2repsum = ibooker.
bookProfile2D(
s,
s, 14, 0., 14., 16, 0., 16., 100, 0, 1.e10,
"");
109 sprintf(
s,
"CASTOR BadChannelsMap");
115 sprintf(
s,
"CASTOR TSmax Significance Map");
121 sprintf(
s,
"CASTOR TSmax Significance All chan");
124 sprintf(
s,
"DigiSize");
126 sprintf(
s,
"ModuleZ(fC)_allTS");
130 sprintf(
s,
"Sector #phi(fC)_allTS");
135 st =
"Castor cells avr digi(fC) per event Map TS vs Channel";
137 ibooker.
bookProfile2D(st, st +
";" +
string(sTileIndex) +
";TS", 224, 0., 224., 10, 0., 10., 0., 1.e10,
"");
140 st =
"Castor cells avr digiRMS(fC) per event Map TS vs Channel";
141 h2QrmsTSvsCh = ibooker.
book2D(st, st +
";" +
string(sTileIndex) +
";TS", 224, 0., 224., 10, 0., 10.);
144 sprintf(
s,
"CASTOR data quality");
152 sprintf(
s,
"QmeanfC_map(allTS)");
158 const int NEtow = 20;
159 float EhadTow[NEtow + 1];
160 float EMTow[NEtow + 1];
161 float ETower[NEtow + 2];
162 double E0tow = 500. / 1024.;
169 double lnBtow =
log(1.8);
170 for (
int j = 1;
j < NEtow;
j++)
171 EMTow[
j + 1] = E0tow *
exp(
j * lnBtow);
172 for (
int j = 1;
j < NEtow;
j++)
173 EhadTow[
j + 1] = E0tow *
exp(
j * lnBtow);
174 for (
int j = 1;
j <= NEtow;
j++)
175 ETower[
j + 1] = E0tow *
exp(
j * lnBtow);
177 sprintf(
s,
"CASTOR_Tower_EMvsEhad(fC)");
183 sprintf(
s,
"CASTOR_TowerTotalEnergy(fC)");
187 for (
int ts = 0; ts <= 1; ts++) {
188 sprintf(
s,
"QIErms_TS=%d", ts);
193 for (
int ind = 0; ind < 224; ind++)
194 for (
int ts = 0; ts < 10; ts++)
205 LogPrint(
"CastorDigiMonitor") <<
"processEvent(begin)";
216 float Ecell[14][16]{};
221 int sector = digi.
id().
sector() - 1;
228 int err = 0, err2 = 0;
229 for (
int i = 0;
i < digi.
size();
i++) {
235 err |= (capid != capid1) | er << 1 | (!dv) << 2;
236 err2 += (capid != capid1) | er | (!dv);
246 LogPrint(
"CastorDigiMonitor") <<
"event/idigi=" <<
ievt_ <<
"/" <<
i <<
" cap=cap1_dv_er_err: " << capid <<
"="
247 << capid1 <<
" " << dv <<
" " << er <<
" " <<
err;
267 float em = Ecell[0][
sec] + Ecell[1][
sec];
269 for (
int mod = 2;
mod < EtowerLastModule;
mod++)
275 const float repChanBAD = 0.9;
276 const float repChanWarning = 0.95;
277 if (
ievt_ % 100 != 0)
280 float ModuleSum[14], SectorSum[16];
281 for (
int m = 0;
m < 14;
m++)
283 for (
int s = 0;
s < 16;
s++)
287 for (
int ts = 0; ts <= 1; ts++) {
295 for (
int ts = 1; ts <=
TS_MAX; ts++) {
301 double Qrms =
QrmsTS[ind - 1][ts - 1] /
ievt_ - Qmean * Qmean;
304 ModuleSum[
mod] += sum;
305 SectorSum[
sec] += sum;
306 float isum =
float(
int(sum * 10. + 0.5)) / 10.;
325 float ChanStatus = 0.;
331 for (
int ts = 0; ts <
TS_MAX - 1; ts++) {
339 for (
int ts = 0; ts <
TS_MAX; ts++)
344 r = 1. - (sum - am) / (
TS_MAX - 2) / am * 2.;
350 float statusTS = 1.0;
352 statusTS = repChanWarning;
354 statusTS = repChanBAD;
355 float gChanStatus = statusTS;
357 gChanStatus = repChanBAD;
359 if (gChanStatus > repChanBAD)
368 LogPrint(
"CastorDigiMonitor") <<
"DigiMonitor::endRun: trigger max index = " << TrigIndexMax
369 <<
" TriggerIndexies(N):" << endl;
378 bool event_triggered =
false;
380 for (
int iTrig = 0; iTrig < nTriggers; ++iTrig) {
383 if (TrigIndexMax <
index)
384 TrigIndexMax =
index;
386 LogPrint(
"CastorDigi") <<
"trigger[" << iTrig <<
"] name:" <<
trigName.triggerName(iTrig)
387 <<
" index= " <<
index << endl;
389 for (
int n = 0;
n <
int(HltPaths_.size());
n++) {
390 if (
trigName.triggerName(iTrig).find(HltPaths_[
n]) != std::string::npos)
391 event_triggered =
true;
404 LogPrint(
"CastorDigiMonitor") <<
" CastorChQuality in CondDB=" << dbChQuality.
isValid() << endl;
412 N_GoodChannels = 224 -
channels.size();
414 LogPrint(
"CastorDigiMonitor") <<
"CastorDigiMonitor::getDBData: QualityRcdSize=" <<
channels.size();
415 for (std::vector<DetId>::iterator ch =
channels.begin(); ch !=
channels.end(); ch++) {
422 if (
mod > 0 && mod < 16 && sec > 0 &&
sec < 16)
425 LogPrint(
"CastorDigiMonitor") << chInd <<
" module=" <<
mod <<
" sec=" <<
sec <<
" rawId=" << rawId
426 <<
" value=" <<
value << endl;
432 int ind = sector +
module * 16;