28 vector<std::string> HltPaths_;
29 int StatusBadChannel = 1;
30 int ChannelStatus[14][16]{};
31 int N_GoodChannels = 224;
32 int EtowerLastModule = 5;
37 : castorChannelQualityToken_{
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)";
207 if (castorDigis.
empty()) {
209 for (
int sec = 0; sec < 16; sec++)
216 float Ecell[14][16]{};
221 int sector = digi.
id().
sector() - 1;
222 if (ChannelStatus[module][sector] == StatusBadChannel)
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;
260 for (
int sec = 0; sec < 16; sec++)
262 Etotal = Ecell[
mod][sec];
266 for (
int sec = 0; sec < 16; sec++) {
267 float em = Ecell[0][sec] + Ecell[1][sec];
269 for (
int mod = 2;
mod < EtowerLastModule;
mod++)
270 ehad += Ecell[
mod][sec];
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++)
286 for (
int sec = 0; sec < 16; sec++) {
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.;
307 if (ChannelStatus[
mod][sec] != StatusBadChannel)
313 for (
int sec = 0; sec < 16; sec++)
318 for (
int mod = 0; mod < 14; mod++)
319 for (
int sec = 0; sec < 16; sec++) {
320 if (ChannelStatus[mod][sec] == StatusBadChannel)
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;
376 int nTriggers = TrigResults.
size();
378 bool event_triggered =
false;
380 for (
int iTrig = 0; iTrig < nTriggers; ++iTrig) {
381 if (TrigResults.
accept(iTrig)) {
383 if (TrigIndexMax < index)
384 TrigIndexMax =
index;
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;
409 for (
int sec = 0; sec < 16; sec++)
410 ChannelStatus[
mod][sec] = 0;
411 std::vector<DetId> channels = dbChQuality->getAllChannels();
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++) {
418 int rawId = quality->
rawId();
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;
MonitorElement * h2towEMvsHAD
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * h2TSratio
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
static std::vector< std::string > checklist log
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
MonitorElement * h2qualityMap
int sector() const
get the sector (1-16)
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * hTSratio
constexpr bool er() const
is the error bit set?
virtual void setOption(const char *option)
uint32_t const *__restrict__ Quality * quality
const HcalQIESample & sample(int i) const
access a sample
bool accept() const
Has at least one path accepted the event?
void bookHistograms(DQMStore::IBooker &, edm::Run const &, const edm::EventSetup &)
std::vector< T >::const_iterator const_iterator
MonitorElement * hpTrigRes
int bunchCrossing() const
unsigned int triggerIndex(std::string_view name) const
int module() const
get the module (1-2 for EM, 1-12 for HAD)
Exp< T >::type exp(const T &t)
Strings const & triggerNames() const
void processEvent(edm::Event const &event, const CastorDigiCollection &cast, const edm::TriggerResults &trig, const CastorDbService &cond)
MonitorElement * h2status
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
MonitorElement * h2digierr
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
uint32_t getValue() const
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
unsigned int size() const
Get number of paths stored.
MonitorElement * h2QmeanMap
edm::ESGetToken< CastorChannelQuality, CastorChannelQualityRcd > castorChannelQualityToken_
virtual TProfile2D * getTProfile2D() const
Log< level::Warning, true > LogPrint
void fillTrigRes(edm::Event const &event, const edm::TriggerResults &TrigResults, double Etot)
constexpr int adc() const
get the ADC sample
std::string subsystemname_
const_iterator end() const
MonitorElement * h2QrmsTSvsCh
static const float LedMonAdc2fc[128]
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
std::string const & triggerName(unsigned int index) const
virtual TProfile * getTProfile() const
int ModSecToIndex(int module, int sector)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
CastorDigiMonitor(const edm::ParameterSet &ps, edm::ConsumesCollector &&)
T getParameter(std::string const &) const
constexpr bool dv() const
is the Data Valid bit set?
MonitorElement * hdigisize
constexpr int capid() const
get the Capacitor id
MonitorElement * h2repsum
void getDbData(const edm::EventSetup &)
MonitorElement * hQIErms[10]
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
const HcalCastorDetId & id() const
T mod(const T &a, const T &b)
int size() const
total number of samples in the digi
const_iterator begin() const
MonitorElement * h2QmeantsvsCh
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * hpBXtrig