CMS 3D CMS Logo

EETriggerTowerClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file EETriggerTowerClient.cc
00003  *
00004  * $Date: 2008/12/04 13:54:56 $
00005  * $Revision: 1.81 $
00006  * \author G. Della Ricca
00007  * \author F. Cossutti
00008  *
00009 */
00010 
00011 #include <memory>
00012 #include <iostream>
00013 #include <fstream>
00014 #include <iomanip>
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 "DQM/EcalCommon/interface/UtilsClient.h"
00024 #include "DQM/EcalCommon/interface/Numbers.h"
00025 
00026 #include <DataFormats/EcalDetId/interface/EEDetId.h>
00027 
00028 #include <DQM/EcalEndcapMonitorClient/interface/EETriggerTowerClient.h>
00029 
00030 using namespace cms;
00031 using namespace edm;
00032 using namespace std;
00033 
00034 EETriggerTowerClient::EETriggerTowerClient(const ParameterSet& ps) {
00035 
00036   // cloneME switch
00037   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00038 
00039   // verbose switch
00040   verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00041 
00042   // debug switch
00043   debug_ = ps.getUntrackedParameter<bool>("debug", false);
00044 
00045   // prefixME path
00046   prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
00047 
00048   // enableCleanup_ switch
00049   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00050 
00051   // vector of selected Super Modules (Defaults to all 18).
00052   superModules_.reserve(18);
00053   for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
00054   superModules_ = ps.getUntrackedParameter<vector<int> >("superModules", superModules_);
00055 
00056   h01_ = 0;
00057   h02_ = 0;
00058 
00059   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00060 
00061     int ism = superModules_[i];
00062 
00063     i01_[ism-1] = 0;
00064     i02_[ism-1] = 0;
00065     j01_[ism-1] = 0;
00066     j02_[ism-1] = 0;
00067 
00068     l01_[ism-1] = 0;
00069     m01_[ism-1] = 0;
00070     n01_[ism-1] = 0;
00071     o01_[ism-1] = 0;
00072 
00073     meh01_ = 0;
00074     meh02_ = 0;
00075 
00076     mei01_[ism-1] = 0;
00077     mei02_[ism-1] = 0;
00078     mej01_[ism-1] = 0;
00079     mej02_[ism-1] = 0;
00080 
00081     mel01_[ism-1] = 0;
00082     mem01_[ism-1] = 0;
00083     men01_[ism-1] = 0;
00084     meo01_[ism-1] = 0;
00085 
00086 //     for (int j=0; j<34; j++) {
00087 //
00088 //       k01_[ism-1][j] = 0;
00089 //       k02_[ism-1][j] = 0;
00090 //
00091 //       mek01_[ism-1][j] = 0;
00092 //       mek02_[ism-1][j] = 0;
00093 //
00094 //     }
00095 
00096     me_h01_[ism-1] = 0;
00097     me_h02_[ism-1] = 0;
00098     for (int j=0; j<2; j++) {
00099       me_i01_[ism-1][j] = 0;
00100       me_i02_[ism-1][j] = 0;
00101       me_n01_[ism-1][j] = 0;
00102     }
00103     for (int j=0; j<6; j++) {
00104       me_j01_[ism-1][j] = 0;
00105       me_j02_[ism-1][j] = 0;
00106       me_m01_[ism-1][j] = 0;
00107     }
00108     me_o01_[ism-1] = 0;
00109 
00110   }
00111 
00112 }
00113 
00114 EETriggerTowerClient::~EETriggerTowerClient() {
00115 
00116 }
00117 
00118 void EETriggerTowerClient::beginJob(DQMStore* dqmStore) {
00119 
00120   dqmStore_ = dqmStore;
00121 
00122   if ( debug_ ) cout << "EETriggerTowerClient: beginJob" << endl;
00123 
00124   ievt_ = 0;
00125   jevt_ = 0;
00126 
00127 }
00128 
00129 void EETriggerTowerClient::beginRun(void) {
00130 
00131   if ( debug_ ) cout << "EETriggerTowerClient: beginRun" << endl;
00132 
00133   jevt_ = 0;
00134 
00135   this->setup();
00136 
00137 }
00138 
00139 void EETriggerTowerClient::endJob(void) {
00140 
00141   if ( debug_ ) cout << "EETriggerTowerClient: endJob, ievt = " << ievt_ << endl;
00142 
00143   this->cleanup();
00144 
00145 }
00146 
00147 void EETriggerTowerClient::endRun(void) {
00148 
00149   if ( debug_ ) cout << "EETriggerTowerClient: endRun, jevt = " << jevt_ << endl;
00150 
00151   this->cleanup();
00152 
00153 }
00154 
00155 void EETriggerTowerClient::setup(void) {
00156 
00157   char histo[200];
00158 
00159   dqmStore_->setCurrentFolder( prefixME_ + "/EETriggerTowerClient" );
00160 
00161   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00162 
00163     int ism = superModules_[i];
00164 
00165     if ( me_h01_[ism-1] ) dqmStore_->removeElement( me_h01_[ism-1]->getName() );
00166     sprintf(histo, "EETTT Et map Real Digis %s", Numbers::sEE(ism).c_str());
00167     me_h01_[ism-1] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50., 256, 0., 256., "s");
00168     me_h01_[ism-1]->setAxisTitle("jx", 1);
00169     me_h01_[ism-1]->setAxisTitle("jy", 2);
00170     if ( me_h02_[ism-1] ) dqmStore_->removeElement( me_h02_[ism-1]->getName() );
00171     sprintf(histo, "EETTT Et map Emulated Digis %s", Numbers::sEE(ism).c_str());
00172     me_h02_[ism-1] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50., 256, 0., 256., "s");
00173     me_h02_[ism-1]->setAxisTitle("jx", 1);
00174     me_h02_[ism-1]->setAxisTitle("jy", 2);
00175     for (int j=0; j<2; j++) {
00176       if ( me_i01_[ism-1][j] ) dqmStore_->removeElement( me_i01_[ism-1][j]->getName() );
00177       sprintf(histo, "EETTT FineGrainVeto Real Digis Flag %d %s", j, Numbers::sEE(ism).c_str());
00178       me_i01_[ism-1][j] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00179       me_i01_[ism-1][j]->setAxisTitle("jx", 1);
00180       me_i01_[ism-1][j]->setAxisTitle("jy", 2);
00181       if ( me_i02_[ism-1][j] ) dqmStore_->removeElement( me_i02_[ism-1][j]->getName() );
00182       sprintf(histo, "EETTT FineGrainVeto Emulated Digis Flag %d %s", j, Numbers::sEE(ism).c_str());
00183       me_i02_[ism-1][j] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00184       me_i02_[ism-1][j]->setAxisTitle("jx", 1);
00185       me_i02_[ism-1][j]->setAxisTitle("jy", 2);
00186       if ( me_n01_[ism-1][j] ) dqmStore_->removeElement( me_n01_[ism-1][j]->getName() );
00187       sprintf(histo, "EETTT EmulFineGrainVetoError Flag %d %s", j, Numbers::sEE(ism).c_str());
00188       me_n01_[ism-1][j] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00189       me_n01_[ism-1][j]->setAxisTitle("jx", 1);
00190       me_n01_[ism-1][j]->setAxisTitle("jy", 2);
00191     }
00192     for (int j=0; j<6; j++) {
00193       string bits;
00194       if ( j == 0 ) bits = "Bit 000";
00195       if ( j == 1 ) bits = "Bit 001";
00196       if ( j == 2 ) bits = "Bit 011";
00197       if ( j == 3 ) bits = "Bit 100";
00198       if ( j == 4 ) bits = "Bit 101";
00199       if ( j == 5 ) bits = "Bits 110+111";
00200       if ( me_j01_[ism-1][j] ) dqmStore_->removeElement( me_j01_[ism-1][j]->getName() );
00201       sprintf(histo, "EETTT Flags Real Digis %s %s", bits.c_str(), Numbers::sEE(ism).c_str());
00202       me_j01_[ism-1][j] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00203       me_j01_[ism-1][j]->setAxisTitle("jx", 1);
00204       me_j01_[ism-1][j]->setAxisTitle("jy", 2);
00205       if ( me_j02_[ism-1][j] ) dqmStore_->removeElement( me_j02_[ism-1][j]->getName() );
00206       sprintf(histo, "EETTT Flags Emulated Digis %s %s", bits.c_str(), Numbers::sEE(ism).c_str());
00207       me_j02_[ism-1][j] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00208       me_j02_[ism-1][j]->setAxisTitle("jx", 1);
00209       me_j02_[ism-1][j]->setAxisTitle("jy", 2);
00210       if ( me_m01_[ism-1][j] ) dqmStore_->removeElement( me_m01_[ism-1][j]->getName() );
00211       sprintf(histo, "EETTT EmulFlagError %s %s", bits.c_str(), Numbers::sEE(ism).c_str());
00212       me_m01_[ism-1][j] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00213       me_m01_[ism-1][j]->setAxisTitle("jx", 1);
00214       me_m01_[ism-1][j]->setAxisTitle("jy", 2);
00215     }
00216     if ( me_o01_[ism-1] ) dqmStore_->removeElement( me_o01_[ism-1]->getName() );
00217     sprintf(histo, "EETTT Trigger Primitives Timing %s", Numbers::sEB(ism).c_str());
00218     me_o01_[ism-1] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00219     me_o01_[ism-1]->setAxisTitle("jx", 1);
00220     me_o01_[ism-1]->setAxisTitle("jy", 2);
00221 
00222   }
00223 
00224   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00225 
00226     int ism = superModules_[i];
00227 
00228     if ( me_h01_[ism-1] ) me_h01_[ism-1]->Reset();
00229     if ( me_h02_[ism-1] ) me_h02_[ism-1]->Reset();
00230     for (int j=0; j<2; j++) {
00231       if ( me_i01_[ism-1][j] ) me_i01_[ism-1][j]->Reset();
00232       if ( me_i02_[ism-1][j] ) me_i02_[ism-1][j]->Reset();
00233       if ( me_n01_[ism-1][j] ) me_n01_[ism-1][j]->Reset();
00234     }
00235     for (int j=0; j<6; j++) {
00236       if ( me_j01_[ism-1][j] ) me_j01_[ism-1][j]->Reset();
00237       if ( me_j02_[ism-1][j] ) me_j02_[ism-1][j]->Reset();
00238       if ( me_m01_[ism-1][j] ) me_m01_[ism-1][j]->Reset();
00239     }
00240     if ( me_o01_[ism-1] ) me_o01_[ism-1]->Reset();
00241 
00242   }
00243 
00244 }
00245 
00246 void EETriggerTowerClient::cleanup(void) {
00247 
00248   if ( ! enableCleanup_ ) return;
00249 
00250   if ( cloneME_ ) {
00251     if ( h01_ ) delete h01_;
00252     if ( h02_ ) delete h02_;
00253   }
00254 
00255   h01_ = 0;
00256   h02_ = 0;
00257 
00258   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00259 
00260     int ism = superModules_[i];
00261 
00262     if ( cloneME_ ) {
00263       if ( i01_[ism-1] ) delete i01_[ism-1];
00264       if ( i02_[ism-1] ) delete i02_[ism-1];
00265       if ( j01_[ism-1] ) delete j01_[ism-1];
00266       if ( j02_[ism-1] ) delete j02_[ism-1];
00267       if ( l01_[ism-1] ) delete l01_[ism-1];
00268       if ( m01_[ism-1] ) delete m01_[ism-1];
00269       if ( n01_[ism-1] ) delete n01_[ism-1];
00270       if ( o01_[ism-1] ) delete o01_[ism-1];
00271     }
00272 
00273     i01_[ism-1] = 0;
00274     i02_[ism-1] = 0;
00275     j01_[ism-1] = 0;
00276     j02_[ism-1] = 0;
00277 
00278     l01_[ism-1] = 0;
00279     m01_[ism-1] = 0;
00280     n01_[ism-1] = 0;
00281     o01_[ism-1] = 0;
00282 
00283     meh01_ = 0;
00284     meh02_ = 0;
00285 
00286     mei01_[ism-1] = 0;
00287     mei02_[ism-1] = 0;
00288     mej01_[ism-1] = 0;
00289     mej02_[ism-1] = 0;
00290 
00291     mel01_[ism-1] = 0;
00292     mem01_[ism-1] = 0;
00293     men01_[ism-1] = 0;
00294     meo01_[ism-1] = 0;
00295 
00296 //     for (int j=0; j<34; j++) {
00297 //
00298 //       if ( cloneME_ ) {
00299 //         if ( k01_[ism-1][j] ) delete k01_[ism-1][j];
00300 //         if ( k02_[ism-1][j] ) delete k02_[ism-1][j];
00301 //       }
00302 //
00303 //       k01_[ism-1][j] = 0;
00304 //       k02_[ism-1][j] = 0;
00305 //
00306 //       mek01_[ism-1][j] = 0;
00307 //       mek02_[ism-1][j] = 0;
00308 //
00309 //     }
00310 
00311   }
00312 
00313   dqmStore_->setCurrentFolder( prefixME_ + "/EETriggerTowerClient" );
00314 
00315   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00316 
00317     int ism = superModules_[i];
00318 
00319     if ( me_h01_[ism-1] ) dqmStore_->removeElement( me_h01_[ism-1]->getName() );
00320     me_h01_[ism-1] = 0;
00321     if ( me_h02_[ism-1] ) dqmStore_->removeElement( me_h02_[ism-1]->getName() );
00322     me_h02_[ism-1] = 0;
00323     for (int j=0; j<2; j++) {
00324       if ( me_i01_[ism-1][j] ) dqmStore_->removeElement( me_i01_[ism-1][j]->getName() );
00325       me_i01_[ism-1][j] = 0;
00326       if ( me_i02_[ism-1][j] ) dqmStore_->removeElement( me_i02_[ism-1][j]->getName() );
00327       me_i02_[ism-1][j] = 0;
00328       if ( me_n01_[ism-1][j] ) dqmStore_->removeElement( me_n01_[ism-1][j]->getName() );
00329       me_n01_[ism-1][j] = 0;
00330     }
00331     for (int j=0; j<6; j++) {
00332       if ( me_j01_[ism-1][j] ) dqmStore_->removeElement( me_j01_[ism-1][j]->getName() );
00333       me_j01_[ism-1][j] = 0;
00334       if ( me_j02_[ism-1][j] ) dqmStore_->removeElement( me_j02_[ism-1][j]->getName() );
00335       me_j02_[ism-1][j] = 0;
00336       if ( me_m01_[ism-1][j] ) dqmStore_->removeElement( me_m01_[ism-1][j]->getName() );
00337       me_m01_[ism-1][j] = 0;
00338     }
00339     if ( me_o01_[ism-1] ) dqmStore_->removeElement( me_o01_[ism-1]->getName() );
00340     me_o01_[ism-1] = 0;
00341 
00342   }
00343 
00344 }
00345 
00346 bool EETriggerTowerClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status, bool flag) {
00347 
00348   status = true;
00349 
00350   if ( ! flag ) return false;
00351 
00352   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00353 
00354     int ism = superModules_[i];
00355 
00356     if ( verbose_ ) {
00357       cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << endl;
00358       cout << endl;
00359       UtilsClient::printBadChannels(mel01_[ism-1], UtilsClient::getHisto<TH2F*>(mel01_[ism-1]), true);
00360       for (int j=0; j<2; j++) {
00361         UtilsClient::printBadChannels(me_n01_[ism-1][j], UtilsClient::getHisto<TH2F*>(me_n01_[ism-1][j]), true);
00362       }
00363       for (int j=0; j<6; j++) {
00364         UtilsClient::printBadChannels(me_m01_[ism-1][j], UtilsClient::getHisto<TH2F*>(me_m01_[ism-1][j]), true);
00365       }
00366     }
00367 
00368   }
00369 
00370   return true;
00371 
00372 }
00373 
00374 void EETriggerTowerClient::analyze(void) {
00375 
00376   ievt_++;
00377   jevt_++;
00378   if ( ievt_ % 10 == 0 ) {
00379     if ( debug_ ) cout << "EETriggerTowerClient: ievt/jevt = " << ievt_ << "/" << jevt_ << endl;
00380   }
00381 
00382   analyze("Real Digis",
00383           "EETriggerTowerTask", false );
00384 
00385   analyze("Emulated Digis",
00386           "EETriggerTowerTask/Emulated", true );
00387 
00388 }
00389 
00390 void EETriggerTowerClient::analyze(const char* nameext,
00391                                    const char* folder,
00392                                    bool emulated) {
00393   char histo[200];
00394 
00395   MonitorElement* me;
00396 
00397   sprintf(histo, (prefixME_ + "/%s/EETTT Et map %s").c_str(), folder, nameext);
00398   me = dqmStore_->get(histo);
00399   if(!emulated) {
00400     h01_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, h01_ );
00401     meh01_ = me;
00402   }
00403   else {
00404     h02_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, h02_ );
00405     meh02_ = me;
00406   }
00407 
00408   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00409 
00410     int ism = superModules_[i];
00411 
00412     sprintf(histo, (prefixME_ + "/%s/EETTT FineGrainVeto %s %s").c_str(), folder, nameext, Numbers::sEE(ism).c_str());
00413     me = dqmStore_->get(histo);
00414     if(!emulated) {
00415       i01_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, i01_[ism-1] );
00416       mei01_[ism-1] = me;
00417     }
00418     else {
00419       i02_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, i02_[ism-1] );
00420       mei02_[ism-1] = me;
00421     }
00422 
00423     sprintf(histo, (prefixME_ + "/%s/EETTT Flags %s %s").c_str(), folder, nameext, Numbers::sEE(ism).c_str());
00424     me = dqmStore_->get(histo);
00425     if(!emulated) {
00426       j01_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, j01_[ism-1] );
00427       mej01_[ism-1] = me;
00428     }
00429     else {
00430       j02_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, j02_[ism-1] );
00431       mej02_[ism-1] = me;
00432     }
00433 
00434     if(!emulated) {
00435       sprintf(histo, (prefixME_ + "/%s/EETTT EmulError %s").c_str(), folder, Numbers::sEE(ism).c_str());
00436       me = dqmStore_->get(histo);
00437       l01_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, l01_[ism-1] );
00438       mel01_[ism-1] = me;
00439 
00440       sprintf(histo, (prefixME_ + "/%s/EETTT EmulFlagError %s").c_str(), folder, Numbers::sEE(ism).c_str());
00441       me = dqmStore_->get(histo);
00442       m01_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, m01_[ism-1] );
00443       mem01_[ism-1] = me;
00444 
00445       sprintf(histo, (prefixME_ + "/%s/EETTT EmulFineGrainVetoError %s").c_str(), folder, Numbers::sEE(ism).c_str());
00446       me = dqmStore_->get(histo);
00447       n01_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, n01_[ism-1] );
00448       men01_[ism-1] = me;
00449 
00450       sprintf(histo, (prefixME_ + "/%s/EETTT EmulMatch %s").c_str(), folder, Numbers::sEE(ism).c_str());
00451       me = dqmStore_->get(histo);
00452       o01_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, o01_[ism-1] );
00453       meo01_[ism-1] = me;
00454 
00455     }
00456 
00457     //     for (int j=0; j<34; j++) {
00458     //
00459     //       sprintf(histo, (prefixME_ + "/EETriggerTowerTask/EnergyMaps/EETTT Et T %s TT%02d").c_str(), ism, j+1);
00460     //       me = dqmStore_->get(histo);
00461     //       k01_[ism-1][j] = UtilsClient::getHisto<TH1F*>( me, cloneME_, k01_[ism-1][j] );
00462     //       mek01_[ism-1][j] = me;
00463     //
00464     //       sprintf(histo, (prefixME_ + "/EETriggerTowerTask/EnergyMaps/EETTT Et R %s TT%02d").c_str(), ism, j+1);
00465     //       me = dqmStore_->get(histo);
00466     //       k02_[ism-1][j] = UtilsClient::getHisto<TH1F*>( me, cloneME_, k02_[ism-1][j] );
00467     //       mek02_[ism-1][j] = me;
00468     //
00469     //     }
00470 
00471     if ( me_h01_[ism-1] ) me_h01_[ism-1]->Reset();
00472     if ( me_h02_[ism-1] ) me_h02_[ism-1]->Reset();
00473     for (int j=0; j<2; j++) {
00474       if ( me_i01_[ism-1][j] ) me_i01_[ism-1][j]->Reset();
00475       if ( me_i02_[ism-1][j] ) me_i02_[ism-1][j]->Reset();
00476       if ( me_n01_[ism-1][j] ) me_n01_[ism-1][j]->Reset();
00477     }
00478     for (int j=0; j<6; j++) {
00479       if ( me_j01_[ism-1][j] ) me_j01_[ism-1][j]->Reset();
00480       if ( me_j02_[ism-1][j] ) me_j02_[ism-1][j]->Reset();
00481       if ( me_m01_[ism-1][j] ) me_m01_[ism-1][j]->Reset();
00482     }
00483     if ( me_o01_[ism-1] ) me_o01_[ism-1]->Reset();
00484 
00485     for (int ix = 1; ix <= 50; ix++) {
00486       for (int iy = 1; iy <= 50; iy++) {
00487 
00488         int jx = ix + Numbers::ix0EE(ism);
00489         int jy = iy + Numbers::iy0EE(ism);
00490 
00491         for (int j=0; j<2; j++) {
00492           if ( i01_[ism-1] ) me_i01_[ism-1][j]->Fill(jx-0.5, jy-0.5, i01_[ism-1]->GetBinContent(ix, iy, j+1));
00493           if ( i02_[ism-1] ) me_i02_[ism-1][j]->Fill(jx-0.5, jy-0.5, i02_[ism-1]->GetBinContent(ix, iy, j+1));
00494           if ( n01_[ism-1] ) me_n01_[ism-1][j]->Fill(jx-0.5, jy-0.5, n01_[ism-1]->GetBinContent(ix, iy, j+1));
00495         }
00496         for (int j=0; j<6; j++) {
00497           if ( j == 0 ) {
00498             if ( j01_[ism-1] ) me_j01_[ism-1][j]->Fill(jx-0.5, jy-0.5, j01_[ism-1]->GetBinContent(ix, iy, j+1));
00499             if ( j02_[ism-1] ) me_j02_[ism-1][j]->Fill(jx-0.5, jy-0.5, j02_[ism-1]->GetBinContent(ix, iy, j+1));
00500             if ( m01_[ism-1] ) me_m01_[ism-1][j]->Fill(jx-0.5, jy-0.5, m01_[ism-1]->GetBinContent(ix, iy, j+1));
00501           }
00502           if ( j == 1 ) {
00503             if ( j01_[ism-1] ) me_j01_[ism-1][j]->Fill(jx-0.5, jy-0.5, j01_[ism-1]->GetBinContent(ix, iy, j+1));
00504             if ( j02_[ism-1] ) me_j02_[ism-1][j]->Fill(jx-0.5, jy-0.5, j02_[ism-1]->GetBinContent(ix, iy, j+1));
00505             if ( m01_[ism-1] ) me_m01_[ism-1][j]->Fill(jx-0.5, jy-0.5, m01_[ism-1]->GetBinContent(ix, iy, j+1));
00506           }
00507           if ( j == 2 ) {
00508             if ( j01_[ism-1] ) me_j01_[ism-1][j]->Fill(jx-0.5, jy-0.5, j01_[ism-1]->GetBinContent(ix, iy, j+2));
00509             if ( j02_[ism-1] ) me_j02_[ism-1][j]->Fill(jx-0.5, jy-0.5, j02_[ism-1]->GetBinContent(ix, iy, j+2));
00510             if ( m01_[ism-1] ) me_m01_[ism-1][j]->Fill(jx-0.5, jy-0.5, m01_[ism-1]->GetBinContent(ix, iy, j+2));
00511           }
00512           if ( j == 3 ) {
00513             if ( j01_[ism-1] ) me_j01_[ism-1][j]->Fill(jx-0.5, jy-0.5, j01_[ism-1]->GetBinContent(ix, iy, j+2));
00514             if ( j02_[ism-1] ) me_j02_[ism-1][j]->Fill(jx-0.5, jy-0.5, j02_[ism-1]->GetBinContent(ix, iy, j+2));
00515             if ( m01_[ism-1] ) me_m01_[ism-1][j]->Fill(jx-0.5, jy-0.5, m01_[ism-1]->GetBinContent(ix, iy, j+2));
00516           }
00517           if ( j == 4 ) {
00518             if ( j01_[ism-1] ) me_j01_[ism-1][j]->Fill(jx-0.5, jy-0.5, j01_[ism-1]->GetBinContent(ix, iy, j+2));
00519             if ( j02_[ism-1] ) me_j02_[ism-1][j]->Fill(jx-0.5, jy-0.5, j02_[ism-1]->GetBinContent(ix, iy, j+2));
00520             if ( m01_[ism-1] ) me_m01_[ism-1][j]->Fill(jx-0.5, jy-0.5, m01_[ism-1]->GetBinContent(ix, iy, j+2));
00521           }
00522           if ( j == 5 ) {
00523             if ( j01_[ism-1] ) {
00524               me_j01_[ism-1][j]->Fill(jx-0.5, jy-0.5, j01_[ism-1]->GetBinContent(ix, iy, j+2));
00525               me_j01_[ism-1][j]->Fill(jx-0.5, jy-0.5, j01_[ism-1]->GetBinContent(ix, iy, j+3));
00526             }
00527             if ( j02_[ism-1] ) {
00528               me_j02_[ism-1][j]->Fill(jx-0.5, jy-0.5, j02_[ism-1]->GetBinContent(ix, iy, j+2));
00529               me_j02_[ism-1][j]->Fill(jx-0.5, jy-0.5, j02_[ism-1]->GetBinContent(ix, iy, j+3));
00530             }
00531             if ( m01_[ism-1] ) {
00532               me_m01_[ism-1][j]->Fill(jx-0.5, jy-0.5, m01_[ism-1]->GetBinContent(ix, iy, j+2));
00533               me_m01_[ism-1][j]->Fill(jx-0.5, jy-0.5, m01_[ism-1]->GetBinContent(ix, iy, j+3));
00534             }
00535           }
00536         }
00537         if ( o01_[ism-1] ) {
00538           float index=-1;
00539           double max=0;
00540           for (int j=0; j<6; j++) {
00541             double sampleEntries = o01_[ism-1]->GetBinContent(jx, jy, j+1);
00542             if(sampleEntries > max) {
00543               index=j;
00544               max = sampleEntries;
00545             }
00546           }
00547           if ( max > 0 ) {
00548             if ( index == 0 ) me_o01_[ism-1]->setBinContent(jx, jy, -1);
00549             else me_o01_[ism-1]->setBinContent(jx, jy, index );
00550           }
00551         }
00552 
00553       }
00554     }
00555 
00556   }
00557 
00558   for(int xttindex = 0; xttindex<28*72; xttindex++) {
00559 
00560     int tccindex=xttindex/28 + 1;
00561     if (tccindex > 36 ) tccindex += 36;
00562     int ttindex=xttindex%28 + 1;
00563 
00564     int dcc = 0;
00565     int offset = 0;
00566     int tccid = tccindex;
00567     if (tccid >= 73) {
00568       tccid = tccid-72;
00569       offset = 45;
00570     }
00571     if (tccid == 24 || tccid == 25 || tccid ==  6 || tccid ==  7) dcc = 4;
00572     if (tccid == 26 || tccid == 27 || tccid ==  8 || tccid ==  9) dcc = 5;
00573     if (tccid == 28 || tccid == 29 || tccid == 10 || tccid == 11) dcc = 6;
00574     if (tccid == 30 || tccid == 31 || tccid == 12 || tccid == 13) dcc = 7;
00575     if (tccid == 32 || tccid == 33 || tccid == 14 || tccid == 15) dcc = 8;
00576     if (tccid == 34 || tccid == 35 || tccid == 16 || tccid == 17) dcc = 9;
00577     if (tccid == 36 || tccid == 19 || tccid == 18 || tccid ==  1) dcc = 1;
00578     if (tccid == 20 || tccid == 21 || tccid ==  2 || tccid ==  3) dcc = 2;
00579     if (tccid == 22 || tccid == 23 || tccid ==  4 || tccid ==  5) dcc = 3;
00580     dcc += offset;
00581 
00582     int ism = 0;
00583 
00584     // EE-
00585     if( dcc >=  1 && dcc <=  9 ) ism = dcc;
00586 
00587     // EE+
00588     if( dcc >= 46 && dcc <= 54 ) ism = dcc - 45 + 9;
00589 
00590     vector<int>::const_iterator iter = find(superModules_.begin(), superModules_.end(), ism);
00591     if ( iter == superModules_.end() ) continue;
00592 
00593     vector<DetId> crystals = Numbers::crystals( EcalEndcap, tccindex, ttindex );
00594 
00595     for ( unsigned int i=0; i<crystals.size(); i++ ) {
00596 
00597       EEDetId id = crystals[i];
00598 
00599       int jx = id.ix();
00600       int jy = id.iy();
00601 
00602       if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
00603 
00604       for (int j = 0; j <= 256; j++) {
00605         if ( h01_ ) me_h01_[ism-1]->Fill(jx-0.5, jy-0.5, j-0.5, h01_->GetBinContent(xttindex, j+1));
00606         if ( h02_ ) me_h02_[ism-1]->Fill(jx-0.5, jy-0.5, j-0.5, h02_->GetBinContent(xttindex, j+1));
00607       }
00608 
00609     }
00610 
00611   }
00612 
00613 }
00614 
00615 void EETriggerTowerClient::softReset(bool flag) {
00616 
00617 }
00618 
00619 void EETriggerTowerClient::htmlOutput(int run, string& htmlDir, string& htmlName) {
00620 
00621   if ( verbose_ ) cout << "Preparing EETriggerTowerClient html output ..." << std::endl;
00622 
00623   std::ofstream htmlFile[19];
00624 
00625   htmlFile[0].open((htmlDir + htmlName).c_str());
00626 
00627   // html page header
00628   htmlFile[0] << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">  " << std::endl;
00629   htmlFile[0] << "<html>  " << std::endl;
00630   htmlFile[0] << "<head>  " << std::endl;
00631   htmlFile[0] << "  <meta content=\"text/html; charset=ISO-8859-1\"  " << std::endl;
00632   htmlFile[0] << " https-equiv=\"content-type\">  " << std::endl;
00633   htmlFile[0] << "  <title>Monitor:TriggerTowerTask output</title> " << std::endl;
00634   htmlFile[0] << "</head>  " << std::endl;
00635   htmlFile[0] << "<style type=\"text/css\"> td { font-weight: bold } </style>" << std::endl;
00636   htmlFile[0] << "<body>  " << std::endl;
00637   //htmlFile[0] << "<br>  " << std::endl;
00638   htmlFile[0] << "<a name=""top""></a>" << endl;
00639   htmlFile[0] << "<h2>Run:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << std::endl;
00640   htmlFile[0] << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << std::endl;
00641   htmlFile[0] << " style=\"color: rgb(0, 0, 153);\">" << run << "</span></h2>" << std::endl;
00642   htmlFile[0] << "<h2>Monitoring task:&nbsp;&nbsp;&nbsp;&nbsp; <span " << std::endl;
00643   htmlFile[0] << " style=\"color: rgb(0, 0, 153);\">TRIGGER TOWER</span></h2> " << std::endl;
00644   htmlFile[0] << "<br>" << std::endl;
00645   //htmlFile[0] << "<table border=1><tr><td bgcolor=red>channel has problems in this task</td>" << std::endl;
00646   //htmlFile[0] << "<td bgcolor=lime>channel has NO problems</td>" << std::endl;
00647   //htmlFile[0] << "<td bgcolor=yellow>channel is missing</td></table>" << std::endl;
00648   htmlFile[0] << "<hr>" << std::endl;
00649   htmlFile[0] << "<table border=1>" << std::endl;
00650   for ( unsigned int i=0; i<superModules_.size(); i ++ ) {
00651     htmlFile[0] << "<td bgcolor=white><a href=""#"
00652                 << Numbers::sEE(superModules_[i]) << ">"
00653                 << setfill( '0' ) << setw(2) << superModules_[i] << "</a></td>";
00654   }
00655   htmlFile[0] << std::endl << "</table>" << std::endl;
00656 
00657   // Produce the plots to be shown as .png files from existing histograms
00658 
00659   const int csize = 250;
00660 
00661   //const double histMax = 1.e15;
00662 
00663   int pCol4[10];
00664   for ( int i = 0; i < 10; i++ ) pCol4[i] = 401+i;
00665   int pCol5[10];
00666   for ( int i = 0; i < 10; i++ ) pCol5[i] = 501+i;
00667 
00668   TH2S labelGrid("labelGrid","label grid", 100, -2., 98., 100, -2., 98.);
00669   for ( short j=0; j<400; j++ ) {
00670     int x = 5*(1 + j%20);
00671     int y = 5*(1 + j/20);
00672     labelGrid.SetBinContent(x, y, Numbers::inTowersEE[j]);
00673   }
00674   labelGrid.SetMarkerSize(1);
00675   labelGrid.SetMinimum(0.1);
00676 
00677   string imgMeName[3], imgName, meName;
00678 
00679   TCanvas* cMe1 = new TCanvas("cMe1", "Temp", 2*csize, 2*csize);
00680   //  TCanvas* cMe2 = new TCanvas("cMe2", "Temp", int(1.2*csize), int(1.2*csize));
00681   //  TCanvas* cMe3 = new TCanvas("cMe3", "Temp", int(0.4*csize), int(0.4*csize));
00682   TCanvas* cMe2 = new TCanvas("cMe2", "Temp", int(1.8*csize), int(1.8*csize));
00683   TCanvas* cMe3 = new TCanvas("cMe3", "Temp", int(0.9*csize), int(0.9*csize));
00684 
00685   TH2F* obj2f;
00686   TProfile2D* obj2p;
00687 
00688   // Loop on endcap supermodules
00689 
00690   for ( unsigned int i=0; i<superModules_.size(); i ++ ) {
00691 
00692     int ism = superModules_[i];
00693 
00694     if ( i>0 ) htmlFile[0] << "<a href=""#top"">Top</a>" << std::endl;
00695     htmlFile[0] << "<hr>" << std::endl;
00696     htmlFile[0] << "<h3><a name="""
00697                 << Numbers::sEE(ism) << """></a><strong>"
00698                 << Numbers::sEE(ism) << "</strong></h3>" << endl;
00699 
00700 
00701     // ---------------------------  Emulator Error
00702 
00703     htmlFile[0] << "<h3><strong>Emulator Error</strong></h3>" << std::endl;
00704     htmlFile[0] << "<table border=\"0\" cellspacing=\"0\" " << std::endl;
00705     htmlFile[0] << "cellpadding=\"10\" align=\"center\"> " << std::endl;
00706     htmlFile[0] << "<tr align=\"center\">" << std::endl;
00707 
00708 
00709     imgMeName[0] = "";
00710 
00711     obj2f = l01_[ism-1];
00712 
00713     if ( obj2f ) {
00714 
00715       meName = obj2f->GetName();
00716 
00717       replace(meName.begin(), meName.end(), ' ', '_');
00718       imgMeName[0] = meName + ".png";
00719       imgName = htmlDir + imgMeName[0];
00720 
00721       cMe2->cd();
00722       gStyle->SetOptStat(" ");
00723       gStyle->SetPalette(10, pCol5);
00724       cMe2->SetGridx();
00725       cMe2->SetGridy();
00726       obj2f->GetXaxis()->SetLabelSize(0.02);
00727       obj2f->GetXaxis()->SetTitleSize(0.02);
00728       obj2f->GetYaxis()->SetLabelSize(0.02);
00729       obj2f->GetYaxis()->SetTitleSize(0.02);
00730       obj2f->GetZaxis()->SetLabelSize(0.02);
00731       obj2f->SetMinimum(0);
00732       obj2f->Draw("colz");
00733       int x1 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+0.);
00734       int x2 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+50.);
00735       int y1 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+0.);
00736       int y2 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+50.);
00737       labelGrid.GetXaxis()->SetRange(x1, x2);
00738       labelGrid.GetYaxis()->SetRange(y1, y2);
00739       labelGrid.Draw("text,same");
00740       cMe2->SetBit(TGraph::kClipFrame);
00741       TLine l;
00742       l.SetLineWidth(1);
00743       for ( int i=0; i<201; i=i+1) {
00744         if ( (Numbers::ixSectorsEE[i]!=0 || Numbers::iySectorsEE[i]!=0) && (Numbers::ixSectorsEE[i+1]!=0 || Numbers::iySectorsEE[i+1]!=0) ) {
00745           l.DrawLine(Numbers::ixSectorsEE[i], Numbers::iySectorsEE[i], Numbers::ixSectorsEE[i+1], Numbers::iySectorsEE[i+1]);
00746         }
00747       }
00748       cMe2->Update();
00749       cMe2->SaveAs(imgName.c_str());
00750     }
00751 
00752     htmlFile[0] << "<img src=\"" << imgMeName[0] << "\"><br>" << std::endl;
00753     htmlFile[0] << "</tr>" << std::endl;
00754     htmlFile[0] << "<br><br>" << std::endl;
00755 
00756     // ---------------------------  Et plots
00757 
00758     for(int iemu=0; iemu<2; iemu++) {
00759 
00760       imgMeName[iemu] = "";
00761 
00762       obj2p = 0;
00763       switch ( iemu ) {
00764         case 0:
00765           obj2p = UtilsClient::getHisto<TProfile2D*>( me_h01_[ism-1] );
00766           break;
00767         case 1:
00768           obj2p = UtilsClient::getHisto<TProfile2D*>( me_h02_[ism-1] );
00769           break;
00770         default:
00771           break;
00772       }
00773 
00774       if ( obj2p ) {
00775 
00776         meName = obj2p->GetName();
00777 
00778         replace(meName.begin(), meName.end(), ' ', '_');
00779         imgMeName[iemu] = meName + ".png";
00780         imgName = htmlDir + imgMeName[iemu];
00781 
00782         cMe1->cd();
00783         gStyle->SetOptStat(" ");
00784         gStyle->SetPalette(10, pCol4);
00785         cMe1->SetGridx();
00786         cMe1->SetGridy();
00787         obj2p->GetXaxis()->SetLabelSize(0.02);
00788         obj2p->GetXaxis()->SetTitleSize(0.02);
00789         obj2p->GetYaxis()->SetLabelSize(0.02);
00790         obj2p->GetYaxis()->SetTitleSize(0.02);
00791         obj2p->GetZaxis()->SetLabelSize(0.02);
00792         obj2p->Draw("colz");
00793         int x1 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+0.);
00794         int x2 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+50.);
00795         int y1 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+0.);
00796         int y2 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+50.);
00797         labelGrid.GetXaxis()->SetRange(x1, x2);
00798         labelGrid.GetYaxis()->SetRange(y1, y2);
00799         labelGrid.Draw("text,same");
00800         cMe1->SetBit(TGraph::kClipFrame);
00801         TLine l;
00802         l.SetLineWidth(1);
00803           for ( int i=0; i<201; i=i+1) {
00804           if ( (Numbers::ixSectorsEE[i]!=0 || Numbers::iySectorsEE[i]!=0) && (Numbers::ixSectorsEE[i+1]!=0 || Numbers::iySectorsEE[i+1]!=0) ) {
00805             l.DrawLine(Numbers::ixSectorsEE[i], Numbers::iySectorsEE[i], Numbers::ixSectorsEE[i+1], Numbers::iySectorsEE[i+1]);
00806           }
00807         }
00808         cMe1->Update();
00809         cMe1->SaveAs(imgName.c_str());
00810       }
00811     }
00812 
00813     htmlFile[0] << "<td><img src=\"" << imgMeName[0] << "\"></td>" << std::endl;
00814     htmlFile[0] << "<td><img src=\"" << imgMeName[1] << "\"></td>" << std::endl;
00815     htmlFile[0] << "</table>" << std::endl;
00816     htmlFile[0] << "<br>" << std::endl;
00817 
00818     std::stringstream subpage;
00819     subpage << htmlName.substr( 0, htmlName.find( ".html" ) ) << "_" << Numbers::sEE(ism) << ".html";
00820     htmlFile[0] << "<a href=\"" << subpage.str() << "\">" << Numbers::sEE(ism) << " details</a><br>" << std::endl;
00821     htmlFile[0] << "<hr>" << std::endl;
00822 
00823     htmlFile[ism].open((htmlDir + subpage.str()).c_str());
00824 
00825     // html page header
00826     htmlFile[ism] << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">  " << std::endl;
00827     htmlFile[ism] << "<html>  " << std::endl;
00828     htmlFile[ism] << "<head>  " << std::endl;
00829     htmlFile[ism] << "  <meta content=\"text/html; charset=ISO-8859-1\"  " << std::endl;
00830     htmlFile[ism] << " https-equiv=\"content-type\">  " << std::endl;
00831     htmlFile[ism] << "  <title>Monitor:TriggerTowerTask output " << Numbers::sEE(ism) << "</title> " << std::endl;
00832     htmlFile[ism] << "</head>  " << std::endl;
00833     htmlFile[ism] << "<style type=\"text/css\"> td { font-weight: bold } </style>" << std::endl;
00834     htmlFile[ism] << "<body>  " << std::endl;
00835     htmlFile[ism] << "<br>  " << std::endl;
00836     htmlFile[ism] << "<h3>Run:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << std::endl;
00837     htmlFile[ism] << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << std::endl;
00838     htmlFile[ism] << " style=\"color: rgb(0, 0, 153);\">" << run << "</span></h3>" << std::endl;
00839     htmlFile[ism] << "<h3>Monitoring task:&nbsp;&nbsp;&nbsp;&nbsp; <span " << std::endl;
00840     htmlFile[ism] << " style=\"color: rgb(0, 0, 153);\">TRIGGER TOWER</span></h3> " << std::endl;
00841     htmlFile[ism] << "<h3>SM:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << std::endl;
00842     htmlFile[ism] << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << std::endl;
00843     htmlFile[ism] << " style=\"color: rgb(0, 0, 153);\">" << Numbers::sEE(ism) << "</span></h3>" << std::endl;
00844     htmlFile[ism] << "<hr>" << std::endl;
00845 
00846     // ---------------------------  Flag bits plots
00847 
00848     htmlFile[ism] << "<h3><strong>Trigger Tower Flags</strong></h3>" << std::endl;
00849     htmlFile[ism] << "<table border=\"0\" cellspacing=\"0\" " << std::endl;
00850     htmlFile[ism] << "cellpadding=\"10\" align=\"center\"> " << std::endl;
00851     htmlFile[ism] << "<tr align=\"center\">" << std::endl;
00852 
00853     int counter = 0;
00854 
00855     for (int j=0; j<6; j++) {
00856 
00857       for(int iemu=0; iemu<3; iemu++) {
00858 
00859         imgMeName[iemu] = "";
00860 
00861         obj2f = 0;
00862         switch ( iemu ) {
00863           case 0:
00864             obj2f = UtilsClient::getHisto<TH2F*>( me_m01_[ism-1][j] );
00865             break;
00866           case 1:
00867             obj2f = UtilsClient::getHisto<TH2F*>( me_j01_[ism-1][j] );
00868             break;
00869           case 2:
00870             obj2f = UtilsClient::getHisto<TH2F*>( me_j02_[ism-1][j] );
00871             break;
00872           default:
00873             break;
00874         }
00875 
00876         if ( obj2f ) {
00877 
00878           meName = obj2f->GetName();
00879 
00880           replace(meName.begin(), meName.end(), ' ', '_');
00881           imgMeName[iemu] = meName + ".png";
00882           imgName = htmlDir + imgMeName[iemu];
00883 
00884           counter++;
00885 
00886           cMe2->cd();
00887           gStyle->SetOptStat(" ");
00888           if (iemu == 0 ) gStyle->SetPalette(10, pCol5);
00889           if (iemu == 1 || iemu == 2) gStyle->SetPalette(10, pCol4);
00890           cMe2->SetGridx();
00891           cMe2->SetGridy();
00892           obj2f->GetXaxis()->SetLabelSize(0.02);
00893           obj2f->GetXaxis()->SetTitleSize(0.02);
00894           obj2f->GetYaxis()->SetLabelSize(0.02);
00895           obj2f->GetYaxis()->SetTitleSize(0.02);
00896           obj2f->GetZaxis()->SetLabelSize(0.02);
00897           obj2f->SetMinimum(0);
00898           obj2f->Draw("colz");
00899           int x1 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+0.);
00900           int x2 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+50.);
00901           int y1 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+0.);
00902           int y2 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+50.);
00903           labelGrid.GetXaxis()->SetRange(x1, x2);
00904           labelGrid.GetYaxis()->SetRange(y1, y2);
00905           labelGrid.Draw("text,same");
00906           cMe2->SetBit(TGraph::kClipFrame);
00907           TLine l;
00908           l.SetLineWidth(1);
00909           for ( int i=0; i<201; i=i+1) {
00910             if ( (Numbers::ixSectorsEE[i]!=0 || Numbers::iySectorsEE[i]!=0) && (Numbers::ixSectorsEE[i+1]!=0 || Numbers::iySectorsEE[i+1]!=0) ) {
00911               l.DrawLine(Numbers::ixSectorsEE[i], Numbers::iySectorsEE[i], Numbers::ixSectorsEE[i+1], Numbers::iySectorsEE[i+1]);
00912             }
00913           }
00914           cMe2->Update();
00915           cMe2->SaveAs(imgName.c_str());
00916 
00917           htmlFile[ism] << "<td><img src=\"" << imgMeName[iemu] << "\"></td>" << std::endl;
00918           if ( counter%3 == 0 ) htmlFile[ism] << "</tr><tr>" << std::endl;
00919 
00920         }
00921       }
00922     }
00923 
00924     htmlFile[ism] << "</tr>" << std::endl << "</table>" << std::endl;
00925 
00926 
00927 
00928     // ---------------------------  Fine Grain Veto
00929 
00930     htmlFile[ism] << "<h3><strong>Fine Grain Veto</strong></h3>" << std::endl;
00931     htmlFile[ism] << "<table border=\"0\" cellspacing=\"0\" " << std::endl;
00932     htmlFile[ism] << "cellpadding=\"10\" align=\"center\"> " << std::endl;
00933     htmlFile[ism] << "<tr align=\"center\">" << std::endl;
00934 
00935 
00936     for (int j=0; j<2; j++) {
00937 
00938       for(int iemu=0; iemu<3; iemu++) {
00939 
00940         imgMeName[iemu] = "";
00941 
00942         obj2f = 0;
00943         switch ( iemu ) {
00944           case 0:
00945             obj2f = UtilsClient::getHisto<TH2F*>( me_n01_[ism-1][j] );
00946             break;
00947           case 1:
00948             obj2f = UtilsClient::getHisto<TH2F*>( me_i01_[ism-1][j] );
00949             break;
00950           case 2:
00951             obj2f = UtilsClient::getHisto<TH2F*>( me_i02_[ism-1][j] );
00952             break;
00953           default:
00954             break;
00955         }
00956 
00957         if ( obj2f ) {
00958 
00959           meName = obj2f->GetName();
00960 
00961           replace(meName.begin(), meName.end(), ' ', '_');
00962           imgMeName[iemu] = meName + ".png";
00963           imgName = htmlDir + imgMeName[iemu];
00964 
00965           cMe2->cd();
00966           gStyle->SetOptStat(" ");
00967           if (iemu == 0 ) gStyle->SetPalette(10, pCol5);
00968           if (iemu == 1 || iemu == 2) gStyle->SetPalette(10, pCol4);
00969           cMe2->SetGridx();
00970           cMe2->SetGridy();
00971           obj2f->GetXaxis()->SetLabelSize(0.02);
00972           obj2f->GetXaxis()->SetTitleSize(0.02);
00973           obj2f->GetYaxis()->SetLabelSize(0.02);
00974           obj2f->GetYaxis()->SetTitleSize(0.02);
00975           obj2f->GetZaxis()->SetLabelSize(0.02);
00976           obj2f->SetMinimum(0);
00977           obj2f->Draw("colz");
00978           int x1 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+0.);
00979           int x2 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+50.);
00980           int y1 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+0.);
00981           int y2 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+50.);
00982           labelGrid.GetXaxis()->SetRange(x1, x2);
00983           labelGrid.GetYaxis()->SetRange(y1, y2);
00984           labelGrid.Draw("text,same");
00985           cMe2->SetBit(TGraph::kClipFrame);
00986           TLine l;
00987           l.SetLineWidth(1);
00988           for ( int i=0; i<201; i=i+1) {
00989             if ( (Numbers::ixSectorsEE[i]!=0 || Numbers::iySectorsEE[i]!=0) && (Numbers::ixSectorsEE[i+1]!=0 || Numbers::iySectorsEE[i+1]!=0) ) {
00990               l.DrawLine(Numbers::ixSectorsEE[i], Numbers::iySectorsEE[i], Numbers::ixSectorsEE[i+1], Numbers::iySectorsEE[i+1]);
00991             }
00992           }
00993           cMe2->Update();
00994           cMe2->SaveAs(imgName.c_str());
00995 
00996           htmlFile[ism] << "<td><img src=\"" << imgMeName[iemu] << "\"></td>" << std::endl;
00997         }
00998       }
00999       htmlFile[ism] << "</tr><tr>" << std::endl;
01000     }
01001 
01002     htmlFile[ism] << "</tr>" << std::endl << "</table>" << std::endl;
01003 
01004     // ---------------------------  Et plots per Tower
01005 
01006     //     htmlFile[ism] << "<h3><strong>Et</strong></h3>" << std::endl;
01007     //     htmlFile[ism] << "<table border=\"0\" cellspacing=\"0\" " << std::endl;
01008     //     htmlFile[ism] << "cellpadding=\"10\" align=\"center\"> " << std::endl;
01009     //     htmlFile[ism] << "<tr align=\"center\">" << std::endl;
01010     //
01011     //     for (int j=0; j<34; j++) {
01012     //
01013     //       TH1F* obj1f1 = k01_[ism-1][j];
01014     //       TH1F* obj1f2 = k02_[ism-1][j];
01015     //
01016     //       if ( obj1f1 ) {
01017     //
01018     //         imgMeName[iemu] = "";
01019     //
01020     //         meName = obj1f1->GetName();
01021     //
01022     //         replace(meName.begin(), meName.end(), ' ', '_');
01023     //         imgMeName[iemu] = meName + ".png";
01024     //         imgName = htmlDir + imgMeName[iemu];
01025     //
01026     //         cMe3->cd();
01027     //         gStyle->SetOptStat("euomr");
01028     //         if ( obj1f2 ) {
01029     //           float m = TMath::Max( obj1f1->GetMaximum(), obj1f2->GetMaximum() );
01030     //           obj1f1->SetMaximum( m + 1. );
01031     //         }
01032     //         obj1f1->SetStats(kTRUE);
01033     //         gStyle->SetStatW( gStyle->GetStatW() * 1.5 );
01034     //         obj1f1->Draw();
01035     //         cMe3->Update();
01036     //
01037     //         if ( obj1f2 ) {
01038     //           gStyle->SetStatY( gStyle->GetStatY() - 1.25*gStyle->GetStatH() );
01039     //           gStyle->SetStatTextColor( kRed );
01040     //           obj1f2->SetStats(kTRUE);
01041     //           obj1f2->SetLineColor( kRed );
01042     //           obj1f2->Draw( "sames" );
01043     //           cMe3->Update();
01044     //           gStyle->SetStatY( gStyle->GetStatY() + 1.25*gStyle->GetStatH() );
01045     //           gStyle->SetStatTextColor( kBlack );
01046     //         }
01047     //
01048     //         gStyle->SetStatW( gStyle->GetStatW() / 1.5 );
01049     //         cMe3->SaveAs(imgName.c_str());
01050     //
01051     //         htmlFile[ism] << "<td><img src=\"" << imgMeName[iemu] << "\"></td>" << std::endl;
01052     //
01053     //       }
01054     //
01055     //       if ( (j+1)%4 == 0 ) htmlFile[ism] << "</tr><tr>" << std::endl;
01056     //
01057     //     }
01058 
01059     htmlFile[ism] << "</tr>" << std::endl << "</table>" << std::endl;
01060 
01061     // html page footer
01062     htmlFile[ism] << "</body> " << std::endl;
01063     htmlFile[ism] << "</html> " << std::endl;
01064     htmlFile[ism].close();
01065   }
01066 
01067   delete cMe1;
01068   delete cMe2;
01069   delete cMe3;
01070 
01071   // html page footer
01072   htmlFile[0] << "</body> " << std::endl;
01073   htmlFile[0] << "</html> " << std::endl;
01074   htmlFile[0].close();
01075 
01076 }
01077 

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