CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/DQM/HcalMonitorClient/src/HcalDetDiagPedestalClient.cc

Go to the documentation of this file.
00001 #include "DQM/HcalMonitorClient/interface/HcalDetDiagPedestalClient.h"
00002 #include "DQM/HcalMonitorClient/interface/HcalClientUtils.h"
00003 #include "DQM/HcalMonitorClient/interface/HcalHistoUtils.h"
00004 
00005 #include "CondFormats/HcalObjects/interface/HcalChannelStatus.h"
00006 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
00007 #include "CondFormats/HcalObjects/interface/HcalCondObjectContainer.h"
00008 
00009 #include "CondFormats/HcalObjects/interface/HcalLogicalMap.h"
00010 
00011 #include <iostream>
00012 
00013 /*
00014  * \file HcalDetDiagPedestalClient.cc
00015  * 
00016  * $Date: 2012/11/12 23:26:19 $
00017  * $Revision: 1.13 $
00018  * \author J. Temple
00019  * \brief Hcal DetDiagPedestal Client class
00020  */
00021 
00022 
00023 HcalDetDiagPedestalClient::HcalDetDiagPedestalClient(std::string myname)
00024 {
00025   name_=myname;   status=0;
00026   needLogicalMap_=true;
00027 }
00028 
00029 HcalDetDiagPedestalClient::HcalDetDiagPedestalClient(std::string myname, const edm::ParameterSet& ps)
00030 {
00031   name_=myname;
00032   enableCleanup_         = ps.getUntrackedParameter<bool>("enableCleanup",false);
00033   debug_                 = ps.getUntrackedParameter<int>("debug",0);
00034   prefixME_              = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
00035   if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00036     prefixME_.append("/");
00037   subdir_                = ps.getUntrackedParameter<std::string>("DetDiagPedestalFolder","DetDiagPedestalMonitor_Hcal/"); // DetDiagPedestalMonitor_Hcal/
00038   if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00039     subdir_.append("/");
00040   subdir_=prefixME_+subdir_;
00041 
00042   validHtmlOutput_       = ps.getUntrackedParameter<bool>("DetDiagPedestal_validHtmlOutput",true);
00043   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00044   badChannelStatusMask_   = ps.getUntrackedParameter<int>("DetDiagPedestal_BadChannelStatusMask",
00045                            ps.getUntrackedParameter<int>("BadChannelStatusMask",(1<<HcalChannelStatus::HcalCellDead)));
00046   
00047   minerrorrate_ = ps.getUntrackedParameter<double>("DetDiagPedestal_minerrorrate",
00048                                                    ps.getUntrackedParameter<double>("minerrorrate",0.05));
00049   minevents_    = ps.getUntrackedParameter<int>("DetDiagPedestal_minevents",
00050                                                 ps.getUntrackedParameter<int>("minevents",1));
00051   Online_                = ps.getUntrackedParameter<bool>("online",false);
00052 
00053   ProblemCells=0;
00054   ProblemCellsByDepth=0;
00055   needLogicalMap_=true;
00056 }
00057 
00058 void HcalDetDiagPedestalClient::analyze()
00059 {
00060   if (debug_>2) std::cout <<"\tHcalDetDiagPedestalClient::analyze()"<<std::endl;
00061   calculateProblems();
00062 }
00063 
00064 void HcalDetDiagPedestalClient::calculateProblems()
00065 {
00066  if (debug_>2) std::cout <<"\t\tHcalDetDiagPedestalClient::calculateProblems()"<<std::endl;
00067   if(!dqmStore_) return;
00068   double totalevents=0;
00069   int etabins=0, phibins=0, zside=0;
00070   double problemvalue=0;
00071 
00072   // Clear away old problems
00073   if (ProblemCells!=0)
00074     {
00075       ProblemCells->Reset();
00076       (ProblemCells->getTH2F())->SetMaximum(1.05);
00077       (ProblemCells->getTH2F())->SetMinimum(0.);
00078     }
00079   for  (unsigned int d=0;d<ProblemCellsByDepth->depth.size();++d)
00080     {
00081       if (ProblemCellsByDepth->depth[d]!=0) 
00082         {
00083           ProblemCellsByDepth->depth[d]->Reset();
00084           (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05);
00085           (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.);
00086         }
00087     }
00088   enoughevents_=true;
00089   // Get histograms that are used in testing
00090   // currently none used,
00091 
00092   std::vector<std::string> name = HcalEtaPhiHistNames();
00093 
00094   // This is a sample of how to get a histogram from the task that can then be used for evaluation purposes
00095   TH2F* PedestalsMissing[4];
00096   TH2F* PedestalsUnstable[4];
00097   TH2F* PedestalsBadMean[4];
00098   TH2F* PedestalsBadRMS[4];
00099   MonitorElement* me;
00100   for (int i=0;i<4;++i)
00101     {
00102       // Assume that histograms aren't found
00103       PedestalsMissing[i]=0;
00104       PedestalsUnstable[i]=0;
00105       PedestalsBadMean[i]=0;
00106       PedestalsBadRMS[i]=0;
00107       std::string s=subdir_+name[i]+" Problem Missing Channels";
00108       me=dqmStore_->get(s.c_str());
00109       if (me!=0) PedestalsMissing[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, PedestalsMissing[i], debug_);
00110       else 
00111         {
00112           if (debug_>0) 
00113             std::cout <<"<HcalDetDiagPedestalClient::calcluateProblems> could not get histogram '"<<s<<"'"<<std::endl;
00114         }
00115 
00116       s=subdir_+name[i]+" Problem Unstable Channels";
00117       me=dqmStore_->get(s.c_str());
00118       if (me!=0) PedestalsUnstable[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, PedestalsUnstable[i], debug_);
00119       else if (debug_>0) std::cout <<"<HcalDetDiagPedestalClient::calculateProblems> could not get histogram '"<<s<<"'"<<std::endl;
00120       s=subdir_+name[i]+" Problem Bad Pedestal Value";
00121       me=dqmStore_->get(s.c_str());
00122       if (me!=0) PedestalsBadMean[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, PedestalsBadMean[i], debug_);
00123       else if (debug_>0) std::cout <<"<HcalDetDiagPedestalClient::calculateProblems> could not get histogram '"<<s<<"'"<<std::endl;
00124       s=subdir_+name[i]+" Problem Bad Rms Value";
00125       me=dqmStore_->get(s.c_str());
00126       if (me!=0) PedestalsBadRMS[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, PedestalsBadRMS[i], debug_);
00127       else if (debug_>0) std::cout <<"<HcalDetDiagPedestalClient::calculateProblems> could not get histogram '"<<s<<"'"<<std::endl;
00128     }      
00129 
00130   // Because we're clearing and re-forming the problem cell histogram here, we don't need to do any cute
00131   // setting of the underflow bin to 0, and we can plot results as a raw rate between 0-1.
00132   
00133   for (unsigned int d=0;d<ProblemCellsByDepth->depth.size();++d)
00134     {
00135       if (ProblemCellsByDepth->depth[d]==0) continue;
00136     
00137       //totalevents=DigiPresentByDepth[d]->GetBinContent(0);
00138       totalevents=0;
00139       // Check underflow bins for events processed
00140       if (PedestalsMissing[d]!=0) totalevents = PedestalsMissing[d]->GetBinContent(0);
00141       else if (PedestalsUnstable[d]!=0) totalevents = PedestalsUnstable[d]->GetBinContent(0);
00142       else if (PedestalsBadMean[d]!=0) totalevents = PedestalsBadMean[d]->GetBinContent(0);
00143       else if (PedestalsBadRMS[d]!=0) totalevents = PedestalsBadRMS[d]->GetBinContent(0);
00144       //if (totalevents==0 || totalevents<minevents_) continue;
00145       
00146       totalevents=1; // temporary value pending removal of normalization from task
00147       etabins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsX();
00148       phibins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsY();
00149       for (int eta=0;eta<etabins;++eta)
00150         {
00151           int ieta=CalcIeta(eta,d+1);
00152           if (ieta==-9999) continue;
00153           for (int phi=0;phi<phibins;++phi)
00154             {
00155               problemvalue=0;
00156               if (PedestalsMissing[d]!=0) problemvalue += PedestalsMissing[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
00157               if (PedestalsUnstable[d]!=0) problemvalue += PedestalsUnstable[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
00158               if (PedestalsBadMean[d]!=0) problemvalue += PedestalsBadMean[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
00159               if (PedestalsBadRMS[d]!=0) problemvalue += PedestalsBadRMS[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
00160 
00161               if (problemvalue==0) continue;
00162               // problem value is a rate; we can normalize it here
00163               problemvalue = std::min(1.,problemvalue);
00164               
00165               zside=0;
00166               if (isHF(eta,d+1)) // shift ieta by 1 for HF
00167                 ieta<0 ? zside = -1 : zside = 1;
00168 
00169               // For problem cells that exceed our allowed rate,
00170               // set the values to -1 if the cells are already marked in the status database
00171               if (problemvalue>minerrorrate_)
00172                 {
00173                   HcalSubdetector subdet=HcalEmpty;
00174                   if (isHB(eta,d+1))subdet=HcalBarrel;
00175                   else if (isHE(eta,d+1)) subdet=HcalEndcap;
00176                   else if (isHF(eta,d+1)) subdet=HcalForward;
00177                   else if (isHO(eta,d+1)) subdet=HcalOuter;
00178                   HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
00179                   if (badstatusmap.find(hcalid)!=badstatusmap.end())
00180                     problemvalue=999;
00181                 }
00182 
00183               ProblemCellsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue);
00184               if (ProblemCells!=0) ProblemCells->Fill(ieta+zside,phi+1,problemvalue);
00185             } // loop on phi
00186         } // loop on eta
00187     } // loop on depth
00188 
00189   if (ProblemCells==0)
00190     {
00191       if (debug_>0) std::cout <<"<HcalDetDiagPedestalClient::analyze> ProblemCells histogram does not exist!"<<std::endl;
00192       return;
00193     }
00194 
00195   // Normalization of ProblemCell plot, in the case where there are errors in multiple depths
00196   etabins=(ProblemCells->getTH2F())->GetNbinsX();
00197   phibins=(ProblemCells->getTH2F())->GetNbinsY();
00198   for (int eta=0;eta<etabins;++eta)
00199     {
00200       for (int phi=0;phi<phibins;++phi)
00201         {
00202           if (ProblemCells->getBinContent(eta+1,phi+1)>1. && ProblemCells->getBinContent(eta+1,phi+1)<999)
00203             ProblemCells->setBinContent(eta+1,phi+1,1.);
00204         }
00205     }
00206 
00207   FillUnphysicalHEHFBins(*ProblemCellsByDepth);
00208   FillUnphysicalHEHFBins(ProblemCells);
00209   return;
00210 }
00211 
00212 void HcalDetDiagPedestalClient::beginJob()
00213 {
00214   dqmStore_ = edm::Service<DQMStore>().operator->();
00215   if (debug_>0) 
00216     {
00217       std::cout <<"<HcalDetDiagPedestalClient::beginJob()>  Displaying dqmStore directory structure:"<<std::endl;
00218       dqmStore_->showDirStructure();
00219     }
00220 }
00221 void HcalDetDiagPedestalClient::endJob(){}
00222 
00223 void HcalDetDiagPedestalClient::beginRun(void)
00224 {
00225   enoughevents_=false;
00226   if (!dqmStore_) 
00227     {
00228       if (debug_>0) std::cout <<"<HcalDetDiagPedestalClient::beginRun> dqmStore does not exist!"<<std::endl;
00229       return;
00230     }
00231   dqmStore_->setCurrentFolder(subdir_);
00232   problemnames_.clear();
00233 
00234   // Put the appropriate name of your problem summary here
00235   ProblemCells=dqmStore_->book2D(" ProblemDetDiagPedestal",
00236                                  " Problem DetDiagPedestal Rate for all HCAL;ieta;iphi",
00237                                  85,-42.5,42.5,
00238                                  72,0.5,72.5);
00239   problemnames_.push_back(ProblemCells->getName());
00240   if (debug_>1)
00241     std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<"  \t  Failed?  "<<(ProblemCells==0)<<std::endl;
00242   dqmStore_->setCurrentFolder(subdir_+"problem_DetDiagPedestal");
00243   ProblemCellsByDepth = new EtaPhiHists();
00244   ProblemCellsByDepth->setup(dqmStore_," Problem DetDiagPedestal Rate");
00245   for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
00246     problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
00247   nevts_=0;
00248 }
00249 
00250 void HcalDetDiagPedestalClient::endRun(void){analyze();}
00251 
00252 void HcalDetDiagPedestalClient::setup(void){}
00253 void HcalDetDiagPedestalClient::cleanup(void){}
00254 
00255 bool HcalDetDiagPedestalClient::hasErrors_Temp(void)
00256 {
00257     if(status&2) return true;
00258     return false;
00259 
00260   if (!ProblemCells)
00261     {
00262       if (debug_>1) std::cout <<"<HcalDetDiagPedestalClient::hasErrors_Temp>  ProblemCells histogram does not exist!"<<std::endl;
00263       return false;
00264     }
00265   int problemcount=0;
00266   int ieta=-9999;
00267 
00268   for (int depth=0;depth<4; ++depth)
00269     {
00270       int etabins  = (ProblemCells->getTH2F())->GetNbinsX();
00271       int phibins  = (ProblemCells->getTH2F())->GetNbinsY();
00272       for (int hist_eta=0;hist_eta<etabins;++hist_eta)
00273         {
00274           for (int hist_phi=0; hist_phi<phibins;++hist_phi)
00275             {
00276               ieta=CalcIeta(hist_eta,depth+1);
00277               if (ieta==-9999) continue;
00278               if (ProblemCellsByDepth->depth[depth]==0)
00279                   continue;
00280               if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
00281                 ++problemcount;
00282 
00283             } // for (int hist_phi=1;...)
00284         } // for (int hist_eta=1;...)
00285     } // for (int depth=0;...)
00286 
00287   if (problemcount>0) return true;
00288   return false;
00289 }
00290 
00291 bool HcalDetDiagPedestalClient::hasWarnings_Temp(void){
00292    if(status&1) return true;
00293    return false;
00294 }
00295 bool HcalDetDiagPedestalClient::hasOther_Temp(void){return false;}
00296 bool HcalDetDiagPedestalClient::test_enabled(void){return true;}
00297 
00298 
00299 void HcalDetDiagPedestalClient::updateChannelStatus(std::map<HcalDetId, unsigned int>& myqual)
00300 {
00301   // This gets called by HcalMonitorClient
00302   // trigger primitives don't yet contribute to channel status (though they could...)
00303   // see dead or hot cell code for an example
00304 
00305 } //void HcalDetDiagPedestalClient::updateChannelStatus
00306 
00307 static void printTableHeader(ofstream& file,std::string  header){
00308   file << "</html><html xmlns=\"https://www.w3.org/1999/xhtml\">"<< std::endl;
00309      file << "<head>"<< std::endl;
00310      file << "<meta https-equiv=\"Content-Type\" content=\"text/html\"/>"<< std::endl;
00311      file << "<title>"<< header <<"</title>"<< std::endl;
00312      file << "<style type=\"text/css\">"<< std::endl;
00313      file << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< std::endl;
00314      file << "   td.s0 { font-family: arial, arial ce, helvetica; }"<< std::endl;
00315      file << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
00316      file << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< std::endl;
00317      file << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< std::endl;
00318      file << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< std::endl;
00319      file << "</style>"<< std::endl;
00320      file << "<body>"<< std::endl;
00321      file << "<table>"<< std::endl;
00322 }
00323 
00324 static void printTableLine(ofstream& file,int ind,HcalDetId& detid,HcalFrontEndId& lmap_entry,HcalElectronicsId &emap_entry,std::string comment=""){
00325    if(ind==0){
00326      file << "<tr>";
00327      file << "<td class=\"s4\" align=\"center\">#</td>"    << std::endl;
00328      file << "<td class=\"s1\" align=\"center\">ETA</td>"  << std::endl;
00329      file << "<td class=\"s1\" align=\"center\">PHI</td>"  << std::endl;
00330      file << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
00331      file << "<td class=\"s1\" align=\"center\">RBX</td>"  << std::endl;
00332      file << "<td class=\"s1\" align=\"center\">RM</td>"   << std::endl;
00333      file << "<td class=\"s1\" align=\"center\">PIXEL</td>"   << std::endl;
00334      file << "<td class=\"s1\" align=\"center\">RM_FIBER</td>"   << std::endl;
00335      file << "<td class=\"s1\" align=\"center\">FIBER_CH</td>"   << std::endl;
00336      file << "<td class=\"s1\" align=\"center\">QIE</td>"   << std::endl;
00337      file << "<td class=\"s1\" align=\"center\">ADC</td>"   << std::endl;
00338      file << "<td class=\"s1\" align=\"center\">CRATE</td>"   << std::endl;
00339      file << "<td class=\"s1\" align=\"center\">DCC</td>"   << std::endl;
00340      file << "<td class=\"s1\" align=\"center\">SPIGOT</td>"   << std::endl;
00341      file << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>"   << std::endl;
00342      file << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>"   << std::endl;
00343      file << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>"   << std::endl;
00344      if(comment[0]!=0) file << "<td class=\"s1\" align=\"center\">Comment</td>"   << std::endl;
00345      file << "</tr>"   << std::endl;
00346    }
00347    std::string raw_class;
00348    file << "<tr>"<< std::endl;
00349    if((ind%2)==1){
00350       raw_class="<td class=\"s2\" align=\"center\">";
00351    }else{
00352       raw_class="<td class=\"s3\" align=\"center\">";
00353    }
00354    file << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
00355    file << raw_class<< detid.ieta()<<"</td>"<< std::endl;
00356    file << raw_class<< detid.iphi()<<"</td>"<< std::endl;
00357    file << raw_class<< detid.depth() <<"</td>"<< std::endl;
00358    file << raw_class<< lmap_entry.rbx()<<"</td>"<< std::endl;
00359    file << raw_class<< lmap_entry.rm() <<"</td>"<< std::endl;
00360    file << raw_class<< lmap_entry.pixel()<<"</td>"<< std::endl;
00361    file << raw_class<< lmap_entry.rmFiber() <<"</td>"<< std::endl;
00362    file << raw_class<< lmap_entry.fiberChannel()<<"</td>"<< std::endl;
00363    file << raw_class<< lmap_entry.qieCard() <<"</td>"<< std::endl;
00364    file << raw_class<< lmap_entry.adc()<<"</td>"<< std::endl;
00365    file << raw_class<< emap_entry.readoutVMECrateId()<<"</td>"<< std::endl;
00366    file << raw_class<< emap_entry.dccid()<<"</td>"<< std::endl;
00367    file << raw_class<< emap_entry.spigot()<<"</td>"<< std::endl;
00368    file << raw_class<< emap_entry.fiberIndex()<<"</td>"<< std::endl;
00369    file << raw_class<< emap_entry.htrSlot()<<"</td>"<< std::endl;
00370    file << raw_class<< emap_entry.htrTopBottom()<<"</td>"<< std::endl;
00371    if(comment[0]!=0) file << raw_class<< comment<<"</td>"<< std::endl;
00372 }
00373 static void printTableTail(ofstream& file){
00374      file << "</table>"<< std::endl;
00375      file << "</body>"<< std::endl;
00376      file << "</html>"<< std::endl;
00377 }
00378 
00379 bool HcalDetDiagPedestalClient::validHtmlOutput(){
00380   std::string s=subdir_+"HcalDetDiagPedestalMonitor Event Number";
00381   MonitorElement *me = dqmStore_->get(s.c_str());
00382   int n=0;
00383   if ( me ) {
00384     s = me->valueString();
00385     sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &n);
00386   }
00387   if(n<100) return false;
00388   return true;
00389 }
00390 
00391 void HcalDetDiagPedestalClient::htmlOutput(std::string htmlDir){
00392 int  MissingCnt=0,UnstableCnt=0,BadCnt=0; 
00393 int  HBP[4]={0,0,0,0},HBM[4]={0,0,0,0},HEP[4]={0,0,0,0},HEM[4]={0,0,0,0},HFP[4]={0,0,0,0},HFM[4]={0,0,0,0},HO[4] ={0,0,0,0}; 
00394 int  newHBP[4]={0,0,0,0},newHBM[4]={0,0,0,0},newHEP[4]={0,0,0,0},newHEM[4]={0,0,0,0};
00395 int  newHFP[4]={0,0,0,0},newHFM[4]={0,0,0,0},newHO[4] ={0,0,0,0}; 
00396  if (debug_>0) std::cout << "<HcalDetDiagPedestalClient::htmlOutput> Preparing  html output ..." << std::endl;
00397   if(!dqmStore_) return;
00398 
00399   HcalElectronicsMap emap=logicalMap_->generateHcalElectronicsMap();
00400   TH2F *Missing_val[4],*Unstable_val[4],*BadPed_val[4],*BadRMS_val[4];
00401   MonitorElement* me;
00402 
00403 
00404   TH1F *PedestalsAve4HB=0;
00405   TH1F *PedestalsAve4HE=0;
00406   TH1F *PedestalsAve4HO=0;
00407   TH1F *PedestalsAve4HF=0;
00408   TH1F *PedestalsAve4Simp=0;
00409  
00410   TH1F *PedestalsAve4HBref=0;
00411   TH1F *PedestalsAve4HEref=0;
00412   TH1F *PedestalsAve4HOref=0;
00413   TH1F *PedestalsAve4HFref=0;
00414   TH1F *PedestalsRmsHB=0;
00415   TH1F *PedestalsRmsHE=0;
00416   TH1F *PedestalsRmsHO=0;
00417   TH1F *PedestalsRmsHF=0;
00418   TH1F *PedestalsRmsSimp=0;
00419   
00420   TH1F *PedestalsRmsHBref=0;
00421   TH1F *PedestalsRmsHEref=0;
00422   TH1F *PedestalsRmsHOref=0;
00423   TH1F *PedestalsRmsHFref=0;
00424   
00425   TH2F *Pedestals2DRmsHBHEHF=0;
00426   TH2F *Pedestals2DRmsHO=0;
00427   TH2F *Pedestals2DHBHEHF=0;
00428   TH2F *Pedestals2DHO=0;
00429   TH2F *Pedestals2DErrorHBHEHF=0;
00430   TH2F *Pedestals2DErrorHO=0;
00431 
00432   std::string s=subdir_+"Summary Plots/HB Pedestal Distribution (average over 4 caps)"; me=dqmStore_->get(s.c_str());
00433   if(me!=0) PedestalsAve4HB=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HB, debug_); else return;
00434   s=subdir_+"Summary Plots/HE Pedestal Distribution (average over 4 caps)"; me=dqmStore_->get(s.c_str()); 
00435   if(me!=0) PedestalsAve4HE=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HE, debug_);  else return; 
00436   s=subdir_+"Summary Plots/HO Pedestal Distribution (average over 4 caps)"; me=dqmStore_->get(s.c_str()); 
00437   if(me!=0) PedestalsAve4HO=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HO, debug_);  else return; 
00438   s=subdir_+"Summary Plots/HF Pedestal Distribution (average over 4 caps)"; me=dqmStore_->get(s.c_str()); 
00439   if(me!=0) PedestalsAve4HF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HF, debug_);  else return; 
00440   s=subdir_+"Summary Plots/SIPM Pedestal Distribution (average over 4 caps)"; me=dqmStore_->get(s.c_str()); 
00441   if(me!=0) PedestalsAve4Simp=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4Simp, debug_); else return; 
00442  
00443   s=subdir_+"Summary Plots/HB Pedestal-Reference Distribution (average over 4 caps)"; me=dqmStore_->get(s.c_str()); 
00444   if(me!=0) PedestalsAve4HBref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HBref, debug_); else return;  
00445   s=subdir_+"Summary Plots/HE Pedestal-Reference Distribution (average over 4 caps)"; me=dqmStore_->get(s.c_str()); 
00446   if(me!=0) PedestalsAve4HEref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HEref, debug_); else return; 
00447   s=subdir_+"Summary Plots/HO Pedestal-Reference Distribution (average over 4 caps)"; me=dqmStore_->get(s.c_str()); 
00448   if(me!=0) PedestalsAve4HOref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HOref, debug_); else return;  
00449   s=subdir_+"Summary Plots/HF Pedestal-Reference Distribution (average over 4 caps)"; me=dqmStore_->get(s.c_str()); 
00450   if(me!=0) PedestalsAve4HFref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HFref, debug_); else return;  
00451    
00452   s=subdir_+"Summary Plots/HB Pedestal RMS Distribution (individual cap)"; me=dqmStore_->get(s.c_str()); 
00453   if(me!=0) PedestalsRmsHB=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHB, debug_);  else return; 
00454   s=subdir_+"Summary Plots/HE Pedestal RMS Distribution (individual cap)"; me=dqmStore_->get(s.c_str()); 
00455   if(me!=0) PedestalsRmsHE=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHE, debug_);  else return; 
00456   s=subdir_+"Summary Plots/HO Pedestal RMS Distribution (individual cap)"; me=dqmStore_->get(s.c_str()); 
00457   if(me!=0) PedestalsRmsHO=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHO, debug_);  else return; 
00458   s=subdir_+"Summary Plots/HF Pedestal RMS Distribution (individual cap)"; me=dqmStore_->get(s.c_str()); 
00459   if(me!=0) PedestalsRmsHF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHF, debug_);  else return; 
00460   s=subdir_+"Summary Plots/SIPM Pedestal RMS Distribution (individual cap)"; me=dqmStore_->get(s.c_str()); 
00461   if(me!=0) PedestalsRmsSimp=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsSimp, debug_);  else return; 
00462    
00463   s=subdir_+"Summary Plots/HB Pedestal_rms-Reference_rms Distribution"; me=dqmStore_->get(s.c_str()); 
00464   if(me!=0) PedestalsRmsHBref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHBref, debug_);  else return; 
00465   s=subdir_+"Summary Plots/HE Pedestal_rms-Reference_rms Distribution"; me=dqmStore_->get(s.c_str()); 
00466   if(me!=0) PedestalsRmsHEref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHEref, debug_);  else return; 
00467   s=subdir_+"Summary Plots/HO Pedestal_rms-Reference_rms Distribution"; me=dqmStore_->get(s.c_str()); 
00468   if(me!=0) PedestalsRmsHOref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHOref, debug_);  else return; 
00469   s=subdir_+"Summary Plots/HF Pedestal_rms-Reference_rms Distribution"; me=dqmStore_->get(s.c_str()); 
00470   if(me!=0) PedestalsRmsHFref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHFref, debug_);  else return; 
00471      
00472   s=subdir_+"Summary Plots/HBHEHF pedestal mean map"; me=dqmStore_->get(s.c_str()); 
00473   if(me!=0) Pedestals2DHBHEHF=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DHBHEHF, debug_); else return;  
00474   s=subdir_+"Summary Plots/HO pedestal mean map"; me=dqmStore_->get(s.c_str()); 
00475   if(me!=0) Pedestals2DHO=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DHO, debug_);  else return; 
00476   s=subdir_+"Summary Plots/HBHEHF pedestal rms map"; me=dqmStore_->get(s.c_str()); 
00477   if(me!=0) Pedestals2DRmsHBHEHF=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DRmsHBHEHF, debug_); else return;  
00478   s=subdir_+"Summary Plots/HO pedestal rms map"; me=dqmStore_->get(s.c_str()); 
00479   if(me!=0) Pedestals2DRmsHO=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DRmsHO, debug_);  else return; 
00480   s=subdir_+"Summary Plots/HBHEHF pedestal problems map"; me=dqmStore_->get(s.c_str()); 
00481   if(me!=0) Pedestals2DErrorHBHEHF=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DErrorHBHEHF, debug_);  else return; 
00482   s=subdir_+"Summary Plots/HO pedestal problems map"; me=dqmStore_->get(s.c_str()); 
00483   if(me!=0) Pedestals2DErrorHO=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DErrorHO, debug_); else return;  
00484 
00485 
00486   std::vector<std::string> name = HcalEtaPhiHistNames();
00487   for(int i=0;i<4;++i){
00488       Missing_val[i]=Unstable_val[i]=BadPed_val[i]=BadRMS_val[i]=0;
00489       std::string s=subdir_+"Plots for client/"+name[i]+" Missing channels";
00490       me=dqmStore_->get(s.c_str());
00491       if (me!=0) Missing_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Missing_val[i], debug_); else return;  
00492       s=subdir_+"Plots for client/"+name[i]+" Channel instability value";
00493       me=dqmStore_->get(s.c_str());
00494       if (me!=0) Unstable_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Unstable_val[i], debug_); else return;  
00495       s=subdir_+"Plots for client/"+name[i]+" Bad Pedestal-Ref Value";
00496       me=dqmStore_->get(s.c_str());
00497       if (me!=0) BadPed_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadPed_val[i], debug_); else return;  
00498       s=subdir_+"Plots for client/"+name[i]+" Bad Rms-ref Value";
00499       me=dqmStore_->get(s.c_str());
00500       if (me!=0) BadRMS_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadRMS_val[i], debug_); else return;  
00501   }
00502   // Calculate problems 
00503   for(int d=0;d<4;++d){
00504       int etabins=Missing_val[d]->GetNbinsX();
00505       int phibins=Missing_val[d]->GetNbinsY();
00506       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00507           int ieta=CalcIeta(eta,d+1);
00508           if(ieta==-9999) continue;
00509           HcalSubdetector subdet=HcalEmpty;
00510           if(isHB(eta,d+1))subdet=HcalBarrel;
00511              else if (isHE(eta,d+1)) subdet=HcalEndcap;
00512              else if (isHF(eta,d+1)) subdet=HcalForward;
00513              else if (isHO(eta,d+1)) subdet=HcalOuter;
00514           HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
00515           float val=Missing_val[d]->GetBinContent(eta+1,phi+1);
00516           if(val!=0){
00517             if(subdet==HcalBarrel){
00518                if(ieta>0){ HBP[0]++;}else{ HBM[0]++;} MissingCnt++;
00519                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[0]++;}else{ newHBM[0]++;}}
00520             }   
00521             if(subdet==HcalEndcap){
00522                if(ieta>0){ HEP[0]++;}else{ HEM[0]++;} MissingCnt++;
00523                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[0]++;}else{ newHEM[0]++;}}
00524             }   
00525             if(subdet==HcalForward){
00526                if(ieta>0){ HFP[0]++;}else{ HFM[0]++;} MissingCnt++;
00527                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[0]++;}else{ newHFM[0]++;}}
00528             }   
00529             if(subdet==HcalOuter){
00530                HO[0]++;MissingCnt++;
00531                if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[0]++;}
00532             }   
00533          }
00534          val=Unstable_val[d]->GetBinContent(eta+1,phi+1);
00535          if(val!=0){
00536             if(subdet==HcalBarrel){
00537                if(ieta>0){ HBP[1]++;}else{ HBM[1]++;} UnstableCnt++;
00538                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[1]++;}else{ newHBM[1]++;}}
00539             }   
00540             if(subdet==HcalEndcap){
00541                if(ieta>0){ HEP[1]++;}else{ HEM[1]++;} UnstableCnt++;
00542                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[1]++;}else{ newHEM[1]++;}}
00543             }   
00544             if(subdet==HcalForward){
00545                if(ieta>0){ HFP[1]++;}else{ HFM[1]++;} UnstableCnt++;
00546                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[1]++;}else{ newHFM[1]++;}}
00547             }   
00548             if(subdet==HcalOuter){
00549                HO[1]++;UnstableCnt++;
00550                if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[1]++;}
00551             }   
00552          }
00553          val=BadPed_val[d]->GetBinContent(eta+1,phi+1);
00554          if(val!=0){
00555             if(subdet==HcalBarrel){
00556                if(ieta>0){ HBP[2]++;}else{ HBM[2]++;} BadCnt++;
00557                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[2]++;}else{ newHBM[2]++;}}
00558             }   
00559             if(subdet==HcalEndcap){
00560                if(ieta>0){ HEP[2]++;}else{ HEM[2]++;} BadCnt++;
00561                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[2]++;}else{ newHEM[2]++;}}
00562             }   
00563             if(subdet==HcalForward){
00564                if(ieta>0){ HFP[2]++;}else{ HFM[2]++;} BadCnt++;
00565                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[2]++;}else{ newHFM[2]++;}}
00566             }   
00567             if(subdet==HcalOuter){
00568                HO[2]++;BadCnt++;
00569                if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[2]++;}
00570             }   
00571          }
00572          val=BadRMS_val[d]->GetBinContent(eta+1,phi+1);
00573          if(val!=0){
00574             if(subdet==HcalBarrel){
00575                if(ieta>0){ HBP[3]++;}else{ HBM[3]++;} BadCnt++;
00576                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[3]++;}else{ newHBM[3]++;}}
00577             }   
00578             if(subdet==HcalEndcap){
00579                if(ieta>0){ HEP[3]++;}else{ HEM[3]++;} BadCnt++;
00580                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[3]++;}else{ newHEM[3]++;}}
00581             }   
00582             if(subdet==HcalForward){
00583                if(ieta>0){ HFP[3]++;}else{ HFM[3]++;} BadCnt++;
00584                if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[3]++;}else{ newHFM[3]++;}}
00585             }   
00586             if(subdet==HcalOuter){
00587                HO[3]++;BadCnt++;
00588                if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[3]++;}
00589             }   
00590          }
00591       } 
00592   } 
00593 
00594 
00595   ofstream badMissing; 
00596   badMissing.open((htmlDir+"bad_missing_table.html").c_str());
00597   printTableHeader(badMissing,"Missing Channels list");
00598   ofstream badUnstable; 
00599   badUnstable.open((htmlDir+"bad_unstable_table.html").c_str());
00600   printTableHeader(badUnstable,"Unstable Channels list");
00601   ofstream badPedRMS; 
00602   badPedRMS.open((htmlDir+"bad_badpedrms_table.html").c_str());
00603   printTableHeader(badPedRMS,"Missing Channels list");
00604 
00605   int cnt=0;
00606   if((HBP[0]+HBP[0])>0 && (HBM[0]+HBP[0])!=(1296*2)){
00607     badMissing << "<tr><td align=\"center\"><h3>"<< "HB" <<"</h3></td></tr>" << std::endl;
00608     for(int d=0;d<4;++d){
00609       int etabins=Missing_val[d]->GetNbinsX();
00610       int phibins=Missing_val[d]->GetNbinsY();
00611       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00612           int ieta=CalcIeta(eta,d+1);
00613           if(ieta==-9999) continue;
00614           if(!isHB(eta,d+1)) continue;
00615           float val=Missing_val[d]->GetBinContent(eta+1,phi+1);
00616           if(val==0) continue;
00617           HcalDetId hcalid(HcalBarrel,ieta,phi+1,d+1);
00618           std::string s=" ";
00619           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s="Known problem";}        
00620           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00621           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00622           printTableLine(badMissing,cnt++,hcalid,lmap_entry,emap_entry,s);
00623       } 
00624     } 
00625   }
00626   cnt=0;
00627   if((HEP[0]+HEP[0])>0 && (HEM[0]+HEP[0])!=(1296*2)){
00628     badMissing << "<tr><td align=\"center\"><h3>"<< "HE" <<"</h3></td></tr>" << std::endl;
00629     for(int d=0;d<4;++d){
00630       int etabins=Missing_val[d]->GetNbinsX();
00631       int phibins=Missing_val[d]->GetNbinsY();
00632       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00633           int ieta=CalcIeta(eta,d+1);
00634           if(ieta==-9999) continue;
00635           if(!isHE(eta,d+1)) continue;
00636           float val=Missing_val[d]->GetBinContent(eta+1,phi+1);
00637           if(val==0) continue;
00638           HcalDetId hcalid(HcalEndcap,ieta,phi+1,d+1);
00639           std::string s=" ";
00640           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s="Known problem";}        
00641           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00642           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00643           printTableLine(badMissing,cnt++,hcalid,lmap_entry,emap_entry,s);
00644       } 
00645     } 
00646   }
00647   cnt=0;
00648   if(HO[0]>0 && HO[0]!=2160){
00649     badMissing << "<tr><td align=\"center\"><h3>"<< "HO" <<"</h3></td></tr>" << std::endl;
00650     for(int d=0;d<4;++d){
00651       int etabins=Missing_val[d]->GetNbinsX();
00652       int phibins=Missing_val[d]->GetNbinsY();
00653       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00654           int ieta=CalcIeta(eta,d+1);
00655           if(ieta==-9999) continue;
00656           if(!isHO(eta,d+1)) continue;
00657           float val=Missing_val[d]->GetBinContent(eta+1,phi+1);
00658           if(val==0) continue;
00659           HcalDetId hcalid(HcalOuter,ieta,phi+1,d+1);
00660           std::string s=" ";
00661           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s="Known problem";}
00662           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00663           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00664           printTableLine(badMissing,cnt++,hcalid,lmap_entry,emap_entry,s);
00665       } 
00666     } 
00667   }
00668   cnt=0;
00669   if((HFP[0]+HFP[0])>0 && (HFM[0]+HFP[0])!=(864*2)){
00670     badMissing << "<tr><td align=\"center\"><h3>"<< "HF" <<"</h3></td></tr>" << std::endl;
00671     for(int d=0;d<4;++d){
00672       int etabins=Missing_val[d]->GetNbinsX();
00673       int phibins=Missing_val[d]->GetNbinsY();
00674       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00675           int ieta=CalcIeta(eta,d+1);
00676           if(ieta==-9999) continue;
00677           if(!isHF(eta,d+1)) continue;
00678           float val=Missing_val[d]->GetBinContent(eta+1,phi+1);
00679           if(val==0) continue;
00680           HcalDetId hcalid(HcalForward,ieta,phi+1,d+1);
00681           std::string s=" ";
00682           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s="Known problem";}        
00683           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00684           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00685           printTableLine(badMissing,cnt++,hcalid,lmap_entry,emap_entry,s);
00686       } 
00687     } 
00688   }
00690   cnt=0;
00691   if((HBP[1]+HBP[1])>0){
00692     badUnstable << "<tr><td align=\"center\"><h3>"<< "HB" <<"</h3></td></tr>" << std::endl;
00693     for(int d=0;d<4;++d){
00694       int etabins=Unstable_val[d]->GetNbinsX();
00695       int phibins=Unstable_val[d]->GetNbinsY();
00696       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00697           int ieta=CalcIeta(eta,d+1);
00698           if(ieta==-9999) continue;
00699           if(!isHB(eta,d+1)) continue;
00700           float val=Unstable_val[d]->GetBinContent(eta+1,phi+1);
00701           if(val==0) continue;
00702           HcalDetId hcalid(HcalBarrel,ieta,phi+1,d+1);
00703           char comment[100]; sprintf(comment,"Missing in %.3f%% of events\n",(1.0-val)*100.0);
00704           std::string s=comment;
00705           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}      
00706           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00707           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00708           printTableLine(badUnstable,cnt++,hcalid,lmap_entry,emap_entry,s);
00709       } 
00710     } 
00711   }
00712   cnt=0;
00713   if((HEP[1]+HEP[1])>0){
00714     badUnstable << "<tr><td align=\"center\"><h3>"<< "HE" <<"</h3></td></tr>" << std::endl;
00715     for(int d=0;d<4;++d){
00716       int etabins=Unstable_val[d]->GetNbinsX();
00717       int phibins=Unstable_val[d]->GetNbinsY();
00718       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00719           int ieta=CalcIeta(eta,d+1);
00720           if(ieta==-9999) continue;
00721           if(!isHE(eta,d+1)) continue;
00722           float val=Unstable_val[d]->GetBinContent(eta+1,phi+1);
00723           if(val==0) continue;
00724           HcalDetId hcalid(HcalEndcap,ieta,phi+1,d+1);
00725           char comment[100]; sprintf(comment,"Missing in %.3f%% of events\n",(1.0-val)*100.0);
00726           std::string s=comment;
00727           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}      
00728           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00729           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00730           printTableLine(badUnstable,cnt++,hcalid,lmap_entry,emap_entry,s);
00731       } 
00732     } 
00733   }
00734   cnt=0;
00735   if(HO[1]>0){
00736     badUnstable << "<tr><td align=\"center\"><h3>"<< "HO" <<"</h3></td></tr>" << std::endl;
00737     for(int d=0;d<4;++d){
00738       int etabins=Unstable_val[d]->GetNbinsX();
00739       int phibins=Unstable_val[d]->GetNbinsY();
00740       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00741           int ieta=CalcIeta(eta,d+1);
00742           if(ieta==-9999) continue;
00743           if(!isHO(eta,d+1)) continue;
00744           float val=Unstable_val[d]->GetBinContent(eta+1,phi+1);
00745           if(val==0) continue;
00746           HcalDetId hcalid(HcalOuter,ieta,phi+1,d+1);
00747           char comment[100]; sprintf(comment,"Missing in %.3f%% of events\n",(1.0-val)*100.0);
00748           std::string s=comment;
00749           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}
00750           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00751           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00752           printTableLine(badUnstable,cnt++,hcalid,lmap_entry,emap_entry,s);
00753       } 
00754     } 
00755   }
00756   cnt=0;
00757   if((HFP[1]+HFP[1])>0){
00758     badUnstable << "<tr><td align=\"center\"><h3>"<< "HF" <<"</h3></td></tr>" << std::endl;
00759     for(int d=0;d<4;++d){
00760       int etabins=Unstable_val[d]->GetNbinsX();
00761       int phibins=Unstable_val[d]->GetNbinsY();
00762       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00763           int ieta=CalcIeta(eta,d+1);
00764           if(ieta==-9999) continue;
00765           if(!isHF(eta,d+1)) continue;
00766           float val=Unstable_val[d]->GetBinContent(eta+1,phi+1);
00767           if(val==0) continue;
00768           HcalDetId hcalid(HcalForward,ieta,phi+1,d+1);
00769           char comment[100]; sprintf(comment,"Missing in %.3f%% of events\n",(1.0-val)*100.0);
00770           std::string s=comment;
00771           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}      
00772           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00773           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00774           printTableLine(badUnstable,cnt++,hcalid,lmap_entry,emap_entry,s);
00775       } 
00776     } 
00777   }
00779   cnt=0;
00780   if((HBP[2]+HBP[2]+HBP[3]+HBP[3])>0){
00781     badPedRMS << "<tr><td align=\"center\"><h3>"<< "HB" <<"</h3></td></tr>" << std::endl;
00782     for(int d=0;d<4;++d){
00783       int etabins=BadPed_val[d]->GetNbinsX();
00784       int phibins=BadPed_val[d]->GetNbinsY();
00785       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00786           int ieta=CalcIeta(eta,d+1);
00787           if(ieta==-9999) continue;
00788           if(!isHB(eta,d+1)) continue;
00789           float val1=BadPed_val[d]->GetBinContent(eta+1,phi+1);
00790           float val2=BadRMS_val[d]->GetBinContent(eta+1,phi+1);
00791           if(val1==0 && val2==0) continue;
00792           HcalDetId hcalid(HcalBarrel,ieta,phi+1,d+1);
00793           char comment[100]; 
00794           if(val1!=0) sprintf(comment,"Ped-Ref=%.2f",val1);
00795           if(val2!=0) sprintf(comment,"Rms-Ref=%.2f",val2);
00796           if(val1!=0 && val2!=0) sprintf(comment,"Ped-Ref=%.2f,Rms-Ref=%.2f",val1,val2);
00797           std::string s=comment;
00798           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}      
00799           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00800           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00801           printTableLine(badPedRMS,cnt++,hcalid,lmap_entry,emap_entry,s);
00802       } 
00803     } 
00804   }
00805   cnt=0;
00806   if((HEP[2]+HEP[2]+HEP[3]+HEP[3])>0){
00807     badPedRMS << "<tr><td align=\"center\"><h3>"<< "HE" <<"</h3></td></tr>" << std::endl;
00808     for(int d=0;d<4;++d){
00809       int etabins=BadPed_val[d]->GetNbinsX();
00810       int phibins=BadPed_val[d]->GetNbinsY();
00811       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00812           int ieta=CalcIeta(eta,d+1);
00813           if(ieta==-9999) continue;
00814           if(!isHE(eta,d+1)) continue;
00815           float val1=BadPed_val[d]->GetBinContent(eta+1,phi+1);
00816           float val2=BadRMS_val[d]->GetBinContent(eta+1,phi+1);
00817           if(val1==0 && val2==0) continue;
00818           HcalDetId hcalid(HcalEndcap,ieta,phi+1,d+1);
00819           char comment[100]; 
00820           if(val1!=0) sprintf(comment,"Ped-Ref=%.2f",val1);
00821           if(val2!=0) sprintf(comment,"Rms-Ref=%.2f",val2);
00822           if(val1!=0 && val2!=0) sprintf(comment,"Ped-Ref=%.2f,Rms-Ref=%.2f",val1,val2);
00823           std::string s=comment;
00824           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}      
00825           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00826           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00827           printTableLine(badPedRMS,cnt++,hcalid,lmap_entry,emap_entry,s);
00828       } 
00829     } 
00830   }
00831   cnt=0;
00832   if((HO[2]+HO[3])>0){
00833     badPedRMS << "<tr><td align=\"center\"><h3>"<< "HO" <<"</h3></td></tr>" << std::endl;
00834     for(int d=0;d<4;++d){
00835       int etabins=BadPed_val[d]->GetNbinsX();
00836       int phibins=BadPed_val[d]->GetNbinsY();
00837       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00838           int ieta=CalcIeta(eta,d+1);
00839           if(ieta==-9999) continue;
00840           if(!isHO(eta,d+1)) continue;
00841           float val1=BadPed_val[d]->GetBinContent(eta+1,phi+1);
00842           float val2=BadRMS_val[d]->GetBinContent(eta+1,phi+1);
00843           if(val1==0 && val2==0) continue;
00844           HcalDetId hcalid(HcalOuter,ieta,phi+1,d+1);
00845           char comment[100]; 
00846           if(val1!=0) sprintf(comment,"Ped-Ref=%.2f",val1);
00847           if(val2!=0) sprintf(comment,"Rms-Ref=%.2f",val2);
00848           if(val1!=0 && val2!=0) sprintf(comment,"Ped-Ref=%.2f,Rms-Ref=%.2f",val1,val2);
00849           std::string s=comment;
00850           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}
00851           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00852           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00853           printTableLine(badPedRMS,cnt++,hcalid,lmap_entry,emap_entry,s);
00854       } 
00855     } 
00856   }
00857   cnt=0;
00858   if((HFP[2]+HFP[2]+HFP[3]+HFP[3])>0){
00859     badPedRMS << "<tr><td align=\"center\"><h3>"<< "HF" <<"</h3></td></tr>" << std::endl;
00860     for(int d=0;d<4;++d){
00861       int etabins=BadPed_val[d]->GetNbinsX();
00862       int phibins=BadPed_val[d]->GetNbinsY();
00863       for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00864           int ieta=CalcIeta(eta,d+1);
00865           if(ieta==-9999) continue;
00866           if(!isHF(eta,d+1)) continue;
00867           float val1=BadPed_val[d]->GetBinContent(eta+1,phi+1);
00868           float val2=BadRMS_val[d]->GetBinContent(eta+1,phi+1);
00869           if(val1==0 && val2==0) continue;
00870           HcalDetId hcalid(HcalForward,ieta,phi+1,d+1);
00871           char comment[100]; 
00872           if(val1!=0) sprintf(comment,"Ped-Ref=%.2f",val1);
00873           if(val2!=0) sprintf(comment,"Rms-Ref=%.2f",val2);
00874           if(val1!=0 && val2!=0) sprintf(comment,"Ped-Ref=%.2f,Rms-Ref=%.2f",val1,val2);
00875           std::string s=comment;
00876           if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}      
00877           HcalFrontEndId    lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
00878           HcalElectronicsId emap_entry=emap.lookup(hcalid);
00879           printTableLine(badPedRMS,cnt++,hcalid,lmap_entry,emap_entry,s);
00880       } 
00881     } 
00882   }
00883 
00884   printTableTail(badMissing);
00885   badMissing.close();
00886   printTableTail(badUnstable);
00887   badUnstable.close();
00888   printTableTail(badPedRMS);
00889   badPedRMS.close();
00890 
00891   int ievt_ = -1,runNo=-1;
00892   std::string ref_run;
00893   s=subdir_+"HcalDetDiagPedestalMonitor Event Number";
00894   me = dqmStore_->get(s.c_str());
00895   if ( me ) {
00896     s = me->valueString();
00897     sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &ievt_);
00898   }
00899   s=subdir_+"HcalDetDiagPedestalMonitor Run Number";
00900   me = dqmStore_->get(s.c_str());
00901   if ( me ) {
00902     s = me->valueString();
00903     sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &runNo);
00904   } 
00905   s=subdir_+"HcalDetDiagLaserMonitor Reference Run";
00906   me = dqmStore_->get(s.c_str());
00907   if(me) {
00908     std::string s=me->valueString();
00909     char str[200]; 
00910     sscanf((s.substr(2,s.length()-2)).c_str(), "%s", str);
00911     ref_run=str;
00912   }
00913 
00914   gROOT->SetBatch(true);
00915   gStyle->SetCanvasColor(0);
00916   gStyle->SetPadColor(0);
00917   gStyle->SetOptStat(111110);
00918   gStyle->SetPalette(1);
00919  
00920   TCanvas *can=new TCanvas("HcalDetDiagPedestalClient","HcalDetDiagPedestalClient",0,0,500,350);
00921   can->cd();
00922 
00923   ofstream htmlFile;
00924   std::string outfile=htmlDir+name_+".html";
00925   htmlFile.open(outfile.c_str());
00926   // html page header
00927   htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">  " << std::endl;
00928   htmlFile << "<html>  " << std::endl;
00929   htmlFile << "<head>  " << std::endl;
00930   htmlFile << "  <meta content=\"text/html; charset=ISO-8859-1\"  " << std::endl;
00931   htmlFile << " https-equiv=\"content-type\">  " << std::endl;
00932   htmlFile << "  <title>Detector Diagnostics Pedestal Monitor</title> " << std::endl;
00933   htmlFile << "</head>  " << std::endl;
00934   htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << std::endl;
00935   htmlFile << "<style type=\"text/css\">"<< std::endl;
00936   htmlFile << "   td.s0 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FF7700; text-align: center;}"<< std::endl;
00937   htmlFile << "   td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
00938   htmlFile << "   td.s2 { font-family: arial, arial ce, helvetica; background-color: red; }"<< std::endl;
00939   htmlFile << "   td.s3 { font-family: arial, arial ce, helvetica; background-color: yellow; }"<< std::endl;
00940   htmlFile << "   td.s4 { font-family: arial, arial ce, helvetica; background-color: green; }"<< std::endl;
00941   htmlFile << "   td.s5 { font-family: arial, arial ce, helvetica; background-color: silver; }"<< std::endl;
00942   std::string state[4]={"<td class=\"s2\" align=\"center\">",
00943                         "<td class=\"s3\" align=\"center\">",
00944                         "<td class=\"s4\" align=\"center\">",
00945                         "<td class=\"s5\" align=\"center\">"};
00946   htmlFile << "</style>"<< std::endl;
00947   htmlFile << "<body>  " << std::endl;
00948   htmlFile << "<br>  " << std::endl;
00949   htmlFile << "<h2>Run:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << std::endl;
00950   htmlFile << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << std::endl;
00951   htmlFile << " style=\"color: rgb(0, 0, 153);\">" << runNo << "</span></h2>" << std::endl;
00952   htmlFile << "<h2>Monitoring task:&nbsp;&nbsp;&nbsp;&nbsp; <span " << std::endl;
00953   htmlFile << " style=\"color: rgb(0, 0, 153);\">Detector Diagnostics Pedestal Monitor</span></h2> " << std::endl;
00954   htmlFile << "<h2>Events processed:&nbsp;&nbsp;&nbsp;&nbsp;<span " << std::endl;
00955   htmlFile << " style=\"color: rgb(0, 0, 153);\">" << ievt_ << "</span></h2>" << std::endl;
00956   htmlFile << "<hr>" << std::endl;
00958   htmlFile << "<table width=100% border=1>" << std::endl;
00959   htmlFile << "<tr>" << std::endl;
00960   htmlFile << "<td class=\"s0\" width=20% align=\"center\">SebDet</td>" << std::endl;
00961   htmlFile << "<td class=\"s0\" width=20% align=\"center\">Missing</td>" << std::endl;
00962   htmlFile << "<td class=\"s0\" width=20% align=\"center\">Unstable</td>" << std::endl;
00963   htmlFile << "<td class=\"s0\" width=20% align=\"center\">Bad |Ped-Ref|</td>" << std::endl;
00964   htmlFile << "<td class=\"s0\" width=20% align=\"center\">Bad |Rms-Ref|</td>" << std::endl;
00965   htmlFile << "</tr><tr>" << std::endl;
00966   int ind1=0,ind2=0,ind3=0,ind4=0;
00967   htmlFile << "<td class=\"s1\" align=\"center\">HB+</td>" << std::endl;
00968   ind1=3; if(newHBP[0]==0) ind1=2; if(newHBP[0]>0 && newHBP[0]<=12) ind1=1; if(newHBP[0]>=12 && newHBP[0]<1296) ind1=0; 
00969   ind2=3; if(newHBP[1]==0) ind2=2; if(newHBP[1]>0)  ind2=1; if(newHBP[1]>21)  ind2=0; 
00970   ind3=3; if(newHBP[2]==0) ind3=2; if(newHBP[2]>0)  ind3=1; if(newHBP[2]>21)  ind3=0;
00971   ind4=3; if(newHBP[3]==0) ind4=2; if(newHBP[3]>0)  ind4=1; if(newHBP[3]>21)  ind4=0;
00972   if(ind1==3) ind2=ind3=ind4=3;  
00973   if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1; 
00974   htmlFile << state[ind1] << HBP[0] <<" (1296)</td>" << std::endl;
00975   htmlFile << state[ind2] << HBP[1] <<"</td>" << std::endl;
00976   htmlFile << state[ind3] << HBP[2] <<"</td>" << std::endl;
00977   htmlFile << state[ind4] << HBP[3] <<"</td>" << std::endl;
00978   
00979   htmlFile << "</tr><tr>" << std::endl;
00980   htmlFile << "<td class=\"s1\" align=\"center\">HB-</td>" << std::endl;
00981   ind1=3; if(newHBM[0]==0) ind1=2; if(newHBM[0]>0 && newHBM[0]<=12) ind1=1; if(newHBM[0]>=12 && newHBM[0]<1296) ind1=0; 
00982   ind2=3; if(newHBM[1]==0) ind2=2; if(newHBM[1]>0)  ind2=1; if(newHBM[1]>21)  ind2=0; 
00983   ind3=3; if(newHBM[2]==0) ind3=2; if(newHBM[2]>0)  ind3=1; if(newHBM[2]>21)  ind3=0;
00984   ind4=3; if(newHBM[3]==0) ind4=2; if(newHBM[3]>0)  ind4=1; if(newHBM[3]>21)  ind4=0;
00985   if(ind1==3) ind2=ind3=ind4=3;
00986   if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1; 
00987   htmlFile << state[ind1] << HBM[0] <<" (1296)</td>" << std::endl;
00988   htmlFile << state[ind2] << HBM[1] <<"</td>" << std::endl;
00989   htmlFile << state[ind3] << HBM[2] <<"</td>" << std::endl;
00990   htmlFile << state[ind4] << HBM[3] <<"</td>" << std::endl;
00991   
00992   htmlFile << "</tr><tr>" << std::endl;
00993   htmlFile << "<td class=\"s1\" align=\"center\">HE+</td>" << std::endl;
00994   ind1=3; if(newHEP[0]==0) ind1=2; if(newHEP[0]>0 && newHEP[0]<=12) ind1=1; if(newHEP[0]>=12 && newHEP[0]<1296) ind1=0; 
00995   ind2=3; if(newHEP[1]==0) ind2=2; if(newHEP[1]>0)  ind2=1; if(newHEP[1]>21)  ind2=0; 
00996   ind3=3; if(newHEP[2]==0) ind3=2; if(newHEP[2]>0)  ind3=1; if(newHEP[2]>21)  ind3=0;
00997   ind4=3; if(newHEP[3]==0) ind4=2; if(newHEP[3]>0)  ind4=1; if(newHEP[3]>21)  ind4=0;
00998   if(ind1==3) ind2=ind3=ind4=3;
00999   if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1; 
01000   htmlFile << state[ind1] << HEP[0] <<" (1296)</td>" << std::endl;
01001   htmlFile << state[ind2] << HEP[1] <<"</td>" << std::endl;
01002   htmlFile << state[ind3] << HEP[2] <<"</td>" << std::endl;
01003   htmlFile << state[ind4] << HEP[3] <<"</td>" << std::endl;
01004   
01005   htmlFile << "</tr><tr>" << std::endl;
01006   htmlFile << "<td class=\"s1\" align=\"center\">HE-</td>" << std::endl;
01007   ind1=3; if(newHEM[0]==0) ind1=2; if(newHEM[0]>0 && newHEM[0]<=12) ind1=1; if(newHEM[0]>=12 && newHEM[0]<1296) ind1=0; 
01008   ind2=3; if(newHEM[1]==0) ind2=2; if(newHEM[1]>0)  ind2=1; if(newHEM[1]>21)  ind2=0; 
01009   ind3=3; if(newHEM[2]==0) ind3=2; if(newHEM[2]>0)  ind3=1; if(newHEM[2]>21)  ind3=0;
01010   ind4=3; if(newHEM[3]==0) ind4=2; if(newHEM[3]>0)  ind4=1; if(newHEM[3]>21)  ind4=0;
01011   if(ind1==3) ind2=ind3=ind4=3;
01012   if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1; 
01013   htmlFile << state[ind1] << HEM[0] <<" (1296)</td>" << std::endl;
01014   htmlFile << state[ind2] << HEM[1] <<"</td>" << std::endl;
01015   htmlFile << state[ind3] << HEM[2] <<"</td>" << std::endl;
01016   htmlFile << state[ind4] << HEM[3] <<"</td>" << std::endl;
01017   
01018   htmlFile << "</tr><tr>" << std::endl;
01019   htmlFile << "<td class=\"s1\" align=\"center\">HF+</td>" << std::endl;
01020   ind1=3; if(newHFP[0]==0) ind1=2; if(newHFP[0]>0 && newHFP[0]<=12) ind1=1; if(newHFP[0]>=12 && newHFP[0]<864) ind1=0; 
01021   ind2=3; if(newHFP[1]==0) ind2=2; if(newHFP[1]>0)  ind2=1; if(newHFP[1]>21)  ind2=0; 
01022   ind3=3; if(newHFP[2]==0) ind3=2; if(newHFP[2]>0)  ind3=1; if(newHFP[2]>21)  ind3=0;
01023   ind4=3; if(newHFP[3]==0) ind4=2; if(newHFP[3]>0)  ind4=1; if(newHFP[3]>21)  ind4=0;
01024   if(ind1==3) ind2=ind3=ind4=3;
01025   if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1; 
01026   htmlFile << state[ind1] << HFP[0] <<" (864)</td>" << std::endl;
01027   htmlFile << state[ind2] << HFP[1] <<"</td>" << std::endl;
01028   htmlFile << state[ind3] << HFP[2] <<"</td>" << std::endl;
01029   htmlFile << state[ind4] << HFP[3] <<"</td>" << std::endl;
01030   
01031   htmlFile << "</tr><tr>" << std::endl;
01032   htmlFile << "<td class=\"s1\" align=\"center\">HF-</td>" << std::endl;
01033   ind1=3; if(newHFM[0]==0) ind1=2; if(newHFM[0]>0 && newHFM[0]<=12) ind1=1; if(newHFM[0]>=12 && newHFM[0]<864) ind1=0; 
01034   ind2=3; if(newHFM[1]==0) ind2=2; if(newHFM[1]>0)  ind2=1; if(newHFM[1]>21)  ind2=0; 
01035   ind3=3; if(newHFM[2]==0) ind3=2; if(newHFM[2]>0)  ind3=1; if(newHFM[2]>21)  ind3=0;
01036   ind4=3; if(newHFM[3]==0) ind4=2; if(newHFM[3]>0)  ind4=1; if(newHFM[3]>21)  ind4=0;
01037   if(ind1==3) ind2=ind3=ind4=3;
01038   if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1; 
01039   htmlFile << state[ind1] << HFM[0] <<" (864)</td>" << std::endl;
01040   htmlFile << state[ind2] << HFM[1] <<"</td>" << std::endl;
01041   htmlFile << state[ind3] << HFM[2] <<"</td>" << std::endl;
01042   htmlFile << state[ind4] << HFM[3] <<"</td>" << std::endl;
01043   
01044   htmlFile << "</tr><tr>" << std::endl;
01045   htmlFile << "<td class=\"s1\" align=\"center\">HO</td>" << std::endl;
01046   ind1=3; if(newHO[0]==0) ind1=2; if(newHO[0]>0 && newHO[0]<=12) ind1=1; if(newHO[0]>=12 && newHO[0]<2160) ind1=0; 
01047   ind2=3; if(newHO[1]==0) ind2=2; if(newHO[1]>0)  ind2=1; if(newHO[1]>21)  ind2=0; 
01048   ind3=3; if(newHO[2]==0) ind3=2; if(newHO[2]>0)  ind3=1; if(newHO[2]>21)  ind3=0;
01049   ind4=3; if(newHO[3]==0) ind4=2; if(newHO[3]>0)  ind4=1; if(newHO[3]>21)  ind4=0;
01050   if(ind1==3) ind2=ind3=ind4=3;
01051   if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1; 
01052   htmlFile << state[ind1] << HO[0] <<" (2160)</td>" << std::endl;
01053   htmlFile << state[ind2] << HO[1] <<"</td>" << std::endl;
01054   htmlFile << state[ind3] << HO[2] <<"</td>" << std::endl;
01055   htmlFile << state[ind4] << HO[3] <<"</td>" << std::endl;
01056 
01057   htmlFile << "</tr></table>" << std::endl;
01058   htmlFile << "<hr>" << std::endl;
01060   if((MissingCnt+UnstableCnt+BadCnt)>0){
01061       htmlFile << "<table width=100% border=1><tr>" << std::endl;
01062       if(MissingCnt>0)  htmlFile << "<td><a href=\"" << "bad_missing_table.html" <<"\">list of missing channels</a></td>";
01063       if(UnstableCnt>0) htmlFile << "<td><a href=\"" << "bad_unstable_table.html" <<"\">list of unstable channels</a></td>";
01064       if(BadCnt>0)      htmlFile << "<td><a href=\"" << "bad_badpedrms_table.html" <<"\">list of bad pedestal/rms channels</a></td>";
01065       htmlFile << "</tr></table>" << std::endl;
01066   }
01067   can->SetGridy();
01068   can->SetGridx();
01069   can->SetLogy(0); 
01070 
01071 
01072 
01074   htmlFile << "<h2 align=\"center\">Summary plots</h2>" << std::endl;
01075   htmlFile << "<table width=100% border=0><tr>" << std::endl;
01076   htmlFile << "<tr align=\"left\">" << std::endl;
01077   Pedestals2DHBHEHF->SetStats(0);
01078   Pedestals2DHBHEHF->SetMaximum(5);
01079   Pedestals2DHBHEHF->SetNdivisions(36,"Y");
01080   Pedestals2DHBHEHF->Draw("COLZ");
01081   can->SaveAs((htmlDir + "hbhehf_pedestal_map.gif").c_str());
01082   htmlFile << "<td><img src=\"hbhehf_pedestal_map.gif\" alt=\"hbhehf pedestal mean map\">   </td>" << std::endl;
01083   Pedestals2DHO->SetStats(0);
01084   Pedestals2DHO->SetMaximum(5);
01085   Pedestals2DHO->SetNdivisions(36,"Y");
01086   Pedestals2DHO->Draw("COLZ");
01087   can->SaveAs((htmlDir + "ho_pedestal_map.gif").c_str());
01088   htmlFile << "<td><img src=\"ho_pedestal_map.gif\" alt=\"ho pedestal mean map\">   </td>" << std::endl;
01089   htmlFile << "</tr>" << std::endl;
01090   
01091   htmlFile << "<tr align=\"left\">" << std::endl;
01092   Pedestals2DRmsHBHEHF->SetStats(0);
01093   Pedestals2DRmsHBHEHF->SetMaximum(2);
01094   Pedestals2DRmsHBHEHF->SetNdivisions(36,"Y");
01095   Pedestals2DRmsHBHEHF->Draw("COLZ");
01096   can->SaveAs((htmlDir + "hbhehf_rms_map.gif").c_str());
01097   htmlFile << "<td><img src=\"hbhehf_rms_map.gif\" alt=\"hbhehf pedestal rms map\">   </td>" << std::endl;
01098   Pedestals2DRmsHO->SetStats(0);
01099   Pedestals2DRmsHO->SetMaximum(2);
01100   Pedestals2DRmsHO->SetNdivisions(36,"Y");
01101   Pedestals2DRmsHO->Draw("COLZ");
01102   can->SaveAs((htmlDir + "ho_rms_map.gif").c_str());
01103   htmlFile << "<td><img src=\"ho_rms_map.gif\" alt=\"ho pedestal rms map\">   </td>" << std::endl;
01104   htmlFile << "</tr>" << std::endl;
01105   
01106   htmlFile << "<tr align=\"left\">" << std::endl;
01107   Pedestals2DErrorHBHEHF->SetStats(0);
01108   Pedestals2DErrorHBHEHF->SetNdivisions(36,"Y");
01109   Pedestals2DErrorHBHEHF->Draw("COLZ");
01110   can->SaveAs((htmlDir + "hbhehf_error_map.gif").c_str());
01111   htmlFile << "<td><img src=\"hbhehf_error_map.gif\" alt=\"hbhehf pedestal error map\">   </td>" << std::endl;
01112   Pedestals2DErrorHO->SetStats(0);
01113   Pedestals2DErrorHO->SetNdivisions(36,"Y");
01114   Pedestals2DErrorHO->Draw("COLZ");
01115   can->SaveAs((htmlDir + "ho_error_map.gif").c_str());
01116   htmlFile << "<td><img src=\"ho_error_map.gif\" alt=\"ho pedestal error map\">   </td>" << std::endl;
01117   htmlFile << "</tr>" << std::endl;
01118   htmlFile << "</table>" << std::endl;
01119   htmlFile << "<hr>" << std::endl;
01120   
01122   htmlFile << "<h2 align=\"center\">HB Pedestal plots (Reference run "<<ref_run<<")</h2>" << std::endl;
01123   htmlFile << "<table width=100% border=0><tr>" << std::endl;
01124   htmlFile << "<tr align=\"left\">" << std::endl;
01125   if(PedestalsAve4HB->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01126   PedestalsAve4HB->Draw();
01127   can->SaveAs((htmlDir + "hb_pedestal_distribution.gif").c_str());
01128   htmlFile << "<td><img src=\"hb_pedestal_distribution.gif\" alt=\"hb pedestal mean\">   </td>" << std::endl;
01129   if(PedestalsRmsHB->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01130   PedestalsRmsHB->Draw();
01131   can->SaveAs((htmlDir + "hb_pedestal_rms_distribution.gif").c_str());
01132   htmlFile << "<td><img src=\"hb_pedestal_rms_distribution.gif\" alt=\"hb pedestal rms mean\">   </td>" << std::endl;
01133   htmlFile << "</tr>" << std::endl;
01134   
01135   htmlFile << "<tr align=\"left\">" << std::endl;
01136   if(PedestalsAve4HBref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01137   PedestalsAve4HBref->Draw();
01138   can->SaveAs((htmlDir + "hb_pedestal_ref_distribution.gif").c_str());
01139   htmlFile << "<td><img src=\"hb_pedestal_ref_distribution.gif\" alt=\"hb pedestal-reference mean\">   </td>" << std::endl;
01140   if(PedestalsRmsHBref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01141   PedestalsRmsHBref->Draw();
01142   can->SaveAs((htmlDir + "hb_pedestal_rms_ref_distribution.gif").c_str());
01143   htmlFile << "<td><img src=\"hb_pedestal_rms_ref_distribution.gif\" alt=\"hb pedestal rms-reference mean\">   </td>" << std::endl;
01144   htmlFile << "</tr>" << std::endl;
01145   htmlFile << "</table>" << std::endl;
01147   htmlFile << "<h2 align=\"center\">HE Pedestal plots (Reference run "<<ref_run<<")</h2>" << std::endl;
01148   htmlFile << "<table width=100% border=0><tr>" << std::endl;
01149   htmlFile << "<tr align=\"left\">" << std::endl;
01150   if(PedestalsAve4HE->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);  
01151   PedestalsAve4HE->Draw();
01152   can->SaveAs((htmlDir + "he_pedestal_distribution.gif").c_str());
01153   htmlFile << "<td><img src=\"he_pedestal_distribution.gif\" alt=\"he pedestal mean\">   </td>" << std::endl;
01154   if(PedestalsRmsHE->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01155   PedestalsRmsHE->Draw();
01156   can->SaveAs((htmlDir + "he_pedestal_rms_distribution.gif").c_str());
01157   htmlFile << "<td><img src=\"he_pedestal_rms_distribution.gif\" alt=\"he pedestal rms mean\">   </td>" << std::endl;
01158   htmlFile << "</tr>" << std::endl;
01159   
01160   htmlFile << "<tr align=\"left\">" << std::endl;
01161   if(PedestalsAve4HEref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01162   PedestalsAve4HEref->Draw();
01163   can->SaveAs((htmlDir + "he_pedestal_ref_distribution.gif").c_str());
01164   htmlFile << "<td><img src=\"he_pedestal_ref_distribution.gif\" alt=\"he pedestal-reference mean\">   </td>" << std::endl;
01165   if(PedestalsRmsHEref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01166   PedestalsRmsHEref->Draw();
01167   can->SaveAs((htmlDir + "he_pedestal_rms_ref_distribution.gif").c_str());
01168   htmlFile << "<td><img src=\"he_pedestal_rms_ref_distribution.gif\" alt=\"he pedestal rms-reference mean\">   </td>" << std::endl;
01169   htmlFile << "</tr>" << std::endl;
01170   htmlFile << "</table>" << std::endl;
01172   htmlFile << "<h2 align=\"center\">HO Pedestal plots (Reference run "<<ref_run<<")</h2>" << std::endl;
01173   htmlFile << "<table width=100% border=0><tr>" << std::endl;
01174   htmlFile << "<tr align=\"left\">" << std::endl;
01175   if(PedestalsAve4HO->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01176   PedestalsAve4HO->Draw();
01177   can->SaveAs((htmlDir + "ho_pedestal_distribution.gif").c_str());
01178   htmlFile << "<td><img src=\"ho_pedestal_distribution.gif\" alt=\"ho pedestal mean\">   </td>" << std::endl;
01179   if(PedestalsRmsHO->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01180   PedestalsRmsHO->Draw();
01181   can->SaveAs((htmlDir + "ho_pedestal_rms_distribution.gif").c_str());
01182   htmlFile << "<td><img src=\"ho_pedestal_rms_distribution.gif\" alt=\"ho pedestal rms mean\">   </td>" << std::endl;
01183   htmlFile << "</tr>" << std::endl;
01184   // SIMP
01185   htmlFile << "<tr align=\"left\">" << std::endl;
01186   if(PedestalsAve4Simp->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01187   PedestalsAve4Simp->Draw();
01188   can->SaveAs((htmlDir + "sipm_pedestal_distribution.gif").c_str());
01189   htmlFile << "<td><img src=\"sipm_pedestal_distribution.gif\" alt=\"sipm pedestal mean\">   </td>" << std::endl;
01190   if(PedestalsRmsSimp->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01191   PedestalsRmsSimp->Draw();
01192   can->SaveAs((htmlDir + "simp_pedestal_rms_distribution.gif").c_str());
01193   htmlFile << "<td><img src=\"simp_pedestal_rms_distribution.gif\" alt=\"sipm pedestal rms mean\">   </td>" << std::endl;
01194   htmlFile << "</tr>" << std::endl;
01195   // SIMP
01196   htmlFile << "<tr align=\"left\">" << std::endl;
01197   if(PedestalsAve4HOref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01198   PedestalsAve4HOref->Draw();
01199   can->SaveAs((htmlDir + "ho_pedestal_ref_distribution.gif").c_str());
01200   htmlFile << "<td><img src=\"ho_pedestal_ref_distribution.gif\" alt=\"ho pedestal-reference mean\">   </td>" << std::endl;
01201   if(PedestalsRmsHOref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01202   PedestalsRmsHOref->Draw();
01203   can->SaveAs((htmlDir + "ho_pedestal_rms_ref_distribution.gif").c_str());
01204   htmlFile << "<td><img src=\"ho_pedestal_rms_ref_distribution.gif\" alt=\"ho pedestal rms-reference mean\">   </td>" << std::endl;
01205   htmlFile << "</tr>" << std::endl;
01206   htmlFile << "</table>" << std::endl;
01208 
01209   htmlFile << "<h2 align=\"center\">HF Pedestal plots (Reference run "<<ref_run<<")</h2>" << std::endl;
01210   htmlFile << "<table width=100% border=0><tr>" << std::endl;
01211   htmlFile << "<tr align=\"left\">" << std::endl;
01212   if(PedestalsAve4HF->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01213   PedestalsAve4HF->Draw();
01214   can->SaveAs((htmlDir + "hf_pedestal_distribution.gif").c_str());
01215   htmlFile << "<td><img src=\"hf_pedestal_distribution.gif\" alt=\"hf pedestal mean\">   </td>" << std::endl;
01216   if(PedestalsRmsHF->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01217   PedestalsRmsHF->Draw();
01218   can->SaveAs((htmlDir + "hf_pedestal_rms_distribution.gif").c_str());
01219   htmlFile << "<td><img src=\"hf_pedestal_rms_distribution.gif\" alt=\"hf pedestal rms mean\">   </td>" << std::endl;
01220   htmlFile << "</tr>" << std::endl;
01221   
01222   htmlFile << "<tr align=\"left\">" << std::endl;
01223   if(PedestalsAve4HFref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01224   PedestalsAve4HFref->Draw();
01225   can->SaveAs((htmlDir + "hf_pedestal_ref_distribution.gif").c_str());
01226   htmlFile << "<td><img src=\"hf_pedestal_ref_distribution.gif\" alt=\"hf pedestal-reference mean\">   </td>" << std::endl;
01227   if(PedestalsRmsHFref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0); 
01228   PedestalsRmsHFref->Draw();
01229   can->SaveAs((htmlDir + "hf_pedestal_rms_ref_distribution.gif").c_str());
01230   htmlFile << "<td><img src=\"hf_pedestal_rms_ref_distribution.gif\" alt=\"hf pedestal rms-reference mean\">   </td>" << std::endl;
01231   htmlFile << "</tr>" << std::endl;
01232   htmlFile << "</table>" << std::endl;
01233   
01234 
01235   htmlFile << "</body> " << std::endl;
01236   htmlFile << "</html> " << std::endl;
01237   htmlFile.close();
01238   can->Close();
01239 }
01240 
01241 HcalDetDiagPedestalClient::~HcalDetDiagPedestalClient()
01242 {}