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]{};
227 int err = 0, err2 = 0;
228 for (
int i = 0;
i < digi.
size();
i++) {
234 err |= (capid != capid1) | er << 1 | (!dv) << 2;
235 err2 += (capid != capid1) | er | (!dv);
244 LogPrint(
"CastorDigiMonitor") <<
"event/idigi=" <<
ievt_ <<
"/" <<
i <<
" cap=cap1_dv_er_err: " << capid <<
"=" 245 << capid1 <<
" " << dv <<
" " << er <<
" " <<
err;
265 float em = Ecell[0][
sec] + Ecell[1][
sec];
267 for (
int mod = 2;
mod < EtowerLastModule;
mod++)
273 const float repChanBAD = 0.9;
274 const float repChanWarning = 0.95;
275 if (
ievt_ % 100 != 0)
278 float ModuleSum[14], SectorSum[16];
279 for (
int m = 0;
m < 14;
m++)
281 for (
int s = 0;
s < 16;
s++)
285 for (
int ts = 0; ts <= 1; ts++) {
293 for (
int ts = 1; ts <=
TS_MAX; ts++) {
299 double Qrms =
QrmsTS[ind - 1][ts - 1] /
ievt_ - Qmean * Qmean;
302 ModuleSum[
mod] += sum;
303 SectorSum[
sec] += sum;
304 float isum =
float(
int(sum * 10. + 0.5)) / 10.;
323 float ChanStatus = 0.;
329 for (
int ts = 0; ts <
TS_MAX - 1; ts++) {
337 for (
int ts = 0; ts <
TS_MAX; ts++)
342 r = 1. - (sum - am) / (
TS_MAX - 2) / am * 2.;
348 float statusTS = 1.0;
350 statusTS = repChanWarning;
352 statusTS = repChanBAD;
353 float gChanStatus = statusTS;
355 gChanStatus = repChanBAD;
357 if (gChanStatus > repChanBAD)
366 LogPrint(
"CastorDigiMonitor") <<
"DigiMonitor::endRun: trigger max index = " << TrigIndexMax
367 <<
" TriggerIndexies(N):" << endl;
376 bool event_triggered =
false;
378 for (
int iTrig = 0; iTrig < nTriggers; ++iTrig) {
381 if (TrigIndexMax <
index)
382 TrigIndexMax =
index;
384 LogPrint(
"CastorDigi") <<
"trigger[" << iTrig <<
"] name:" <<
trigName.triggerName(iTrig)
385 <<
" index= " <<
index << endl;
387 for (
int n = 0;
n <
int(HltPaths_.size());
n++) {
388 if (
trigName.triggerName(iTrig).find(HltPaths_[
n]) != std::string::npos)
389 event_triggered =
true;
402 LogPrint(
"CastorDigiMonitor") <<
" CastorChQuality in CondDB=" << dbChQuality.
isValid() << endl;
410 N_GoodChannels = 224 -
channels.size();
412 LogPrint(
"CastorDigiMonitor") <<
"CastorDigiMonitor::getDBData: QualityRcdSize=" <<
channels.size();
413 for (std::vector<DetId>::iterator ch =
channels.begin(); ch !=
channels.end(); ch++) {
420 if (
mod > 0 && mod < 16 && sec > 0 &&
sec < 16)
423 LogPrint(
"CastorDigiMonitor") << chInd <<
" module=" <<
mod <<
" sec=" <<
sec <<
" rawId=" <<
rawId 424 <<
" value=" <<
value << endl;
MonitorElement * h2towEMvsHAD
MonitorElement * h2TSratio
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
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())
virtual TProfile * getTProfile() const
const Item * getValues(DetId fId, bool throwOnFail=true) const
MonitorElement * h2qualityMap
const HcalQIESample & sample(int i) const
access a sample
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * hTSratio
virtual void setOption(const char *option)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, const edm::EventSetup &)
constexpr bool dv() const
is the Data Valid bit set?
std::vector< T >::const_iterator const_iterator
MonitorElement * hpTrigRes
std::vector< DetId > getAllChannels() 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
int size() const
total number of samples in the digi
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
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())
int module() const
get the module (1-2 for EM, 1-12 for HAD)
MonitorElement * h2QmeanMap
edm::ESGetToken< CastorChannelQuality, CastorChannelQualityRcd > castorChannelQualityToken_
int sector() const
get the sector (1-16)
Log< level::Warning, true > LogPrint
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
void fillTrigRes(edm::Event const &event, const edm::TriggerResults &TrigResults, double Etot)
std::string subsystemname_
MonitorElement * h2QrmsTSvsCh
const HcalCastorDetId & id() const
static const float LedMonAdc2fc[128]
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
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 &&)
MonitorElement * hdigisize
constexpr int capid() const
get the Capacitor id
constexpr bool er() const
is the error bit set?
constexpr int adc() const
get the ADC sample
virtual TProfile2D * getTProfile2D() const
MonitorElement * h2repsum
void getDbData(const edm::EventSetup &)
MonitorElement * hQIErms[10]
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
T mod(const T &a, const T &b)
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