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";
109 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest")
110 <<
"[DTOccupancyTest]: End of LS transition, performing the DQM client operation";
130 if (chamberOccupancyHisto !=
nullptr) {
133 float chamberPercentage = 1.;
135 int sector = chId.
sector();
140 if (resultSect4 >
result) {
143 }
else if (sector == 14) {
146 if (resultSect10 >
result) {
152 if ((sector == 4 || sector == 10) && chId.
station() == 4)
153 chamberPercentage = chamberPercentage / 2.;
161 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest")
166 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsDigi";
177 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest")
178 <<
"[DTOccupancyTest] ME: " << nEvtsName <<
" not found!" << endl;
186 ntuple->AutoSave(
"SaveSelf");
190 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest") <<
"[DTOccupancyTest] endjob called!";
210 LogVerbatim(
"DTDQM|DTMonitorClient|DTOccupancyTest")
211 <<
"[DTOccupancyTest]: booking wheel histo:" <<
histoName <<
" (tag " <<
histoTag 214 string histoTitle =
"Occupancy summary WHEEL: " +
wheel.str();
216 histoTitle =
"TP Occupancy summary WHEEL: " +
wheel.str();
237 string folder =
"Occupancies/";
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) {
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.);
336 chamberPercentage = 1. - (
float(compDeadCell) / totCell);
352 if (totOccup < min_occup)
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.
Log< level::Info, true > LogVerbatim
int station() const
Return the station number.
bool runOnNoiseOccupancies
virtual void setCurrentFolder(std::string const &fullpath)
virtual void setEntries(double nentries)
set # of entries
bool runOnInTimeOccupancies
int runOccupancyTest(TH2F *histo, const DTChamberId &chId, float &chamberPercentage)
MonitorElement * summaryHisto
std::string nameMonitoredHisto
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.
std::string topFolder() const
T getUntrackedParameter(std::string const &, T const &) const
int firstChannel() const
Returns the wire number of the first wire.
virtual TH2F * getTH2F() const
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
DTOccupancyTest(const edm::ParameterSet &ps)
Constructor.
virtual double getFloatValue() const
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.
bool runOnAllHitsOccupancies
const DTTopology & specificTopology() const
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
const DTGeometry * muonGeom
~DTOccupancyTest() override
Destructor.
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
virtual MonitorElement * get(std::string const &fullpath) const
int wheel() const
Return the wheel number.
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
std::map< int, MonitorElement * > wheelHistos
static char chambers[264][20]
int channels() const
Returns the number of wires in the layer.
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
MonitorElement * glbSummaryHisto
virtual double getBinContent(int binx) const
get content of bin (1-D)
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)