CMS 3D CMS Logo

EEClusterClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file EEClusterClient.cc
00003  *
00004  * $Date: 2008/08/11 20:38:45 $
00005  * $Revision: 1.57 $
00006  * \author G. Della Ricca
00007  * \author E. Di Marco
00008  *
00009 */
00010 
00011 #include <memory>
00012 #include <iostream>
00013 #include <fstream>
00014 
00015 #include "TCanvas.h"
00016 #include "TStyle.h"
00017 #include "TGaxis.h"
00018 #include "TGraph.h"
00019 #include "TLine.h"
00020 
00021 #include "DQMServices/Core/interface/DQMStore.h"
00022 
00023 #include "DQM/EcalCommon/interface/UtilsClient.h"
00024 #include "DQM/EcalCommon/interface/Numbers.h"
00025 
00026 #include <DQM/EcalEndcapMonitorClient/interface/EEClusterClient.h>
00027 
00028 using namespace cms;
00029 using namespace edm;
00030 using namespace std;
00031 
00032 EEClusterClient::EEClusterClient(const ParameterSet& ps) {
00033 
00034   // cloneME switch
00035   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00036 
00037   // verbose switch
00038   verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00039 
00040   // debug switch
00041   debug_ = ps.getUntrackedParameter<bool>("debug", false);
00042 
00043   // prefixME path
00044   prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
00045 
00046   // enableCleanup_ switch
00047   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00048 
00049   // vector of selected Super Modules (Defaults to all 18).
00050   superModules_.reserve(18);
00051   for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
00052   superModules_ = ps.getUntrackedParameter<vector<int> >("superModules", superModules_);
00053 
00054   h01_[0] = 0;
00055   h01_[1] = 0;
00056   h01_[2] = 0;
00057 
00058   for(int iEE=0;iEE<2;iEE++) {
00059     for(int i=0;i<3;++i) {
00060       h04_[i][iEE] = 0;
00061       h02ProjR_[i][iEE] = 0;
00062       h02ProjPhi_[i][iEE] = 0;
00063     }
00064   }
00065 
00066   h03_[0] = 0;
00067   h03ProjR_[0] = 0;
00068   h03ProjPhi_[0] = 0;
00069 
00070   h03_[1] = 0;
00071   h03ProjR_[1] = 0;
00072   h03ProjPhi_[1] = 0;
00073 
00074   i01_[0] = 0;
00075   i01_[1] = 0;
00076   i01_[2] = 0;
00077 
00078   s01_[0] = 0;
00079   s01_[1] = 0;
00080   s01_[2] = 0;
00081 
00082 }
00083 
00084 EEClusterClient::~EEClusterClient() {
00085 
00086 }
00087 
00088 void EEClusterClient::beginJob(DQMStore* dqmStore) {
00089 
00090   dqmStore_ = dqmStore;
00091 
00092   if ( debug_ ) cout << "EEClusterClient: beginJob" << endl;
00093 
00094   ievt_ = 0;
00095   jevt_ = 0;
00096 
00097 }
00098 
00099 void EEClusterClient::beginRun(void) {
00100 
00101   if ( debug_ ) cout << "EEClusterClient: beginRun" << endl;
00102 
00103   jevt_ = 0;
00104 
00105   this->setup();
00106 
00107 }
00108 
00109 void EEClusterClient::endJob(void) {
00110 
00111   if ( debug_ ) cout << "EEClusterClient: endJob, ievt = " << ievt_ << endl;
00112 
00113   this->cleanup();
00114 
00115 }
00116 
00117 void EEClusterClient::endRun(void) {
00118 
00119   if ( debug_ ) cout << "EEClusterClient: endRun, jevt = " << jevt_ << endl;
00120 
00121   this->cleanup();
00122 
00123 }
00124 
00125 void EEClusterClient::setup(void) {
00126 
00127   dqmStore_->setCurrentFolder( prefixME_ + "/EEClusterClient" );
00128 
00129 }
00130 
00131 void EEClusterClient::cleanup(void) {
00132 
00133   if ( ! enableCleanup_ ) return;
00134 
00135   if ( cloneME_ ) {
00136     if ( h01_[0] ) delete h01_[0];
00137     if ( h01_[1] ) delete h01_[1];
00138     if ( h01_[2] ) delete h01_[2];
00139 
00140     for(int iEE=0;iEE<2;iEE++) {
00141       for(int i=0;i<3;++i) {
00142         if(h04_[i][iEE]) delete h04_[i][iEE];
00143         if(h02ProjR_[i][iEE]) delete h02ProjR_[i][iEE];
00144         if(h02ProjPhi_[i][iEE]) delete h02ProjPhi_[i][iEE];
00145       }
00146     }
00147 
00148     if(h03_[0]) delete h03_[0];
00149     if(h03ProjR_[0]) delete h03ProjR_[0];
00150     if(h03ProjPhi_[0]) delete h03ProjPhi_[0];
00151 
00152     if(h03_[1]) delete h03_[1];
00153     if(h03ProjR_[1]) delete h03ProjR_[1];
00154     if(h03ProjPhi_[1]) delete h03ProjPhi_[1];
00155 
00156     if(i01_[0]) delete i01_[0];
00157     if(i01_[1]) delete i01_[1];
00158     if(i01_[2]) delete i01_[2];
00159 
00160     if(s01_[0]) delete s01_[0];
00161     if(s01_[1]) delete s01_[1];
00162     if(s01_[2]) delete s01_[2];
00163 
00164   }
00165 
00166   h01_[0] = 0;
00167   h01_[1] = 0;
00168   h01_[2] = 0;
00169 
00170   for(int iEE=0;iEE<2;iEE++) {
00171     for(int i=0;i<3;++i) {
00172       h04_[i][iEE] = 0;
00173       h02ProjR_[i][iEE] = 0;
00174       h02ProjPhi_[i][iEE] = 0;
00175     }
00176   }
00177 
00178   h03_[0] = 0;
00179   h03ProjR_[0] = 0;
00180   h03ProjPhi_[0] = 0;
00181 
00182   h03_[1] = 0;
00183   h03ProjR_[1] = 0;
00184   h03ProjPhi_[1] = 0;
00185 
00186   i01_[0] = 0;
00187   i01_[1] = 0;
00188   i01_[2] = 0;
00189 
00190   s01_[0] = 0;
00191   s01_[1] = 0;
00192   s01_[2] = 0;
00193 
00194 }
00195 
00196 bool EEClusterClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status, bool flag) {
00197 
00198   status = true;
00199 
00200   if ( ! flag ) return false;
00201 
00202   return true;
00203 
00204 }
00205 
00206 void EEClusterClient::analyze(void) {
00207 
00208   ievt_++;
00209   jevt_++;
00210   if ( ievt_ % 10 == 0 ) {
00211     if ( debug_ ) cout << "EEClusterClient: ievt/jevt = " << ievt_ << "/" << jevt_ << endl;
00212   }
00213 
00214   char histo[200];
00215 
00216   MonitorElement* me;
00217 
00218   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC energy").c_str());
00219   me = dqmStore_->get(histo);
00220   h01_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h01_[0] );
00221 
00222   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC size").c_str());
00223   me = dqmStore_->get(histo);
00224   h01_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h01_[1] );
00225 
00226   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC number").c_str());
00227   me = dqmStore_->get(histo);
00228   h01_[2] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h01_[2] );
00229 
00230   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC energy map EE -").c_str());
00231   me = dqmStore_->get(histo);
00232   h04_[0][0] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h04_[0][0] );
00233 
00234   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC number map EE -").c_str());
00235   me = dqmStore_->get(histo);
00236   h03_[0] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h03_[0] );
00237 
00238   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC ET map EE -").c_str());
00239   me = dqmStore_->get(histo);
00240   h04_[1][0] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h04_[1][0] );
00241 
00242   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC size map EE -").c_str());
00243   me = dqmStore_->get(histo);
00244   h04_[2][0] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h04_[2][0] );
00245 
00246   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC energy projection R EE -").c_str());
00247   me = dqmStore_->get(histo);
00248   h02ProjR_[0][0] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjR_[0][0] );
00249 
00250   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC energy projection phi EE -").c_str());
00251   me = dqmStore_->get(histo);
00252   h02ProjPhi_[0][0] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjPhi_[0][0] );
00253 
00254   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC number projection R EE -").c_str());
00255   me = dqmStore_->get(histo);
00256   h03ProjR_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h03ProjR_[0] );
00257 
00258   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC number projection phi EE -").c_str());
00259   me = dqmStore_->get(histo);
00260   h03ProjPhi_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h03ProjPhi_[0] );
00261 
00262   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC ET projection R EE -").c_str());
00263   me = dqmStore_->get(histo);
00264   h02ProjR_[1][0] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjR_[1][0] );
00265 
00266   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC ET projection phi EE -").c_str());
00267   me = dqmStore_->get(histo);
00268   h02ProjPhi_[1][0] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjPhi_[1][0] );
00269 
00270   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC size projection R EE -").c_str());
00271   me = dqmStore_->get(histo);
00272   h02ProjR_[2][0] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjR_[2][0] );
00273 
00274   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC size projection phi EE -").c_str());
00275   me = dqmStore_->get(histo);
00276   h02ProjPhi_[2][0] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjPhi_[2][0] );
00277 
00278   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC energy map EE +").c_str());
00279   me = dqmStore_->get(histo);
00280   h04_[0][1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h04_[0][1] );
00281 
00282   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC number map EE +").c_str());
00283   me = dqmStore_->get(histo);
00284   h03_[1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h03_[1] );
00285 
00286   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC ET map EE +").c_str());
00287   me = dqmStore_->get(histo);
00288   h04_[1][1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h04_[1][1] );
00289 
00290   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC size map EE +").c_str());
00291   me = dqmStore_->get(histo);
00292   h04_[2][1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h04_[2][1] );
00293 
00294   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC energy projection R EE +").c_str());
00295   me = dqmStore_->get(histo);
00296   h02ProjR_[0][1] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjR_[0][1] );
00297 
00298   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC energy projection phi EE +").c_str());
00299   me = dqmStore_->get(histo);
00300   h02ProjPhi_[0][1] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjPhi_[0][1] );
00301 
00302   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC number projection R EE +").c_str());
00303   me = dqmStore_->get(histo);
00304   h03ProjR_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h03ProjR_[1] );
00305 
00306   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC number projection phi EE +").c_str());
00307   me = dqmStore_->get(histo);
00308   h03ProjPhi_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h03ProjPhi_[1] );
00309 
00310   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC ET projection R EE +").c_str());
00311   me = dqmStore_->get(histo);
00312   h02ProjR_[1][1] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjR_[1][1] );
00313 
00314   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC ET projection phi EE +").c_str());
00315   me = dqmStore_->get(histo);
00316   h02ProjPhi_[1][1] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjPhi_[1][1] );
00317 
00318   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC size projection R EE +").c_str());
00319   me = dqmStore_->get(histo);
00320   h02ProjR_[2][1] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjR_[2][1] );
00321 
00322   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT BC size projection phi EE +").c_str());
00323   me = dqmStore_->get(histo);
00324   h02ProjPhi_[2][1] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjPhi_[2][1] );
00325 
00326   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT SC energy").c_str());
00327   me = dqmStore_->get(histo);
00328   i01_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, i01_[0] );
00329 
00330   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT SC size").c_str());
00331   me = dqmStore_->get(histo);
00332   i01_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, i01_[1] );
00333 
00334   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT SC number").c_str());
00335   me = dqmStore_->get(histo);
00336   i01_[2] = UtilsClient::getHisto<TH1F*>( me, cloneME_, i01_[2] );
00337 
00338   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT s1s9").c_str());
00339   me = dqmStore_->get(histo);
00340   s01_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, s01_[0] );
00341 
00342   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT s9s25").c_str());
00343   me = dqmStore_->get(histo);
00344   s01_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, s01_[1] );
00345 
00346   sprintf(histo, (prefixME_ + "/EEClusterTask/EECLT dicluster invariant mass Pi0").c_str());
00347   me = dqmStore_->get(histo);
00348   s01_[2] = UtilsClient::getHisto<TH1F*>( me, cloneME_, s01_[2] );
00349 
00350 }
00351 
00352 void EEClusterClient::softReset(bool flag) {
00353 
00354 }
00355 
00356 void EEClusterClient::htmlOutput(int run, string& htmlDir, string& htmlName) {
00357 
00358   if ( verbose_ ) cout << "Preparing EEClusterClient html output ..." << endl;
00359 
00360   ofstream htmlFile;
00361 
00362   htmlFile.open((htmlDir + htmlName).c_str());
00363 
00364   // html page header
00365   htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">  " << endl;
00366   htmlFile << "<html>  " << endl;
00367   htmlFile << "<head>  " << endl;
00368   htmlFile << "  <meta content=\"text/html; charset=ISO-8859-1\"  " << endl;
00369   htmlFile << " https-equiv=\"content-type\">  " << endl;
00370   htmlFile << "  <title>Monitor:ClusterTask output</title> " << endl;
00371   htmlFile << "</head>  " << endl;
00372   htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
00373   htmlFile << "<body>  " << endl;
00374   htmlFile << "<br>  " << endl;
00375   htmlFile << "<h2>Run:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << endl;
00376   htmlFile << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
00377   htmlFile << " style=\"color: rgb(0, 0, 153);\">" << run << "</span></h2>" << endl;
00378   htmlFile << "<h2>Monitoring task:&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
00379   htmlFile << " style=\"color: rgb(0, 0, 153);\">CLUSTER</span></h2> " << endl;
00380   htmlFile << "<hr>" << endl;
00381 
00382   htmlFile <<  "<a href=\"#bc_plots\"> Basic Clusters plots </a>" << endl;
00383   htmlFile << "<p>" << endl;
00384   htmlFile <<  "<a href=\"#sc_plots\"> Super Clusters plots </a>" << endl;
00385   htmlFile << "<p>" << endl;
00386   htmlFile <<  "<a href=\"#hl_plots\"> Higher Level Quantities plots </a>" << endl;
00387   htmlFile << "<p>" << endl;
00388 
00389   htmlFile << "<hr>" << endl;
00390   htmlFile << "<p>" << endl;
00391 
00392   // Produce the plots to be shown as .png files from existing histograms
00393 
00394   const int csize1D = 250;
00395   const int csize2D = 500;
00396 
00397   const double histMax = 1.e15;
00398 
00399   int pCol4[10];
00400   for ( int i = 0; i < 10; i++ ) pCol4[i] = 401+i;
00401 
00402   TH2C labelGrid1("labelGrid1","label grid for EE -", 10, -150.0, 150.0, 10, -150.0, 150.0);
00403 
00404   for ( int i=1; i<=10; i++) {
00405     for ( int j=1; j<=10; j++) {
00406       labelGrid1.SetBinContent(i, j, -10);
00407     }
00408   }
00409 
00410   labelGrid1.SetBinContent(2, 5, -3);
00411   labelGrid1.SetBinContent(2, 7, -2);
00412   labelGrid1.SetBinContent(4, 9, -1);
00413   labelGrid1.SetBinContent(7, 9, -9);
00414   labelGrid1.SetBinContent(9, 7, -8);
00415   labelGrid1.SetBinContent(9, 5, -7);
00416   labelGrid1.SetBinContent(8, 3, -6);
00417   labelGrid1.SetBinContent(5, 2, -5);
00418   labelGrid1.SetBinContent(3, 3, -4);
00419 
00420   labelGrid1.SetMarkerSize(2);
00421   labelGrid1.SetMinimum(-9.01);
00422   labelGrid1.SetMaximum(-0.01);
00423 
00424   TH2C labelGrid2("labelGrid2","label grid for EE +", 10, -150.0, 150.0, 10, -150.0, 150.0);
00425 
00426   for ( int i=1; i<=10; i++) {
00427     for ( int j=1; j<=10; j++) {
00428       labelGrid2.SetBinContent(i, j, -10);
00429     }
00430   }
00431 
00432   labelGrid2.SetBinContent(2, 5, +3);
00433   labelGrid2.SetBinContent(2, 7, +2);
00434   labelGrid2.SetBinContent(4, 9, +1);
00435   labelGrid2.SetBinContent(7, 9, +9);
00436   labelGrid2.SetBinContent(9, 7, +8);
00437   labelGrid2.SetBinContent(9, 5, +7);
00438   labelGrid2.SetBinContent(8, 3, +6);
00439   labelGrid2.SetBinContent(6, 2, +5);
00440   labelGrid2.SetBinContent(3, 3, +4);
00441 
00442   labelGrid2.SetMarkerSize(2);
00443   labelGrid2.SetMinimum(+0.01);
00444   labelGrid2.SetMaximum(+9.01);
00445 
00446   TGaxis Xaxis(-150.0, -150.0,  150.0, -150.0, -150.0, 150.0, 50210, "N");
00447   TGaxis Yaxis(-150.0, -150.0, -150.0,  150.0, -150.0, 150.0, 50210, "N");
00448   Xaxis.SetLabelSize(0.02);
00449   Yaxis.SetLabelSize(0.02);
00450 
00451   string imgNameAll[3], imgNameEneMap[3][2], imgNameNumMap[2];
00452   string imgNameEneXproj[3][2], imgNameNumXproj[2], imgNameEneYproj[3][2], imgNameNumYproj[2];
00453   string imgNameHL[3], imgName, meName;
00454 
00455   TCanvas* cEne = new TCanvas("cEne", "Temp", csize1D, csize1D);
00456   TCanvas* cMap = new TCanvas("cMap", "Temp", csize2D, csize2D);
00457 
00458   TH1F* obj1f;
00459   TProfile2D* objp;
00460   TH2F* objf;
00461   TProfile* obj1pX;
00462   TProfile* obj1pY;
00463   TH1F* obj1dX;
00464   TH1F* obj1dY;
00465 
00466   gStyle->SetPaintTextFormat("+g");
00467 
00468   // ====> B A S I C     C L U S T E R S <===
00469   // ==========================================================================
00470   // all Ecal Endcap 1D plots
00471   // ==========================================================================
00472 
00473   for ( int iCanvas = 1; iCanvas <= 3; iCanvas++ ) {
00474 
00475     imgNameAll[iCanvas-1] = "";
00476 
00477     obj1f = h01_[iCanvas-1];
00478 
00479     if ( obj1f ) {
00480 
00481       meName = obj1f->GetName();
00482 
00483       replace(meName.begin(), meName.end(), ' ', '_');
00484       imgNameAll[iCanvas-1] = meName + ".png";
00485       imgName = htmlDir + imgNameAll[iCanvas-1];
00486 
00487       cEne->cd();
00488       gStyle->SetOptStat("euomr");
00489       obj1f->SetStats(kTRUE);
00490       if ( obj1f->GetMaximum(histMax) > 0. ) {
00491         gPad->SetLogy(kTRUE);
00492       } else {
00493         gPad->SetLogy(kFALSE);
00494       }
00495       obj1f->Draw();
00496       cEne->Update();
00497       cEne->SaveAs(imgName.c_str());
00498       gPad->SetLogy(kFALSE);
00499     }
00500   }
00501 
00503   htmlFile << "<br>" << endl;
00504   htmlFile <<  "<a name=\"bc_plots\"> <B> Basic Clusters plots </B> </a> " << endl;
00505   htmlFile << "</br>" << endl;
00507 
00508   htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00509   htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
00510   htmlFile << "<tr align=\"center\">" << endl;
00511 
00512   for ( int iCanvas = 1; iCanvas <= 3; iCanvas++ ) {
00513 
00514     if ( imgNameAll[iCanvas-1].size() != 0 )
00515       htmlFile << "<td><img src=\"" << imgNameAll[iCanvas-1] << "\"></td>" << endl;
00516     else
00517       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00518 
00519   }
00520 
00521   htmlFile << "</tr>" << endl;
00522   htmlFile << "</table>" << endl;
00523   htmlFile << "<br>" << endl;
00524 
00525   // Energy profiles
00526   for(int iVar=0; iVar<3; ++iVar) {
00527     for(int iEE=0; iEE<2; iEE++) {
00528 
00529       imgNameEneMap[iVar][iEE] = "";
00530 
00531       objp = h04_[iVar][iEE];
00532 
00533       if ( objp ) {
00534 
00535         meName = objp->GetName();
00536 
00537         replace(meName.begin(), meName.end(), ' ', '_');
00538         imgNameEneMap[iVar][iEE] = meName + ".png";
00539         imgName = htmlDir + imgNameEneMap[iVar][iEE];
00540 
00541         cMap->cd();
00542         gStyle->SetOptStat(" ");
00543         gStyle->SetPalette(10, pCol4);
00544         objp->GetXaxis()->SetNdivisions(10, kFALSE);
00545         objp->GetXaxis()->SetLabelSize(0.02);
00546         objp->GetXaxis()->SetTitleSize(0.02);
00547         objp->GetYaxis()->SetNdivisions(10, kFALSE);
00548         objp->GetYaxis()->SetLabelSize(0.02);
00549         objp->GetYaxis()->SetTitleSize(0.02);
00550         objp->GetZaxis()->SetLabelSize(0.02);
00551         cMap->SetGridx();
00552         cMap->SetGridy();
00553         objp->Draw("colz");
00554         if ( iEE == 0 ) labelGrid1.Draw("text,same");
00555         if ( iEE == 1 ) labelGrid2.Draw("text,same");
00556         Xaxis.Draw();
00557         Yaxis.Draw();
00558         cMap->SetBit(TGraph::kClipFrame);
00559         TLine l;
00560         l.SetLineWidth(1);
00561         for ( int i=0; i<201; i=i+1) {
00562           if ( (Numbers::ixSectorsEE[i]!=0 || Numbers::iySectorsEE[i]!=0) && (Numbers::ixSectorsEE[i+1]!=0 || Numbers::iySectorsEE[i+1]!=0) ) {
00563             l.DrawLine(3.0*(Numbers::ixSectorsEE[i]-50), 3.0*(Numbers::iySectorsEE[i]-50), 3.0*(Numbers::ixSectorsEE[i+1]-50), 3.0*(Numbers::iySectorsEE[i+1]-50));
00564           }
00565         }
00566         cMap->Update();
00567         objp->GetXaxis()->SetLabelColor(0);
00568         objp->GetYaxis()->SetLabelColor(0);
00569         cMap->SaveAs(imgName.c_str());
00570         objp->GetXaxis()->SetLabelColor(1);
00571         objp->GetYaxis()->SetLabelColor(1);
00572       }
00573 
00574       char projXName[100];
00575       char projYName[100];
00576       sprintf(projXName,"%s_px",meName.c_str());
00577       imgNameEneXproj[iVar][iEE] = string(projXName) + ".png";
00578       sprintf(projYName,"%s_py",meName.c_str());
00579       imgNameEneYproj[iVar][iEE] = string(projYName) + ".png";
00580 
00581       obj1pX = h02ProjR_[iVar][iEE];
00582       obj1pY = h02ProjPhi_[iVar][iEE];
00583 
00584       if(obj1pX && obj1pY) {
00585         cEne->cd();
00586         gStyle->SetOptStat("emr");
00587         obj1pX->GetXaxis()->SetNdivisions(50205, kFALSE);
00588         obj1pY->GetXaxis()->SetNdivisions(50206, kFALSE);
00589 
00590         imgName = htmlDir + imgNameEneXproj[iVar][iEE];
00591         obj1pX->SetStats(kTRUE);
00592         obj1pX->Draw("pe");
00593         cEne->Update();
00594         cEne->SaveAs(imgName.c_str());
00595 
00596         imgName = htmlDir + imgNameEneYproj[iVar][iEE];
00597         obj1pY->SetStats(kTRUE);
00598         obj1pY->Draw("pe");
00599         cEne->Update();
00600         cEne->SaveAs(imgName.c_str());
00601       }
00602     }
00603   }
00604 
00605   // Cluster occupancy profiles
00606   for (int iEE=0; iEE<2; iEE++) {
00607 
00608     imgNameNumMap[iEE] = "";
00609 
00610     objf = h03_[iEE];
00611 
00612     if ( objf ) {
00613 
00614       meName = objf->GetName();
00615 
00616       replace(meName.begin(), meName.end(), ' ', '_');
00617       imgNameNumMap[iEE] = meName + ".png";
00618       imgName = htmlDir + imgNameNumMap[iEE];
00619 
00620       cMap->cd();
00621       gStyle->SetOptStat(" ");
00622       gStyle->SetPalette(10, pCol4);
00623       objf->GetXaxis()->SetNdivisions(10, kFALSE);
00624       objf->GetXaxis()->SetLabelSize(0.02);
00625       objf->GetXaxis()->SetTitleSize(0.02);
00626       objf->GetYaxis()->SetNdivisions(10, kFALSE);
00627       objf->GetYaxis()->SetLabelSize(0.02);
00628       objf->GetYaxis()->SetTitleSize(0.02);
00629       objf->GetZaxis()->SetLabelSize(0.02);
00630       cMap->SetGridx();
00631       cMap->SetGridy();
00632       objf->Draw("colz");
00633       if ( iEE == 0 ) labelGrid1.Draw("text,same");
00634       if ( iEE == 1 ) labelGrid2.Draw("text,same");
00635       Xaxis.Draw();
00636       Yaxis.Draw();
00637       cMap->SetBit(TGraph::kClipFrame);
00638       TLine l;
00639       l.SetLineWidth(1);
00640       for ( int i=0; i<201; i=i+1) {
00641         if ( (Numbers::ixSectorsEE[i]!=0 || Numbers::iySectorsEE[i]!=0) && (Numbers::ixSectorsEE[i+1]!=0 || Numbers::iySectorsEE[i+1]!=0) ) {
00642           l.DrawLine(3.0*(Numbers::ixSectorsEE[i]-50), 3.0*(Numbers::iySectorsEE[i]-50), 3.0*(Numbers::ixSectorsEE[i+1]-50), 3.0*(Numbers::iySectorsEE[i+1]-50));
00643         }
00644       }
00645       cMap->Update();
00646       objf->GetXaxis()->SetLabelColor(0);
00647       objf->GetYaxis()->SetLabelColor(0);
00648       cMap->SaveAs(imgName.c_str());
00649       objf->GetXaxis()->SetLabelColor(1);
00650       objf->GetYaxis()->SetLabelColor(1);
00651     }
00652 
00653     char projXName[100];
00654     char projYName[100];
00655     sprintf(projXName,"%s_px",meName.c_str());
00656     imgNameNumXproj[iEE] = string(projXName) + ".png";
00657     sprintf(projYName,"%s_py",meName.c_str());
00658     imgNameNumYproj[iEE] = string(projYName) + ".png";
00659 
00660     obj1dX = h03ProjR_[iEE];
00661     obj1dY = h03ProjPhi_[iEE];
00662 
00663     if(obj1dX && obj1dY) {
00664       cEne->cd();
00665       gStyle->SetOptStat("emr");
00666       obj1dX->GetXaxis()->SetNdivisions(50205, kFALSE);
00667       obj1dY->GetXaxis()->SetNdivisions(50206, kFALSE);
00668 
00669       imgName = htmlDir + imgNameNumXproj[iEE];
00670       obj1dX->SetStats(kTRUE);
00671       obj1dX->Draw("pe");
00672       cEne->Update();
00673       cEne->SaveAs(imgName.c_str());
00674 
00675       imgName = htmlDir + imgNameNumYproj[iEE];
00676       obj1dY->SetStats(kTRUE);
00677       obj1dY->Draw("pe");
00678       cEne->Update();
00679       cEne->SaveAs(imgName.c_str());
00680     }
00681   }
00682 
00683   htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00684   htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
00685   htmlFile << "<tr align=\"center\">" << endl;
00686 
00687   for(int iVar=0; iVar<3; ++iVar) {
00688     for(int iEE=0; iEE<2; iEE++) {
00689       if ( imgNameEneMap[iVar][iEE].size() != 0)
00690         htmlFile << "<td><img src=\"" << imgNameEneMap[iVar][iEE] << "\"></td>" << endl;
00691       else
00692         htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00693     }
00694     htmlFile << "</tr>" << endl;
00695   }
00696 
00697   for ( int iEE = 0; iEE<2; iEE++ ) {
00698     if ( imgNameNumMap[iEE].size() != 0)
00699       htmlFile << "<td><img src=\"" << imgNameNumMap[iEE] << "\"></td>" << endl;
00700     else
00701       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00702   }
00703 
00704   htmlFile << "</tr>" << endl;
00705   htmlFile << "</table>" << endl;
00706   htmlFile << "<br>" << endl;
00707 
00708   // projections...
00709   htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00710   htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
00711   htmlFile << "<tr align=\"center\">" << endl;
00712 
00713   for(int iVar=0; iVar<3; ++iVar) {
00714     for(int iEE=0; iEE<2; iEE++) {
00715       if ( imgNameEneXproj[iVar][iEE].size() != 0 )
00716         htmlFile << "<td><img src=\"" << imgNameEneXproj[iVar][iEE] << "\"></td>" << endl;
00717       else
00718         htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00719       if ( imgNameEneYproj[iVar][iEE].size() != 0 )
00720         htmlFile << "<td><img src=\"" << imgNameEneYproj[iVar][iEE] << "\"></td>" << endl;
00721       else
00722         htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00723     }
00724     htmlFile << "</tr>" << endl;
00725   }
00726 
00727   for(int iEE=0; iEE<2; iEE++) {
00728     if ( imgNameNumXproj[iEE].size() != 0 )
00729       htmlFile << "<td><img src=\"" << imgNameNumXproj[iEE] << "\"></td>" << endl;
00730     else
00731       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00732     if ( imgNameNumYproj[iEE].size() != 0 )
00733       htmlFile << "<td><img src=\"" << imgNameNumYproj[iEE] << "\"></td>" << endl;
00734     else
00735       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00736   }
00737 
00738   htmlFile << "</tr>" << endl;
00739   htmlFile << "</table>" << endl;
00740   htmlFile << "<br>" << endl;
00741 
00742   // ====>  S U P E R   C L U S T E R S   <====
00743 
00744   // ==========================================================================
00745   // all Ecal Endcap 1D plots
00746   // ==========================================================================
00747 
00748   for ( int iCanvas = 1; iCanvas <= 3; iCanvas++ ) {
00749 
00750     imgNameAll[iCanvas-1] = "";
00751 
00752     obj1f = i01_[iCanvas-1];
00753 
00754     if ( obj1f ) {
00755 
00756       meName = obj1f->GetName();
00757 
00758       replace(meName.begin(), meName.end(), ' ', '_');
00759       imgNameAll[iCanvas-1] = meName + ".png";
00760       imgName = htmlDir + imgNameAll[iCanvas-1];
00761 
00762       cEne->cd();
00763       gStyle->SetOptStat("euomr");
00764       obj1f->SetStats(kTRUE);
00765       if ( obj1f->GetMaximum(histMax) > 0. ) {
00766         gPad->SetLogy(kTRUE);
00767       } else {
00768         gPad->SetLogy(kFALSE);
00769       }
00770       obj1f->Draw();
00771       cEne->Update();
00772       cEne->SaveAs(imgName.c_str());
00773       gPad->SetLogy(kFALSE);
00774     }
00775   }
00776 
00778   htmlFile << "<br>" << endl;
00779   htmlFile <<  "<a name=\"sc_plots\"> <B> Super Clusters plots </B> </a> " << endl;
00780   htmlFile << "</br>" << endl;
00782 
00783   htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00784   htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
00785   htmlFile << "<tr align=\"center\">" << endl;
00786 
00787   for ( int iCanvas = 1; iCanvas <= 3; iCanvas++ ) {
00788 
00789     if ( imgNameAll[iCanvas-1].size() != 0 )
00790       htmlFile << "<td><img src=\"" << imgNameAll[iCanvas-1] << "\"></td>" << endl;
00791     else
00792       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00793 
00794   }
00795 
00796   htmlFile << "</tr>" << endl;
00797   htmlFile << "</table>" << endl;
00798   htmlFile << "<br>" << endl;
00799 
00800   // ===========================================================================
00801   // Higher Level variables
00802   // ===========================================================================
00803 
00804   for(int iVar=0; iVar<3; ++iVar) {
00805 
00806     imgNameHL[iVar] = "";
00807 
00808     obj1f = s01_[iVar];
00809 
00810     if ( obj1f ) {
00811 
00812       meName = obj1f->GetName();
00813 
00814       replace(meName.begin(), meName.end(), ' ', '_');
00815       imgNameHL[iVar] = meName + ".png";
00816       imgName = htmlDir + imgNameHL[iVar];
00817 
00818       cEne->cd();
00819       gStyle->SetOptStat("euomr");
00820       obj1f->SetStats(kTRUE);
00821       obj1f->Draw();
00822       cEne->Update();
00823       cEne->SaveAs(imgName.c_str());
00824 
00825     }
00826   }
00827 
00829   htmlFile << "<br>" << endl;
00830   htmlFile <<  "<a name=\"hl_plots\"> <B> Higher Level Quantities plots </B> </a> " << endl;
00831   htmlFile << "</br>" << endl;
00833 
00834   htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00835   htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
00836   htmlFile << "<tr align=\"center\">" << endl;
00837 
00838   for(int iVar=0; iVar<3; ++iVar) {
00839     if ( imgNameHL[iVar].size() != 0 )
00840       htmlFile << "<td><img src=\"" << imgNameHL[iVar] << "\"></td>" << endl;
00841     else
00842       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00843   }
00844 
00845   htmlFile << "</tr>" << endl;
00846   htmlFile << "</table>" << endl;
00847   htmlFile << "<br>" << endl;
00848 
00849   delete cEne;
00850   delete cMap;
00851 
00852   gStyle->SetPaintTextFormat();
00853 
00854   // html page footer
00855   htmlFile << "</body> " << endl;
00856   htmlFile << "</html> " << endl;
00857 
00858   htmlFile.close();
00859 
00860 }
00861 

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