00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <DQM/DTMonitorClient/src/DTResolutionTest.h>
00013
00014
00015 #include <FWCore/Framework/interface/Event.h>
00016 #include "DataFormats/Common/interface/Handle.h"
00017 #include <FWCore/Framework/interface/ESHandle.h>
00018 #include <FWCore/Framework/interface/EventSetup.h>
00019 #include <FWCore/ParameterSet/interface/ParameterSet.h>
00020
00021
00022
00023 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00024 #include "Geometry/DTGeometry/interface/DTChamber.h"
00025 #include "Geometry/DTGeometry/interface/DTGeometry.h"
00026
00027
00028
00029 #include "DQMServices/Core/interface/DQMStore.h"
00030 #include "DQMServices/Core/interface/MonitorElement.h"
00031 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00032
00033 #include <iostream>
00034 #include <stdio.h>
00035 #include <string>
00036 #include <sstream>
00037 #include <math.h>
00038 #include "TF1.h"
00039
00040
00041 using namespace edm;
00042 using namespace std;
00043
00044
00045 DTResolutionTest::DTResolutionTest(const edm::ParameterSet& ps){
00046
00047 edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Constructor";
00048 parameters = ps;
00049
00050 dbe = edm::Service<DQMStore>().operator->();
00051 if(ps.getUntrackedParameter<bool>("readFile", false))
00052 dbe->open(ps.getUntrackedParameter<string>("inputFile", "residuals.root"));
00053
00054 prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
00055
00056 percentual = parameters.getUntrackedParameter<int>("BadSLpercentual", 10);
00057
00058
00059
00060 }
00061
00062
00063 DTResolutionTest::~DTResolutionTest(){
00064
00065 edm::LogVerbatim ("resolution") << "DTResolutionTest: analyzed " << nevents << " events";
00066
00067 }
00068
00069
00070 void DTResolutionTest::beginRun(const edm::Run& run, const edm::EventSetup& context){
00071
00072 edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: BeginRun";
00073
00074 nevents = 0;
00075
00076 context.get<MuonGeometryRecord>().get(muonGeom);
00077
00078
00079 for(int wheel=-2; wheel<3; wheel++){
00080 bookHistos(wheel);
00081 }
00082 vector<DTChamber*> chambers = muonGeom->chambers();
00083 for(vector<DTChamber*>::const_iterator chamber = chambers.begin();
00084 chamber != chambers.end(); ++chamber) {
00085 bookHistos((*chamber)->id());
00086 }
00087
00088 }
00089
00090
00091 void DTResolutionTest::beginLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00092
00093 edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: Begin of LS transition";
00094
00095
00096 run = lumiSeg.run();
00097 }
00098
00099
00100 void DTResolutionTest::analyze(const edm::Event& e, const edm::EventSetup& context){
00101
00102 nevents++;
00103 edm::LogVerbatim ("resolution") << "[DTResolutionTest]: "<<nevents<<" events";
00104
00105 }
00106
00107
00108
00109 void DTResolutionTest::endLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00110
00111
00112
00113
00114
00115
00116
00117
00118 edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: End of LS transition, performing the DQM client operation";
00119
00120
00121 nLumiSegs = lumiSeg.id().luminosityBlock();
00122
00123
00124 if ( nLumiSegs%prescaleFactor != 0 ) return;
00125
00126 for(map<int, MonitorElement*> ::const_iterator histo = wheelMeanHistos.begin();
00127 histo != wheelMeanHistos.end();
00128 histo++) {
00129 (*histo).second->Reset();
00130 }
00131 if(parameters.getUntrackedParameter<bool>("sigmaTest")){
00132 for(map<int, MonitorElement*> ::const_iterator histo = wheelSigmaHistos.begin();
00133 histo != wheelSigmaHistos.end();
00134 histo++) {
00135 (*histo).second->Reset();
00136 }
00137 }
00138 if(parameters.getUntrackedParameter<bool>("slopeTest")){
00139 for(map<int, MonitorElement*> ::const_iterator histo = wheelSlopeHistos.begin();
00140 histo != wheelSlopeHistos.end();
00141 histo++) {
00142 (*histo).second->Reset();
00143 }
00144 }
00145
00146 cmsMeanHistos.clear();
00147 for(int i=-2; i<3; i++){
00148 for(int j=1; j<15; j++){
00149 MeanFilled[make_pair(i,j)]=false;
00150 }
00151 }
00152 if(parameters.getUntrackedParameter<bool>("sigmaTest")){
00153 cmsSigmaHistos.clear();
00154 for(int i=-2; i<3; i++){
00155 for(int j=1; j<15; j++){
00156 SigmaFilled[make_pair(i,j)]=false;
00157 }
00158 }
00159 }
00160 if(parameters.getUntrackedParameter<bool>("slopeTest")){
00161 cmsSlopeHistos.clear();
00162 for(int i=-2; i<3; i++){
00163 for(int j=1; j<15; j++){
00164 SlopeFilled[make_pair(i,j)]=false;
00165 }
00166 }
00167 }
00168
00169
00170
00171 for(int wh=-2; wh<=3; wh++){
00172 if(wh!=3){
00173 for(int xBin=0; xBin<14; xBin++){
00174 for(int yBin=0; yBin<11; yBin++){
00175 wheelMeanHistos[wh]->setBinContent(xBin,yBin,0);
00176 if(parameters.getUntrackedParameter<bool>("sigmaTest"))
00177 wheelSigmaHistos[wh]->setBinContent(xBin,yBin,0);
00178 if(parameters.getUntrackedParameter<bool>("slopeTest"))
00179 wheelSlopeHistos[wh]->setBinContent(xBin,yBin,0);
00180 }
00181 }
00182 }
00183 else{
00184 for(int xBin=0; xBin<14; xBin++){
00185 for(int yBin=-2; yBin<3; yBin++){
00186 wheelMeanHistos[wh]->setBinContent(xBin,yBin,0);
00187 if(parameters.getUntrackedParameter<bool>("sigmaTest"))
00188 wheelSigmaHistos[wh]->setBinContent(xBin,yBin,0);
00189 if(parameters.getUntrackedParameter<bool>("slopeTest"))
00190 wheelSlopeHistos[wh]->setBinContent(xBin,yBin,0);
00191 }
00192 }
00193 }
00194 }
00195
00196
00197 edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: "<<nLumiSegs<<" updates";
00198
00199 vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
00200 vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
00201
00202 edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Residual Distribution tests results";
00203
00204 for (; ch_it != ch_end; ++ch_it) {
00205
00206 DTChamberId chID = (*ch_it)->id();
00207
00208
00209 int entry=-1;
00210 if(chID.station() == 1) entry=0;
00211 if(chID.station() == 2) entry=3;
00212 if(chID.station() == 3) entry=6;
00213 if(chID.station() == 4) entry=9;
00214
00215 vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
00216 vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
00217
00218 for(; sl_it != sl_end; ++sl_it) {
00219
00220 DTSuperLayerId slID = (*sl_it)->id();
00221
00222 edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Superlayer: " << slID;
00223
00224 stringstream wheel; wheel << slID.wheel();
00225 stringstream station; station << slID.station();
00226 stringstream sector; sector << slID.sector();
00227 stringstream superLayer; superLayer << slID.superlayer();
00228
00229 string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
00230 string supLayer = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str();
00231
00232 MonitorElement * res_histo = dbe->get(getMEName(slID));
00233 if (res_histo) {
00234
00235 string GaussianCriterionName =
00236 parameters.getUntrackedParameter<string>("resDistributionTestName",
00237 "ResidualsDistributionGaussianTest");
00238 const QReport * GaussianReport = res_histo->getQReport(GaussianCriterionName);
00239 if(GaussianReport){
00240
00241
00242 }
00243 int BinNumber = entry+slID.superLayer();
00244 if(BinNumber == 12) BinNumber=11;
00245 float mean = (*res_histo).getMean(1);
00246 float sigma = (*res_histo).getRMS(1);
00247 MeanHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, mean);
00248 if(parameters.getUntrackedParameter<bool>("sigmaTest"))
00249 SigmaHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, sigma);
00250 }
00251
00252 if(parameters.getUntrackedParameter<bool>("slopeTest")){
00253 MonitorElement * res_histo_2D = dbe->get(getMEName2D(slID));
00254 if (res_histo_2D) {
00255 TH2F * res_histo_2D_root = res_histo_2D->getTH2F();
00256 int BinNumber = entry+slID.superLayer();
00257 if(BinNumber == 12) BinNumber=11;
00258 TProfile* prof = res_histo_2D_root->ProfileX();
00259 prof->GetXaxis()->SetRangeUser(0,2);
00260
00261 try {
00262 prof->Fit("pol1","Q0");
00263 } catch (...) {
00264 edm::LogError ("resolution") << "[DTResolutionTest]: Exception when fitting..."
00265 << "SuperLayer : " << slID << "\n"
00266 << " STEP : " << parameters.getUntrackedParameter<string>("STEP", "STEP3") << "\n"
00267 << "Filling slope histogram with standard value -99. for bin " << BinNumber;
00268 SlopeHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, -99.);
00269 continue;
00270 }
00271 TF1 *fitting = prof->GetFunction("pol1");
00272 double slope = fitting->GetParameter(1);
00273 SlopeHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, slope);
00274 }
00275 }
00276
00277 }
00278 }
00279
00280
00281 string MeanCriterionName = parameters.getUntrackedParameter<string>("meanTestName","ResidualsMeanInRange");
00282 for(map<pair<int,int>, MonitorElement*>::const_iterator hMean = MeanHistos.begin();
00283 hMean != MeanHistos.end();
00284 hMean++) {
00285 const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName);
00286 stringstream wheel; wheel << (*hMean).first.first;
00287 stringstream sector; sector << (*hMean).first.second;
00288
00289 if(theMeanQReport) {
00290 vector<dqm::me_util::Channel> badChannels = theMeanQReport->getBadChannels();
00291 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
00292 channel != badChannels.end(); channel++) {
00293 edm::LogError("resolution") << "Bad mean channel: wh: " << wheel.str()
00294 << " st: " << stationFromBin((*channel).getBin())
00295 << " sect: " <<sector.str()
00296 << " sl: " << slFromBin((*channel).getBin())
00297 << " mean (cm): " << (*channel).getContents();
00298 string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
00299 if(parameters.getUntrackedParameter<bool>("meanWrongHisto")){
00300 MeanHistosSetRange.find(HistoName)->second->Fill((*channel).getBin());
00301 MeanHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents());
00302 }
00303
00304 if(abs((*channel).getContents())<parameters.getUntrackedParameter<double>("meanMaxLimit"))
00305 wheelMeanHistos[(*hMean).first.first]->Fill(((*hMean).first.second)-1,(*channel).getBin()-1,1);
00306 else
00307 wheelMeanHistos[(*hMean).first.first]->Fill(((*hMean).first.second)-1,(*channel).getBin()-1,2);
00308
00309
00310 if(abs((*channel).getContents())>parameters.getUntrackedParameter<double>("meanMaxLimit")){
00311 cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)]++;
00312 if(((*hMean).first.second<13 &&
00313 double(cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)])/11>double(percentual)/100 &&
00314 MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]==false) ||
00315 ((*hMean).first.first>=13 &&
00316 double(cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)])/2>double(percentual)/100 &&
00317 MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]==false)){
00318 MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]=true;
00319 wheelMeanHistos[3]->Fill(((*hMean).first.second)-1,(*hMean).first.first);
00320 }
00321 }
00322 }
00323
00324
00325 }
00326 }
00327
00328
00329 if(parameters.getUntrackedParameter<bool>("sigmaTest")){
00330 string SigmaCriterionName = parameters.getUntrackedParameter<string>("sigmaTestName","ResidualsSigmaInRange");
00331 for(map<pair<int,int>, MonitorElement*>::const_iterator hSigma = SigmaHistos.begin();
00332 hSigma != SigmaHistos.end();
00333 hSigma++) {
00334 const QReport * theSigmaQReport = (*hSigma).second->getQReport(SigmaCriterionName);
00335 stringstream wheel; wheel << (*hSigma).first.first;
00336 stringstream sector; sector << (*hSigma).first.second;
00337 if(theSigmaQReport) {
00338 vector<dqm::me_util::Channel> badChannels = theSigmaQReport->getBadChannels();
00339 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
00340 channel != badChannels.end(); channel++) {
00341 edm::LogError("resolution") << "Bad sigma: wh: " << wheel.str()
00342 << " st: " << stationFromBin((*channel).getBin())
00343 << " sect: " <<sector.str()
00344 << " sl: " << slFromBin((*channel).getBin())
00345 << " sigma (cm): " << (*channel).getContents();
00346 string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
00347 SigmaHistosSetRange.find(HistoName)->second->Fill((*channel).getBin());
00348 SigmaHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents());
00349
00350 wheelSigmaHistos[(*hSigma).first.first]->Fill(((*hSigma).first.second)-1,(*channel).getBin()-1);
00351
00352
00353 cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)]++;
00354 if(((*hSigma).first.second<13 &&
00355 double(cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)])/11>double(percentual)/100 &&
00356 SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]==false) ||
00357 ((*hSigma).first.first>=13 &&
00358 double(cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)])/2>double(percentual)/100 &&
00359 SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]==false)){
00360 SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]=true;
00361 wheelSigmaHistos[3]->Fill((*hSigma).first.second-1,(*hSigma).first.first);
00362 }
00363 }
00364
00365
00366 }
00367 }
00368 }
00369
00370
00371 if(parameters.getUntrackedParameter<bool>("slopeTest")){
00372 string SlopeCriterionName = parameters.getUntrackedParameter<string>("slopeTestName","ResidualsSlopeInRange");
00373 for(map<pair<int,int>, MonitorElement*>::const_iterator hSlope = SlopeHistos.begin();
00374 hSlope != SlopeHistos.end();
00375 hSlope++) {
00376 const QReport * theSlopeQReport = (*hSlope).second->getQReport(SlopeCriterionName);
00377 stringstream wheel; wheel << (*hSlope).first.first;
00378 stringstream sector; sector << (*hSlope).first.second;
00379 if(theSlopeQReport) {
00380 vector<dqm::me_util::Channel> badChannels = theSlopeQReport->getBadChannels();
00381 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
00382 channel != badChannels.end(); channel++) {
00383 edm::LogError("resolution") << "Bad slope: wh: " << wheel.str()
00384 << " st: " << stationFromBin((*channel).getBin())
00385 << " sect: " <<sector.str()
00386 << " sl: " << slFromBin((*channel).getBin())
00387 << " slope: " << (*channel).getContents();
00388 string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
00389 SlopeHistosSetRange.find(HistoName)->second->Fill((*channel).getBin());
00390 SlopeHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents());
00391
00392 wheelSlopeHistos[(*hSlope).first.first]->Fill(((*hSlope).first.second)-1,(*channel).getBin()-1);
00393
00394
00395 cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)]++;
00396 if(((*hSlope).first.second<13 &&
00397 double(cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)])/11>double(percentual)/100 &&
00398 SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]==false) ||
00399 ((*hSlope).first.first>=13 &&
00400 double(cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)])/2>double(percentual)/100 &&
00401 SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]==false)){
00402 SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]=true;
00403 wheelSlopeHistos[3]->Fill((*hSlope).first.second-1,(*hSlope).first.first);
00404 }
00405 }
00406
00407
00408 }
00409 }
00410 }
00411
00412 }
00413
00414
00415
00416 void DTResolutionTest::endJob(){
00417
00418 edm::LogVerbatim ("resolution") << "[DTResolutionTest] endjob called!";
00419
00420
00421 bool outputMEsInRootFile = parameters.getParameter<bool>("OutputMEsInRootFile");
00422 if(outputMEsInRootFile){
00423 std::string outputFileName = parameters.getParameter<std::string>("OutputFileName");
00424 dbe->save(outputFileName,"DT/CalibrationSummary");
00425 }
00426
00427 }
00428
00429
00430
00431 string DTResolutionTest::getMEName(const DTSuperLayerId & slID) {
00432
00433 stringstream wheel; wheel << slID.wheel();
00434 stringstream station; station << slID.station();
00435 stringstream sector; sector << slID.sector();
00436 stringstream superLayer; superLayer << slID.superlayer();
00437
00438 string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
00439 string folderName;
00440
00441 if(parameters.getUntrackedParameter<bool>("calibModule", false)){
00442 folderName =
00443 folderRoot + "DT/DTCalibValidation/Wheel" + wheel.str() +
00444 "/Station" + station.str() +
00445 "/Sector" + sector.str() + "/";
00446 }
00447 else{
00448 folderName =
00449 folderRoot + "DT/DTResolutionAnalysisTask/Wheel" + wheel.str() +
00450 "/Station" + station.str() +
00451 "/Sector" + sector.str() + "/";
00452 }
00453
00454 string histoTag = parameters.getUntrackedParameter<string>("histoTag", "hResDist");
00455
00456 string histoname = folderName + histoTag
00457 + "_W" + wheel.str()
00458 + "_St" + station.str()
00459 + "_Sec" + sector.str()
00460 + "_SL" + superLayer.str();
00461
00462 return histoname;
00463
00464 }
00465
00466
00467 string DTResolutionTest::getMEName2D(const DTSuperLayerId & slID) {
00468
00469 stringstream wheel; wheel << slID.wheel();
00470 stringstream station; station << slID.station();
00471 stringstream sector; sector << slID.sector();
00472 stringstream superLayer; superLayer << slID.superlayer();
00473
00474 string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
00475 string folderName;
00476
00477 if(parameters.getUntrackedParameter<bool>("calibModule", false)){
00478 folderName =
00479 folderRoot + "DT/DTCalibValidation/Wheel" + wheel.str() +
00480 "/Station" + station.str() +
00481 "/Sector" + sector.str() + "/";
00482 }
00483 else{
00484 folderName =
00485 folderRoot + "DT/DTResolutionAnalysisTask/Wheel" + wheel.str() +
00486 "/Station" + station.str() +
00487 "/Sector" + sector.str() + "/";
00488 }
00489
00490 string histoTag2D = parameters.getUntrackedParameter<string>("histoTag2D", "hResDistVsDist");
00491
00492 string histoname = folderName + histoTag2D
00493 + "_W" + wheel.str()
00494 + "_St" + station.str()
00495 + "_Sec" + sector.str()
00496 + "_SL" + superLayer.str();
00497
00498 return histoname;
00499
00500 }
00501
00502
00503
00504 void DTResolutionTest::bookHistos(const DTChamberId & ch) {
00505
00506 stringstream wheel; wheel << ch.wheel();
00507 stringstream sector; sector << ch.sector();
00508
00509
00510 string MeanHistoName = "MeanTest_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str();
00511 string SigmaHistoName = "SigmaTest_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str();
00512 string SlopeHistoName = "SlopeTest_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str();
00513
00514 dbe->setCurrentFolder("DT/Tests/DTResolution");
00515
00516
00517 MeanHistos[make_pair(ch.wheel(),ch.sector())] = dbe->book1D(MeanHistoName.c_str(),MeanHistoName.c_str(),11,0,11);
00518 (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1);
00519 (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1);
00520 (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1);
00521 (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1);
00522 (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1);
00523 (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1);
00524 (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1);
00525 (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1);
00526 (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1);
00527 (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1);
00528 (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1);
00529
00530
00531
00532 if(parameters.getUntrackedParameter<bool>("sigmaTest")){
00533 SigmaHistos[make_pair(ch.wheel(),ch.sector())] = dbe->book1D(SigmaHistoName.c_str(),SigmaHistoName.c_str(),11,0,11);
00534 (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1);
00535 (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1);
00536 (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1);
00537 (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1);
00538 (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1);
00539 (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1);
00540 (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1);
00541 (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1);
00542 (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1);
00543 (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1);
00544 (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1);
00545 }
00546
00547
00548 if(parameters.getUntrackedParameter<bool>("slopeTest")){
00549 SlopeHistos[make_pair(ch.wheel(),ch.sector())] = dbe->book1D(SlopeHistoName.c_str(),SlopeHistoName.c_str(),11,0,11);
00550 (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1);
00551 (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1);
00552 (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1);
00553 (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1);
00554 (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1);
00555 (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1);
00556 (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1);
00557 (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1);
00558 (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1);
00559 (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1);
00560 (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1);
00561 }
00562
00563 string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
00564
00565 if(parameters.getUntrackedParameter<bool>("meanWrongHisto")){
00566 string MeanHistoNameSetRange = "MeanWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange";
00567 MeanHistosSetRange[HistoName] = dbe->book1D(MeanHistoNameSetRange.c_str(),MeanHistoNameSetRange.c_str(),11,0.5,11.5);
00568 string MeanHistoNameSetRange2D = "MeanWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D";
00569 MeanHistosSetRange2D[HistoName] = dbe->book2D(MeanHistoNameSetRange2D.c_str(),MeanHistoNameSetRange2D.c_str(),11, 0.5, 11.5, 100, -0.05, 0.05);
00570 }
00571
00572 if(parameters.getUntrackedParameter<bool>("sigmaTest")){
00573 string SigmaHistoNameSetRange = "SigmaWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange";
00574 SigmaHistosSetRange[HistoName] = dbe->book1D(SigmaHistoNameSetRange.c_str(),SigmaHistoNameSetRange.c_str(),11,0.5,11.5);
00575 string SigmaHistoNameSetRange2D = "SigmaWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D";
00576 SigmaHistosSetRange2D[HistoName] = dbe->book2D(SigmaHistoNameSetRange2D.c_str(),SigmaHistoNameSetRange2D.c_str(),11, 0.5, 11.5, 500, 0, 0.5);
00577 }
00578
00579 if(parameters.getUntrackedParameter<bool>("slopeTest")){
00580 string SlopeHistoNameSetRange = "SlopeWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange";
00581 SlopeHistosSetRange[HistoName] = dbe->book1D(SlopeHistoNameSetRange.c_str(),SlopeHistoNameSetRange.c_str(),11,0.5,11.5);
00582 string SlopeHistoNameSetRange2D = "SlopeWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D";
00583 SlopeHistosSetRange2D[HistoName] = dbe->book2D(SlopeHistoNameSetRange2D.c_str(),SlopeHistoNameSetRange2D.c_str(),11, 0.5, 11.5, 200, -0.1, 0.1);
00584 }
00585
00586 }
00587
00588
00589 void DTResolutionTest::bookHistos(int wh) {
00590
00591 dbe->setCurrentFolder("DT/CalibrationSummary");
00592
00593 if(wheelMeanHistos.find(3) == wheelMeanHistos.end()){
00594 string histoName = "MeanSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter<string>("STEP", "STEP3");
00595 wheelMeanHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3);
00596 wheelMeanHistos[3]->setBinLabel(1,"Sector1",1);
00597 wheelMeanHistos[3]->setBinLabel(1,"Sector1",1);
00598 wheelMeanHistos[3]->setBinLabel(2,"Sector2",1);
00599 wheelMeanHistos[3]->setBinLabel(3,"Sector3",1);
00600 wheelMeanHistos[3]->setBinLabel(4,"Sector4",1);
00601 wheelMeanHistos[3]->setBinLabel(5,"Sector5",1);
00602 wheelMeanHistos[3]->setBinLabel(6,"Sector6",1);
00603 wheelMeanHistos[3]->setBinLabel(7,"Sector7",1);
00604 wheelMeanHistos[3]->setBinLabel(8,"Sector8",1);
00605 wheelMeanHistos[3]->setBinLabel(9,"Sector9",1);
00606 wheelMeanHistos[3]->setBinLabel(10,"Sector10",1);
00607 wheelMeanHistos[3]->setBinLabel(11,"Sector11",1);
00608 wheelMeanHistos[3]->setBinLabel(12,"Sector12",1);
00609 wheelMeanHistos[3]->setBinLabel(13,"Sector13",1);
00610 wheelMeanHistos[3]->setBinLabel(14,"Sector14",1);
00611 wheelMeanHistos[3]->setBinLabel(1,"Wheel-2",2);
00612 wheelMeanHistos[3]->setBinLabel(2,"Wheel-1",2);
00613 wheelMeanHistos[3]->setBinLabel(3,"Wheel0",2);
00614 wheelMeanHistos[3]->setBinLabel(4,"Wheel+1",2);
00615 wheelMeanHistos[3]->setBinLabel(5,"Wheel+2",2);
00616 }
00617
00618 if(parameters.getUntrackedParameter<bool>("sigmaTest")){
00619 if(wheelSigmaHistos.find(3) == wheelSigmaHistos.end()){
00620 string histoName = "SigmaSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter<string>("STEP", "STEP3");
00621 wheelSigmaHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3);
00622 wheelSigmaHistos[3]->setBinLabel(1,"Sector1",1);
00623 wheelSigmaHistos[3]->setBinLabel(1,"Sector1",1);
00624 wheelSigmaHistos[3]->setBinLabel(2,"Sector2",1);
00625 wheelSigmaHistos[3]->setBinLabel(3,"Sector3",1);
00626 wheelSigmaHistos[3]->setBinLabel(4,"Sector4",1);
00627 wheelSigmaHistos[3]->setBinLabel(5,"Sector5",1);
00628 wheelSigmaHistos[3]->setBinLabel(6,"Sector6",1);
00629 wheelSigmaHistos[3]->setBinLabel(7,"Sector7",1);
00630 wheelSigmaHistos[3]->setBinLabel(8,"Sector8",1);
00631 wheelSigmaHistos[3]->setBinLabel(9,"Sector9",1);
00632 wheelSigmaHistos[3]->setBinLabel(10,"Sector10",1);
00633 wheelSigmaHistos[3]->setBinLabel(11,"Sector11",1);
00634 wheelSigmaHistos[3]->setBinLabel(12,"Sector12",1);
00635 wheelSigmaHistos[3]->setBinLabel(13,"Sector13",1);
00636 wheelSigmaHistos[3]->setBinLabel(14,"Sector14",1);
00637 wheelSigmaHistos[3]->setBinLabel(1,"Wheel-2",2);
00638 wheelSigmaHistos[3]->setBinLabel(2,"Wheel-1",2);
00639 wheelSigmaHistos[3]->setBinLabel(3,"Wheel0",2);
00640 wheelSigmaHistos[3]->setBinLabel(4,"Wheel+1",2);
00641 wheelSigmaHistos[3]->setBinLabel(5,"Wheel+2",2);
00642 }
00643 }
00644
00645 if(parameters.getUntrackedParameter<bool>("slopeTest")){
00646 if(wheelSlopeHistos.find(3) == wheelSlopeHistos.end()){
00647 string histoName = "SlopeSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter<string>("STEP", "STEP3");
00648 wheelSlopeHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3);
00649 wheelSlopeHistos[3]->setBinLabel(1,"Sector1",1);
00650 wheelSlopeHistos[3]->setBinLabel(1,"Sector1",1);
00651 wheelSlopeHistos[3]->setBinLabel(2,"Sector2",1);
00652 wheelSlopeHistos[3]->setBinLabel(3,"Sector3",1);
00653 wheelSlopeHistos[3]->setBinLabel(4,"Sector4",1);
00654 wheelSlopeHistos[3]->setBinLabel(5,"Sector5",1);
00655 wheelSlopeHistos[3]->setBinLabel(6,"Sector6",1);
00656 wheelSlopeHistos[3]->setBinLabel(7,"Sector7",1);
00657 wheelSlopeHistos[3]->setBinLabel(8,"Sector8",1);
00658 wheelSlopeHistos[3]->setBinLabel(9,"Sector9",1);
00659 wheelSlopeHistos[3]->setBinLabel(10,"Sector10",1);
00660 wheelSlopeHistos[3]->setBinLabel(11,"Sector11",1);
00661 wheelSlopeHistos[3]->setBinLabel(12,"Sector12",1);
00662 wheelSlopeHistos[3]->setBinLabel(13,"Sector13",1);
00663 wheelSlopeHistos[3]->setBinLabel(14,"Sector14",1);
00664 wheelSlopeHistos[3]->setBinLabel(1,"Wheel-2",2);
00665 wheelSlopeHistos[3]->setBinLabel(2,"Wheel-1",2);
00666 wheelSlopeHistos[3]->setBinLabel(3,"Wheel0",2);
00667 wheelSlopeHistos[3]->setBinLabel(4,"Wheel+1",2);
00668 wheelSlopeHistos[3]->setBinLabel(5,"Wheel+2",2);
00669 }
00670 }
00671
00672 stringstream wheel; wheel <<wh;
00673
00674 if(wheelMeanHistos.find(wh) == wheelMeanHistos.end()){
00675 string histoName = "MeanSummaryRes_testFailed_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str();
00676 wheelMeanHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
00677 wheelMeanHistos[wh]->setBinLabel(1,"Sector1",1);
00678 wheelMeanHistos[wh]->setBinLabel(2,"Sector2",1);
00679 wheelMeanHistos[wh]->setBinLabel(3,"Sector3",1);
00680 wheelMeanHistos[wh]->setBinLabel(4,"Sector4",1);
00681 wheelMeanHistos[wh]->setBinLabel(5,"Sector5",1);
00682 wheelMeanHistos[wh]->setBinLabel(6,"Sector6",1);
00683 wheelMeanHistos[wh]->setBinLabel(7,"Sector7",1);
00684 wheelMeanHistos[wh]->setBinLabel(8,"Sector8",1);
00685 wheelMeanHistos[wh]->setBinLabel(9,"Sector9",1);
00686 wheelMeanHistos[wh]->setBinLabel(10,"Sector10",1);
00687 wheelMeanHistos[wh]->setBinLabel(11,"Sector11",1);
00688 wheelMeanHistos[wh]->setBinLabel(12,"Sector12",1);
00689 wheelMeanHistos[wh]->setBinLabel(13,"Sector13",1);
00690 wheelMeanHistos[wh]->setBinLabel(14,"Sector14",1);
00691 wheelMeanHistos[wh]->setBinLabel(1,"MB1_SL1",2);
00692 wheelMeanHistos[wh]->setBinLabel(2,"MB1_SL2",2);
00693 wheelMeanHistos[wh]->setBinLabel(3,"MB1_SL3",2);
00694 wheelMeanHistos[wh]->setBinLabel(4,"MB2_SL1",2);
00695 wheelMeanHistos[wh]->setBinLabel(5,"MB2_SL2",2);
00696 wheelMeanHistos[wh]->setBinLabel(6,"MB2_SL3",2);
00697 wheelMeanHistos[wh]->setBinLabel(7,"MB3_SL1",2);
00698 wheelMeanHistos[wh]->setBinLabel(8,"MB3_SL2",2);
00699 wheelMeanHistos[wh]->setBinLabel(9,"MB3_SL3",2);
00700 wheelMeanHistos[wh]->setBinLabel(10,"MB4_SL1",2);
00701 wheelMeanHistos[wh]->setBinLabel(11,"MB4_SL3",2);
00702 }
00703
00704 if(parameters.getUntrackedParameter<bool>("sigmaTest")){
00705 if(wheelSigmaHistos.find(wh) == wheelSigmaHistos.end()){
00706 string histoName = "SigmaSummaryRes_testFailed_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str();
00707 wheelSigmaHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
00708 wheelSigmaHistos[wh]->setBinLabel(1,"Sector1",1);
00709 wheelSigmaHistos[wh]->setBinLabel(2,"Sector2",1);
00710 wheelSigmaHistos[wh]->setBinLabel(3,"Sector3",1);
00711 wheelSigmaHistos[wh]->setBinLabel(4,"Sector4",1);
00712 wheelSigmaHistos[wh]->setBinLabel(5,"Sector5",1);
00713 wheelSigmaHistos[wh]->setBinLabel(6,"Sector6",1);
00714 wheelSigmaHistos[wh]->setBinLabel(7,"Sector7",1);
00715 wheelSigmaHistos[wh]->setBinLabel(8,"Sector8",1);
00716 wheelSigmaHistos[wh]->setBinLabel(9,"Sector9",1);
00717 wheelSigmaHistos[wh]->setBinLabel(10,"Sector10",1);
00718 wheelSigmaHistos[wh]->setBinLabel(11,"Sector11",1);
00719 wheelSigmaHistos[wh]->setBinLabel(12,"Sector12",1);
00720 wheelSigmaHistos[wh]->setBinLabel(13,"Sector13",1);
00721 wheelSigmaHistos[wh]->setBinLabel(14,"Sector14",1);
00722 wheelSigmaHistos[wh]->setBinLabel(1,"MB1_SL1",2);
00723 wheelSigmaHistos[wh]->setBinLabel(2,"MB1_SL2",2);
00724 wheelSigmaHistos[wh]->setBinLabel(3,"MB1_SL3",2);
00725 wheelSigmaHistos[wh]->setBinLabel(4,"MB2_SL1",2);
00726 wheelSigmaHistos[wh]->setBinLabel(5,"MB2_SL2",2);
00727 wheelSigmaHistos[wh]->setBinLabel(6,"MB2_SL3",2);
00728 wheelSigmaHistos[wh]->setBinLabel(7,"MB3_SL1",2);
00729 wheelSigmaHistos[wh]->setBinLabel(8,"MB3_SL2",2);
00730 wheelSigmaHistos[wh]->setBinLabel(9,"MB3_SL3",2);
00731 wheelSigmaHistos[wh]->setBinLabel(10,"MB4_SL1",2);
00732 wheelSigmaHistos[wh]->setBinLabel(11,"MB4_SL3",2);
00733 }
00734 }
00735
00736 if(parameters.getUntrackedParameter<bool>("slopeTest")){
00737 if(wheelSlopeHistos.find(wh) == wheelSlopeHistos.end()){
00738 string histoName = "SlopeSummaryRes_testFailed_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str();
00739 wheelSlopeHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
00740 wheelSlopeHistos[wh]->setBinLabel(1,"Sector1",1);
00741 wheelSlopeHistos[wh]->setBinLabel(2,"Sector2",1);
00742 wheelSlopeHistos[wh]->setBinLabel(3,"Sector3",1);
00743 wheelSlopeHistos[wh]->setBinLabel(4,"Sector4",1);
00744 wheelSlopeHistos[wh]->setBinLabel(5,"Sector5",1);
00745 wheelSlopeHistos[wh]->setBinLabel(6,"Sector6",1);
00746 wheelSlopeHistos[wh]->setBinLabel(7,"Sector7",1);
00747 wheelSlopeHistos[wh]->setBinLabel(8,"Sector8",1);
00748 wheelSlopeHistos[wh]->setBinLabel(9,"Sector9",1);
00749 wheelSlopeHistos[wh]->setBinLabel(10,"Sector10",1);
00750 wheelSlopeHistos[wh]->setBinLabel(11,"Sector11",1);
00751 wheelSlopeHistos[wh]->setBinLabel(12,"Sector12",1);
00752 wheelSlopeHistos[wh]->setBinLabel(13,"Sector13",1);
00753 wheelSlopeHistos[wh]->setBinLabel(14,"Sector14",1);
00754 wheelSlopeHistos[wh]->setBinLabel(1,"MB1_SL1",2);
00755 wheelSlopeHistos[wh]->setBinLabel(2,"MB1_SL2",2);
00756 wheelSlopeHistos[wh]->setBinLabel(3,"MB1_SL3",2);
00757 wheelSlopeHistos[wh]->setBinLabel(4,"MB2_SL1",2);
00758 wheelSlopeHistos[wh]->setBinLabel(5,"MB2_SL2",2);
00759 wheelSlopeHistos[wh]->setBinLabel(6,"MB2_SL3",2);
00760 wheelSlopeHistos[wh]->setBinLabel(7,"MB3_SL1",2);
00761 wheelSlopeHistos[wh]->setBinLabel(8,"MB3_SL2",2);
00762 wheelSlopeHistos[wh]->setBinLabel(9,"MB3_SL3",2);
00763 wheelSlopeHistos[wh]->setBinLabel(10,"MB4_SL1",2);
00764 wheelSlopeHistos[wh]->setBinLabel(11,"MB4_SL3",2);
00765 }
00766 }
00767
00768 }
00769
00770 int DTResolutionTest::stationFromBin(int bin) const {
00771 return (int) (bin /3.1)+1;
00772 }
00773
00774
00775 int DTResolutionTest::slFromBin(int bin) const {
00776 int ret = bin%3;
00777 if(ret == 0 || bin == 11) ret = 3;
00778
00779 return ret;
00780 }