46 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: Constructor";
50 detailedAnalysis =
parameters.getUntrackedParameter<
bool>(
"detailedAnalysis",
false);
51 normalizeHistoPlots =
parameters.getUntrackedParameter<
bool>(
"normalizeHistoPlots",
false);
52 runOnline =
parameters.getUntrackedParameter<
bool>(
"runOnline",
true);
71 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"DTSegmentAnalysisTest: analyzed " << nevents <<
" events";
76 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: BeginRun";
94 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
95 <<
"[DTSegmentAnalysisTest]: End of LS " << nLumiSegs
96 <<
". Client called in online mode , perform DQM client operation";
98 performClientDiagnostic(igetter);
110 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
111 <<
"[DTSegmentAnalysisTest]: endJob. Client called in offline mode , perform DQM client operation";
113 performClientDiagnostic(igetter);
116 if(normalizeHistoPlots) {
117 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
" Performing time-histo normalization" << endl;
120 if(hltDQMMode) hNevtPerLS = igetter.
get(topHistoFolder +
"/NevtPerLS");
121 else hNevtPerLS = igetter.
get(
"DT/EventInfo/NevtPerLS");
123 if(hNevtPerLS !=
nullptr) {
125 for(
int sector = 1; sector <= 12; ++sector) {
126 stringstream wheelstr; wheelstr <<
wheel;
127 stringstream sectorstr; sectorstr << sector;
128 string sectorHistoName = topHistoFolder +
"/Wheel" + wheelstr.str() +
129 "/Sector" + sectorstr.str() +
130 "/NSegmPerEvent_W" + wheelstr.str() +
131 "_Sec" + sectorstr.str();
143 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Histo NevtPerLS not found!" << endl;
150 summaryHistos[3]->Reset();
151 summaryHistos[4]->Reset();
152 vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
153 vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
155 for (; ch_it != ch_end; ++ch_it) {
161 if (hNHits && hSegmOcc) {
163 TH1F * hNHits_root = hNHits->
getTH1F();
164 TH2F * hSegmOcc_root = hSegmOcc->
getTH2F();
165 TH2F * summary_histo_root = summaryHistos[3]->getTH2F();
167 int sector = chID.
sector();
168 if(sector == 13) sector=4;
169 if(sector == 14) sector=10;
172 if((chID.
station()!=4 && hNHits_root->GetMaximumBin() < maxPhiZHit)||
173 (chID.
station()==4 && hNHits_root->GetMaximumBin() < maxPhiHit)){
174 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),1);
175 if(summary_histo_root->GetBinContent(sector, chID.
wheel()+3)<1)
176 summaryHistos[3]->setBinContent(sector, chID.
wheel()+3,1);
179 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),0);
181 if(detailedAnalysis) {
188 TH2F * summary2_histo_root = summaryHistos[3]->getTH2F();
190 if(hSegmOcc_root->GetBinContent(sector,chID.
station())==0){
191 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),2);
192 if(summary2_histo_root->GetBinContent(sector, chID.
wheel()+3)<2)
193 summaryHistos[3]->setBinContent(sector, chID.
wheel()+3,2);
197 if((sector == 4 || sector == 10) && chID.
station() == 4) weight = 1./8.;
199 summaryHistos[4]->Fill(sector, chID.
wheel(),
weight);
201 LogVerbatim (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
202 <<
"[DTSegmentAnalysisTest]: histos not found!!";
205 if(detailedAnalysis){
211 TH1F * chi2_histo_root = chi2_histo->
getTH1F();
213 double maximum = chi2_histo_root->GetXaxis()->GetXmax();
214 double minimum = chi2_histo_root->GetXaxis()->GetXmin();
215 int nbins = chi2_histo_root->GetXaxis()->GetNbins();
216 int thresholdBin =
int(threshold/((maximum-minimum)/nbins));
218 double badSegments=0;
220 badSegments+=chi2_histo_root->GetBinContent(
bin);
223 if(chi2_histo_root->GetEntries()!=0){
224 double badSegmentsPercentual= badSegments/double(chi2_histo_root->GetEntries());
228 LogVerbatim (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
229 <<
"[DTSegmentAnalysisTest]: Histo: " << getMEName(chID,
"h4DChi2") <<
" not found!" << endl;
235 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsSegment";
241 summaryHistos[4]->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
243 summaryHistos[4]->setEntries(nMinEvts + 1);
244 LogVerbatim (
"DTDQM|DTMonitorClient|DTOccupancyTest") <<
"[DTOccupancyTest] ME: " 245 << nEvtsName <<
" not found!" << endl;
248 if(detailedAnalysis){
250 string chi2CriterionName =
parameters.getUntrackedParameter<
string>(
"chi2TestName",
"chi2InRange");
252 histo != chi2Histos.end();
255 const QReport * theChi2QReport = (*histo).second->getQReport(chi2CriterionName);
257 vector<dqm::me_util::Channel> badChannels = theChi2QReport->
getBadChannels();
258 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
259 channel != badChannels.end(); channel++) {
261 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Wheel: "<<(*histo).first.first
262 <<
" Sector: "<<(*histo).first.second
263 <<
" Bad stations: "<<(*channel).getBin()
264 <<
" Contents : "<<(*channel).getContents();
270 string segmRecHitCriterionName =
parameters.getUntrackedParameter<
string>(
"segmRecHitTestName",
"segmRecHitInRange");
272 histo != segmRecHitHistos.end();
275 const QReport * theSegmRecHitQReport = (*histo).second->getQReport(segmRecHitCriterionName);
276 if(theSegmRecHitQReport) {
277 vector<dqm::me_util::Channel> badChannels = theSegmRecHitQReport->
getBadChannels();
278 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
279 channel != badChannels.end(); channel++) {
281 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Wheel: "<<(*histo).first.first
282 <<
" Sector: "<<(*histo).first.second
283 <<
" Bad stations on recHit number: " 284 <<(*channel).getBin()
286 <<(*channel).getContents();
299 stringstream sector; sector << chID.
sector();
302 topHistoFolder +
"/Wheel" + wheel.str() +
303 "/Sector" + sector.str() +
304 "/Station" + station.str() +
"/";
306 string histoname = folderName + histoTag
308 +
"_St" + station.str()
309 +
"_Sec" + sector.str();
311 if(histoTag ==
"numberOfSegments")
313 topHistoFolder +
"/Wheel" + wheel.str() +
"/" +
314 histoTag + +
"_W" + wheel.str();
322 for(
int wh=-2; wh<=2; wh++){
323 stringstream
wheel; wheel << wh;
324 string histoName =
"segmentSummary_W" + wheel.str();
328 summaryHistos[wh] = ibooker.
book2D(histoName.c_str(),histoName.c_str(),12,1,13,4,1,5);
330 summaryHistos[wh]->setBinLabel(1,
"MB1",2);
331 summaryHistos[wh]->setBinLabel(2,
"MB2",2);
332 summaryHistos[wh]->setBinLabel(3,
"MB3",2);
333 summaryHistos[wh]->setBinLabel(4,
"MB4",2);
335 if(detailedAnalysis){
336 for(
int sect=1; sect<=14; sect++){
337 stringstream sector; sector << sect;
338 string chi2HistoName =
"chi2BadSegmPercentual_W" + wheel.str() +
"_Sec" + sector.str();
339 ibooker.
setCurrentFolder(topHistoFolder +
"/Wheel" + wheel.str() +
"/Tests");
340 chi2Histos[make_pair(wh,sect)] = ibooker.
book1D(chi2HistoName.c_str(),chi2HistoName.c_str(),4,1,5);
341 chi2Histos[make_pair(wh,sect)]->
setBinLabel(1,
"MB1");
342 chi2Histos[make_pair(wh,sect)]->setBinLabel(2,
"MB2");
343 chi2Histos[make_pair(wh,sect)]->setBinLabel(3,
"MB3");
344 chi2Histos[make_pair(wh,sect)]->setBinLabel(4,
"MB4");
346 string segmHistoName =
"residualsOnSegmRecHitNumber_W" + wheel.str() +
"_Sec" + sector.str();
347 segmRecHitHistos[make_pair(wh,sect)] = ibooker.
book1D(segmHistoName.c_str(),segmHistoName.c_str(),4,1,5);
348 segmRecHitHistos[make_pair(wh,sect)]->
setBinLabel(1,
"MB1");
349 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(2,
"MB2");
350 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(3,
"MB3");
351 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(4,
"MB4");
357 string histoName =
"segmentSummary";
361 summaryHistos[3] = ibooker.
book2D(histoName.c_str(),histoName.c_str(),12,1,13,5,-2,3);
363 summaryHistos[3]->setAxisTitle(
"Wheel",2);
365 summaryHistos[4] = ibooker.
book2D(
"SegmentGlbSummary",histoName.c_str(),12,1,13,5,-2,3);
367 summaryHistos[4]->setAxisTitle(
"Wheel",2);
LuminosityBlockID id() const
T getUntrackedParameter(std::string const &, T const &) const
~DTSegmentAnalysisTest() override
Destructor.
void beginRun(const edm::Run &, const edm::EventSetup &) override
MonitorElement * get(const std::string &path)
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)
void endRun(edm::Run const &run, edm::EventSetup const &c) override
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
double getFloatValue(void) const
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
void bookHistos(DQMStore::IBooker &)
DTSegmentAnalysisTest(const edm::ParameterSet &ps)
Constructor.
const std::vector< DQMChannel > & getBadChannels(void) const
bin
set the eta bin as selection string.
std::string getMEName(const DTChamberId &chID, std::string histoTag)
Get the ME name.
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
TH1F * getTH1F(void) const
LuminosityBlockNumber_t luminosityBlock() const
void normalizeTo(const MonitorElement *histForNorm)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
int station() const
Return the station number.
TH2F * getTH2F(void) const
int wheel() const
Return the wheel number.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void performClientDiagnostic(DQMStore::IGetter &)
Perform client diagnostic operations.