CMS 3D CMS Logo

EBTimingClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file EBTimingClient.cc
00003  *
00004  * $Date: 2008/08/11 07:24:13 $
00005  * $Revision: 1.90 $
00006  * \author G. Della Ricca
00007  *
00008 */
00009 
00010 #include <memory>
00011 #include <iostream>
00012 #include <fstream>
00013 #include <iomanip>
00014 #include <math.h>
00015 
00016 #include "TCanvas.h"
00017 #include "TStyle.h"
00018 
00019 #include "DQMServices/Core/interface/DQMStore.h"
00020 
00021 #include "OnlineDB/EcalCondDB/interface/MonTimingCrystalDat.h"
00022 #include "OnlineDB/EcalCondDB/interface/RunCrystalErrorsDat.h"
00023 #include "OnlineDB/EcalCondDB/interface/RunTTErrorsDat.h"
00024 
00025 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
00026 
00027 #include "CondTools/Ecal/interface/EcalErrorDictionary.h"
00028 
00029 #include "DQM/EcalCommon/interface/EcalErrorMask.h"
00030 #include "DQM/EcalCommon/interface/UtilsClient.h"
00031 #include "DQM/EcalCommon/interface/LogicID.h"
00032 #include "DQM/EcalCommon/interface/Numbers.h"
00033 
00034 #include <DQM/EcalBarrelMonitorClient/interface/EBTimingClient.h>
00035 
00036 using namespace cms;
00037 using namespace edm;
00038 using namespace std;
00039 
00040 EBTimingClient::EBTimingClient(const ParameterSet& ps) {
00041 
00042   // cloneME switch
00043   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00044 
00045   // verbose switch
00046   verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00047 
00048   // debug switch
00049   debug_ = ps.getUntrackedParameter<bool>("debug", false);
00050 
00051   // prefixME path
00052   prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
00053 
00054   // enableCleanup_ switch
00055   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00056 
00057   // vector of selected Super Modules (Defaults to all 36).
00058   superModules_.reserve(36);
00059   for ( unsigned int i = 1; i <= 36; i++ ) superModules_.push_back(i);
00060   superModules_ = ps.getUntrackedParameter<vector<int> >("superModules", superModules_);
00061 
00062   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00063 
00064     int ism = superModules_[i];
00065 
00066     h01_[ism-1] = 0;
00067     h02_[ism-1] = 0;
00068 
00069     meh01_[ism-1] = 0;
00070     meh02_[ism-1] = 0;
00071 
00072   }
00073 
00074   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00075 
00076     int ism = superModules_[i];
00077 
00078     meg01_[ism-1] = 0;
00079 
00080     mea01_[ism-1] = 0;
00081 
00082     mep01_[ism-1] = 0;
00083 
00084     mer01_[ism-1] = 0;
00085 
00086   }
00087 
00088   expectedMean_ = 5.0;
00089   discrepancyMean_ = 0.5;
00090   RMSThreshold_ = 2.5;
00091 
00092 }
00093 
00094 EBTimingClient::~EBTimingClient() {
00095 
00096 }
00097 
00098 void EBTimingClient::beginJob(DQMStore* dqmStore) {
00099 
00100   dqmStore_ = dqmStore;
00101 
00102   if ( debug_ ) cout << "EBTimingClient: beginJob" << endl;
00103 
00104   ievt_ = 0;
00105   jevt_ = 0;
00106 
00107 }
00108 
00109 void EBTimingClient::beginRun(void) {
00110 
00111   if ( debug_ ) cout << "EBTimingClient: beginRun" << endl;
00112 
00113   jevt_ = 0;
00114 
00115   this->setup();
00116 
00117 }
00118 
00119 void EBTimingClient::endJob(void) {
00120 
00121   if ( debug_ ) cout << "EBTimingClient: endJob, ievt = " << ievt_ << endl;
00122 
00123   this->cleanup();
00124 
00125 }
00126 
00127 void EBTimingClient::endRun(void) {
00128 
00129   if ( debug_ ) cout << "EBTimingClient: endRun, jevt = " << jevt_ << endl;
00130 
00131   this->cleanup();
00132 
00133 }
00134 
00135 void EBTimingClient::setup(void) {
00136 
00137   char histo[200];
00138 
00139   dqmStore_->setCurrentFolder( prefixME_ + "/EBTimingClient" );
00140 
00141   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00142 
00143     int ism = superModules_[i];
00144 
00145     if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00146     sprintf(histo, "EBTMT timing quality %s", Numbers::sEB(ism).c_str());
00147     meg01_[ism-1] = dqmStore_->book2D(histo, histo, 85, 0., 85., 20, 0., 20.);
00148     meg01_[ism-1]->setAxisTitle("ieta", 1);
00149     meg01_[ism-1]->setAxisTitle("iphi", 2);
00150 
00151     if ( mea01_[ism-1] ) dqmStore_->removeElement( mea01_[ism-1]->getName() );
00152     sprintf(histo, "EBTMT timing %s", Numbers::sEB(ism).c_str());
00153     mea01_[ism-1] = dqmStore_->book1D(histo, histo, 1700, 0., 1700.);
00154     mea01_[ism-1]->setAxisTitle("channel", 1);
00155     mea01_[ism-1]->setAxisTitle("jitter", 2);
00156 
00157     if ( mep01_[ism-1] ) dqmStore_->removeElement( mep01_[ism-1]->getName() );
00158     sprintf(histo, "EBTMT timing mean %s", Numbers::sEB(ism).c_str());
00159     mep01_[ism-1] = dqmStore_->book1D(histo, histo, 100, 0.0, 10.0);
00160     mep01_[ism-1]->setAxisTitle("mean", 1);
00161 
00162     if ( mer01_[ism-1] ) dqmStore_->removeElement( mer01_[ism-1]->getName() );
00163     sprintf(histo, "EBTMT timing rms %s", Numbers::sEB(ism).c_str());
00164     mer01_[ism-1] = dqmStore_->book1D(histo, histo, 100, 0.0, 6.0);
00165     mer01_[ism-1]->setAxisTitle("rms", 1);
00166 
00167   }
00168 
00169   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00170 
00171     int ism = superModules_[i];
00172 
00173     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
00174 
00175     for ( int ie = 1; ie <= 85; ie++ ) {
00176       for ( int ip = 1; ip <= 20; ip++ ) {
00177 
00178         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ie, ip, 2. );
00179 
00180       }
00181     }
00182 
00183     if ( mea01_[ism-1] ) mea01_[ism-1]->Reset();
00184     if ( mep01_[ism-1] ) mep01_[ism-1]->Reset();
00185     if ( mer01_[ism-1] ) mer01_[ism-1]->Reset();
00186 
00187   }
00188 
00189 }
00190 
00191 void EBTimingClient::cleanup(void) {
00192 
00193   if ( ! enableCleanup_ ) return;
00194 
00195   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00196 
00197     int ism = superModules_[i];
00198 
00199     if ( cloneME_ ) {
00200       if ( h01_[ism-1] ) delete h01_[ism-1];
00201       if ( h02_[ism-1] ) delete h02_[ism-1];
00202     }
00203 
00204     h01_[ism-1] = 0;
00205     h02_[ism-1] = 0;
00206 
00207     meh01_[ism-1] = 0;
00208     meh02_[ism-1] = 0;
00209 
00210   }
00211 
00212   dqmStore_->setCurrentFolder( prefixME_ + "/EBTimingClient" );
00213 
00214   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00215 
00216     int ism = superModules_[i];
00217 
00218     if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00219     meg01_[ism-1] = 0;
00220 
00221     if ( mea01_[ism-1] ) dqmStore_->removeElement( mea01_[ism-1]->getName() );
00222     mea01_[ism-1] = 0;
00223 
00224     if ( mep01_[ism-1] ) dqmStore_->removeElement( mep01_[ism-1]->getName() );
00225     mep01_[ism-1] = 0;
00226 
00227     if ( mer01_[ism-1] ) dqmStore_->removeElement( mer01_[ism-1]->getName() );
00228     mer01_[ism-1] = 0;
00229 
00230   }
00231 
00232 }
00233 
00234 bool EBTimingClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status, bool flag) {
00235 
00236   status = true;
00237 
00238   if ( ! flag ) return false;
00239 
00240   EcalLogicID ecid;
00241 
00242   MonTimingCrystalDat t;
00243   map<EcalLogicID, MonTimingCrystalDat> dataset;
00244 
00245   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00246 
00247     int ism = superModules_[i];
00248 
00249     if ( verbose_ ) {
00250       cout << " " << Numbers::sEB(ism) << " (ism=" << ism << ")" << endl;
00251       cout << endl;
00252       UtilsClient::printBadChannels(meg01_[ism-1], h01_[ism-1]);
00253     }
00254 
00255     float num01;
00256     float mean01;
00257     float rms01;
00258 
00259     for ( int ie = 1; ie <= 85; ie++ ) {
00260       for ( int ip = 1; ip <= 20; ip++ ) {
00261 
00262         bool update01;
00263 
00264         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ie, ip, num01, mean01, rms01);
00265 
00266         if ( update01 ) {
00267 
00268           if ( Numbers::icEB(ism, ie, ip) == 1 ) {
00269 
00270             if ( verbose_ ) {
00271               cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << endl;
00272               cout << "crystal (" << ie << "," << ip << ") " << num01  << " " << mean01 << " " << rms01  << endl;
00273               cout << endl;
00274             }
00275 
00276           }
00277 
00278           t.setTimingMean(mean01);
00279           t.setTimingRMS(rms01);
00280 
00281           if ( UtilsClient::getBinStatus(meg01_[ism-1], ie, ip) ) {
00282             t.setTaskStatus(true);
00283           } else {
00284             t.setTaskStatus(false);
00285           }
00286 
00287           status = status && UtilsClient::getBinQuality(meg01_[ism-1], ie, ip);
00288 
00289           int ic = Numbers::indexEB(ism, ie, ip);
00290 
00291           if ( econn ) {
00292             ecid = LogicID::getEcalLogicID("EB_crystal_number", Numbers::iSM(ism, EcalBarrel), ic);
00293             dataset[ecid] = t;
00294           }
00295 
00296         }
00297 
00298       }
00299     }
00300 
00301   }
00302 
00303   if ( econn ) {
00304     try {
00305       if ( verbose_ ) cout << "Inserting MonTimingCrystalDat ..." << endl;
00306       if ( dataset.size() != 0 ) econn->insertDataArraySet(&dataset, moniov);
00307       if ( verbose_ ) cout << "done." << endl;
00308     } catch (runtime_error &e) {
00309       cerr << e.what() << endl;
00310     }
00311   }
00312 
00313   return true;
00314 
00315 }
00316 
00317 void EBTimingClient::analyze(void) {
00318 
00319   ievt_++;
00320   jevt_++;
00321   if ( ievt_ % 10 == 0 ) {
00322     if ( debug_ ) cout << "EBTimingClient: ievt/jevt = " << ievt_ << "/" << jevt_ << endl;
00323   }
00324 
00325   uint64_t bits01 = 0;
00326   bits01 |= EcalErrorDictionary::getMask("TIMING_MEAN_WARNING");
00327   bits01 |= EcalErrorDictionary::getMask("TIMING_RMS_WARNING");
00328   bits01 |= EcalErrorDictionary::getMask("TIMING_MEAN_ERROR");
00329   bits01 |= EcalErrorDictionary::getMask("TIMING_RMS_ERROR");
00330 
00331   map<EcalLogicID, RunCrystalErrorsDat> mask1;
00332   map<EcalLogicID, RunTTErrorsDat> mask2;
00333 
00334   EcalErrorMask::fetchDataSet(&mask1);
00335   EcalErrorMask::fetchDataSet(&mask2);
00336 
00337   char histo[200];
00338 
00339   MonitorElement* me;
00340 
00341   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00342 
00343     int ism = superModules_[i];
00344 
00345     sprintf(histo, (prefixME_ + "/EBTimingTask/EBTMT timing %s").c_str(), Numbers::sEB(ism).c_str());
00346     me = dqmStore_->get(histo);
00347     h01_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h01_[ism-1] );
00348     meh01_[ism-1] = me;
00349 
00350     sprintf(histo, (prefixME_ + "/EBTimingTask/EBTMT timing vs amplitude %s").c_str(), Numbers::sEB(ism).c_str());
00351     me = dqmStore_->get(histo);
00352     h02_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h02_[ism-1] );
00353     meh02_[ism-1] = me;
00354 
00355     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
00356     if ( mea01_[ism-1] ) mea01_[ism-1]->Reset();
00357     if ( mep01_[ism-1] ) mep01_[ism-1]->Reset();
00358     if ( mer01_[ism-1] ) mer01_[ism-1]->Reset();
00359 
00360     for ( int ie = 1; ie <= 85; ie++ ) {
00361       for ( int ip = 1; ip <= 20; ip++ ) {
00362 
00363         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent(ie, ip, 2.);
00364 
00365         bool update01;
00366 
00367         float num01;
00368         float mean01;
00369         float rms01;
00370 
00371         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ie, ip, num01, mean01, rms01);
00372 
00373         if ( update01 ) {
00374 
00375           float val;
00376 
00377           val = 1.;
00378           if ( fabs(mean01 - expectedMean_) > discrepancyMean_ )
00379             val = 0.;
00380           if ( rms01 > RMSThreshold_ )
00381             val = 0.;
00382           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent(ie, ip, val);
00383 
00384           int ic = Numbers::icEB(ism, ie, ip);
00385 
00386           if ( mea01_[ism-1] ) {
00387             if ( mean01 > 0. ) {
00388               mea01_[ism-1]->setBinContent(ic, mean01);
00389               mea01_[ism-1]->setBinError(ic, rms01);
00390             } else {
00391               mea01_[ism-1]->setEntries(1.+mea01_[ism-1]->getEntries());
00392             }
00393           }
00394           if ( mep01_[ism-1] ) mep01_[ism-1]->Fill(mean01);
00395           if ( mer01_[ism-1] ) mer01_[ism-1]->Fill(rms01);
00396 
00397         }
00398 
00399         // masking
00400 
00401         if ( mask1.size() != 0 ) {
00402           map<EcalLogicID, RunCrystalErrorsDat>::const_iterator m;
00403           for (m = mask1.begin(); m != mask1.end(); m++) {
00404 
00405             EcalLogicID ecid = m->first;
00406 
00407             int ic = Numbers::indexEB(ism, ie, ip);
00408 
00409             if ( ecid.getLogicID() == LogicID::getEcalLogicID("EB_crystal_number", Numbers::iSM(ism, EcalBarrel), ic).getLogicID() ) {
00410               if ( (m->second).getErrorBits() & bits01 ) {
00411                 UtilsClient::maskBinContent( meg01_[ism-1], ie, ip );
00412               }
00413             }
00414 
00415           }
00416         }
00417 
00418         // TT masking
00419 
00420         if ( mask2.size() != 0 ) {
00421           map<EcalLogicID, RunTTErrorsDat>::const_iterator m;
00422           for (m = mask2.begin(); m != mask2.end(); m++) {
00423 
00424             EcalLogicID ecid = m->first;
00425 
00426             int itt = Numbers::iTT(ism, EcalBarrel, ie, ip);
00427 
00428             if ( ecid.getLogicID() == LogicID::getEcalLogicID("EB_trigger_tower", Numbers::iSM(ism, EcalBarrel), itt).getLogicID() ) {
00429               if ( (m->second).getErrorBits() & bits01 ) {
00430                 UtilsClient::maskBinContent( meg01_[ism-1], ie, ip );
00431               }
00432             }
00433 
00434           }
00435         }
00436 
00437       }
00438     }
00439 
00440   }
00441 
00442 }
00443 
00444 void EBTimingClient::softReset(bool flag) {
00445 
00446 }
00447 
00448 void EBTimingClient::htmlOutput(int run, string& htmlDir, string& htmlName) {
00449 
00450   if ( verbose_ ) cout << "Preparing EBTimingClient html output ..." << endl;
00451 
00452   ofstream htmlFile;
00453 
00454   htmlFile.open((htmlDir + htmlName).c_str());
00455 
00456   // html page header
00457   htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">  " << endl;
00458   htmlFile << "<html>  " << endl;
00459   htmlFile << "<head>  " << endl;
00460   htmlFile << "  <meta content=\"text/html; charset=ISO-8859-1\"  " << endl;
00461   htmlFile << " https-equiv=\"content-type\">  " << endl;
00462   htmlFile << "  <title>Monitor:TimingTask output</title> " << endl;
00463   htmlFile << "</head>  " << endl;
00464   htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
00465   htmlFile << "<body>  " << endl;
00466   //htmlFile << "<br>  " << endl;
00467   htmlFile << "<a name=""top""></a>" << endl;
00468   htmlFile << "<h2>Run:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << endl;
00469   htmlFile << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
00470   htmlFile << " style=\"color: rgb(0, 0, 153);\">" << run << "</span></h2>" << endl;
00471   htmlFile << "<h2>Monitoring task:&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
00472   htmlFile << " style=\"color: rgb(0, 0, 153);\">TIMING</span></h2> " << endl;
00473   htmlFile << "<hr>" << endl;
00474   htmlFile << "<table border=1><tr><td bgcolor=red>channel has problems in this task</td>" << endl;
00475   htmlFile << "<td bgcolor=lime>channel has NO problems</td>" << endl;
00476   htmlFile << "<td bgcolor=yellow>channel is missing</td></table>" << endl;
00477   htmlFile << "<br>" << endl;
00478   htmlFile << "<table border=1>" << std::endl;
00479   for ( unsigned int i=0; i<superModules_.size(); i ++ ) {
00480     htmlFile << "<td bgcolor=white><a href=""#"
00481              << Numbers::sEB(superModules_[i]) << ">"
00482              << setfill( '0' ) << setw(2) << superModules_[i] << "</a></td>";
00483   }
00484   htmlFile << std::endl << "</table>" << std::endl;
00485 
00486   // Produce the plots to be shown as .png files from existing histograms
00487 
00488   const int csize = 250;
00489 
00490   const double histMax = 1.e15;
00491 
00492   int pCol3[7] = { 301, 302, 303, 304, 305, 306, 307 };
00493   int pCol4[10];
00494   for ( int i = 0; i < 10; i++ ) pCol4[i] = 401+i;
00495 
00496   TH2C dummy( "dummy", "dummy for sm", 85, 0., 85., 20, 0., 20. );
00497   for ( int i = 0; i < 68; i++ ) {
00498     int a = 2 + ( i/4 ) * 5;
00499     int b = 2 + ( i%4 ) * 5;
00500     dummy.Fill( a, b, i+1 );
00501   }
00502   dummy.SetMarkerSize(2);
00503   dummy.SetMinimum(0.1);
00504 
00505   string imgNameQual, imgNameTim, imgNameMean, imgNameRMS, imgNameAmpl, imgName, meName;
00506 
00507   TCanvas* cQual = new TCanvas("cQual", "Temp", 0, 0, 3*csize, csize);
00508   TCanvas* cTim = new TCanvas("cTim", "Temp", 0, 0, csize, csize);
00509   TCanvas* cMean = new TCanvas("cMean", "Temp", 0, 0, csize, csize);
00510   TCanvas* cRMS = new TCanvas("cRMS", "Temp", 0, 0, csize, csize);
00511   TCanvas* cAmpl = new TCanvas("cAmpl", "Temp", 0, 0, 2*csize, csize);
00512 
00513   TH2F* obj2f;
00514   TH1F* obj1f;
00515 
00516   // Loop on barrel supermodules
00517 
00518   for ( unsigned int i=0; i<superModules_.size(); i ++ ) {
00519 
00520     int ism = superModules_[i];
00521 
00522     // Quality plots
00523 
00524     imgNameQual = "";
00525 
00526     obj2f = 0;
00527     obj2f = UtilsClient::getHisto<TH2F*>( meg01_[ism-1] );
00528 
00529     if ( obj2f ) {
00530 
00531       meName = obj2f->GetName();
00532 
00533       replace(meName.begin(), meName.end(), ' ', '_');
00534       imgNameQual = meName + ".png";
00535       imgName = htmlDir + imgNameQual;
00536 
00537       cQual->cd();
00538       gStyle->SetOptStat(" ");
00539       gStyle->SetPalette(7, pCol3);
00540       obj2f->GetXaxis()->SetNdivisions(17);
00541       obj2f->GetYaxis()->SetNdivisions(4);
00542       cQual->SetGridx();
00543       cQual->SetGridy();
00544       obj2f->SetMinimum(-0.00000001);
00545       obj2f->SetMaximum(7.0);
00546       obj2f->Draw("col");
00547       dummy.Draw("text,same");
00548       cQual->Update();
00549       cQual->SaveAs(imgName.c_str());
00550 
00551     }
00552 
00553     // Timing distributions
00554 
00555     imgNameTim = "";
00556 
00557     obj1f = 0;
00558     obj1f = UtilsClient::getHisto<TH1F*>( mea01_[ism-1] );
00559 
00560     if ( obj1f ) {
00561 
00562       meName = obj1f->GetName();
00563 
00564       replace(meName.begin(), meName.end(), ' ', '_');
00565       imgNameTim = meName + ".png";
00566       imgName = htmlDir + imgNameTim;
00567 
00568       cTim->cd();
00569       gStyle->SetOptStat("euo");
00570       obj1f->SetStats(kTRUE);
00571 //      if ( obj1f->GetMaximum(histMax) > 0. ) {
00572 //        gPad->SetLogy(kTRUE);
00573 //      } else {
00574 //        gPad->SetLogy(kFALSE);
00575 //      }
00576       obj1f->SetMinimum(0.0);
00577       obj1f->SetMaximum(10.0);
00578       obj1f->Draw();
00579       cTim->Update();
00580       cTim->SaveAs(imgName.c_str());
00581       gPad->SetLogy(kFALSE);
00582 
00583     }
00584 
00585     // Mean distributions
00586 
00587     imgNameMean = "";
00588 
00589     obj1f = 0;
00590     obj1f = UtilsClient::getHisto<TH1F*>( mep01_[ism-1] );
00591 
00592     if ( obj1f ) {
00593 
00594       meName = obj1f->GetName();
00595 
00596       replace(meName.begin(), meName.end(), ' ', '_');
00597       imgNameMean = meName + ".png";
00598       imgName = htmlDir + imgNameMean;
00599 
00600       cMean->cd();
00601       gStyle->SetOptStat("euomr");
00602       obj1f->SetStats(kTRUE);
00603       if ( obj1f->GetMaximum(histMax) > 0. ) {
00604         gPad->SetLogy(kTRUE);
00605       } else {
00606         gPad->SetLogy(kFALSE);
00607       }
00608       obj1f->Draw();
00609       cMean->Update();
00610       cMean->SaveAs(imgName.c_str());
00611       gPad->SetLogy(kFALSE);
00612 
00613     }
00614 
00615     // RMS distributions
00616 
00617     obj1f = 0;
00618     obj1f = UtilsClient::getHisto<TH1F*>( mer01_[ism-1] );
00619 
00620     imgNameRMS = "";
00621 
00622     if ( obj1f ) {
00623 
00624       meName = obj1f->GetName();
00625 
00626       replace(meName.begin(), meName.end(), ' ', '_');
00627       imgNameRMS = meName + ".png";
00628       imgName = htmlDir + imgNameRMS;
00629 
00630       cRMS->cd();
00631       gStyle->SetOptStat("euomr");
00632       obj1f->SetStats(kTRUE);
00633       if ( obj1f->GetMaximum(histMax) > 0. ) {
00634         gPad->SetLogy(kTRUE);
00635       } else {
00636         gPad->SetLogy(kFALSE);
00637       }
00638       obj1f->Draw();
00639       cRMS->Update();
00640       cRMS->SaveAs(imgName.c_str());
00641       gPad->SetLogy(kFALSE);
00642 
00643     }
00644 
00645     // Amplitude vs. Time distributions
00646 
00647     obj2f = h02_[ism-1];
00648 
00649     imgNameAmpl = "";
00650 
00651     if ( obj2f ) {
00652 
00653       meName = obj2f->GetName();
00654 
00655       replace(meName.begin(), meName.end(), ' ', '_');
00656       imgNameAmpl = meName + ".png";
00657       imgName = htmlDir + imgNameAmpl;
00658 
00659       cAmpl->cd();
00660       gStyle->SetOptStat(" ");
00661       gStyle->SetPalette(10, pCol4);
00662       obj2f->SetMinimum(0.0);
00663       if ( obj2f->GetMaximum(histMax) > 0. ) {
00664         gPad->SetLogz(kTRUE);
00665       } else {
00666         gPad->SetLogz(kFALSE);
00667       }
00668       obj2f->Draw("colz");
00669       cAmpl->Update();
00670       cAmpl->SaveAs(imgName.c_str());
00671       gPad->SetLogz(kFALSE);
00672 
00673     }
00674 
00675     if( i>0 ) htmlFile << "<a href=""#top"">Top</a>" << std::endl;
00676     htmlFile << "<hr>" << std::endl;
00677     htmlFile << "<h3><a name="""
00678              << Numbers::sEB(ism) << """></a><strong>"
00679              << Numbers::sEB(ism) << "</strong></h3>" << endl;
00680     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00681     htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
00682     htmlFile << "<tr align=\"center\">" << endl;
00683 
00684     if ( imgNameQual.size() != 0 )
00685       htmlFile << "<td colspan=\"3\"><img src=\"" << imgNameQual << "\"></td>" << endl;
00686     else
00687       htmlFile << "<td colspan=\"3\"><img src=\"" << " " << "\"></td>" << endl;
00688 
00689     htmlFile << "</tr>" << endl;
00690     htmlFile << "<tr>" << endl;
00691 
00692     if ( imgNameTim.size() != 0 )
00693       htmlFile << "<td><img src=\"" << imgNameTim << "\"></td>" << endl;
00694     else
00695       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00696 
00697     if ( imgNameMean.size() != 0 )
00698       htmlFile << "<td><img src=\"" << imgNameMean << "\"></td>" << endl;
00699     else
00700       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00701 
00702     if ( imgNameRMS.size() != 0 )
00703       htmlFile << "<td><img src=\"" << imgNameRMS << "\"></td>" << endl;
00704     else
00705       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00706 
00707     htmlFile << "</tr>" << endl;
00708 
00709     htmlFile << "</table>" << endl;
00710     htmlFile << "<br>" << endl;
00711 
00712     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00713     htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
00714     htmlFile << "<tr align=\"center\">" << endl;
00715 
00716     if ( imgNameAmpl.size() != 0 )
00717       htmlFile << "<td colspan=\"3\"><img src=\"" << imgNameAmpl << "\"></td>" << endl;
00718     else
00719       htmlFile << "<td colspan=\"3\"><img src=\"" << " " << "\"></td>" << endl;
00720 
00721     htmlFile << "</table>" << endl;
00722     htmlFile << "<br>" << endl;
00723 
00724   }
00725 
00726   delete cQual;
00727   delete cTim;
00728   delete cMean;
00729   delete cRMS;
00730   delete cAmpl;
00731 
00732   // html page footer
00733   htmlFile << "</body> " << endl;
00734   htmlFile << "</html> " << endl;
00735 
00736   htmlFile.close();
00737 
00738 }
00739 

Generated on Tue Jun 9 17:32:44 2009 for CMSSW by  doxygen 1.5.4