CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQM/DTMonitorClient/src/DTEfficiencyTest.cc

Go to the documentation of this file.
00001 
00002 
00003 /*
00004  *  See header file for a description of this class.
00005  *
00006  *  $Date: 2010/01/05 10:15:46 $
00007  *  $Revision: 1.19 $
00008  *  \author G. Mila - INFN Torino
00009  */
00010 
00011 
00012 #include <DQM/DTMonitorClient/src/DTEfficiencyTest.h>
00013 
00014 // Framework
00015 #include <FWCore/Framework/interface/EventSetup.h>
00016 
00017 
00018 // Geometry
00019 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00020 #include "Geometry/DTGeometry/interface/DTGeometry.h"
00021 #include "Geometry/DTGeometry/interface/DTLayer.h"
00022 #include "Geometry/DTGeometry/interface/DTTopology.h"
00023 
00024 #include "DQMServices/Core/interface/DQMStore.h"
00025 #include "DQMServices/Core/interface/MonitorElement.h"
00026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00027 
00028 #include <stdio.h>
00029 #include <sstream>
00030 #include <math.h>
00031 
00032 
00033 using namespace edm;
00034 using namespace std;
00035 
00036 DTEfficiencyTest::DTEfficiencyTest(const edm::ParameterSet& ps){
00037 
00038   edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest]: Constructor";
00039 
00040   parameters = ps;
00041 
00042   dbe = edm::Service<DQMStore>().operator->();
00043   
00044   prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
00045 
00046   percentual = parameters.getUntrackedParameter<int>("BadSLpercentual", 10);
00047 
00048 }
00049 
00050 DTEfficiencyTest::~DTEfficiencyTest(){
00051 
00052   edm::LogVerbatim ("efficiency") << "DTEfficiencyTest: analyzed " << nevents << " events";
00053 
00054 }
00055 
00056 
00057 void DTEfficiencyTest::beginJob(){
00058 
00059   edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest]: BeginJob";
00060 
00061   nevents = 0;
00062 
00063 }
00064 
00065 void DTEfficiencyTest::beginRun(Run const& run, EventSetup const& context) {
00066 
00067   // Get the geometry
00068   context.get<MuonGeometryRecord>().get(muonGeom);
00069 
00070 }
00071 
00072 void DTEfficiencyTest::beginLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00073 
00074   edm::LogVerbatim ("efficiency") <<"[DTEfficiencyTest]: Begin of LS transition";
00075 
00076   // Get the run number
00077   run = lumiSeg.run();
00078 
00079 }
00080 
00081 
00082 void DTEfficiencyTest::analyze(const edm::Event& e, const edm::EventSetup& context){
00083 
00084   nevents++;
00085   edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest]: "<<nevents<<" events";
00086 }
00087 
00088 
00089 void DTEfficiencyTest::endLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00090   
00091   // counts number of updats (online mode) or number of events (standalone mode)
00092   //nevents++;
00093   // if running in standalone perform diagnostic only after a reasonalbe amount of events
00094   //if ( parameters.getUntrackedParameter<bool>("runningStandalone", false) && 
00095   //     nevents%parameters.getUntrackedParameter<int>("diagnosticPrescale", 1000) != 0 ) return;
00096 
00097 
00098   for(map<int, MonitorElement*> ::const_iterator histo = wheelHistos.begin();
00099       histo != wheelHistos.end();
00100       histo++) {
00101     (*histo).second->Reset();
00102   }
00103 
00104   for(map<int, MonitorElement*> ::const_iterator histo = wheelUnassHistos.begin();
00105       histo != wheelUnassHistos.end();
00106       histo++) {
00107     (*histo).second->Reset();
00108   }
00109 
00110   edm::LogVerbatim ("efficiency") <<"[DTEfficiencyTest]: End of LS transition, performing the DQM client operation"; 
00111 
00112   // counts number of lumiSegs 
00113   nLumiSegs = lumiSeg.id().luminosityBlock();
00114 
00115   // prescale factor
00116   if ( nLumiSegs%prescaleFactor != 0 ) return;
00117 
00118   edm::LogVerbatim ("efficiency") <<"[DTEfficiencyTest]: "<<nLumiSegs<<" updates";
00119   
00120   vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
00121   vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
00122 
00123   edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest]: Efficiency tests results";
00124 
00125   
00126   map <DTLayerId, vector<double> > LayerBadCells;
00127   LayerBadCells.clear();
00128   map <DTLayerId, vector<double> > LayerUnassBadCells;
00129   LayerUnassBadCells.clear();
00130   map <DTSuperLayerId, vector<double> > SuperLayerBadCells;
00131   SuperLayerBadCells.clear();
00132   map <DTSuperLayerId,vector<double> > SuperLayerUnassBadCells;
00133   SuperLayerUnassBadCells.clear();
00134   map <pair<int,int>, int> cmsHistos;
00135   cmsHistos.clear();
00136   map <pair<int,int>, bool> filled;
00137   for(int i=-2; i<3; i++){
00138     for(int j=1; j<15; j++){
00139       filled[make_pair(i,j)]=false;
00140     }
00141   }
00142   map <pair<int,int>, int> cmsUnassHistos;
00143   cmsUnassHistos.clear();
00144   map <pair<int,int>, bool> UnassFilled;
00145   for(int i=-2; i<3; i++){
00146     for(int j=1; j<15; j++){
00147       UnassFilled[make_pair(i,j)]=false;
00148     }
00149   }
00150   
00151   
00152 
00153   // Loop over the chambers
00154   for (; ch_it != ch_end; ++ch_it) {
00155     DTChamberId chID = (*ch_it)->id();
00156     vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin(); 
00157     vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
00158 
00159     // Loop over the SuperLayers
00160     for(; sl_it != sl_end; ++sl_it) {
00161       DTSuperLayerId slID = (*sl_it)->id();
00162       vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
00163       vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00164       
00165       // Loop over the layers
00166       for(; l_it != l_end; ++l_it) {
00167         DTLayerId lID = (*l_it)->id();
00168          
00169         stringstream wheel; wheel << chID.wheel();
00170         stringstream station; station << chID.station();
00171         stringstream sector; sector << chID.sector();
00172         stringstream superLayer; superLayer << slID.superlayer();
00173         stringstream layer; layer << lID.layer();
00174         
00175         string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() +  "_SL" + superLayer.str() +  "_L" + layer.str();
00176         
00177         // Get the ME produced by EfficiencyTask Source
00178         MonitorElement * occupancy_histo = dbe->get(getMEName("hEffOccupancy", lID));   
00179         MonitorElement * unassOccupancy_histo = dbe->get(getMEName("hEffUnassOccupancy", lID));
00180         MonitorElement * recSegmOccupancy_histo = dbe->get(getMEName("hRecSegmOccupancy", lID));
00181          
00182         // ME -> TH1F
00183         if(occupancy_histo && unassOccupancy_histo && recSegmOccupancy_histo) {   
00184           TH1F * occupancy_histo_root = occupancy_histo->getTH1F();
00185           TH1F * unassOccupancy_histo_root = unassOccupancy_histo->getTH1F();
00186           TH1F * recSegmOccupancy_histo_root = recSegmOccupancy_histo->getTH1F();
00187 
00188           const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel();
00189           const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel();
00190 
00191           // Loop over the TH1F bin and fill the ME to be used for the Quality Test
00192           for(int bin=firstWire; bin <= lastWire; bin++) {
00193             if((recSegmOccupancy_histo_root->GetBinContent(bin))!=0) {
00194               //cout<<"book histos"<<endl;
00195               if (EfficiencyHistos.find(lID) == EfficiencyHistos.end()) bookHistos(lID, firstWire, lastWire);
00196               float efficiency = occupancy_histo_root->GetBinContent(bin) / recSegmOccupancy_histo_root->GetBinContent(bin);
00197               float errorEff = sqrt(efficiency*(1-efficiency) / recSegmOccupancy_histo_root->GetBinContent(bin));
00198               EfficiencyHistos.find(lID)->second->setBinContent(bin, efficiency);
00199               EfficiencyHistos.find(lID)->second->setBinError(bin, errorEff);
00200                   
00201               if (UnassEfficiencyHistos.find(lID) == EfficiencyHistos.end()) bookHistos(lID, firstWire, lastWire);
00202               float unassEfficiency = unassOccupancy_histo_root->GetBinContent(bin) / recSegmOccupancy_histo_root->GetBinContent(bin);
00203               float errorUnassEff = sqrt(unassEfficiency*(1-unassEfficiency) / recSegmOccupancy_histo_root->GetBinContent(bin));
00204               UnassEfficiencyHistos.find(lID)->second->setBinContent(bin, unassEfficiency);     
00205               UnassEfficiencyHistos.find(lID)->second->setBinError(bin, errorUnassEff);
00206             }
00207           }
00208         }
00209       } // loop on layers
00210     } // loop on superlayers
00211   } //loop on chambers
00212   
00213 
00214 
00215   // Efficiency test 
00216   //cout<<"[DTEfficiencyTest]: Efficiency Tests results"<<endl;
00217   string EfficiencyCriterionName = parameters.getUntrackedParameter<string>("EfficiencyTestName","EfficiencyInRange"); 
00218   for(map<DTLayerId, MonitorElement*>::const_iterator hEff = EfficiencyHistos.begin();
00219       hEff != EfficiencyHistos.end();
00220       hEff++) {
00221     const QReport * theEfficiencyQReport = (*hEff).second->getQReport(EfficiencyCriterionName);
00222     double counter=0;
00223     if(theEfficiencyQReport) {
00224       vector<dqm::me_util::Channel> badChannels = theEfficiencyQReport->getBadChannels();
00225       for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
00226            channel != badChannels.end(); channel++) {
00227         edm::LogError ("efficiency") <<"LayerID : "<<getMEName("hEffOccupancy",(*hEff).first)<< " Bad efficiency channels: "<<(*channel).getBin()<<"  Contents : "<<(*channel).getContents();
00228         counter++;
00229       }
00230       LayerBadCells[(*hEff).first].push_back(counter);
00231       LayerBadCells[(*hEff).first].push_back(muonGeom->layer((*hEff).first)->specificTopology().channels());
00232       // FIXME: getMessage() sometimes returns and invalid string (null pointer inside QReport data member)
00233       // edm::LogWarning ("efficiency") << "-------- "<<theEfficiencyQReport->getMessage()<<" ------- "<<theEfficiencyQReport->getStatus();
00234     }
00235   }
00236 
00237 
00238         
00239   // UnassEfficiency test 
00240   //cout<<"[DTEfficiencyTest]: UnassEfficiency Tests results"<<endl;
00241   string UnassEfficiencyCriterionName = parameters.getUntrackedParameter<string>("UnassEfficiencyTestName","UnassEfficiencyInRange"); 
00242   for(map<DTLayerId, MonitorElement*>::const_iterator hUnassEff = UnassEfficiencyHistos.begin();
00243       hUnassEff != UnassEfficiencyHistos.end();
00244       hUnassEff++) {
00245     const QReport * theUnassEfficiencyQReport = (*hUnassEff).second->getQReport(UnassEfficiencyCriterionName);
00246     double counter=0;
00247     if(theUnassEfficiencyQReport) {
00248       vector<dqm::me_util::Channel> badChannels = theUnassEfficiencyQReport->getBadChannels();
00249       for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
00250            channel != badChannels.end(); channel++) {
00251         edm::LogError ("efficiency") << "Bad unassEfficiency channels: "<<(*channel).getBin()<<" "<<(*channel).getContents();
00252         counter++;
00253       }
00254       LayerUnassBadCells[(*hUnassEff).first].push_back(counter);
00255       LayerUnassBadCells[(*hUnassEff).first].push_back(double(muonGeom->layer((*hUnassEff).first)->specificTopology().channels()));
00256       // FIXME: getMessage() sometimes returns and invalid string (null pointer inside QReport data member)
00257       // edm::LogWarning ("efficiency") << theUnassEfficiencyQReport->getMessage()<<" ------- "<<theUnassEfficiencyQReport->getStatus();
00258     }
00259   }
00260 
00261   
00262   vector<DTChamber*>::const_iterator ch2_it = muonGeom->chambers().begin();
00263   vector<DTChamber*>::const_iterator ch2_end = muonGeom->chambers().end();
00264   for (; ch2_it != ch2_end; ++ch2_it) {
00265     DTChamberId ch = (*ch2_it)->id();
00266     vector<const DTSuperLayer*>::const_iterator sl2_it = (*ch2_it)->superLayers().begin(); 
00267     vector<const DTSuperLayer*>::const_iterator sl2_end = (*ch2_it)->superLayers().end();
00268     // Loop over the SLs
00269     for(; sl2_it != sl2_end; ++sl2_it) {
00270       DTSuperLayerId sl = (*sl2_it)->id();
00271       double superLayerBadC=0;
00272       double superLayerTotC=0;
00273       double superLayerUnassBadC=0;
00274       double superLayerUnassTotC=0;
00275       bool fill=false;
00276       vector<const DTLayer*>::const_iterator l2_it = (*sl2_it)->layers().begin(); 
00277       vector<const DTLayer*>::const_iterator l2_end = (*sl2_it)->layers().end();
00278       // Loop over the Ls
00279       for(; l2_it != l2_end; ++l2_it) {
00280         DTLayerId layerId = (*l2_it)->id();
00281         if(LayerBadCells.find(layerId) != LayerBadCells.end() &&
00282            LayerUnassBadCells.find(layerId) != LayerUnassBadCells.end()){
00283           fill=true;
00284           superLayerBadC+=LayerBadCells[layerId][0];
00285           superLayerTotC+=LayerBadCells[layerId][1];
00286           superLayerUnassBadC+=LayerUnassBadCells[layerId][0];
00287           superLayerUnassTotC+=LayerUnassBadCells[layerId][1];
00288         }
00289       }
00290       if(fill){
00291         SuperLayerBadCells[sl].push_back(superLayerBadC);
00292         SuperLayerBadCells[sl].push_back(superLayerTotC);
00293         SuperLayerUnassBadCells[sl].push_back(superLayerUnassBadC);
00294         SuperLayerUnassBadCells[sl].push_back(superLayerUnassTotC);
00295       }
00296     }
00297   }
00298 
00299 
00300   for(map<DTSuperLayerId, vector<double> >::const_iterator SLBCells = SuperLayerBadCells.begin();
00301       SLBCells != SuperLayerBadCells.end();
00302       SLBCells++) {
00303     if((*SLBCells).second[0]/(*SLBCells).second[1] > double(percentual/100)){
00304       if(wheelHistos.find((*SLBCells).first.wheel()) == wheelHistos.end()) bookHistos((*SLBCells).first.wheel());
00305       if(!((*SLBCells).first.station() == 4 && (*SLBCells).first.superlayer() == 3))
00306         wheelHistos[(*SLBCells).first.wheel()]->Fill((*SLBCells).first.sector()-1,((*SLBCells).first.superlayer()-1)+3*((*SLBCells).first.station()-1));
00307       else
00308         wheelHistos[(*SLBCells).first.wheel()]->Fill((*SLBCells).first.sector()-1,10);
00309       // fill the cms summary histo if the percentual of SL which have not passed the test 
00310       // is more than a predefined treshold
00311       cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]++;
00312       if(((*SLBCells).first.sector()<13 &&
00313           double(cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())])/11>double(percentual)/100 &&
00314           filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]==false) ||
00315          ((*SLBCells).first.sector()>=13 && 
00316           double(cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())])/2>double(percentual)/100 &&
00317           filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]==false)){
00318         filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]=true;
00319         wheelHistos[3]->Fill((*SLBCells).first.sector()-1,(*SLBCells).first.wheel());
00320       }
00321     }
00322   }
00323 
00324 
00325   for(map<DTSuperLayerId, vector<double> >::const_iterator SLUBCells = SuperLayerUnassBadCells.begin();
00326       SLUBCells != SuperLayerUnassBadCells.end();
00327       SLUBCells++) {
00328     if((*SLUBCells).second[0]/(*SLUBCells).second[1] > double(percentual/100)){
00329       if(wheelUnassHistos.find((*SLUBCells).first.wheel()) == wheelUnassHistos.end()) bookHistos((*SLUBCells).first.wheel());
00330       if(!((*SLUBCells).first.station() == 4 && (*SLUBCells).first.superlayer() == 3))
00331         wheelUnassHistos[(*SLUBCells).first.wheel()]->Fill((*SLUBCells).first.sector()-1,((*SLUBCells).first.superlayer()-1)+3*((*SLUBCells).first.station()-1));
00332       else
00333         wheelUnassHistos[(*SLUBCells).first.wheel()]->Fill((*SLUBCells).first.sector()-1,10);
00334       // fill the cms summary histo if the percentual of SL which have not passed the test 
00335       // is more than a predefined treshold
00336       cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]++;
00337       if(((*SLUBCells).first.sector()<13 &&
00338           double(cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())])/11>double(percentual)/100 &&
00339           UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]==false) ||
00340          ((*SLUBCells).first.sector()>=13 && 
00341           double(cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())])/2>double(percentual)/100 &&
00342           UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]==false)){
00343         UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]=true;
00344         wheelUnassHistos[3]->Fill((*SLUBCells).first.sector()-1,(*SLUBCells).first.wheel());
00345       }
00346     }
00347   }
00348 
00349 
00350   
00351 }
00352 
00353 
00354 void DTEfficiencyTest::endJob(){
00355 
00356   edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest] endjob called!";
00357 
00358   dbe->rmdir("DT/Tests/DTEfficiency");
00359 
00360 }
00361 
00362 
00363 string DTEfficiencyTest::getMEName(string histoTag, const DTLayerId & lID) {
00364 
00365   stringstream wheel; wheel << lID.superlayerId().wheel();
00366   stringstream station; station << lID.superlayerId().station();
00367   stringstream sector; sector << lID.superlayerId().sector();
00368   stringstream superLayer; superLayer << lID.superlayerId().superlayer();
00369   stringstream layer; layer << lID.layer();
00370 
00371  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
00372  string folderName = 
00373     folderRoot + "DT/DTEfficiencyTask/Wheel" +  wheel.str() +
00374     "/Station" + station.str() +
00375     "/Sector" + sector.str() + 
00376     "/SuperLayer" + superLayer.str() + "/";
00377 
00378   string histoname = folderName + histoTag  
00379     + "_W" + wheel.str() 
00380     + "_St" + station.str() 
00381     + "_Sec" + sector.str() 
00382     + "_SL" + superLayer.str()
00383     + "_L" + layer.str();
00384   
00385   return histoname;
00386   
00387 }
00388 
00389 
00390 void DTEfficiencyTest::bookHistos(const DTLayerId & lId, int firstWire, int lastWire) {
00391 
00392   stringstream wheel; wheel << lId.superlayerId().wheel();
00393   stringstream station; station << lId.superlayerId().station();        
00394   stringstream sector; sector << lId.superlayerId().sector();
00395   stringstream superLayer; superLayer << lId.superlayerId().superlayer();
00396   stringstream layer; layer << lId.layer();
00397 
00398   string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() +  "_SL" + superLayer.str() +  "_L" + layer.str();
00399   string EfficiencyHistoName =  "Efficiency_" + HistoName; 
00400   string UnassEfficiencyHistoName =  "UnassEfficiency_" + HistoName; 
00401 
00402   dbe->setCurrentFolder("DT/Tests/DTEfficiency/Wheel" + wheel.str() +
00403                            "/Station" + station.str() +
00404                            "/Sector" + sector.str());
00405 
00406   EfficiencyHistos[lId] = dbe->book1D(EfficiencyHistoName.c_str(),EfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
00407   UnassEfficiencyHistos[lId] = dbe->book1D(UnassEfficiencyHistoName.c_str(),UnassEfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
00408 
00409 }
00410 
00411 
00412 void DTEfficiencyTest::bookHistos(int wh) {
00413   
00414   dbe->setCurrentFolder("DT/Tests/DTEfficiency/SummaryPlot");
00415 
00416   if(wheelHistos.find(3) == wheelHistos.end()){
00417     string histoName =  "ESummary_testFailedByAtLeastBadSL";
00418     wheelHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
00419     wheelHistos[3]->setBinLabel(1,"Sector1",1);
00420     wheelHistos[3]->setBinLabel(1,"Sector1",1);
00421     wheelHistos[3]->setBinLabel(2,"Sector2",1);
00422     wheelHistos[3]->setBinLabel(3,"Sector3",1);
00423     wheelHistos[3]->setBinLabel(4,"Sector4",1);
00424     wheelHistos[3]->setBinLabel(5,"Sector5",1);
00425     wheelHistos[3]->setBinLabel(6,"Sector6",1);
00426     wheelHistos[3]->setBinLabel(7,"Sector7",1);
00427     wheelHistos[3]->setBinLabel(8,"Sector8",1);
00428     wheelHistos[3]->setBinLabel(9,"Sector9",1);
00429     wheelHistos[3]->setBinLabel(10,"Sector10",1);
00430     wheelHistos[3]->setBinLabel(11,"Sector11",1);
00431     wheelHistos[3]->setBinLabel(12,"Sector12",1);
00432     wheelHistos[3]->setBinLabel(13,"Sector13",1);
00433     wheelHistos[3]->setBinLabel(14,"Sector14",1);
00434     wheelHistos[3]->setBinLabel(1,"Wheel-2",2);
00435     wheelHistos[3]->setBinLabel(2,"Wheel-1",2);
00436     wheelHistos[3]->setBinLabel(3,"Wheel0",2);
00437     wheelHistos[3]->setBinLabel(4,"Wheel+1",2);
00438     wheelHistos[3]->setBinLabel(5,"Wheel+2",2);
00439   }
00440   if(wheelUnassHistos.find(3) == wheelUnassHistos.end()){
00441     string histoName =  "UESummary_testFailedByAtLeastBadSL";
00442     wheelUnassHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
00443     wheelUnassHistos[3]->setBinLabel(1,"Sector1",1);
00444     wheelUnassHistos[3]->setBinLabel(1,"Sector1",1);
00445     wheelUnassHistos[3]->setBinLabel(2,"Sector2",1);
00446     wheelUnassHistos[3]->setBinLabel(3,"Sector3",1);
00447     wheelUnassHistos[3]->setBinLabel(4,"Sector4",1);
00448     wheelUnassHistos[3]->setBinLabel(5,"Sector5",1);
00449     wheelUnassHistos[3]->setBinLabel(6,"Sector6",1);
00450     wheelUnassHistos[3]->setBinLabel(7,"Sector7",1);
00451     wheelUnassHistos[3]->setBinLabel(8,"Sector8",1);
00452     wheelUnassHistos[3]->setBinLabel(9,"Sector9",1);
00453     wheelUnassHistos[3]->setBinLabel(10,"Sector10",1);
00454     wheelUnassHistos[3]->setBinLabel(11,"Sector11",1);
00455     wheelUnassHistos[3]->setBinLabel(12,"Sector12",1);
00456     wheelUnassHistos[3]->setBinLabel(13,"Sector13",1);
00457     wheelUnassHistos[3]->setBinLabel(14,"Sector14",1);
00458     wheelUnassHistos[3]->setBinLabel(1,"Wheel-2",2);
00459     wheelUnassHistos[3]->setBinLabel(2,"Wheel-1",2);
00460     wheelUnassHistos[3]->setBinLabel(3,"Wheel0",2);
00461     wheelUnassHistos[3]->setBinLabel(4,"Wheel+1",2);
00462     wheelUnassHistos[3]->setBinLabel(5,"Wheel+2",2);
00463   }
00464 
00465 
00466   stringstream wheel; wheel <<wh;
00467 
00468   if(wheelHistos.find(wh) == wheelHistos.end()){
00469     string histoName =  "ESummary_testFailed_W" + wheel.str();
00470     wheelHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
00471     wheelHistos[wh]->setBinLabel(1,"Sector1",1);
00472     wheelHistos[wh]->setBinLabel(2,"Sector2",1);
00473     wheelHistos[wh]->setBinLabel(3,"Sector3",1);
00474     wheelHistos[wh]->setBinLabel(4,"Sector4",1);
00475     wheelHistos[wh]->setBinLabel(5,"Sector5",1);
00476     wheelHistos[wh]->setBinLabel(6,"Sector6",1);
00477     wheelHistos[wh]->setBinLabel(7,"Sector7",1);
00478     wheelHistos[wh]->setBinLabel(8,"Sector8",1);
00479     wheelHistos[wh]->setBinLabel(9,"Sector9",1);
00480     wheelHistos[wh]->setBinLabel(10,"Sector10",1);
00481     wheelHistos[wh]->setBinLabel(11,"Sector11",1);
00482     wheelHistos[wh]->setBinLabel(12,"Sector12",1);
00483     wheelHistos[wh]->setBinLabel(13,"Sector13",1);
00484     wheelHistos[wh]->setBinLabel(14,"Sector14",1);
00485     wheelHistos[wh]->setBinLabel(1,"MB1_SL1",2);
00486     wheelHistos[wh]->setBinLabel(2,"MB1_SL2",2);
00487     wheelHistos[wh]->setBinLabel(3,"MB1_SL3",2);
00488     wheelHistos[wh]->setBinLabel(4,"MB2_SL1",2);
00489     wheelHistos[wh]->setBinLabel(5,"MB2_SL2",2);
00490     wheelHistos[wh]->setBinLabel(6,"MB2_SL3",2);
00491     wheelHistos[wh]->setBinLabel(7,"MB3_SL1",2);
00492     wheelHistos[wh]->setBinLabel(8,"MB3_SL2",2);
00493     wheelHistos[wh]->setBinLabel(9,"MB3_SL3",2);
00494     wheelHistos[wh]->setBinLabel(10,"MB4_SL1",2);
00495     wheelHistos[wh]->setBinLabel(11,"MB4_SL3",2);
00496   }  
00497   if(wheelUnassHistos.find(wh) == wheelUnassHistos.end()){  
00498     string histoName =  "UESummary_testFailed_W" + wheel.str();
00499     wheelUnassHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
00500     wheelUnassHistos[wh]->setBinLabel(1,"Sector1",1);
00501     wheelUnassHistos[wh]->setBinLabel(2,"Sector2",1);
00502     wheelUnassHistos[wh]->setBinLabel(3,"Sector3",1);
00503     wheelUnassHistos[wh]->setBinLabel(4,"Sector4",1);
00504     wheelUnassHistos[wh]->setBinLabel(5,"Sector5",1);
00505     wheelUnassHistos[wh]->setBinLabel(6,"Sector6",1);
00506     wheelUnassHistos[wh]->setBinLabel(7,"Sector7",1);
00507     wheelUnassHistos[wh]->setBinLabel(8,"Sector8",1);
00508     wheelUnassHistos[wh]->setBinLabel(9,"Sector9",1);
00509     wheelUnassHistos[wh]->setBinLabel(10,"Sector10",1);
00510     wheelUnassHistos[wh]->setBinLabel(11,"Sector11",1);
00511     wheelUnassHistos[wh]->setBinLabel(12,"Sector12",1);
00512     wheelUnassHistos[wh]->setBinLabel(13,"Sector13",1);
00513     wheelUnassHistos[wh]->setBinLabel(14,"Sector14",1);
00514     wheelUnassHistos[wh]->setBinLabel(1,"MB1_SL1",2);
00515     wheelUnassHistos[wh]->setBinLabel(2,"MB1_SL2",2);
00516     wheelUnassHistos[wh]->setBinLabel(3,"MB1_SL3",2);
00517     wheelUnassHistos[wh]->setBinLabel(4,"MB2_SL1",2);
00518     wheelUnassHistos[wh]->setBinLabel(5,"MB2_SL2",2);
00519     wheelUnassHistos[wh]->setBinLabel(6,"MB2_SL3",2);
00520     wheelUnassHistos[wh]->setBinLabel(7,"MB3_SL1",2);
00521     wheelUnassHistos[wh]->setBinLabel(8,"MB3_SL2",2);
00522     wheelUnassHistos[wh]->setBinLabel(9,"MB3_SL3",2);
00523     wheelUnassHistos[wh]->setBinLabel(10,"MB4_SL1",2);
00524     wheelUnassHistos[wh]->setBinLabel(11,"MB4_SL3",2);
00525   }
00526 
00527 }
00528