CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/DQM/HcalMonitorClient/src/ZDCMonitorClient.cc

Go to the documentation of this file.
00001 #include "DQM/HcalMonitorClient/interface/ZDCMonitorClient.h"
00002 #include "FWCore/ServiceRegistry/interface/Service.h"
00003 #include "FWCore/Framework/interface/MakerMacros.h"
00004 #include "DQMServices/Core/interface/MonitorElement.h"
00005 #include "DataFormats/DetId/interface/DetId.h"
00006 
00007 #include "TROOT.h"
00008 #include "TTree.h"
00009 #include "TGaxis.h"
00010 #include "TH1F.h"
00011 #include "TH2F.h"
00012 #include "TFile.h"
00013 
00014 #include <memory>
00015 #include <iostream>
00016 #include <fstream>
00017 #include <vector>
00018 #include <string>
00019 #include <sys/time.h>
00020 
00021 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
00022 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
00023 
00024 #include "DQM/HcalMonitorClient/interface/HcalDQMDbInterface.h"
00025 // Use to hold/get channel status
00026 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
00027 #include "CondFormats/HcalObjects/interface/HcalCondObjectContainer.h"
00028 #include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
00029 #include "CondFormats/HcalObjects/interface/HcalChannelStatus.h"
00030 
00031 #include "DQM/HcalMonitorClient/interface/HcalClientUtils.h"
00032 #include "DQM/HcalMonitorClient/interface/HcalHistoUtils.h"
00033 #include "DQM/HcalMonitorTasks/interface/HcalEtaPhiHists.h"
00034 
00035 #include "FWCore/Framework/interface/Run.h"
00036 #include "FWCore/Framework/interface/LuminosityBlock.h"
00037 #include "FWCore/Framework/interface/Event.h"
00038 #include "FWCore/Framework/interface/MakerMacros.h"
00039 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00040 #include "FWCore/ServiceRegistry/interface/Service.h"
00041 #include "FWCore/Framework/interface/ESHandle.h"
00042 
00043 #include "DQMServices/Core/interface/MonitorElement.h"
00044 #include "DQMServices/Core/interface/DQMStore.h"
00045 
00046 
00047 //--------------------------------------------------------
00048 ZDCMonitorClient::ZDCMonitorClient(std::string myname, const edm::ParameterSet& ps){
00049   name_=myname;
00050   
00051   inputFile_ = ps.getUntrackedParameter<std::string>("inputFile","");
00052   mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
00053   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00054   prescaleFactor_ = ps.getUntrackedParameter<int>("prescaleFactor", -1);
00055   prefixME_              = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
00056   if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00057     prefixME_.append("/");
00058   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00059   
00060   updateTime_ = ps.getUntrackedParameter<int>("UpdateTime",0);
00061   baseHtmlDir_ = ps.getUntrackedParameter<std::string>("baseHtmlDir", "");
00062   htmlUpdateTime_ = ps.getUntrackedParameter<int>("htmlUpdateTime", 0);
00063   htmlFirstUpdate_ = ps.getUntrackedParameter<int>("htmlFirstUpdate",20);
00064   databasedir_   = ps.getUntrackedParameter<std::string>("databaseDir","");
00065   databaseUpdateTime_ = ps.getUntrackedParameter<int>("databaseUpdateTime",0);
00066   databaseFirstUpdate_ = ps.getUntrackedParameter<int>("databaseFirstUpdate",10);
00067 
00068   saveByLumiSection_  = ps.getUntrackedParameter<bool>("saveByLumiSection",false);
00069   Online_             = ps.getUntrackedParameter<bool>("online",false);
00070  
00071   subdir_                = ps.getUntrackedParameter<std::string>("ZDCFolder","ZDCMonitor_Hcal/"); // DeadCellMonitor_Hcal  
00072   if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00073     subdir_.append("/");
00074   subdir_=prefixME_+subdir_;
00075 
00076   debug_              = ps.getUntrackedParameter<int>("debug",0);
00077   ZDCGoodLumi_        = ps.getUntrackedParameter<std::vector<double> > ("ZDC_QIValueForGoodLS");
00078 
00079 }
00080 
00081 
00082 //--------------------------------------------------------
00083 ZDCMonitorClient::~ZDCMonitorClient(){
00084 
00085   if (debug_>0) std::cout << "ZDCMonitorClient: Exit ..." << std::endl;
00086 }
00087 
00088 
00089 //--------------------------------------------------------
00090 void ZDCMonitorClient::beginJob()
00091 {
00092   dqmStore_ = edm::Service<DQMStore>().operator->();
00093   if (debug_>0) 
00094     {
00095       std::cout <<"<ZDCMonitorClient::beginJob()>  Displaying dqmStore directory structure:"<<std::endl;
00096       dqmStore_->showDirStructure();
00097     }
00098 }
00099 
00100 //--------------------------------------------------------
00101 void ZDCMonitorClient::beginRun(void) {
00102 
00103   begin_run_ = true;
00104   end_run_   = false;
00105 
00106   evt_=0;
00107   jevt_=0;
00108   htmlcounter_=0;
00109   /*  if (!dqmStore_) 
00110     {
00111       if (debug_>0) std::cout <<"<ZDCMonitorClient::beginRun> dqmStore does not exist!"<<std::endl;
00112       return;
00113       }*/
00114  //subdir_="Hcal/";
00115   dqmStore_->setCurrentFolder(subdir_); // what is Hcal/ZDCMonitor/EventInfoDUMMY folder
00116   
00117   // Add new histograms; remove those created in previous runs
00118   // prefixMe = Hcal/
00119 
00120   ZDCChannelSummary_=dqmStore_->get(subdir_ + "ZDC_Channel_Summary");
00121   if (ZDCChannelSummary_) dqmStore_->removeElement(ZDCChannelSummary_->getName());
00122   ZDCChannelSummary_= dqmStore_->book2D("ZDC_Channel_Summary", "Fraction of Events where ZDC Channels had no Errors" , 2, 0, 2, 9, 0, 9); //This is the histo which will show the health of each ZDC Channel
00123   for (int i=0;i<18;++i)
00124     {
00125       ZDCChannelSummary_->setBinContent(i/9,i%9,-1);
00126     }
00127   (ZDCChannelSummary_->getTH2F())->GetXaxis()->SetBinLabel(1,"ZDC+");
00128   (ZDCChannelSummary_->getTH2F())->GetXaxis()->SetBinLabel(2,"ZDC-");
00129   (ZDCChannelSummary_->getTH2F())->GetYaxis()->SetBinLabel(1,"EM1");
00130   (ZDCChannelSummary_->getTH2F())->GetYaxis()->SetBinLabel(2,"EM2");
00131   (ZDCChannelSummary_->getTH2F())->GetYaxis()->SetBinLabel(3,"EM3");
00132   (ZDCChannelSummary_->getTH2F())->GetYaxis()->SetBinLabel(4,"EM4");
00133   (ZDCChannelSummary_->getTH2F())->GetYaxis()->SetBinLabel(5,"EM5");
00134   (ZDCChannelSummary_->getTH2F())->GetYaxis()->SetBinLabel(6,"HAD1");
00135   (ZDCChannelSummary_->getTH2F())->GetYaxis()->SetBinLabel(7,"HAD2");
00136   (ZDCChannelSummary_->getTH2F())->GetYaxis()->SetBinLabel(8,"HAD3");
00137   (ZDCChannelSummary_->getTH2F())->GetYaxis()->SetBinLabel(9,"HAD4");
00138   (ZDCChannelSummary_->getTH2F())->SetOption("textcolz");  
00139   (ZDCChannelSummary_->getTH2F())->SetMinimum(-1);
00140   (ZDCChannelSummary_->getTH2F())->SetMaximum(1);
00141 
00142 
00143   
00144   ZDCReportSummary_ = dqmStore_->get(subdir_ + "ZDC_ReportSummary");
00145   if (ZDCReportSummary_) dqmStore_->removeElement(ZDCReportSummary_->getName());
00146   ZDCReportSummary_= dqmStore_->book2D("ZDC_ReportSummary","Fraction of Good Lumis for either ZDC",2,0,2,1,0,1);
00147           for (int i=0;i<3;++i)
00148     {
00149       ZDCReportSummary_->setBinContent(i,1,-1);
00150     }
00151   (ZDCReportSummary_->getTH2F())->GetXaxis()->SetBinLabel(1,"ZDC+");
00152   (ZDCReportSummary_->getTH2F())->GetXaxis()->SetBinLabel(2,"ZDC-");
00153   (ZDCReportSummary_->getTH2F())->SetOption("textcolz");
00154   (ZDCReportSummary_->getTH2F())->SetMinimum(-1);
00155   (ZDCReportSummary_->getTH2F())->SetMaximum(1);
00156 
00157   ZDCHotChannelFraction_ = dqmStore_->get(subdir_+"Errors/HotChannel/ZDC_Hot_Channel_Fraction");
00158   if (ZDCHotChannelFraction_) dqmStore_->removeElement(ZDCHotChannelFraction_->getName());
00159   dqmStore_->setCurrentFolder(subdir_ + "Errors/HotChannel");
00160   ZDCHotChannelFraction_ = dqmStore_->book2D("ZDC_Hot_Channel_Fraction", "Hot Channel Rates in the ZDC Channels", 2, 0, 2, 9, 0, 9); //Hot channel checker for ZDC
00161    for (int i=0;i<18;++i)
00162     {
00163       ZDCHotChannelFraction_->setBinContent(i/9,i%9,-1);
00164     }
00165  (ZDCHotChannelFraction_->getTH2F())->GetXaxis()->SetBinLabel(1,"ZDC+");
00166   (ZDCHotChannelFraction_->getTH2F())->GetXaxis()->SetBinLabel(2,"ZDC-");
00167   (ZDCHotChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(1,"EM1");
00168   (ZDCHotChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(2,"EM2");
00169   (ZDCHotChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(3,"EM3");
00170   (ZDCHotChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(4,"EM4");
00171   (ZDCHotChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(5,"EM5");
00172   (ZDCHotChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(6,"HAD1");
00173   (ZDCHotChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(7,"HAD2");
00174   (ZDCHotChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(8,"HAD3");
00175   (ZDCHotChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(9,"HAD4");
00176   (ZDCHotChannelFraction_->getTH2F())->SetOption("textcolz");
00177   (ZDCHotChannelFraction_->getTH2F())->SetMinimum(-1);
00178   (ZDCHotChannelFraction_->getTH2F())->SetMaximum(1);
00179  
00180   ZDCColdChannelFraction_ = dqmStore_->get(subdir_ + "Errors/ColdChannel/ZDC_Cold_Channel_Fraction");
00181   if (ZDCColdChannelFraction_) dqmStore_->removeElement(ZDCColdChannelFraction_->getName());
00182   dqmStore_->setCurrentFolder(subdir_ + "Errors/ColdChannel");
00183   ZDCColdChannelFraction_=dqmStore_->book2D("ZDC_Cold_Channel_Fraction", "Cold Channel Rates in the ZDC Channels", 2, 0, 2,9, 0, 9); //Cold channel checker for ZDC                    
00184   for (int i=0;i<18;++i)
00185     {
00186       ZDCColdChannelFraction_->setBinContent(i/9,i%9,-1);
00187     }
00188   (ZDCColdChannelFraction_->getTH2F())->GetXaxis()->SetBinLabel(1,"ZDC+");
00189   (ZDCColdChannelFraction_->getTH2F())->GetXaxis()->SetBinLabel(2,"ZDC-");
00190   (ZDCColdChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(1,"EM1");
00191   (ZDCColdChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(2,"EM2");
00192   (ZDCColdChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(3,"EM3");
00193   (ZDCColdChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(4,"EM4");
00194   (ZDCColdChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(5,"EM5");
00195   (ZDCColdChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(6,"HAD1");
00196   (ZDCColdChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(7,"HAD2");
00197   (ZDCColdChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(8,"HAD3");
00198   (ZDCColdChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(9,"HAD4");
00199   (ZDCColdChannelFraction_->getTH2F())->SetOption("textcolz");
00200   (ZDCColdChannelFraction_->getTH2F())->SetMinimum(-1);
00201   (ZDCColdChannelFraction_->getTH2F())->SetMaximum(1);
00202 
00203  
00204   ZDCDeadChannelFraction_ = dqmStore_->get(subdir_ + "Errors/DeadChannel/ZDC_Dead_Channel_Fraction");
00205   if ( ZDCDeadChannelFraction_) dqmStore_->removeElement(ZDCDeadChannelFraction_->getName());
00206   dqmStore_->setCurrentFolder(subdir_+ "Errors/DeadChannel");
00207   ZDCDeadChannelFraction_=dqmStore_->book2D("ZDC_Dead_Channel_Fraction","Dead Channel Rates in the ZDC Channels",2,0,2,9,0,9);
00208   for (int i=0;i<18;++i)
00209     {
00210       ZDCDeadChannelFraction_->setBinContent(i/9,i%9,-1);
00211     }
00212   (ZDCDeadChannelFraction_->getTH2F())->GetXaxis()->SetBinLabel(1,"ZDC+");
00213   (ZDCDeadChannelFraction_->getTH2F())->GetXaxis()->SetBinLabel(2,"ZDC-");
00214   (ZDCDeadChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(1,"EM1");
00215   (ZDCDeadChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(2,"EM2");
00216   (ZDCDeadChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(3,"EM3");
00217   (ZDCDeadChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(4,"EM4");
00218   (ZDCDeadChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(5,"EM5");
00219   (ZDCDeadChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(6,"HAD1");
00220   (ZDCDeadChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(7,"HAD2");
00221   (ZDCDeadChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(8,"HAD3");
00222   (ZDCDeadChannelFraction_->getTH2F())->GetYaxis()->SetBinLabel(9,"HAD4");
00223   (ZDCDeadChannelFraction_->getTH2F())->SetOption("textcolz");
00224   (ZDCDeadChannelFraction_->getTH2F())->SetMinimum(-1);
00225   (ZDCDeadChannelFraction_->getTH2F())->SetMaximum(1);
00226 
00227   ZDCDigiErrorFraction_ = dqmStore_->get(subdir_ + "Errors/Digis/ZDC_Digi_Error_Fraction");
00228   if (ZDCDigiErrorFraction_) dqmStore_->removeElement(ZDCDigiErrorFraction_->getName());
00229   dqmStore_->setCurrentFolder(subdir_ + "Errors/Digis");
00230   ZDCDigiErrorFraction_=dqmStore_->book2D("ZDC_Digi_Error_Fraction", "Digi Error Rates in the ZDC Channels", 2, 0, 2,9, 0, 9); //Hot channel checker for ZDC                    
00231   for (int i=0;i<18;++i)
00232     {
00233       ZDCDigiErrorFraction_->setBinContent(i/9,i%9,-1);
00234     }
00235   (ZDCDigiErrorFraction_->getTH2F())->GetXaxis()->SetBinLabel(2,"ZDC-");
00236   (ZDCDigiErrorFraction_->getTH2F())->GetXaxis()->SetBinLabel(1,"EM1");
00237   (ZDCDigiErrorFraction_->getTH2F())->GetYaxis()->SetBinLabel(2,"EM2");
00238   (ZDCDigiErrorFraction_->getTH2F())->GetYaxis()->SetBinLabel(3,"EM3");
00239   (ZDCDigiErrorFraction_->getTH2F())->GetYaxis()->SetBinLabel(4,"EM4");
00240   (ZDCDigiErrorFraction_->getTH2F())->GetYaxis()->SetBinLabel(5,"EM5");
00241   (ZDCDigiErrorFraction_->getTH2F())->GetYaxis()->SetBinLabel(6,"HAD1");
00242   (ZDCDigiErrorFraction_->getTH2F())->GetYaxis()->SetBinLabel(7,"HAD2");
00243   (ZDCDigiErrorFraction_->getTH2F())->GetYaxis()->SetBinLabel(8,"HAD3");
00244   (ZDCDigiErrorFraction_->getTH2F())->GetYaxis()->SetBinLabel(9,"HAD4");
00245   (ZDCDigiErrorFraction_->getTH2F())->SetOption("textcolz");
00246   (ZDCDigiErrorFraction_->getTH2F())->SetMinimum(-1);
00247   (ZDCDigiErrorFraction_->getTH2F())->SetMaximum(1);  
00248 }
00249 
00250 
00251 //--------------------------------------------------------
00252 void ZDCMonitorClient::endJob(void) {
00253 
00254   if( debug_>0 ) 
00255     std::cout << "ZDCMonitorClient: endJob, ievt = " << ievt_ << std::endl;
00256 
00257   return;
00258 }
00259 
00260 //--------------------------------------------------------
00261 void ZDCMonitorClient::endRun(void){analyze();}
00262 
00263 void ZDCMonitorClient::setup(void){}
00264 void ZDCMonitorClient::cleanup(void){}
00265 
00266 void ZDCMonitorClient::analyze()
00267 {
00268   if (debug_>0) 
00269     std::cout <<"<ZDCMonitorClient> Entered ZDCMonitorClient::analyze()"<<std::endl;
00270   if(debug_>1) std::cout<<"\nZDC Monitor Client heartbeat...."<<std::endl;
00271   
00272   float ChannelRatio[18]={0};
00273    //dqmStore_->runQTests();
00274   
00275   // Make a rate plot, by first getting plots from tasks
00276   MonitorElement* me;
00277   std::string s;
00278 
00282 
00283   s=subdir_+"Errors/Digis/ZDC_Digi_Errors";  // prefixME_ = "Hcal/"
00284   me=dqmStore_->get(s.c_str());
00285 
00286   TH2F* ZdcDigiErrors=0;
00287   if (me!=0)
00288     {
00289       ZdcDigiErrors=HcalUtilsClient::getHisto<TH2F*>(me,false,0,0);
00290       if (ZdcDigiErrors!=0)
00291         {
00292           int num_events_digis = ZdcDigiErrors->GetBinContent(-1,-1);
00293           if(num_events_digis != 0)
00294             {
00295               for (int i=0;i<18;++i)
00296                 {
00297                   ZDCDigiErrorFraction_->setBinContent((i/9)+1,(i%9)+1,(ZdcDigiErrors->GetBinContent((i/9)+1,(i%9)+1)*1./num_events_digis));
00298                 }
00299             }
00300         }
00301     }
00302 
00306 
00307   // Now get Hot Channel plot, used normalized values (num hot/event) in ZDCHotChannelFraction_
00308   s=subdir_+"Errors/HotChannel/ZDC_Hot_Channel_Errors";
00309   me=dqmStore_->get(s.c_str());
00310   TH2F* ZdcHotChannel=0;
00311   if (me!=0)
00312     {
00313       ZdcHotChannel=HcalUtilsClient::getHisto<TH2F*>(me,false,0,0);
00314       if (ZdcHotChannel!=0)
00315         {
00316           int num_events_hot = ZdcHotChannel->GetBinContent(-1,-1);
00317           if(num_events_hot!=0)
00318             {
00319               for (int i=0;i<18;++i)
00320                 {
00321                   ZDCHotChannelFraction_->setBinContent((i/9)+1,(i%9)+1,((ZdcHotChannel->GetBinContent((i/9)+1,(i%9)+1))*1./num_events_hot));
00322                 }
00323             }                    
00324         }     
00325     } // if (me!=0)
00326 
00330 
00331   //Now get Cold Channel plot, used normalized values (num Cold/event) in ZDCColdChannelFraction_
00332   s=subdir_+"Errors/ColdChannel/ZDC_Cold_Channel_Errors";
00333   me=dqmStore_->get(s.c_str());
00334   TH2F* ZdcColdChannel=0;
00335   if (me!=0)
00336     {
00337       ZdcColdChannel=HcalUtilsClient::getHisto<TH2F*>(me,false,0,0);
00338       if ((ZdcColdChannel)!=0)
00339         {
00340           int num_events_cold = ZdcColdChannel->GetBinContent(-1,-1);
00341           if(num_events_cold!=0)
00342             {
00343               for (int i=0;i<18;++i)
00344                 {
00345                   ZDCColdChannelFraction_->setBinContent((i/9)+1,(i%9)+1,((ZdcColdChannel->GetBinContent((i/9)+1,(i%9)+1))*1./num_events_cold));
00346                 }
00347             }
00348         }
00349     }
00350 
00354 
00355   //Now get Cold Channel plot, used normalized values (num Cold/event) in ZDCHotChannelFraction_
00356   s=subdir_+"Errors/DeadChannel/ZDC_Dead_Channel_Errors";
00357   me=dqmStore_->get(s.c_str());
00358   TH2F* ZdcDeadChannel=0;
00359   if (me!=0)
00360     {
00361       ZdcDeadChannel=HcalUtilsClient::getHisto<TH2F*>(me,false,0,0);
00362       if ((ZdcDeadChannel)!=0)
00363         {
00364           int num_events_dead = ZdcDeadChannel->GetBinContent(-1,-1);
00365           if(num_events_dead!=0)
00366             {
00367               for (int i=0;i<18;++i)
00368                 {
00369                   ZDCDeadChannelFraction_->setBinContent((i/9)+1,(i%9)+1,(ZdcDeadChannel->GetBinContent((i/9)+1,(i%9)+1))*1./num_events_dead);
00370                 }
00371             }
00372         }
00373     }
00374 
00375 
00376 
00377 
00378 
00381   //     This simply takes the total errors that each channel got (Cold,hot, digi error) sums them up from the 
00382   //  totalchannelerrors plot and turns them into a rate. 1-errorrate be the number displayed.            //
00385 
00386 
00388   s=subdir_+"Errors/ZDC_TotalChannelErrors";
00389   me=dqmStore_->get(s.c_str());
00390   TH2F* ZdcTotalErrors=0;
00391   if (me!=0)
00392     {
00393       ZdcTotalErrors=HcalUtilsClient::getHisto<TH2F*>(me,false,0,0);
00394       int num_events_errors = ZdcTotalErrors->GetBinContent(-1,-1);
00395       if(num_events_errors!=0)
00396         {
00397           for (int i=0;i<18;++i)
00398             {
00399               ChannelRatio[i]=(ZdcTotalErrors->GetBinContent((i/9)+1,(i%9)+1))*1./num_events_errors;
00400               ZDCChannelSummary_->setBinContent((i/9)+1,(i%9)+1,1-ChannelRatio[i]);
00401             }
00402         }
00403     }
00404 
00405 
00408   //     This is a ratio of GoodLumis/TotalLumis. The determination of which is made by the Quality Index plots.            //
00411 
00412   LumiCounter=0;
00413   PZDC_GoodLumiCounter=0;
00414   PZDC_LumiRatio=0.;
00415   NZDC_GoodLumiCounter=0;
00416   NZDC_LumiRatio=0.;
00417   s=subdir_+"EventsVsLS";
00418   me=dqmStore_->get(s.c_str());
00419   TH1F* EventsvsLs=0;
00420   if (me!=0)
00421     EventsvsLs=HcalUtilsClient::getHisto<TH1F*>(me,false,0,0);
00422   s=subdir_+"PZDC_QualityIndexVSLB";
00423   me=dqmStore_->get(s.c_str());
00424   TH1F* Pzdc_QI=0;
00425   if (me!=0)
00426     Pzdc_QI=HcalUtilsClient::getHisto<TH1F*>(me,false,0,0);
00427   s=subdir_+"NZDC_QualityIndexVSLB";
00428   me=dqmStore_->get(s.c_str());
00429   TH1F* Nzdc_QI=0;
00430   if (me!=0)
00431     Nzdc_QI=HcalUtilsClient::getHisto<TH1F*>(me,false,0,0);
00432   
00433   if(EventsvsLs!=0 && Pzdc_QI!=0 && Nzdc_QI!=0)
00434     {
00435       for (int i=1;i<=EventsvsLs->GetNbinsX();++i)
00436         {
00437           if (EventsvsLs->GetBinContent(i)==0)
00438             continue;
00439           LumiCounter+=1;
00440 
00441           if(Pzdc_QI!=0)
00442             if(Pzdc_QI->GetBinContent(i)>ZDCGoodLumi_[0])
00443               PZDC_GoodLumiCounter+=1;
00444 
00445           if(Nzdc_QI!=0)
00446             if(Nzdc_QI->GetBinContent(i)>ZDCGoodLumi_[1])
00447               NZDC_GoodLumiCounter+=1;
00448 
00449           PZDC_LumiRatio=PZDC_GoodLumiCounter*(1./LumiCounter);
00450           NZDC_LumiRatio=NZDC_GoodLumiCounter*(1./LumiCounter);
00451         }
00452     }
00453 
00454   ZDCReportSummary_->setBinContent(1,1,PZDC_LumiRatio);
00455   ZDCReportSummary_->setBinContent(2,1,NZDC_LumiRatio);
00456 
00457   return;
00458 }