CMS 3D CMS Logo

EETimingClient.cc

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

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