CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/DQM/DTMonitorClient/src/DTResolutionAnalysisTest.cc

Go to the documentation of this file.
00001 
00002 
00003 /*
00004  *  See header file for a description of this class.
00005  *
00006  *  $Date: 2011/10/31 17:22:23 $
00007  *  $Revision: 1.24 $
00008  *  \author G. Mila - INFN Torino
00009  */
00010 
00011 
00012 #include <DQM/DTMonitorClient/src/DTResolutionAnalysisTest.h>
00013 
00014 // Framework
00015 #include <FWCore/Framework/interface/Event.h>
00016 #include <FWCore/Framework/interface/EventSetup.h>
00017 #include <FWCore/ParameterSet/interface/ParameterSet.h>
00018 
00019 
00020 // Geometry
00021 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00022 #include "Geometry/DTGeometry/interface/DTGeometry.h"
00023 
00024 #include "FWCore/ServiceRegistry/interface/Service.h"
00025 #include "DQMServices/Core/interface/DQMStore.h"
00026 #include "DQMServices/Core/interface/MonitorElement.h"
00027 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00028 
00029 #include <string>
00030 #include <sstream>
00031 #include <math.h>
00032 
00033 
00034 using namespace edm;
00035 using namespace std;
00036 
00037 
00038 DTResolutionAnalysisTest::DTResolutionAnalysisTest(const ParameterSet& ps){
00039 
00040   LogTrace ("DTDQM|DTMonitorClient|DTResolutionAnalysisTest") << "[DTResolutionAnalysisTest]: Constructor";
00041 
00042   dbe = Service<DQMStore>().operator->();
00043 
00044   prescaleFactor = ps.getUntrackedParameter<int>("diagnosticPrescale", 1);
00045   // permitted test range
00046   maxGoodMeanValue = ps.getUntrackedParameter<double>("maxGoodMeanValue",0.02); 
00047   minBadMeanValue = ps.getUntrackedParameter<double>("minBadMeanValue",0.04);  
00048   maxGoodSigmaValue = ps.getUntrackedParameter<double>("maxGoodSigmaValue",0.08); 
00049   minBadSigmaValue = ps.getUntrackedParameter<double>("minBadSigmaValue",0.16);
00050   // top folder for the histograms in DQMStore
00051   topHistoFolder = ps.getUntrackedParameter<string>("topHistoFolder","DT/02-Segments");
00052 
00053   doCalibAnalysis = ps.getUntrackedParameter<bool>("doCalibAnalysis",false);
00054 }
00055 
00056 
00057 DTResolutionAnalysisTest::~DTResolutionAnalysisTest(){
00058 
00059   LogTrace ("DTDQM|DTMonitorClient|DTResolutionAnalysisTest") << "DTResolutionAnalysisTest: analyzed " << nevents << " events";
00060 
00061 }
00062 
00063 
00064 void DTResolutionAnalysisTest::beginJob(){
00065 
00066   LogTrace ("DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<"[DTResolutionAnalysisTest]: BeginJob"; 
00067 
00068   nevents = 0;
00069 
00070 }
00071 
00072 void DTResolutionAnalysisTest::beginRun(const Run& run, const EventSetup& context){
00073 
00074   LogTrace ("DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<"[DTResolutionAnalysisTest]: BeginRun"; 
00075 
00076   // Get the geometry
00077   context.get<MuonGeometryRecord>().get(muonGeom);
00078 
00079 }
00080 
00081 
00082 void DTResolutionAnalysisTest::beginLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00083 
00084   LogTrace ("DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<"[DTResolutionAnalysisTest]: Begin of LS transition";
00085 
00086   // Get the run number
00087   run = lumiSeg.run();
00088 
00089 }
00090 
00091 
00092 
00093 void DTResolutionAnalysisTest::analyze(const Event& e, const EventSetup& context){
00094 
00095   nevents++;
00096 
00097 }
00098 
00099 
00100 
00101 void DTResolutionAnalysisTest::endLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00102 
00103 }
00104 
00105 
00106 void DTResolutionAnalysisTest::bookHistos() {
00107 
00108   // global residual summary
00109   dbe->setCurrentFolder(topHistoFolder);
00110   globalResSummary = dbe->book2D("ResidualsGlbSummary", "# of SLs with good mean and good sigma of residuals",12,1,13,5,-2,3);
00111 
00112   // book summaries for mean and sigma
00113   dbe->setCurrentFolder(topHistoFolder + "/00-MeanRes");
00114   meanDistr[-2] = dbe->book1D("MeanDistr","Mean value of the residuals all (cm)",
00115       100,-0.1,0.1);
00116   meanDistr[-1] = dbe->book1D("MeanDistr_Phi","Mean value of the residuals #phi SL (cm)",
00117       100,-0.1,0.1);
00118   meanDistr[0] = dbe->book1D("MeanDistr_ThetaWh0","Mean values of the residuals #theta SL Wh 0 (cm)",
00119       100,-0.1,0.1);
00120   meanDistr[1] = dbe->book1D("MeanDistr_ThetaWh1","Mean value of the residuals #theta SL Wh +/-1 (cm)",
00121       100,-0.1,0.1);
00122   meanDistr[2] = dbe->book1D("MeanDistr_ThetaWh2","Mean value of the residuals #theta SL Wh +/-2 (cm)",
00123       100,-0.1,0.1);
00124 
00125 
00126   string histoTitle = "# of SLs with good mean of residuals";
00127   wheelMeanHistos[3] = dbe->book2D("MeanResGlbSummary",histoTitle.c_str(),12,1,13,5,-2,3);
00128   wheelMeanHistos[3]->setAxisTitle("Sector",1);
00129   wheelMeanHistos[3]->setAxisTitle("Wheel",2);
00130 
00131 
00132   dbe->setCurrentFolder(topHistoFolder + "/01-SigmaRes");
00133   sigmaDistr[-2] = dbe->book1D("SigmaDistr","Sigma value of the residuals all (cm)",
00134       50,0.0,0.2);
00135   sigmaDistr[-1] = dbe->book1D("SigmaDistr_Phi","Sigma value of the residuals #phi SL (cm)",
00136       50,0.0,0.2);
00137   sigmaDistr[0] = dbe->book1D("SigmaDistr_ThetaWh0","Sigma value of the residuals #theta SL Wh 0 (cm)",
00138       50,0.0,0.2);
00139   sigmaDistr[1] = dbe->book1D("SigmaDistr_ThetaWh1","Sigma value of the residuals #theta SL Wh +/-1 (cm)",
00140       50,0.0,0.2);
00141   sigmaDistr[2] = dbe->book1D("SigmaDistr_ThetaWh2","Sigma value of the residuals #theta SL Wh +/-2 (cm)",
00142       50,0.0,0.2);
00143 
00144   histoTitle = "# of SLs with good sigma of residuals";
00145   wheelSigmaHistos[3] = dbe->book2D("SigmaResGlbSummary",histoTitle.c_str(),12,1,13,5,-2,3);
00146   wheelSigmaHistos[3]->setAxisTitle("Sector",1);
00147   wheelSigmaHistos[3]->setAxisTitle("Wheel",2);
00148 
00149 
00150   // loop over all the CMS wheels, sectors & book the summary histos
00151   for (int wheel=-2; wheel<=2; wheel++){
00152     bookHistos(wheel);
00153     for (int sector=1; sector<=12; sector++){
00154       bookHistos(wheel, sector);
00155     }
00156   }
00157 
00158 }
00159 
00160 void DTResolutionAnalysisTest::endRun(Run const& run, EventSetup const& context) {
00161 
00162   if (!dbe->dirExists(topHistoFolder)) {
00163     LogTrace ("DTDQM|DTMonitorClient|DTResolutionAnalysisTest") 
00164       <<"[DTResolutionAnalysisTest]: Base folder " << topHistoFolder 
00165       << " does not exist. Skipping client operation." << endl;
00166     return;
00167   }
00168 
00169   bookHistos(); // histos booked only if top histo folder exist
00170   // as Standard/AlcaReco Harvest is performed in the same step
00171 
00172   LogTrace ("DTDQM|DTMonitorClient|DTResolutionAnalysisTest") 
00173     << "[DTResolutionAnalysisTest]: End of Run transition, performing the DQM client operation" << endl;
00174 
00175   // reset the ME with fixed scale
00176   resetMEs();
00177 
00178   for (vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
00179       ch_it != muonGeom->chambers().end(); ++ch_it) {  // loop over the chambers
00180 
00181     DTChamberId chID = (*ch_it)->id();
00182 
00183     // Fill the test histos
00184     for(vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
00185         sl_it != (*ch_it)->superLayers().end(); ++sl_it) {    // loop over SLs
00186 
00187 
00188       DTSuperLayerId slID = (*sl_it)->id();
00189       MonitorElement * res_histo = dbe->get(getMEName(slID));
00190 
00191       if(res_histo) { // Gaussian Fit
00192         float statMean = res_histo->getMean(1);
00193         float statSigma = res_histo->getRMS(1);
00194         double mean = -1;
00195         double sigma = -1;
00196         TH1F * histo_root = res_histo->getTH1F();
00197 
00198         // fill the summaries
00199         int entry= (chID.station() - 1) * 3;
00200         int binSect = slID.sector();
00201         if(slID.sector() == 13) binSect = 4;
00202         else if(slID.sector() == 14) binSect = 10;
00203         int binSL = entry+slID.superLayer();
00204         if(chID.station() == 4 && slID.superLayer() == 3) binSL--;
00205         if((slID.sector()==13 || slID.sector()==14)  && slID.superLayer()==1) binSL=12;
00206         if((slID.sector()==13 || slID.sector()==14) && slID.superLayer()==3) binSL=13;
00207 
00208         if(histo_root->GetEntries()>20) {
00209           TF1 *gfit = new TF1("Gaussian","gaus",(statMean-(2*statSigma)),(statMean+(2*statSigma)));
00210           try {
00211             histo_root->Fit(gfit, "Q0", "", -0.1, 0.1);
00212           } catch (...) {
00213             LogWarning ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask")
00214               << "[DTResolutionAnalysisTask]: Exception when fitting SL : " << slID;
00215             // FIXME: the SL is set as OK in the summary
00216             double weight = 1/11.;
00217             if((binSect == 4 || binSect == 10) && slID.station() == 4)  weight = 1/22.;
00218             globalResSummary->Fill(binSect, slID.wheel(), weight);
00219             continue;
00220           }
00221 
00222           if(gfit){
00223             // get the mean and the sigma of the distribution
00224             mean = gfit->GetParameter(1); 
00225             sigma = gfit->GetParameter(2);
00226 
00227             // fill the distributions
00228             meanDistr[-2]->Fill(mean);
00229             sigmaDistr[-2]->Fill(sigma);
00230             if(slID.superlayer() == 2) {
00231               meanDistr[abs(slID.wheel())]->Fill(mean);
00232               sigmaDistr[abs(slID.wheel())]->Fill(sigma);
00233             } else {
00234               meanDistr[-1]->Fill(mean);
00235               sigmaDistr[-1]->Fill(sigma);
00236             }
00237 
00238             // sector summaries
00239             MeanHistos[make_pair(slID.wheel(),binSect)]->setBinContent(binSL, mean);    
00240             SigmaHistos[make_pair(slID.wheel(),binSect)]->setBinContent(binSL, sigma);
00241 
00242             if((slID.sector() == 13 || slID.sector() == 14) && binSL == 12) binSL=10;
00243             if((slID.sector() == 13 || slID.sector() == 14) && binSL == 13) binSL=11;
00244 
00245 
00246             if((slID.sector() == 13 || slID.sector() == 14) ) {
00247 
00248               double MeanVal = wheelMeanHistos[slID.wheel()]->getBinContent(binSect,binSL);
00249               double MeanBinVal = (MeanVal > 0. && MeanVal < meanInRange(mean)) ? MeanVal : meanInRange(mean);
00250               wheelMeanHistos[slID.wheel()]->setBinContent(binSect,binSL,MeanBinVal);
00251 
00252               double SigmaVal =  wheelSigmaHistos[slID.wheel()]->getBinContent(binSect,binSL);
00253               double SigmaBinVal = (SigmaVal > 0. && SigmaVal < sigmaInRange(sigma)) ? SigmaVal : sigmaInRange(sigma);
00254               wheelSigmaHistos[slID.wheel()]->setBinContent(binSect,binSL,SigmaBinVal);
00255 
00256             } else {
00257               wheelMeanHistos[slID.wheel()]->setBinContent(binSect,binSL,meanInRange(mean));
00258               wheelSigmaHistos[slID.wheel()]->setBinContent(binSect,binSL,sigmaInRange(sigma));
00259             }
00260 
00261             // set the weight
00262             double weight = 1/11.;
00263             if((binSect == 4 || binSect == 10) && slID.station() == 4)  weight = 1/22.;
00264 
00265             // test the values of mean and sigma
00266             if( (meanInRange(mean) > 0.85) && (sigmaInRange(sigma) > 0.85) ) { // sigma and mean ok
00267               globalResSummary->Fill(binSect, slID.wheel(), weight);
00268               wheelMeanHistos[3]->Fill(binSect,slID.wheel(),weight);
00269               wheelSigmaHistos[3]->Fill(binSect,slID.wheel(),weight);
00270             } else {
00271               if( (meanInRange(mean) < 0.85) && (sigmaInRange(sigma) > 0.85) ) { // only sigma ok
00272                 wheelSigmaHistos[3]->Fill(binSect,slID.wheel(),weight);
00273               }
00274               if((meanInRange(mean) > 0.85) && (sigmaInRange(sigma) < 0.85)  ) { // only mean ok
00275                 wheelMeanHistos[3]->Fill(binSect,slID.wheel(),weight);
00276               }
00277             }
00278           }
00279           delete gfit;
00280         }
00281         else{
00282           LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask")
00283             << "[DTResolutionAnalysisTask] Fit of " << slID
00284             << " not performed because # entries < 20 ";
00285           // FIXME: the SL is set as OK in the summary
00286           double weight = 1/11.;
00287           if((binSect == 4 || binSect == 10) && slID.station() == 4)  weight = 1/22.;
00288           globalResSummary->Fill(binSect, slID.wheel(), weight);
00289           wheelMeanHistos[3]->Fill(binSect,slID.wheel(),weight);
00290           wheelSigmaHistos[3]->Fill(binSect,slID.wheel(),weight);
00291           wheelMeanHistos[slID.wheel()]->setBinContent(binSect,binSL,1.);
00292           wheelSigmaHistos[slID.wheel()]->setBinContent(binSect,binSL,1.);
00293         }
00294       } else {
00295         LogWarning ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask")
00296           << "[DTResolutionAnalysisTask] Histo: " << getMEName(slID) << " not found" << endl;
00297       }
00298     } // loop on SLs
00299   } // Loop on Stations
00300 
00301 }
00302 
00303 
00304 
00305 void DTResolutionAnalysisTest::bookHistos(int wh) { 
00306 
00307   stringstream wheel; wheel <<wh;
00308 
00309   dbe->setCurrentFolder(topHistoFolder + "/00-MeanRes");
00310   string histoName =  "MeanSummaryRes_W" + wheel.str();
00311   string histoTitle = "# of SLs with wrong mean of residuals (Wheel " + wheel.str() + ")";
00312   wheelMeanHistos[wh] = dbe->book2D(histoName.c_str(),histoTitle.c_str(),12,1,13,11,1,12);
00313   wheelMeanHistos[wh]->setAxisTitle("Sector",1);
00314   wheelMeanHistos[wh]->setBinLabel(1,"MB1_SL1",2);
00315   wheelMeanHistos[wh]->setBinLabel(2,"MB1_SL2",2);
00316   wheelMeanHistos[wh]->setBinLabel(3,"MB1_SL3",2);
00317   wheelMeanHistos[wh]->setBinLabel(4,"MB2_SL1",2);
00318   wheelMeanHistos[wh]->setBinLabel(5,"MB2_SL2",2);
00319   wheelMeanHistos[wh]->setBinLabel(6,"MB2_SL3",2);
00320   wheelMeanHistos[wh]->setBinLabel(7,"MB3_SL1",2);
00321   wheelMeanHistos[wh]->setBinLabel(8,"MB3_SL2",2);
00322   wheelMeanHistos[wh]->setBinLabel(9,"MB3_SL3",2);
00323   wheelMeanHistos[wh]->setBinLabel(10,"MB4_SL1",2);
00324   wheelMeanHistos[wh]->setBinLabel(11,"MB4_SL3",2); 
00325   //   wheelMeanHistos[wh]->setBinLabel(12,"MB4_SL1",2);
00326   //   wheelMeanHistos[wh]->setBinLabel(13,"MB4_SL3",2); 
00327 
00328 
00329 
00330   dbe->setCurrentFolder(topHistoFolder + "/01-SigmaRes");
00331   histoName =  "SigmaSummaryRes_W" + wheel.str();
00332   histoTitle = "# of SLs with wrong sigma of residuals (Wheel " + wheel.str() + ")";
00333   wheelSigmaHistos[wh] = dbe->book2D(histoName.c_str(),histoTitle.c_str(),12,1,13,11,1,12);
00334   wheelSigmaHistos[wh]->setAxisTitle("Sector",1);
00335   wheelSigmaHistos[wh]->setBinLabel(1,"MB1_SL1",2);
00336   wheelSigmaHistos[wh]->setBinLabel(2,"MB1_SL2",2);
00337   wheelSigmaHistos[wh]->setBinLabel(3,"MB1_SL3",2);
00338   wheelSigmaHistos[wh]->setBinLabel(4,"MB2_SL1",2);
00339   wheelSigmaHistos[wh]->setBinLabel(5,"MB2_SL2",2);
00340   wheelSigmaHistos[wh]->setBinLabel(6,"MB2_SL3",2);
00341   wheelSigmaHistos[wh]->setBinLabel(7,"MB3_SL1",2);
00342   wheelSigmaHistos[wh]->setBinLabel(8,"MB3_SL2",2);
00343   wheelSigmaHistos[wh]->setBinLabel(9,"MB3_SL3",2);
00344   wheelSigmaHistos[wh]->setBinLabel(10,"MB4_SL1",2);
00345   wheelSigmaHistos[wh]->setBinLabel(11,"MB4_SL3",2);
00346   //   wheelSigmaHistos[wh]->setBinLabel(12,"MB4_SL1",2);
00347   //   wheelSigmaHistos[wh]->setBinLabel(13,"MB4_SL3",2);
00348 
00349 }
00350 
00351 
00352 void DTResolutionAnalysisTest::bookHistos(int wh, int sect) {
00353 
00354   stringstream wheel; wheel << wh;              
00355   stringstream sector; sector << sect;  
00356 
00357 
00358   string MeanHistoName =  "MeanTest_W" + wheel.str() + "_Sec" + sector.str(); 
00359   string SigmaHistoName =  "SigmaTest_W" + wheel.str() + "_Sec" + sector.str(); 
00360 
00361   string folder = topHistoFolder + "/Wheel" + wheel.str() + "/Sector" + sector.str();
00362   dbe->setCurrentFolder(folder);
00363 
00364   if(sect!=4 && sect!=10) {
00365     MeanHistos[make_pair(wh,sect)] =
00366       dbe->book1D(MeanHistoName.c_str(),"Mean (from gaussian fit) of the residuals distribution",11,1,12);
00367   } else {
00368     MeanHistos[make_pair(wh,sect)] =
00369       dbe->book1D(MeanHistoName.c_str(),"Mean (from gaussian fit) of the residuals distribution",13,1,14);
00370   }
00371   (MeanHistos[make_pair(wh,sect)])->setBinLabel(1,"MB1_SL1",1);
00372   (MeanHistos[make_pair(wh,sect)])->setBinLabel(2,"MB1_SL2",1);
00373   (MeanHistos[make_pair(wh,sect)])->setBinLabel(3,"MB1_SL3",1);
00374   (MeanHistos[make_pair(wh,sect)])->setBinLabel(4,"MB2_SL1",1);
00375   (MeanHistos[make_pair(wh,sect)])->setBinLabel(5,"MB2_SL2",1);
00376   (MeanHistos[make_pair(wh,sect)])->setBinLabel(6,"MB2_SL3",1);
00377   (MeanHistos[make_pair(wh,sect)])->setBinLabel(7,"MB3_SL1",1);
00378   (MeanHistos[make_pair(wh,sect)])->setBinLabel(8,"MB3_SL2",1);
00379   (MeanHistos[make_pair(wh,sect)])->setBinLabel(9,"MB3_SL3",1);
00380   (MeanHistos[make_pair(wh,sect)])->setBinLabel(10,"MB4_SL1",1);
00381   (MeanHistos[make_pair(wh,sect)])->setBinLabel(11,"MB4_SL3",1);
00382   if(sect==4){
00383     (MeanHistos[make_pair(wh,sect)])->setBinLabel(12,"MB4S13_SL1",1);
00384     (MeanHistos[make_pair(wh,sect)])->setBinLabel(13,"MB4S13_SL3",1);
00385   }
00386   if(sect==10){
00387     (MeanHistos[make_pair(wh,sect)])->setBinLabel(12,"MB4S14_SL1",1);
00388     (MeanHistos[make_pair(wh,sect)])->setBinLabel(13,"MB4S14_SL3",1);
00389   }
00390 
00391   if(sect!=4 && sect!=10) {
00392     SigmaHistos[make_pair(wh,sect)] =
00393       dbe->book1D(SigmaHistoName.c_str(),"Sigma (from gaussian fit) of the residuals distribution",11,1,12);
00394   } else {
00395     SigmaHistos[make_pair(wh,sect)] =
00396       dbe->book1D(SigmaHistoName.c_str(),"Sigma (from gaussian fit) of the residuals distribution",13,1,14);
00397   }
00398   (SigmaHistos[make_pair(wh,sect)])->setBinLabel(1,"MB1_SL1",1);  
00399   (SigmaHistos[make_pair(wh,sect)])->setBinLabel(2,"MB1_SL2",1);
00400   (SigmaHistos[make_pair(wh,sect)])->setBinLabel(3,"MB1_SL3",1);
00401   (SigmaHistos[make_pair(wh,sect)])->setBinLabel(4,"MB2_SL1",1);
00402   (SigmaHistos[make_pair(wh,sect)])->setBinLabel(5,"MB2_SL2",1);
00403   (SigmaHistos[make_pair(wh,sect)])->setBinLabel(6,"MB2_SL3",1);
00404   (SigmaHistos[make_pair(wh,sect)])->setBinLabel(7,"MB3_SL1",1);
00405   (SigmaHistos[make_pair(wh,sect)])->setBinLabel(8,"MB3_SL2",1);
00406   (SigmaHistos[make_pair(wh,sect)])->setBinLabel(9,"MB3_SL3",1);
00407   (SigmaHistos[make_pair(wh,sect)])->setBinLabel(10,"MB4_SL1",1);
00408   (SigmaHistos[make_pair(wh,sect)])->setBinLabel(11,"MB4_SL3",1);
00409   if(sect==4){
00410     (SigmaHistos[make_pair(wh,sect)])->setBinLabel(12,"MB4S13_SL1",1);
00411     (SigmaHistos[make_pair(wh,sect)])->setBinLabel(13,"MB4S13_SL3",1);
00412   }
00413   if(sect==10){
00414     (SigmaHistos[make_pair(wh,sect)])->setBinLabel(12,"MB4S14_SL1",1);
00415     (SigmaHistos[make_pair(wh,sect)])->setBinLabel(13,"MB4S14_SL3",1);
00416   }
00417 
00418 
00419 }
00420 
00421 
00422 string DTResolutionAnalysisTest::getMEName(const DTSuperLayerId & slID) {
00423 
00424   stringstream wheel; wheel << slID.wheel();    
00425   stringstream station; station << slID.station();      
00426   stringstream sector; sector << slID.sector(); 
00427   stringstream superLayer; superLayer << slID.superlayer();
00428 
00429   string folderName = 
00430     topHistoFolder + "/Wheel" +  wheel.str() +
00431     "/Sector" + sector.str() +
00432     "/Station" + station.str() + "/";
00433 
00434   if(doCalibAnalysis) folderName =
00435     "DT/DTCalibValidation/Wheel" +  wheel.str() +
00436       "/Station" + station.str() + "/Sector" + sector.str() + "/";
00437 
00438   string histoname = folderName + "hResDist" 
00439     + "_W" + wheel.str() 
00440     + "_St" + station.str() 
00441     + "_Sec" + sector.str() 
00442     + "_SL" + superLayer.str(); 
00443 
00444   if(doCalibAnalysis) histoname = folderName + "hResDist_STEP3" 
00445     + "_W" + wheel.str() 
00446       + "_St" + station.str() 
00447       + "_Sec" + sector.str() 
00448       + "_SL" + superLayer.str();
00449 
00450   return histoname;
00451 
00452 }
00453 
00454 
00455 
00456 int DTResolutionAnalysisTest::stationFromBin(int bin) const {
00457   return (int) (bin /3.1)+1;
00458 }
00459 
00460 
00461 int DTResolutionAnalysisTest::slFromBin(int bin) const {
00462   int ret = bin%3;
00463   if(ret == 0 || bin == 11) ret = 3;
00464 
00465   return ret;
00466 }
00467 
00468 double DTResolutionAnalysisTest::meanInRange(double mean) const {
00469   double value(0.);
00470   if( fabs(mean) <= maxGoodMeanValue ) {value = 1.;}
00471   else if( fabs(mean) > maxGoodMeanValue && fabs(mean) < minBadMeanValue ) {value = 0.9;}
00472   else if( fabs(mean) >= minBadMeanValue ) {value = 0.1;}
00473   return value;
00474 }
00475 
00476 double DTResolutionAnalysisTest::sigmaInRange(double sigma) const {
00477   double value(0.);
00478   if( sigma <= maxGoodSigmaValue ) {value = 1.;}
00479   else if( sigma > maxGoodSigmaValue && sigma < minBadSigmaValue ) {value = 0.9;}
00480   else if( sigma >= minBadSigmaValue ) {value = 0.1;}
00481   return value;
00482 }
00483 
00484 void DTResolutionAnalysisTest::resetMEs() {
00485   globalResSummary->Reset();
00486   // Reset the summary histo
00487   for(map<int, MonitorElement*> ::const_iterator histo = wheelMeanHistos.begin();
00488       histo != wheelMeanHistos.end();
00489       histo++) {
00490     (*histo).second->Reset();
00491   }
00492   for(map<int, MonitorElement*> ::const_iterator histo = wheelSigmaHistos.begin();
00493       histo != wheelSigmaHistos.end();
00494       histo++) {
00495     (*histo).second->Reset();
00496   }
00497 
00498   for(int indx = -2; indx != 3; ++indx) {
00499     meanDistr[indx]->Reset();
00500     sigmaDistr[indx]->Reset();
00501   }
00502 }
00503