47 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: Constructor";
54 normalizeHistoPlots =
parameters.getUntrackedParameter<
bool>(
"normalizeHistoPlots",
false);
55 runOnline =
parameters.getUntrackedParameter<
bool>(
"runOnline",
true);
65 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"DTSegmentAnalysisTest: analyzed " <<
nevents <<
" events";
71 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: BeginJob";
83 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: BeginRun";
92 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: Begin of LS transition";
101 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: "<<
nevents<<
" events";
112 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
113 <<
"[DTSegmentAnalysisTest]: End of LS " << nLumiSegs
114 <<
". Client called in online mode , perform DQM client operation";
115 performClientDiagnostic();
123 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
124 <<
"[DTSegmentAnalysisTest]: endRun. Client called in offline mode , perform DQM client operation";
125 performClientDiagnostic();
128 if(normalizeHistoPlots) {
129 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
" Performing time-histo normalization" << endl;
132 else hNevtPerLS = dbe->get(
"DT/EventInfo/NevtPerLS");
134 if(hNevtPerLS != 0) {
135 for(
int wheel = -2; wheel != 3; ++wheel) {
136 for(
int sector = 1; sector <= 12; ++sector) {
137 stringstream wheelstr; wheelstr << wheel;
138 stringstream sectorstr; sectorstr << sector;
139 string sectorHistoName =
topHistoFolder +
"/Wheel" + wheelstr.str() +
140 "/Sector" + sectorstr.str() +
141 "/NSegmPerEvent_W" + wheelstr.str() +
142 "_Sec" + sectorstr.str();
148 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Histo NevtPerLS not found!" << endl;
156 summaryHistos[3]->Reset();
157 summaryHistos[4]->Reset();
158 vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
159 vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
161 for (; ch_it != ch_end; ++ch_it) {
164 MonitorElement * hNHits = dbe->get(getMEName(chID,
"h4DSegmNHits"));
165 MonitorElement * hSegmOcc = dbe->get(getMEName(chID,
"numberOfSegments"));
167 if (hNHits && hSegmOcc) {
169 TH1F * hNHits_root = hNHits->
getTH1F();
170 TH2F * hSegmOcc_root = hSegmOcc->
getTH2F();
171 TH2F * summary_histo_root = summaryHistos[3]->getTH2F();
173 int sector = chID.
sector();
174 if(sector == 13) sector=4;
175 if(sector == 14) sector=10;
178 if((chID.
station()!=4 && hNHits_root->GetMaximumBin() != 12)||
179 (chID.
station()==4 && hNHits_root->GetMaximumBin() != 8)){
180 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),1);
181 if(summary_histo_root->GetBinContent(sector, chID.
wheel()+3)<1)
182 summaryHistos[3]->setBinContent(sector, chID.
wheel()+3,1);
185 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),0);
189 segmRecHitHistos[make_pair(chID.
wheel(),chID.
sector())]->Fill(chID.
station(),
abs(12-hNHits_root->GetMaximumBin()));
191 segmRecHitHistos[make_pair(chID.
wheel(),chID.
sector())]->Fill(chID.
station(),
abs(8-hNHits_root->GetMaximumBin()));
194 TH2F * summary2_histo_root = summaryHistos[3]->getTH2F();
196 if(hSegmOcc_root->GetBinContent(sector,chID.
station())==0){
197 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),2);
198 if(summary2_histo_root->GetBinContent(sector, chID.
wheel()+3)<2)
199 summaryHistos[3]->setBinContent(sector, chID.
wheel()+3,2);
203 if((sector == 4 || sector == 10) && chID.
station() == 4) weight = 1./8.;
204 summaryHistos[4]->Fill(sector, chID.
wheel(),
weight);
208 LogVerbatim (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
209 <<
"[DTSegmentAnalysisTest]: histos not found!!";
215 MonitorElement * chi2_histo = dbe->get(getMEName(chID,
"h4DChi2"));
217 TH1F * chi2_histo_root = chi2_histo->
getTH1F();
219 double maximum = chi2_histo_root->GetXaxis()->GetXmax();
220 double minimum = chi2_histo_root->GetXaxis()->GetXmin();
221 int nbins = chi2_histo_root->GetXaxis()->GetNbins();
222 int thresholdBin = int(threshold/((maximum-minimum)/nbins));
224 double badSegments=0;
226 badSegments+=chi2_histo_root->GetBinContent(
bin);
229 if(chi2_histo_root->GetEntries()!=0){
230 double badSegmentsPercentual= badSegments/double(chi2_histo_root->GetEntries());
231 chi2Histos[make_pair(chID.
wheel(),chID.
sector())]->Fill(chID.
station(),badSegmentsPercentual);
234 LogVerbatim (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
235 <<
"[DTSegmentAnalysisTest]: Histo: " << getMEName(chID,
"h4DChi2") <<
" not found!" << endl;
244 string chi2CriterionName =
parameters.getUntrackedParameter<
string>(
"chi2TestName",
"chi2InRange");
246 histo != chi2Histos.end();
249 const QReport * theChi2QReport = (*histo).second->getQReport(chi2CriterionName);
251 vector<dqm::me_util::Channel> badChannels = theChi2QReport->
getBadChannels();
252 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
253 channel != badChannels.end(); channel++) {
255 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Wheel: "<<(*histo).first.first
256 <<
" Sector: "<<(*histo).first.second
257 <<
" Bad stations: "<<(*channel).getBin()
258 <<
" Contents : "<<(*channel).getContents();
263 string segmRecHitCriterionName =
parameters.getUntrackedParameter<
string>(
"segmRecHitTestName",
"segmRecHitInRange");
265 histo != segmRecHitHistos.end();
268 const QReport * theSegmRecHitQReport = (*histo).second->getQReport(segmRecHitCriterionName);
269 if(theSegmRecHitQReport) {
270 vector<dqm::me_util::Channel> badChannels = theSegmRecHitQReport->
getBadChannels();
271 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
272 channel != badChannels.end(); channel++) {
274 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Wheel: "<<(*histo).first.first
275 <<
" Sector: "<<(*histo).first.second
276 <<
" Bad stations on recHit number: "
277 <<(*channel).getBin()
279 <<(*channel).getContents();
291 stringstream wheel; wheel << chID.
wheel();
293 stringstream sector; sector << chID.
sector();
297 "/Sector" + sector.str() +
298 "/Station" + station.str() +
"/";
300 string histoname = folderName + histoTag
302 +
"_St" + station.str()
303 +
"_Sec" + sector.str();
305 if(histoTag ==
"numberOfSegments")
308 histoTag + +
"_W" + wheel.str();
317 for(
int wh=-2; wh<=2; wh++){
318 stringstream wheel; wheel << wh;
319 string histoName =
"segmentSummary_W" + wheel.str();
321 summaryHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),12,1,13,4,1,5);
322 summaryHistos[wh]->setAxisTitle(
"Sector",1);
323 summaryHistos[wh]->setBinLabel(1,
"MB1",2);
324 summaryHistos[wh]->setBinLabel(2,
"MB2",2);
325 summaryHistos[wh]->setBinLabel(3,
"MB3",2);
326 summaryHistos[wh]->setBinLabel(4,
"MB4",2);
329 for(
int sect=1; sect<=14; sect++){
330 stringstream sector; sector << sect;
331 string chi2HistoName =
"chi2BadSegmPercentual_W" + wheel.str() +
"_Sec" + sector.str();
332 dbe->setCurrentFolder(
topHistoFolder +
"/Wheel" + wheel.str() +
"/Tests");
333 chi2Histos[make_pair(wh,sect)] = dbe->book1D(chi2HistoName.c_str(),chi2HistoName.c_str(),4,1,5);
334 chi2Histos[make_pair(wh,sect)]->setBinLabel(1,
"MB1");
335 chi2Histos[make_pair(wh,sect)]->setBinLabel(2,
"MB2");
336 chi2Histos[make_pair(wh,sect)]->setBinLabel(3,
"MB3");
337 chi2Histos[make_pair(wh,sect)]->setBinLabel(4,
"MB4");
339 string segmHistoName =
"residualsOnSegmRecHitNumber_W" + wheel.str() +
"_Sec" + sector.str();
340 segmRecHitHistos[make_pair(wh,sect)] = dbe->book1D(segmHistoName.c_str(),segmHistoName.c_str(),4,1,5);
341 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(1,
"MB1");
342 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(2,
"MB2");
343 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(3,
"MB3");
344 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(4,
"MB4");
350 string histoName =
"segmentSummary";
352 summaryHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),12,1,13,5,-2,3);
353 summaryHistos[3]->setAxisTitle(
"Sector",1);
354 summaryHistos[3]->setAxisTitle(
"Wheel",2);
356 summaryHistos[4] = dbe->book2D(
"SegmentGlbSummary",histoName.c_str(),12,1,13,5,-2,3);
357 summaryHistos[4]->setAxisTitle(
"Sector",1);
358 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)
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)