47 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: Constructor";
53 detailedAnalysis =
parameters.getUntrackedParameter<
bool>(
"detailedAnalysis",
false);
54 normalizeHistoPlots =
parameters.getUntrackedParameter<
bool>(
"normalizeHistoPlots",
false);
55 runOnline =
parameters.getUntrackedParameter<
bool>(
"runOnline",
true);
69 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"DTSegmentAnalysisTest: analyzed " <<
nevents <<
" events";
75 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: BeginJob";
87 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: BeginRun";
96 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: Begin of LS transition";
105 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: "<<
nevents<<
" events";
116 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
117 <<
"[DTSegmentAnalysisTest]: End of LS " << nLumiSegs
118 <<
". Client called in online mode , perform DQM client operation";
119 performClientDiagnostic();
127 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
128 <<
"[DTSegmentAnalysisTest]: endRun. Client called in offline mode , perform DQM client operation";
129 performClientDiagnostic();
132 if(normalizeHistoPlots) {
133 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
" Performing time-histo normalization" << endl;
135 if(hltDQMMode) hNevtPerLS = dbe->get(topHistoFolder +
"/NevtPerLS");
136 else hNevtPerLS = dbe->get(
"DT/EventInfo/NevtPerLS");
138 if(hNevtPerLS != 0) {
139 for(
int wheel = -2; wheel != 3; ++wheel) {
140 for(
int sector = 1; sector <= 12; ++sector) {
141 stringstream wheelstr; wheelstr << wheel;
142 stringstream sectorstr; sectorstr << sector;
143 string sectorHistoName = topHistoFolder +
"/Wheel" + wheelstr.str() +
144 "/Sector" + sectorstr.str() +
145 "/NSegmPerEvent_W" + wheelstr.str() +
146 "_Sec" + sectorstr.str();
152 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Histo NevtPerLS not found!" << endl;
160 summaryHistos[3]->Reset();
161 summaryHistos[4]->Reset();
162 vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
163 vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
165 for (; ch_it != ch_end; ++ch_it) {
168 MonitorElement * hNHits = dbe->get(getMEName(chID,
"h4DSegmNHits"));
169 MonitorElement * hSegmOcc = dbe->get(getMEName(chID,
"numberOfSegments"));
171 if (hNHits && hSegmOcc) {
173 TH1F * hNHits_root = hNHits->
getTH1F();
174 TH2F * hSegmOcc_root = hSegmOcc->
getTH2F();
175 TH2F * summary_histo_root = summaryHistos[3]->getTH2F();
177 int sector = chID.
sector();
178 if(sector == 13) sector=4;
179 if(sector == 14) sector=10;
182 if((chID.
station()!=4 && hNHits_root->GetMaximumBin() < maxPhiZHit)||
183 (chID.
station()==4 && hNHits_root->GetMaximumBin() < maxPhiHit)){
184 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),1);
185 if(summary_histo_root->GetBinContent(sector, chID.
wheel()+3)<1)
186 summaryHistos[3]->setBinContent(sector, chID.
wheel()+3,1);
189 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),0);
191 if(detailedAnalysis) {
198 TH2F * summary2_histo_root = summaryHistos[3]->getTH2F();
200 if(hSegmOcc_root->GetBinContent(sector,chID.
station())==0){
201 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),2);
202 if(summary2_histo_root->GetBinContent(sector, chID.
wheel()+3)<2)
203 summaryHistos[3]->setBinContent(sector, chID.
wheel()+3,2);
207 if((sector == 4 || sector == 10) && chID.
station() == 4) weight = 1./8.;
208 summaryHistos[4]->Fill(sector, chID.
wheel(),
weight);
212 LogVerbatim (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
213 <<
"[DTSegmentAnalysisTest]: histos not found!!";
216 if(detailedAnalysis){
219 MonitorElement * chi2_histo = dbe->get(getMEName(chID,
"h4DChi2"));
221 TH1F * chi2_histo_root = chi2_histo->
getTH1F();
223 double maximum = chi2_histo_root->GetXaxis()->GetXmax();
224 double minimum = chi2_histo_root->GetXaxis()->GetXmin();
225 int nbins = chi2_histo_root->GetXaxis()->GetNbins();
226 int thresholdBin = int(threshold/((maximum-minimum)/nbins));
228 double badSegments=0;
230 badSegments+=chi2_histo_root->GetBinContent(
bin);
233 if(chi2_histo_root->GetEntries()!=0){
234 double badSegmentsPercentual= badSegments/double(chi2_histo_root->GetEntries());
238 LogVerbatim (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
239 <<
"[DTSegmentAnalysisTest]: Histo: " << getMEName(chID,
"h4DChi2") <<
" not found!" << endl;
245 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsSegment";
250 summaryHistos[4]->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
252 summaryHistos[4]->setEntries(nMinEvts + 1);
253 LogVerbatim (
"DTDQM|DTMonitorClient|DTOccupancyTest") <<
"[DTOccupancyTest] ME: "
254 << nEvtsName <<
" not found!" << endl;
257 if(detailedAnalysis){
259 string chi2CriterionName =
parameters.getUntrackedParameter<
string>(
"chi2TestName",
"chi2InRange");
261 histo != chi2Histos.end();
264 const QReport * theChi2QReport = (*histo).second->getQReport(chi2CriterionName);
266 vector<dqm::me_util::Channel> badChannels = theChi2QReport->
getBadChannels();
267 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
268 channel != badChannels.end(); channel++) {
270 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Wheel: "<<(*histo).first.first
271 <<
" Sector: "<<(*histo).first.second
272 <<
" Bad stations: "<<(*channel).getBin()
273 <<
" Contents : "<<(*channel).getContents();
278 string segmRecHitCriterionName =
parameters.getUntrackedParameter<
string>(
"segmRecHitTestName",
"segmRecHitInRange");
280 histo != segmRecHitHistos.end();
283 const QReport * theSegmRecHitQReport = (*histo).second->getQReport(segmRecHitCriterionName);
284 if(theSegmRecHitQReport) {
285 vector<dqm::me_util::Channel> badChannels = theSegmRecHitQReport->
getBadChannels();
286 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
287 channel != badChannels.end(); channel++) {
289 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Wheel: "<<(*histo).first.first
290 <<
" Sector: "<<(*histo).first.second
291 <<
" Bad stations on recHit number: "
292 <<(*channel).getBin()
294 <<(*channel).getContents();
306 stringstream wheel; wheel << chID.
wheel();
308 stringstream sector; sector << chID.
sector();
311 topHistoFolder +
"/Wheel" + wheel.str() +
312 "/Sector" + sector.str() +
313 "/Station" + station.str() +
"/";
315 string histoname = folderName + histoTag
317 +
"_St" + station.str()
318 +
"_Sec" + sector.str();
320 if(histoTag ==
"numberOfSegments")
322 topHistoFolder +
"/Wheel" + wheel.str() +
"/" +
323 histoTag + +
"_W" + wheel.str();
332 for(
int wh=-2; wh<=2; wh++){
333 stringstream wheel; wheel << wh;
334 string histoName =
"segmentSummary_W" + wheel.str();
335 dbe->setCurrentFolder(topHistoFolder);
336 summaryHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),12,1,13,4,1,5);
337 summaryHistos[wh]->setAxisTitle(
"Sector",1);
338 summaryHistos[wh]->setBinLabel(1,
"MB1",2);
339 summaryHistos[wh]->setBinLabel(2,
"MB2",2);
340 summaryHistos[wh]->setBinLabel(3,
"MB3",2);
341 summaryHistos[wh]->setBinLabel(4,
"MB4",2);
343 if(detailedAnalysis){
344 for(
int sect=1; sect<=14; sect++){
345 stringstream sector; sector << sect;
346 string chi2HistoName =
"chi2BadSegmPercentual_W" + wheel.str() +
"_Sec" + sector.str();
347 dbe->setCurrentFolder(topHistoFolder +
"/Wheel" + wheel.str() +
"/Tests");
348 chi2Histos[make_pair(wh,sect)] = dbe->book1D(chi2HistoName.c_str(),chi2HistoName.c_str(),4,1,5);
349 chi2Histos[make_pair(wh,sect)]->setBinLabel(1,
"MB1");
350 chi2Histos[make_pair(wh,sect)]->setBinLabel(2,
"MB2");
351 chi2Histos[make_pair(wh,sect)]->setBinLabel(3,
"MB3");
352 chi2Histos[make_pair(wh,sect)]->setBinLabel(4,
"MB4");
354 string segmHistoName =
"residualsOnSegmRecHitNumber_W" + wheel.str() +
"_Sec" + sector.str();
355 segmRecHitHistos[make_pair(wh,sect)] = dbe->book1D(segmHistoName.c_str(),segmHistoName.c_str(),4,1,5);
356 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(1,
"MB1");
357 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(2,
"MB2");
358 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(3,
"MB3");
359 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(4,
"MB4");
365 string histoName =
"segmentSummary";
366 dbe->setCurrentFolder(topHistoFolder);
367 summaryHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),12,1,13,5,-2,3);
368 summaryHistos[3]->setAxisTitle(
"Sector",1);
369 summaryHistos[3]->setAxisTitle(
"Wheel",2);
371 summaryHistos[4] = dbe->book2D(
"SegmentGlbSummary",histoName.c_str(),12,1,13,5,-2,3);
372 summaryHistos[4]->setAxisTitle(
"Sector",1);
373 summaryHistos[4]->setAxisTitle(
"Wheel",2);
LuminosityBlockID id() const
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
T getUntrackedParameter(std::string const &, T const &) const
void endRun(edm::Run const &run, edm::EventSetup const &c)
DQM Client Diagnostic in offline mode.
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
DQM Client Diagnostic in online mode.
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
double getFloatValue(void) const
DTSegmentAnalysisTest(const edm::ParameterSet &ps)
Constructor.
const std::vector< DQMChannel > & getBadChannels(void) const
std::string getMEName(const DTChamberId &chID, std::string histoTag)
Get the ME name.
virtual ~DTSegmentAnalysisTest()
Destructor.
TH1F * getTH1F(void) const
LuminosityBlockNumber_t luminosityBlock() const
void normalizeTo(const MonitorElement *histForNorm)
void bookHistos()
book the summary histograms
int station() const
Return the station number.
TH2F * getTH2F(void) const
void performClientDiagnostic()
Perform client diagnostic operations.
int wheel() const
Return the wheel number.
void beginRun(const edm::Run &run, const edm::EventSetup &eSetup)