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