39 LogTrace (
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<
"[DTResolutionAnalysisTest]: Constructor";
56 LogTrace (
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<
"DTResolutionAnalysisTest: analyzed " << nevents <<
" events";
62 LogTrace (
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<
"[DTResolutionAnalysisTest]: BeginRun";
77 globalResSummary = ibooker.
book2D(
"ResidualsGlbSummary",
"# of SLs with good mean and good sigma of residuals",12,1,13,5,-2,3);
81 meanDistr[-2] = ibooker.
book1D(
"MeanDistr",
"Mean value of the residuals all (cm)",
83 meanDistr[-1] = ibooker.
book1D(
"MeanDistr_Phi",
"Mean value of the residuals #phi SL (cm)",
85 meanDistr[0] = ibooker.
book1D(
"MeanDistr_ThetaWh0",
"Mean values of the residuals #theta SL Wh 0 (cm)",
87 meanDistr[1] = ibooker.
book1D(
"MeanDistr_ThetaWh1",
"Mean value of the residuals #theta SL Wh +/-1 (cm)",
89 meanDistr[2] = ibooker.
book1D(
"MeanDistr_ThetaWh2",
"Mean value of the residuals #theta SL Wh +/-2 (cm)",
93 string histoTitle =
"# of SLs with good mean of residuals";
95 wheelMeanHistos[3] = ibooker.
book2D(
"MeanResGlbSummary",histoTitle.c_str(),12,1,13,5,-2,3);
97 wheelMeanHistos[3]->setAxisTitle(
"Wheel",2);
100 sigmaDistr[-2] = ibooker.
book1D(
"SigmaDistr",
"Sigma value of the residuals all (cm)",
102 sigmaDistr[-1] = ibooker.
book1D(
"SigmaDistr_Phi",
"Sigma value of the residuals #phi SL (cm)",
104 sigmaDistr[0] = ibooker.
book1D(
"SigmaDistr_ThetaWh0",
"Sigma value of the residuals #theta SL Wh 0 (cm)",
106 sigmaDistr[1] = ibooker.
book1D(
"SigmaDistr_ThetaWh1",
"Sigma value of the residuals #theta SL Wh +/-1 (cm)",
108 sigmaDistr[2] = ibooker.
book1D(
"SigmaDistr_ThetaWh2",
"Sigma value of the residuals #theta SL Wh +/-2 (cm)",
111 histoTitle =
"# of SLs with good sigma of residuals";
112 wheelSigmaHistos[3] = ibooker.
book2D(
"SigmaResGlbSummary",histoTitle.c_str(),12,1,13,5,-2,3);
114 wheelSigmaHistos[3]->setAxisTitle(
"Wheel",2);
120 for (
int sector=1; sector<=12; sector++){
129 if (!igetter.
dirExists(topHistoFolder)) {
130 LogTrace (
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest")
131 <<
"[DTResolutionAnalysisTest]: Base folder " << topHistoFolder
132 <<
" does not exist. Skipping client operation." << endl;
139 LogTrace (
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest")
140 <<
"[DTResolutionAnalysisTest]: End of Run transition, performing the DQM client operation" << endl;
145 for (vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
146 ch_it != muonGeom->chambers().end(); ++ch_it) {
151 for(vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
152 sl_it != (*ch_it)->superLayers().end(); ++sl_it) {
159 float statMean = res_histo->
getMean(1);
160 float statSigma = res_histo->
getRMS(1);
163 TH1F * histo_root = res_histo->
getTH1F();
167 int binSect = slID.
sector();
168 if(slID.
sector() == 13) binSect = 4;
169 else if(slID.
sector() == 14) binSect = 10;
175 if(histo_root->GetEntries()>20) {
176 TF1 *gfit =
new TF1(
"Gaussian",
"gaus",(statMean-(2*statSigma)),(statMean+(2*statSigma)));
178 histo_root->Fit(gfit,
"Q0",
"", -0.1, 0.1);
180 LogWarning (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask")
181 <<
"[DTResolutionAnalysisTask]: Exception when fitting SL : " << slID;
184 if((binSect == 4 || binSect == 10) && slID.
station() == 4) weight = 1/22.;
185 globalResSummary->Fill(binSect, slID.
wheel(),
weight);
191 mean = gfit->GetParameter(1);
192 sigma = gfit->GetParameter(2);
195 meanDistr[-2]->Fill(mean);
196 sigmaDistr[-2]->Fill(sigma);
201 meanDistr[-1]->Fill(mean);
202 sigmaDistr[-1]->Fill(sigma);
206 MeanHistos[make_pair(slID.
wheel(),binSect)]->setBinContent(binSL, mean);
207 SigmaHistos[make_pair(slID.
wheel(),binSect)]->setBinContent(binSL, sigma);
209 if((slID.
sector() == 13 || slID.
sector() == 14) && binSL == 12) binSL=10;
210 if((slID.
sector() == 13 || slID.
sector() == 14) && binSL == 13) binSL=11;
215 double MeanVal = wheelMeanHistos[slID.
wheel()]->getBinContent(binSect,binSL);
216 double MeanBinVal = (MeanVal > 0. && MeanVal < meanInRange(mean)) ? MeanVal : meanInRange(mean);
217 wheelMeanHistos[slID.
wheel()]->setBinContent(binSect,binSL,MeanBinVal);
219 double SigmaVal = wheelSigmaHistos[slID.
wheel()]->getBinContent(binSect,binSL);
220 double SigmaBinVal = (SigmaVal > 0. && SigmaVal < sigmaInRange(sigma)) ? SigmaVal : sigmaInRange(sigma);
221 wheelSigmaHistos[slID.
wheel()]->setBinContent(binSect,binSL,SigmaBinVal);
224 wheelMeanHistos[slID.
wheel()]->setBinContent(binSect,binSL,meanInRange(mean));
225 wheelSigmaHistos[slID.
wheel()]->setBinContent(binSect,binSL,sigmaInRange(sigma));
230 if((binSect == 4 || binSect == 10) && slID.
station() == 4) weight = 1/22.;
233 if( (meanInRange(mean) > 0.85) && (sigmaInRange(sigma) > 0.85) ) {
234 globalResSummary->Fill(binSect, slID.
wheel(),
weight);
235 wheelMeanHistos[3]->Fill(binSect,slID.
wheel(),
weight);
236 wheelSigmaHistos[3]->Fill(binSect,slID.
wheel(),
weight);
238 if( (meanInRange(mean) < 0.85) && (sigmaInRange(sigma) > 0.85) ) {
239 wheelSigmaHistos[3]->Fill(binSect,slID.
wheel(),
weight);
241 if((meanInRange(mean) > 0.85) && (sigmaInRange(sigma) < 0.85) ) {
242 wheelMeanHistos[3]->Fill(binSect,slID.
wheel(),
weight);
249 LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask")
250 <<
"[DTResolutionAnalysisTask] Fit of " << slID
251 <<
" not performed because # entries < 20 ";
254 if((binSect == 4 || binSect == 10) && slID.
station() == 4) weight = 1/22.;
255 globalResSummary->Fill(binSect, slID.
wheel(),
weight);
256 wheelMeanHistos[3]->Fill(binSect,slID.
wheel(),
weight);
257 wheelSigmaHistos[3]->Fill(binSect,slID.
wheel(),
weight);
258 wheelMeanHistos[slID.
wheel()]->setBinContent(binSect,binSL,1.);
259 wheelSigmaHistos[slID.
wheel()]->setBinContent(binSect,binSL,1.);
262 LogWarning (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask")
263 <<
"[DTResolutionAnalysisTask] Histo: " << getMEName(slID) <<
" not found" << endl;
272 stringstream
wheel; wheel <<wh;
275 string histoName =
"MeanSummaryRes_W" + wheel.str();
276 string histoTitle =
"# of SLs with wrong mean of residuals (Wheel " + wheel.str() +
")";
278 wheelMeanHistos[wh] = ibooker.
book2D(histoName.c_str(),histoTitle.c_str(),12,1,13,11,1,12);
280 wheelMeanHistos[wh]->setBinLabel(1,
"MB1_SL1",2);
281 wheelMeanHistos[wh]->setBinLabel(2,
"MB1_SL2",2);
282 wheelMeanHistos[wh]->setBinLabel(3,
"MB1_SL3",2);
283 wheelMeanHistos[wh]->setBinLabel(4,
"MB2_SL1",2);
284 wheelMeanHistos[wh]->setBinLabel(5,
"MB2_SL2",2);
285 wheelMeanHistos[wh]->setBinLabel(6,
"MB2_SL3",2);
286 wheelMeanHistos[wh]->setBinLabel(7,
"MB3_SL1",2);
287 wheelMeanHistos[wh]->setBinLabel(8,
"MB3_SL2",2);
288 wheelMeanHistos[wh]->setBinLabel(9,
"MB3_SL3",2);
289 wheelMeanHistos[wh]->setBinLabel(10,
"MB4_SL1",2);
290 wheelMeanHistos[wh]->setBinLabel(11,
"MB4_SL3",2);
293 histoName =
"SigmaSummaryRes_W" + wheel.str();
294 histoTitle =
"# of SLs with wrong sigma of residuals (Wheel " + wheel.str() +
")";
296 wheelSigmaHistos[wh] = ibooker.
book2D(histoName.c_str(),histoTitle.c_str(),12,1,13,11,1,12);
298 wheelSigmaHistos[wh]->setBinLabel(1,
"MB1_SL1",2);
299 wheelSigmaHistos[wh]->setBinLabel(2,
"MB1_SL2",2);
300 wheelSigmaHistos[wh]->setBinLabel(3,
"MB1_SL3",2);
301 wheelSigmaHistos[wh]->setBinLabel(4,
"MB2_SL1",2);
302 wheelSigmaHistos[wh]->setBinLabel(5,
"MB2_SL2",2);
303 wheelSigmaHistos[wh]->setBinLabel(6,
"MB2_SL3",2);
304 wheelSigmaHistos[wh]->setBinLabel(7,
"MB3_SL1",2);
305 wheelSigmaHistos[wh]->setBinLabel(8,
"MB3_SL2",2);
306 wheelSigmaHistos[wh]->setBinLabel(9,
"MB3_SL3",2);
307 wheelSigmaHistos[wh]->setBinLabel(10,
"MB4_SL1",2);
308 wheelSigmaHistos[wh]->setBinLabel(11,
"MB4_SL3",2);
313 stringstream
wheel; wheel << wh;
314 stringstream sector; sector << sect;
317 string MeanHistoName =
"MeanTest_W" + wheel.str() +
"_Sec" + sector.str();
318 string SigmaHistoName =
"SigmaTest_W" + wheel.str() +
"_Sec" + sector.str();
320 string folder = topHistoFolder +
"/Wheel" + wheel.str() +
"/Sector" + sector.str();
323 if(sect!=4 && sect!=10) {
324 MeanHistos[make_pair(wh,sect)] =
326 ibooker.
book1D(MeanHistoName.c_str(),
"Mean (from gaussian fit) of the residuals distribution",11,1,12);
328 MeanHistos[make_pair(wh,sect)] =
329 ibooker.
book1D(MeanHistoName.c_str(),
"Mean (from gaussian fit) of the residuals distribution",13,1,14);
331 (MeanHistos[make_pair(wh,sect)])->setBinLabel(1,
"MB1_SL1",1);
332 (MeanHistos[make_pair(wh,sect)])->setBinLabel(2,
"MB1_SL2",1);
333 (MeanHistos[make_pair(wh,sect)])->setBinLabel(3,
"MB1_SL3",1);
334 (MeanHistos[make_pair(wh,sect)])->setBinLabel(4,
"MB2_SL1",1);
335 (MeanHistos[make_pair(wh,sect)])->setBinLabel(5,
"MB2_SL2",1);
336 (MeanHistos[make_pair(wh,sect)])->setBinLabel(6,
"MB2_SL3",1);
337 (MeanHistos[make_pair(wh,sect)])->setBinLabel(7,
"MB3_SL1",1);
338 (MeanHistos[make_pair(wh,sect)])->setBinLabel(8,
"MB3_SL2",1);
339 (MeanHistos[make_pair(wh,sect)])->setBinLabel(9,
"MB3_SL3",1);
340 (MeanHistos[make_pair(wh,sect)])->setBinLabel(10,
"MB4_SL1",1);
341 (MeanHistos[make_pair(wh,sect)])->setBinLabel(11,
"MB4_SL3",1);
343 (MeanHistos[make_pair(wh,sect)])->setBinLabel(12,
"MB4S13_SL1",1);
344 (MeanHistos[make_pair(wh,sect)])->setBinLabel(13,
"MB4S13_SL3",1);
347 (MeanHistos[make_pair(wh,sect)])->setBinLabel(12,
"MB4S14_SL1",1);
348 (MeanHistos[make_pair(wh,sect)])->setBinLabel(13,
"MB4S14_SL3",1);
351 if(sect!=4 && sect!=10) {
352 SigmaHistos[make_pair(wh,sect)] =
353 ibooker.
book1D(SigmaHistoName.c_str(),
"Sigma (from gaussian fit) of the residuals distribution",11,1,12);
355 SigmaHistos[make_pair(wh,sect)] =
356 ibooker.
book1D(SigmaHistoName.c_str(),
"Sigma (from gaussian fit) of the residuals distribution",13,1,14);
358 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(1,
"MB1_SL1",1);
359 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(2,
"MB1_SL2",1);
360 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(3,
"MB1_SL3",1);
361 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(4,
"MB2_SL1",1);
362 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(5,
"MB2_SL2",1);
363 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(6,
"MB2_SL3",1);
364 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(7,
"MB3_SL1",1);
365 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(8,
"MB3_SL2",1);
366 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(9,
"MB3_SL3",1);
367 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(10,
"MB4_SL1",1);
368 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(11,
"MB4_SL3",1);
370 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(12,
"MB4S13_SL1",1);
371 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(13,
"MB4S13_SL3",1);
374 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(12,
"MB4S14_SL1",1);
375 (SigmaHistos[make_pair(wh,sect)])->setBinLabel(13,
"MB4S14_SL3",1);
386 stringstream sector; sector << slID.
sector();
387 stringstream superLayer; superLayer << slID.
superlayer();
390 topHistoFolder +
"/Wheel" + wheel.str() +
391 "/Sector" + sector.str() +
392 "/Station" + station.str() +
"/";
394 if(doCalibAnalysis) folderName =
395 "DT/DTCalibValidation/Wheel" + wheel.str() +
396 "/Station" + station.str() +
"/Sector" + sector.str() +
"/";
398 string histoname = folderName +
"hResDist" 400 +
"_St" + station.str()
401 +
"_Sec" + sector.str()
402 +
"_SL" + superLayer.str();
404 if(doCalibAnalysis) histoname = folderName +
"hResDist_STEP3" 406 +
"_St" + station.str()
407 +
"_Sec" + sector.str()
408 +
"_SL" + superLayer.str();
417 return (
int) (bin /3.1)+1;
423 if(ret == 0 || bin == 11) ret = 3;
430 if( fabs(mean) <= maxGoodMeanValue ) {value = 1.;}
431 else if( fabs(mean) > maxGoodMeanValue && fabs(mean) < minBadMeanValue ) {value = 0.9;}
432 else if( fabs(mean) >= minBadMeanValue ) {value = 0.1;}
438 if( sigma <= maxGoodSigmaValue ) {value = 1.;}
439 else if( sigma > maxGoodSigmaValue && sigma < minBadSigmaValue ) {value = 0.9;}
440 else if( sigma >= minBadSigmaValue ) {value = 0.1;}
445 globalResSummary->Reset();
447 for(map<int, MonitorElement*> ::const_iterator
histo = wheelMeanHistos.begin();
448 histo != wheelMeanHistos.end();
450 (*histo).second->Reset();
452 for(map<int, MonitorElement*> ::const_iterator
histo = wheelSigmaHistos.begin();
453 histo != wheelSigmaHistos.end();
455 (*histo).second->Reset();
458 for(
int indx = -2; indx != 3; ++indx) {
459 meanDistr[indx]->Reset();
460 sigmaDistr[indx]->Reset();
T getUntrackedParameter(std::string const &, T const &) const
void bookHistos(DQMStore::IBooker &)
double meanInRange(double mean) const
DTResolutionAnalysisTest(const edm::ParameterSet &ps)
Constructor.
MonitorElement * get(const std::string &path)
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)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
int superLayer() const
Return the superlayer number.
bin
set the eta bin as selection string.
bool dirExists(const std::string &path)
int superlayer() const
Return the superlayer number (deprecated method name)
int slFromBin(int bin) const
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
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)
double sigmaInRange(double sigma) const
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &)
int station() const
Return the station number.
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 beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.