CMS 3D CMS Logo

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