27 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest") <<
"[DTOccupancyTest]: Constructor";
35 rootFile =
new TFile(
"DTOccupancyTest.root",
"RECREATE");
36 ntuple =
new TNtuple(
"OccupancyNtuple",
38 "ls:wh:st:se:lay1MeanCell:lay1RMS:lay2MeanCell:lay2RMS:lay3MeanCell:lay3RMS:lay4MeanCell:" 39 "lay4RMS:lay5MeanCell:lay5RMS:lay6MeanCell:lay6RMS:lay7MeanCell:lay7RMS:lay8MeanCell:lay8RMS:" 40 "lay9MeanCell:lay9RMS:lay10MeanCell:lay10RMS:lay11MeanCell:lay11RMS:lay12MeanCell:lay12RMS");
60 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest") <<
" destructor called" << endl;
64 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest") <<
"[DTOccupancyTest]: BeginRun";
77 for (
int wh = -2; wh <= 2; ++wh) {
78 bookHistos(ibooker, wh,
string(
"Occupancies"),
"OccupancySummary");
82 string title =
"Occupancy Summary";
84 title =
"Test Pulse Occupancy Summary";
87 summaryHisto = ibooker.
book2D(
"OccupancySummary", title.c_str(), 12, 1, 13, 5, -2, 3);
89 summaryHisto->setAxisTitle(
"wheel", 2);
92 glbSummaryHisto = ibooker.
book2D(
"OccupancyGlbSummary", title.c_str(), 12, 1, 13, 5, -2, 3);
94 glbSummaryHisto->setAxisTitle(
"wheel", 2);
98 nameMonitoredHisto =
"OccupancyAllHits_perCh";
100 nameMonitoredHisto =
"OccupancyNoise_perCh";
102 nameMonitoredHisto =
"OccupancyInTimeHits_perCh";
104 nameMonitoredHisto =
"OccupancyAllHits_perCh";
109 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest")
110 <<
"[DTOccupancyTest]: End of LS transition, performing the DQM client operation";
114 summaryHisto->Reset();
115 glbSummaryHisto->Reset();
121 vector<const DTChamber*>
chambers = muonGeom->chambers();
123 for (vector<const DTChamber*>::const_iterator
chamber = chambers.begin();
chamber != chambers.end();
127 MonitorElement* chamberOccupancyHisto = igetter.
get(getMEName(nameMonitoredHisto, chId));
130 if (chamberOccupancyHisto !=
nullptr) {
133 float chamberPercentage = 1.;
134 int result = runOccupancyTest(histo, chId, chamberPercentage);
135 int sector = chId.
sector();
139 float resultSect4 = wheelHistos[chId.
wheel()]->getBinContent(sector, chId.
station());
140 if (resultSect4 > result) {
141 result = (
int)resultSect4;
143 }
else if (sector == 14) {
145 float resultSect10 = wheelHistos[chId.
wheel()]->getBinContent(sector, chId.
station());
146 if (resultSect10 > result) {
147 result = (
int)resultSect10;
152 if ((sector == 4 || sector == 10) && chId.
station() == 4)
153 chamberPercentage = chamberPercentage / 2.;
156 if (result > summaryHisto->getBinContent(sector, chId.
wheel() + 3)) {
157 summaryHisto->setBinContent(sector, chId.
wheel() + 3,
result);
159 glbSummaryHisto->Fill(sector, chId.
wheel(), chamberPercentage * 1. / 4.);
161 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest")
162 <<
"[DTOccupancyTest] ME: " << getMEName(nameMonitoredHisto, chId) <<
" not found!" << endl;
166 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsDigi";
172 glbSummaryHisto->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
173 summaryHisto->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
175 glbSummaryHisto->setEntries(nMinEvts + 1);
176 summaryHisto->setEntries(nMinEvts + 1);
177 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest")
178 <<
"[DTOccupancyTest] ME: " << nEvtsName <<
" not found!" << endl;
186 ntuple->AutoSave(
"SaveSelf");
190 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest") <<
"[DTOccupancyTest] endjob called!";
208 string histoName = histoTag +
"_W" + wheel.str();
210 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest")
211 <<
"[DTOccupancyTest]: booking wheel histo:" << histoName <<
" (tag " << histoTag
212 <<
") in: " << topFolder() +
"Wheel" + wheel.str() +
"/" + folder << endl;
214 string histoTitle =
"Occupancy summary WHEEL: " + wheel.str();
216 histoTitle =
"TP Occupancy summary WHEEL: " + wheel.str();
219 wheelHistos[wheelId] = ibooker.
book2D(histoName, histoTitle, 12, 1, 13, 4, 1, 5);
221 wheelHistos[wheelId]->setBinLabel(2,
"MB2", 2);
222 wheelHistos[wheelId]->setBinLabel(3,
"MB3", 2);
223 wheelHistos[wheelId]->setBinLabel(4,
"MB4", 2);
224 wheelHistos[wheelId]->setAxisTitle(
"sector", 1);
229 wheel << chId.
wheel();
235 string folderRoot = topFolder() +
"Wheel" + wheel.str() +
"/Sector" + sector.str() +
"/Station" + station.str() +
"/";
237 string folder =
"Occupancies/";
240 string histoName = histoTag +
"_W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str();
242 string histoname = folderRoot +
histoName;
249 for (Int_t
i = firstBinX;
i < lastBinX + 1;
i++) {
250 for (Int_t
j = firstBinY;
j < lastBinY + 1;
j++) {
251 if (histo->GetBinContent(
i,
j) > 0) {
254 sum += histo->GetBinContent(
i,
j);
271 int nBinsX = histo->GetNbinsX();
273 LogTrace(
"DTDQM|DTMonitorClient|DTOccupancyTest") <<
"--- Occupancy test for chamber: " << chId << endl;
275 int compDeadCell = 0;
279 for (
int slay = 1; slay <= 3; ++slay) {
280 int binYlow = ((slay - 1) * 4) + 1;
282 if (chId.
station() == 4 && slay == 2)
284 for (
int lay = 1; lay <= 4; ++lay) {
286 int firstWire = muonGeom->layer(layID)->specificTopology().firstChannel();
287 int nWires = muonGeom->layer(layID)->specificTopology().channels();
288 int binY = binYlow + (lay - 1);
289 int totalDeadCells = 0;
290 int nDeadCellsInARow = 1;
291 int nDeadCellsInARowMax = 0;
292 int nCellsZeroCount = 0;
293 bool previousIsDead =
false;
295 int interDeadCells = 0;
299 for (
int cell = firstWire; cell != (nWires + firstWire); ++cell) {
300 double cellOccup = histo->GetBinContent(cell, binY);
301 LogTrace(
"DTDQM|DTMonitorClient|DTOccupancyTest") <<
" cell occup: " << cellOccup;
302 totOccup += cellOccup;
304 if (cellOccup == 0) {
307 if (previousIsDead) {
311 if (nDeadCellsInARow > nDeadCellsInARowMax)
312 nDeadCellsInARowMax = nDeadCellsInARow;
313 nDeadCellsInARow = 1;
316 previousIsDead =
true;
318 LogTrace(
"DTDQM|DTMonitorClient|DTOccupancyTest") <<
" below reference" << endl;
320 previousIsDead =
false;
324 if (nDeadCellsInARow > nDeadCellsInARowMax)
325 nDeadCellsInARowMax = nDeadCellsInARow;
327 compDeadCell += totalDeadCells;
328 if (nDeadCellsInARowMax >= 7.) {
329 histo->SetBinContent(nBinsX + 1, binY, -1.);
334 nChannelTotal += totCell;
335 nChannelDead += compDeadCell;
336 chamberPercentage = 1. - (
float(compDeadCell) / totCell);
338 int min_occup = nZeroEvtsPC * 20;
340 min_occup = nZeroEvtsPC * 3;
342 min_occup = nZeroEvtsPC * 8;
344 min_occup = nZeroEvtsPC * 3;
346 min_occup = nZeroEvtsPC * 3;
348 min_occup = nZeroEvtsPC * 3;
350 min_occup = nZeroEvtsPC * 3;
352 if (totOccup < min_occup)
354 if (totOccup < nMinEvtsPC)
355 chamberPercentage = 1.;
357 if (chamberPercentage < 0.2)
359 if (chamberPercentage < 0.5)
361 if (chamberPercentage < 0.75)
363 if (chamberPercentage < 0.9)
371 return string(
"DT/10-TestPulses/");
372 return string(
"DT/01-Digi/");
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Endjob.
T getUntrackedParameter(std::string const &, T const &) const
virtual TH2F * getTH2F() const
int runOccupancyTest(TH2F *histo, const DTChamberId &chId, float &chamberPercentage)
void setCurrentFolder(std::string const &fullpath)
int getIntegral(TH2F *histo, int, int, int, int, bool)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
DQM Client Diagnostic.
DTOccupancyTest(const edm::ParameterSet &ps)
Constructor.
void bookHistos(DQMStore::IBooker &, const int wheelId, std::string folder, std::string histoTag)
book the summary histograms
std::string getMEName(std::string histoTag, const DTChamberId &chId)
Get the ME name.
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
~DTOccupancyTest() override
Destructor.
virtual double getFloatValue() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
std::string topFolder() const
int station() const
Return the station number.
static char chambers[264][20]
MonitorElement * get(std::string const &path)
int wheel() const
Return the wheel number.
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)