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";
123 for (vector<const DTChamber*>::const_iterator chamber = chambers.begin(); chamber != chambers.end();
130 if (chamberOccupancyHisto !=
nullptr) {
133 float chamberPercentage = 1.;
135 int sector = chId.
sector();
140 if (resultSect4 > result) {
141 result = (int)resultSect4;
143 }
else if (sector == 14) {
146 if (resultSect10 > result) {
147 result = (int)resultSect10;
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!";
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);
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) {
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
T getUntrackedParameter(std::string const &, T const &) const
bool runOnNoiseOccupancies
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
virtual TH2F * getTH2F() const
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.
int firstChannel() const
Returns the wire number of the first wire.
bool getData(T &iHolder) const
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
const DTTopology & specificTopology() const
DTOccupancyTest(const edm::ParameterSet &ps)
Constructor.
void bookHistos(DQMStore::IBooker &, const int wheelId, std::string folder, std::string histoTag)
book the summary histograms
virtual MonitorElement * get(std::string const &fullpath) const
std::string getMEName(std::string histoTag, const DTChamberId &chId)
Get the ME name.
bool runOnAllHitsOccupancies
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
virtual double getBinContent(int binx) const
get content of bin (1-D)
const DTGeometry * muonGeom
~DTOccupancyTest() override
Destructor.
int channels() const
Returns the number of wires in the layer.
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 double getFloatValue() const
std::string topFolder() const
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
std::map< int, MonitorElement * > wheelHistos
int station() const
Return the station number.
static char chambers[264][20]
int wheel() const
Return the wheel number.
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
MonitorElement * glbSummaryHisto
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)