45 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: Constructor";
51 detailedAnalysis =
parameters.getUntrackedParameter<
bool>(
"detailedAnalysis",
false);
52 normalizeHistoPlots =
parameters.getUntrackedParameter<
bool>(
"normalizeHistoPlots",
false);
53 runOnline =
parameters.getUntrackedParameter<
bool>(
"runOnline",
true);
67 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"DTSegmentAnalysisTest: analyzed " <<
nevents <<
" events";
73 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: BeginJob";
85 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: BeginRun";
94 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: Begin of LS transition";
103 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"[DTSegmentAnalysisTest]: "<<
nevents<<
" events";
114 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
115 <<
"[DTSegmentAnalysisTest]: End of LS " << nLumiSegs
116 <<
". Client called in online mode , perform DQM client operation";
117 performClientDiagnostic();
125 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
126 <<
"[DTSegmentAnalysisTest]: endRun. Client called in offline mode , perform DQM client operation";
127 performClientDiagnostic();
130 if(normalizeHistoPlots) {
131 LogTrace (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
" Performing time-histo normalization" << endl;
133 if(hltDQMMode) hNevtPerLS = dbe->get(topHistoFolder +
"/NevtPerLS");
134 else hNevtPerLS = dbe->get(
"DT/EventInfo/NevtPerLS");
136 if(hNevtPerLS != 0) {
137 for(
int wheel = -2; wheel != 3; ++wheel) {
138 for(
int sector = 1; sector <= 12; ++sector) {
139 stringstream wheelstr; wheelstr << wheel;
140 stringstream sectorstr; sectorstr << sector;
141 string sectorHistoName = topHistoFolder +
"/Wheel" + wheelstr.str() +
142 "/Sector" + sectorstr.str() +
143 "/NSegmPerEvent_W" + wheelstr.str() +
144 "_Sec" + sectorstr.str();
150 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Histo NevtPerLS not found!" << endl;
158 summaryHistos[3]->Reset();
159 summaryHistos[4]->Reset();
160 vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
161 vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
163 for (; ch_it != ch_end; ++ch_it) {
166 MonitorElement * hNHits = dbe->get(getMEName(chID,
"h4DSegmNHits"));
167 MonitorElement * hSegmOcc = dbe->get(getMEName(chID,
"numberOfSegments"));
169 if (hNHits && hSegmOcc) {
171 TH1F * hNHits_root = hNHits->
getTH1F();
172 TH2F * hSegmOcc_root = hSegmOcc->
getTH2F();
173 TH2F * summary_histo_root = summaryHistos[3]->getTH2F();
175 int sector = chID.
sector();
176 if(sector == 13) sector=4;
177 if(sector == 14) sector=10;
180 if((chID.
station()!=4 && hNHits_root->GetMaximumBin() < maxPhiZHit)||
181 (chID.
station()==4 && hNHits_root->GetMaximumBin() < maxPhiHit)){
182 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),1);
183 if(summary_histo_root->GetBinContent(sector, chID.
wheel()+3)<1)
184 summaryHistos[3]->setBinContent(sector, chID.
wheel()+3,1);
187 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),0);
189 if(detailedAnalysis) {
196 TH2F * summary2_histo_root = summaryHistos[3]->getTH2F();
198 if(hSegmOcc_root->GetBinContent(sector,chID.
station())==0){
199 summaryHistos[chID.
wheel()]->setBinContent(sector, chID.
station(),2);
200 if(summary2_histo_root->GetBinContent(sector, chID.
wheel()+3)<2)
201 summaryHistos[3]->setBinContent(sector, chID.
wheel()+3,2);
205 if((sector == 4 || sector == 10) && chID.
station() == 4) weight = 1./8.;
206 summaryHistos[4]->Fill(sector, chID.
wheel(),
weight);
210 LogVerbatim (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
211 <<
"[DTSegmentAnalysisTest]: histos not found!!";
214 if(detailedAnalysis){
217 MonitorElement * chi2_histo = dbe->get(getMEName(chID,
"h4DChi2"));
219 TH1F * chi2_histo_root = chi2_histo->
getTH1F();
221 double maximum = chi2_histo_root->GetXaxis()->GetXmax();
222 double minimum = chi2_histo_root->GetXaxis()->GetXmin();
223 int nbins = chi2_histo_root->GetXaxis()->GetNbins();
224 int thresholdBin = int(threshold/((maximum-minimum)/nbins));
226 double badSegments=0;
228 badSegments+=chi2_histo_root->GetBinContent(
bin);
231 if(chi2_histo_root->GetEntries()!=0){
232 double badSegmentsPercentual= badSegments/double(chi2_histo_root->GetEntries());
236 LogVerbatim (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
237 <<
"[DTSegmentAnalysisTest]: Histo: " << getMEName(chID,
"h4DChi2") <<
" not found!" << endl;
243 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsSegment";
248 summaryHistos[4]->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
250 summaryHistos[4]->setEntries(nMinEvts + 1);
251 LogVerbatim (
"DTDQM|DTMonitorClient|DTOccupancyTest") <<
"[DTOccupancyTest] ME: "
252 << nEvtsName <<
" not found!" << endl;
255 if(detailedAnalysis){
257 string chi2CriterionName =
parameters.getUntrackedParameter<
string>(
"chi2TestName",
"chi2InRange");
259 histo != chi2Histos.end();
262 const QReport * theChi2QReport = (*histo).second->getQReport(chi2CriterionName);
264 vector<dqm::me_util::Channel> badChannels = theChi2QReport->
getBadChannels();
265 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
266 channel != badChannels.end(); channel++) {
268 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Wheel: "<<(*histo).first.first
269 <<
" Sector: "<<(*histo).first.second
270 <<
" Bad stations: "<<(*channel).getBin()
271 <<
" Contents : "<<(*channel).getContents();
276 string segmRecHitCriterionName =
parameters.getUntrackedParameter<
string>(
"segmRecHitTestName",
"segmRecHitInRange");
278 histo != segmRecHitHistos.end();
281 const QReport * theSegmRecHitQReport = (*histo).second->getQReport(segmRecHitCriterionName);
282 if(theSegmRecHitQReport) {
283 vector<dqm::me_util::Channel> badChannels = theSegmRecHitQReport->
getBadChannels();
284 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
285 channel != badChannels.end(); channel++) {
287 LogError (
"DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<
"Wheel: "<<(*histo).first.first
288 <<
" Sector: "<<(*histo).first.second
289 <<
" Bad stations on recHit number: "
290 <<(*channel).getBin()
292 <<(*channel).getContents();
304 stringstream wheel; wheel << chID.
wheel();
306 stringstream sector; sector << chID.
sector();
309 topHistoFolder +
"/Wheel" + wheel.str() +
310 "/Sector" + sector.str() +
311 "/Station" + station.str() +
"/";
313 string histoname = folderName + histoTag
315 +
"_St" + station.str()
316 +
"_Sec" + sector.str();
318 if(histoTag ==
"numberOfSegments")
320 topHistoFolder +
"/Wheel" + wheel.str() +
"/" +
321 histoTag + +
"_W" + wheel.str();
330 for(
int wh=-2; wh<=2; wh++){
331 stringstream wheel; wheel << wh;
332 string histoName =
"segmentSummary_W" + wheel.str();
333 dbe->setCurrentFolder(topHistoFolder);
334 summaryHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),12,1,13,4,1,5);
335 summaryHistos[wh]->setAxisTitle(
"Sector",1);
336 summaryHistos[wh]->setBinLabel(1,
"MB1",2);
337 summaryHistos[wh]->setBinLabel(2,
"MB2",2);
338 summaryHistos[wh]->setBinLabel(3,
"MB3",2);
339 summaryHistos[wh]->setBinLabel(4,
"MB4",2);
341 if(detailedAnalysis){
342 for(
int sect=1; sect<=14; sect++){
343 stringstream sector; sector << sect;
344 string chi2HistoName =
"chi2BadSegmPercentual_W" + wheel.str() +
"_Sec" + sector.str();
345 dbe->setCurrentFolder(topHistoFolder +
"/Wheel" + wheel.str() +
"/Tests");
346 chi2Histos[make_pair(wh,sect)] = dbe->book1D(chi2HistoName.c_str(),chi2HistoName.c_str(),4,1,5);
347 chi2Histos[make_pair(wh,sect)]->setBinLabel(1,
"MB1");
348 chi2Histos[make_pair(wh,sect)]->setBinLabel(2,
"MB2");
349 chi2Histos[make_pair(wh,sect)]->setBinLabel(3,
"MB3");
350 chi2Histos[make_pair(wh,sect)]->setBinLabel(4,
"MB4");
352 string segmHistoName =
"residualsOnSegmRecHitNumber_W" + wheel.str() +
"_Sec" + sector.str();
353 segmRecHitHistos[make_pair(wh,sect)] = dbe->book1D(segmHistoName.c_str(),segmHistoName.c_str(),4,1,5);
354 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(1,
"MB1");
355 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(2,
"MB2");
356 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(3,
"MB3");
357 segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(4,
"MB4");
363 string histoName =
"segmentSummary";
364 dbe->setCurrentFolder(topHistoFolder);
365 summaryHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),12,1,13,5,-2,3);
366 summaryHistos[3]->setAxisTitle(
"Sector",1);
367 summaryHistos[3]->setAxisTitle(
"Wheel",2);
369 summaryHistos[4] = dbe->book2D(
"SegmentGlbSummary",histoName.c_str(),12,1,13,5,-2,3);
370 summaryHistos[4]->setAxisTitle(
"Sector",1);
371 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
Abs< T >::type abs(const T &t)
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)