40 LogTrace (
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<
"[DTResolutionAnalysisTest]: Constructor";
56 LogTrace (
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<
"DTResolutionAnalysisTest: analyzed " <<
nevents <<
" events";
63 LogTrace (
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<
"[DTResolutionAnalysisTest]: BeginJob";
69 globalResSummary = dbe->book2D(
"ResidualsGlbSummary",
"Summary residuals",12,1,13,5,-2,3);
75 meanDistr[-2] = dbe->book1D(
"MeanDistr",
"Mean value of the residuals all (cm)",
77 meanDistr[-1] = dbe->book1D(
"MeanDistr_Phi",
"Mean value of the residuals #phi SL (cm)",
79 meanDistr[0] = dbe->book1D(
"MeanDistr_ThetaWh0",
"Mean values of the residuals #theta SL Wh 0 (cm)",
81 meanDistr[1] = dbe->book1D(
"MeanDistr_ThetaWh1",
"Mean value of the residuals #theta SL Wh +/-1 (cm)",
83 meanDistr[2] = dbe->book1D(
"MeanDistr_ThetaWh2",
"Mean value of the residuals #theta SL Wh +/-2 (cm)",
87 stringstream meanRange; meanRange << (permittedMeanRange*10000);
88 string histoTitle =
"Fraction of SLs with |mean of res.| > " + meanRange.str() +
"#mum";
89 wheelMeanHistos[3] = dbe->book2D(
"MeanResGlbSummary",histoTitle.c_str(),12,1,13,5,-2,3);
90 wheelMeanHistos[3]->setAxisTitle(
"Sector",1);
91 wheelMeanHistos[3]->setAxisTitle(
"Wheel",2);
95 sigmaDistr[-2] = dbe->book1D(
"SigmaDistr",
"Sigma value of the residuals all (cm)",
97 sigmaDistr[-1] = dbe->book1D(
"SigmaDistr_Phi",
"Sigma value of the residuals #phi SL (cm)",
99 sigmaDistr[0] = dbe->book1D(
"SigmaDistr_ThetaWh0",
"Sigma value of the residuals #theta SL Wh 0 (cm)",
101 sigmaDistr[1] = dbe->book1D(
"SigmaDistr_ThetaWh1",
"Sigma value of the residuals #theta SL Wh +/-1 (cm)",
103 sigmaDistr[2] = dbe->book1D(
"SigmaDistr_ThetaWh2",
"Sigma value of the residuals #theta SL Wh +/-2 (cm)",
106 stringstream sigmaRange; sigmaRange << (permittedSigmaRange*10000);
107 histoTitle =
"Fraction of SLs with #sigma res. > " + sigmaRange.str() +
"#mum";
108 wheelSigmaHistos[3] = dbe->book2D(
"SigmaResGlbSummary",histoTitle.c_str(),12,1,13,5,-2,3);
109 wheelSigmaHistos[3]->setAxisTitle(
"Sector",1);
110 wheelSigmaHistos[3]->setAxisTitle(
"Wheel",2);
114 for (
int wheel=-2; wheel<=2; wheel++){
116 for (
int sector=1; sector<=12; sector++){
125 LogTrace (
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<
"[DTResolutionAnalysisTest]: BeginRun";
135 LogTrace (
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<
"[DTResolutionAnalysisTest]: Begin of LS transition";
160 LogTrace (
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<
"[DTResolutionAnalysisTest]: End of Run transition, performing the DQM client operation";
171 for (vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
172 ch_it != muonGeom->chambers().end(); ++ch_it) {
177 for(vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
178 sl_it != (*ch_it)->superLayers().end(); ++sl_it) {
185 float statMean = res_histo->
getMean(1);
186 float statSigma = res_histo->
getRMS(1);
189 TH1F * histo_root = res_histo->
getTH1F();
193 int binSect = slID.
sector();
194 if(slID.
sector() == 13) binSect = 4;
195 else if(slID.
sector() == 14) binSect = 10;
201 if(histo_root->GetEntries()>20) {
202 TF1 *gfit =
new TF1(
"Gaussian",
"gaus",(statMean-(2*statSigma)),(statMean+(2*statSigma)));
204 histo_root->Fit(gfit,
"Q0",
"", -0.1, 0.1);
206 LogWarning (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask")
207 <<
"[DTResolutionAnalysisTask]: Exception when fitting SL : " << slID;
210 if((binSect == 4 || binSect == 10) && slID.
station() == 4) weight = 1/22.;
211 globalResSummary->Fill(binSect, slID.
wheel(),
weight);
217 mean = gfit->GetParameter(1);
218 sigma = gfit->GetParameter(2);
221 meanDistr[-2]->Fill(mean);
222 sigmaDistr[-2]->Fill(sigma);
224 meanDistr[
abs(slID.
wheel())]->Fill(mean);
225 sigmaDistr[
abs(slID.
wheel())]->Fill(sigma);
227 meanDistr[-1]->Fill(mean);
228 sigmaDistr[-1]->Fill(sigma);
234 MeanHistos[make_pair(slID.
wheel(),binSect)]->setBinContent(binSL, mean);
235 SigmaHistos[make_pair(slID.
wheel(),binSect)]->setBinContent(binSL, sigma);
239 if((binSect == 4 || binSect == 10) && slID.
station() == 4) weight = 1/22.;
242 if(meanInRange(mean) && sigmaInRange(sigma)) {
243 globalResSummary->Fill(binSect, slID.
wheel(),
weight);
244 wheelMeanHistos[3]->Fill(binSect,slID.
wheel(),
weight);
245 wheelSigmaHistos[3]->Fill(binSect,slID.
wheel(),
weight);
247 if(!meanInRange(mean)) {
248 wheelMeanHistos[slID.
wheel()]->Fill(binSect,binSL);
250 wheelMeanHistos[3]->Fill(binSect,slID.
wheel(),
weight);
252 if(!sigmaInRange(sigma)) {
253 wheelSigmaHistos[slID.
wheel()]->Fill(binSect,binSL);
255 wheelSigmaHistos[3]->Fill(binSect,slID.
wheel(),
weight);
262 LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask")
263 <<
"[DTResolutionAnalysisTask] Fit of " << slID
264 <<
" not performed because # entries < 20 ";
267 if((binSect == 4 || binSect == 10) && slID.
station() == 4) weight = 1/22.;
268 globalResSummary->Fill(binSect, slID.
wheel(),
weight);
269 wheelMeanHistos[3]->Fill(binSect,slID.
wheel(),
weight);
270 wheelSigmaHistos[3]->Fill(binSect,slID.
wheel(),
weight);
273 LogWarning (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask")
274 <<
"[DTResolutionAnalysisTask] Histo: " << getMEName(slID) <<
" not found" << endl;
285 stringstream wheel; wheel <<wh;
288 string histoName =
"MeanSummaryRes_W" + wheel.str();
289 stringstream meanRange; meanRange << (permittedMeanRange*10000);
290 string histoTitle =
"# of SL with |mean of res.| > " + meanRange.str() +
"#mum (Wheel " + wheel.str() +
")";
291 wheelMeanHistos[wh] = dbe->book2D(histoName.c_str(),histoTitle.c_str(),12,1,13,11,1,12);
292 wheelMeanHistos[wh]->setAxisTitle(
"Sector",1);
293 wheelMeanHistos[wh]->setBinLabel(1,
"MB1_SL1",2);
294 wheelMeanHistos[wh]->setBinLabel(2,
"MB1_SL2",2);
295 wheelMeanHistos[wh]->setBinLabel(3,
"MB1_SL3",2);
296 wheelMeanHistos[wh]->setBinLabel(4,
"MB2_SL1",2);
297 wheelMeanHistos[wh]->setBinLabel(5,
"MB2_SL2",2);
298 wheelMeanHistos[wh]->setBinLabel(6,
"MB2_SL3",2);
299 wheelMeanHistos[wh]->setBinLabel(7,
"MB3_SL1",2);
300 wheelMeanHistos[wh]->setBinLabel(8,
"MB3_SL2",2);
301 wheelMeanHistos[wh]->setBinLabel(9,
"MB3_SL3",2);
302 wheelMeanHistos[wh]->setBinLabel(10,
"MB4_SL1",2);
303 wheelMeanHistos[wh]->setBinLabel(11,
"MB4_SL3",2);
310 histoName =
"SigmaSummaryRes_W" + wheel.str();
311 stringstream sigmaRange; sigmaRange << (permittedSigmaRange*10000);
312 histoTitle =
"# of SL with #sigma res. > " + sigmaRange.str() +
"#mum (Wheel " + wheel.str() +
")";
313 wheelSigmaHistos[wh] = dbe->book2D(histoName.c_str(),histoTitle.c_str(),12,1,13,11,1,12);
314 wheelSigmaHistos[wh]->setAxisTitle(
"Sector",1);
315 wheelSigmaHistos[wh]->setBinLabel(1,
"MB1_SL1",2);
316 wheelSigmaHistos[wh]->setBinLabel(2,
"MB1_SL2",2);
317 wheelSigmaHistos[wh]->setBinLabel(3,
"MB1_SL3",2);
318 wheelSigmaHistos[wh]->setBinLabel(4,
"MB2_SL1",2);
319 wheelSigmaHistos[wh]->setBinLabel(5,
"MB2_SL2",2);
320 wheelSigmaHistos[wh]->setBinLabel(6,
"MB2_SL3",2);
321 wheelSigmaHistos[wh]->setBinLabel(7,
"MB3_SL1",2);
322 wheelSigmaHistos[wh]->setBinLabel(8,
"MB3_SL2",2);
323 wheelSigmaHistos[wh]->setBinLabel(9,
"MB3_SL3",2);
324 wheelSigmaHistos[wh]->setBinLabel(10,
"MB4_SL1",2);
325 wheelSigmaHistos[wh]->setBinLabel(11,
"MB4_SL3",2);
334 stringstream wheel; wheel << wh;
335 stringstream sector; sector << sect;
338 string MeanHistoName =
"MeanTest_W" + wheel.str() +
"_Sec" + sector.str();
339 string SigmaHistoName =
"SigmaTest_W" + wheel.str() +
"_Sec" + sector.str();
341 string folder =
topHistoFolder +
"/Wheel" + wheel.str() +
"/Sector" + sector.str();
342 dbe->setCurrentFolder(folder);
344 if(sect!=4 && sect!=10) {
345 MeanHistos[make_pair(wh,sect)] =
346 dbe->book1D(MeanHistoName.c_str(),
"Mean (from gaussian fit) of the residuals distribution",11,1,12);
348 MeanHistos[make_pair(wh,sect)] =
349 dbe->book1D(MeanHistoName.c_str(),
"Mean (from gaussian fit) of the residuals distribution",13,1,14);
351 (MeanHistos[make_pair(wh,sect)])->setBinLabel(1,
"MB1_SL1",1);
352 (MeanHistos[make_pair(wh,sect)])->setBinLabel(2,
"MB1_SL2",1);
353 (MeanHistos[make_pair(wh,sect)])->setBinLabel(3,
"MB1_SL3",1);
354 (MeanHistos[make_pair(wh,sect)])->setBinLabel(4,
"MB2_SL1",1);
355 (MeanHistos[make_pair(wh,sect)])->setBinLabel(5,
"MB2_SL2",1);
356 (MeanHistos[make_pair(wh,sect)])->setBinLabel(6,
"MB2_SL3",1);
357 (MeanHistos[make_pair(wh,sect)])->setBinLabel(7,
"MB3_SL1",1);
358 (MeanHistos[make_pair(wh,sect)])->setBinLabel(8,
"MB3_SL2",1);
359 (MeanHistos[make_pair(wh,sect)])->setBinLabel(9,
"MB3_SL3",1);
360 (MeanHistos[make_pair(wh,sect)])->setBinLabel(10,
"MB4_SL1",1);
361 (MeanHistos[make_pair(wh,sect)])->setBinLabel(11,
"MB4_SL3",1);
363 (MeanHistos[make_pair(wh,sect)])->setBinLabel(12,
"MB4S4_SL1",1);
364 (MeanHistos[make_pair(wh,sect)])->setBinLabel(13,
"MB4S4_SL3",1);
367 (MeanHistos[make_pair(wh,sect)])->setBinLabel(12,
"MB4S10_SL1",1);
368 (MeanHistos[make_pair(wh,sect)])->setBinLabel(13,
"MB4S10_SL3",1);
371 if(sect!=4 && sect!=10) {
372 SigmaHistos[make_pair(wh,sect)] =
373 dbe->book1D(SigmaHistoName.c_str(),
"Sigma (from gaussian fit) of the residuals distribution",11,1,12);
375 SigmaHistos[make_pair(wh,sect)] =
376 dbe->book1D(SigmaHistoName.c_str(),
"Sigma (from gaussian fit) of the residuals distribution",13,1,14);
378 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(1,
"MB1_SL1",1);
379 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(2,
"MB1_SL2",1);
380 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(3,
"MB1_SL3",1);
381 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(4,
"MB2_SL1",1);
382 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(5,
"MB2_SL2",1);
383 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(6,
"MB2_SL3",1);
384 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(7,
"MB3_SL1",1);
385 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(8,
"MB3_SL2",1);
386 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(9,
"MB3_SL3",1);
387 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(10,
"MB4_SL1",1);
388 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(11,
"MB4_SL3",1);
390 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(12,
"MB4S13_SL1",1);
391 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(13,
"MB4S13_SL3",1);
394 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(12,
"MB4S14_SL1",1);
395 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(13,
"MB4S14_SL3",1);
404 stringstream wheel; wheel << slID.
wheel();
406 stringstream sector; sector << slID.
sector();
407 stringstream superLayer; superLayer << slID.
superlayer();
411 "/Sector" + sector.str() +
412 "/Station" + station.str() +
"/";
414 if(doCalibAnalysis) folderName =
415 "DT/DTCalibValidation/Wheel" + wheel.str() +
416 "/Station" + station.str() +
"/Sector" + sector.str() +
"/";
418 string histoname = folderName +
"hResDist"
420 +
"_St" + station.str()
421 +
"_Sec" + sector.str()
422 +
"_SL" + superLayer.str();
424 if(doCalibAnalysis) histoname = folderName +
"hResDist_STEP3"
426 +
"_St" + station.str()
427 +
"_Sec" + sector.str()
428 +
"_SL" + superLayer.str();
437 return (
int) (bin /3.1)+1;
443 if(ret == 0 || bin == 11) ret = 3;
450 return fabs(mean) < permittedMeanRange;
455 return sigma < permittedSigmaRange;
460 globalResSummary->Reset();
462 for(map<int, MonitorElement*> ::const_iterator
histo = wheelMeanHistos.begin();
463 histo != wheelMeanHistos.end();
465 (*histo).second->Reset();
467 for(map<int, MonitorElement*> ::const_iterator
histo = wheelSigmaHistos.begin();
468 histo != wheelSigmaHistos.end();
470 (*histo).second->Reset();
473 for(
int indx = -2; indx != 3; ++indx) {
474 meanDistr[indx]->Reset();
475 sigmaDistr[indx]->Reset();
T getUntrackedParameter(std::string const &, T const &) const
DTResolutionAnalysisTest(const edm::ParameterSet &ps)
Constructor.
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
DQM Client Diagnostic.
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
std::string getMEName(const DTSuperLayerId &slID)
Get the ME name.
virtual ~DTResolutionAnalysisTest()
Destructor.
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
bool meanInRange(double mean) const
std::pair< std::string, MonitorElement * > entry
int superLayer() const
Return the superlayer number.
int superlayer() const
Return the superlayer number (deprecated method name)
int slFromBin(int bin) const
int stationFromBin(int bin) const
TH1F * getTH1F(void) const
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
void bookHistos(int wh)
book the summary histograms
int station() const
Return the station number.
int wheel() const
Return the wheel number.
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
bool sigmaInRange(double sigma) const
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
void endRun(edm::Run const &run, edm::EventSetup const &c)