CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/DQM/EcalEndcapMonitorClient/src/EEClusterClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file EEClusterClient.cc
00003  *
00004  * $Date: 2011/09/02 13:55:02 $
00005  * $Revision: 1.66 $
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 "FWCore/ServiceRegistry/interface/Service.h"
00016 
00017 #include "DQMServices/Core/interface/DQMStore.h"
00018 #include "DQMServices/Core/interface/MonitorElement.h"
00019 
00020 #include "DQM/EcalCommon/interface/UtilsClient.h"
00021 #include "DQM/EcalCommon/interface/Numbers.h"
00022 
00023 #include "DQM/EcalEndcapMonitorClient/interface/EEClusterClient.h"
00024 
00025 EEClusterClient::EEClusterClient(const edm::ParameterSet& ps) {
00026 
00027   // cloneME switch
00028   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00029 
00030   // verbose switch
00031   verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00032 
00033   // debug switch
00034   debug_ = ps.getUntrackedParameter<bool>("debug", false);
00035 
00036   // prefixME path
00037   prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00038 
00039   // enableCleanup_ switch
00040   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00041 
00042   // vector of selected Super Modules (Defaults to all 18).
00043   superModules_.reserve(18);
00044   for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
00045   superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
00046 
00047   h01_[0] = 0;
00048   h01_[1] = 0;
00049   h01_[2] = 0;
00050 
00051   for(int iEE=0;iEE<2;iEE++) {
00052     for(int i=0;i<3;++i) {
00053       h04_[i][iEE] = 0;
00054       h02ProjEta_[i][iEE] = 0;
00055       h02ProjPhi_[i][iEE] = 0;
00056     }
00057   }
00058 
00059   h03_[0] = 0;
00060   h03ProjEta_[0] = 0;
00061   h03ProjPhi_[0] = 0;
00062 
00063   h03_[1] = 0;
00064   h03ProjEta_[1] = 0;
00065   h03ProjPhi_[1] = 0;
00066 
00067   i01_[0] = 0;
00068   i01_[1] = 0;
00069   i01_[2] = 0;
00070 
00071   s01_[0] = 0;
00072   s01_[1] = 0;
00073   s01_[2] = 0;
00074 
00075 }
00076 
00077 EEClusterClient::~EEClusterClient() {
00078 
00079 }
00080 
00081 void EEClusterClient::beginJob(void) {
00082 
00083   dqmStore_ = edm::Service<DQMStore>().operator->();
00084 
00085   if ( debug_ ) std::cout << "EEClusterClient: beginJob" << std::endl;
00086 
00087   ievt_ = 0;
00088   jevt_ = 0;
00089 
00090 }
00091 
00092 void EEClusterClient::beginRun(void) {
00093 
00094   if ( debug_ ) std::cout << "EEClusterClient: beginRun" << std::endl;
00095 
00096   jevt_ = 0;
00097 
00098   this->setup();
00099 
00100 }
00101 
00102 void EEClusterClient::endJob(void) {
00103 
00104   if ( debug_ ) std::cout << "EEClusterClient: endJob, ievt = " << ievt_ << std::endl;
00105 
00106   this->cleanup();
00107 
00108 }
00109 
00110 void EEClusterClient::endRun(void) {
00111 
00112   if ( debug_ ) std::cout << "EEClusterClient: endRun, jevt = " << jevt_ << std::endl;
00113 
00114   this->cleanup();
00115 
00116 }
00117 
00118 void EEClusterClient::setup(void) {
00119 
00120   dqmStore_->setCurrentFolder( prefixME_ + "/EEClusterClient" );
00121 
00122 }
00123 
00124 void EEClusterClient::cleanup(void) {
00125 
00126   if ( ! enableCleanup_ ) return;
00127 
00128   if ( cloneME_ ) {
00129     if ( h01_[0] ) delete h01_[0];
00130     if ( h01_[1] ) delete h01_[1];
00131     if ( h01_[2] ) delete h01_[2];
00132 
00133     for(int iEE=0;iEE<2;iEE++) {
00134       for(int i=0;i<3;++i) {
00135         if(h04_[i][iEE]) delete h04_[i][iEE];
00136         if(h02ProjEta_[i][iEE]) delete h02ProjEta_[i][iEE];
00137         if(h02ProjPhi_[i][iEE]) delete h02ProjPhi_[i][iEE];
00138       }
00139     }
00140 
00141     if(h03_[0]) delete h03_[0];
00142     if(h03ProjEta_[0]) delete h03ProjEta_[0];
00143     if(h03ProjPhi_[0]) delete h03ProjPhi_[0];
00144 
00145     if(h03_[1]) delete h03_[1];
00146     if(h03ProjEta_[1]) delete h03ProjEta_[1];
00147     if(h03ProjPhi_[1]) delete h03ProjPhi_[1];
00148 
00149     if(i01_[0]) delete i01_[0];
00150     if(i01_[1]) delete i01_[1];
00151     if(i01_[2]) delete i01_[2];
00152 
00153     if(s01_[0]) delete s01_[0];
00154     if(s01_[1]) delete s01_[1];
00155     if(s01_[2]) delete s01_[2];
00156 
00157   }
00158 
00159   h01_[0] = 0;
00160   h01_[1] = 0;
00161   h01_[2] = 0;
00162 
00163   for(int iEE=0;iEE<2;iEE++) {
00164     for(int i=0;i<3;++i) {
00165       h04_[i][iEE] = 0;
00166       h02ProjEta_[i][iEE] = 0;
00167       h02ProjPhi_[i][iEE] = 0;
00168     }
00169   }
00170 
00171   h03_[0] = 0;
00172   h03ProjEta_[0] = 0;
00173   h03ProjPhi_[0] = 0;
00174 
00175   h03_[1] = 0;
00176   h03ProjEta_[1] = 0;
00177   h03ProjPhi_[1] = 0;
00178 
00179   i01_[0] = 0;
00180   i01_[1] = 0;
00181   i01_[2] = 0;
00182 
00183   s01_[0] = 0;
00184   s01_[1] = 0;
00185   s01_[2] = 0;
00186 
00187 }
00188 
00189 #ifdef WITH_ECAL_COND_DB
00190 bool EEClusterClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
00191 
00192   status = true;
00193 
00194   return true;
00195 
00196 }
00197 #endif
00198 
00199 void EEClusterClient::analyze(void) {
00200 
00201   ievt_++;
00202   jevt_++;
00203   if ( ievt_ % 10 == 0 ) {
00204     if ( debug_ ) std::cout << "EEClusterClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
00205   }
00206 
00207   MonitorElement* me;
00208 
00209   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC energy" );
00210   h01_[0] = UtilsClient::getHisto( me, cloneME_, h01_[0] );
00211 
00212   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC size" );
00213   h01_[1] = UtilsClient::getHisto( me, cloneME_, h01_[1] );
00214 
00215   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC number" );
00216   h01_[2] = UtilsClient::getHisto( me, cloneME_, h01_[2] );
00217 
00218   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC energy map EE -" );
00219   h04_[0][0] = UtilsClient::getHisto( me, cloneME_, h04_[0][0] );
00220 
00221   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC number map EE -" );
00222   h03_[0] = UtilsClient::getHisto( me, cloneME_, h03_[0] );
00223 
00224   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC ET map EE -" );
00225   h04_[1][0] = UtilsClient::getHisto( me, cloneME_, h04_[1][0] );
00226 
00227   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC size map EE -" );
00228   h04_[2][0] = UtilsClient::getHisto( me, cloneME_, h04_[2][0] );
00229 
00230   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC energy projection eta EE -" );
00231   h02ProjEta_[0][0] = UtilsClient::getHisto( me, cloneME_, h02ProjEta_[0][0] );
00232 
00233   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC energy projection phi EE -" );
00234   h02ProjPhi_[0][0] = UtilsClient::getHisto( me, cloneME_, h02ProjPhi_[0][0] );
00235 
00236   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC number projection eta EE -" );
00237   h03ProjEta_[0] = UtilsClient::getHisto( me, cloneME_, h03ProjEta_[0] );
00238 
00239   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC number projection phi EE -" );
00240   h03ProjPhi_[0] = UtilsClient::getHisto( me, cloneME_, h03ProjPhi_[0] );
00241 
00242   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC ET projection eta EE -" );
00243   h02ProjEta_[1][0] = UtilsClient::getHisto( me, cloneME_, h02ProjEta_[1][0] );
00244 
00245   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC ET projection phi EE -" );
00246   h02ProjPhi_[1][0] = UtilsClient::getHisto( me, cloneME_, h02ProjPhi_[1][0] );
00247 
00248   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC size projection eta EE -" );
00249   h02ProjEta_[2][0] = UtilsClient::getHisto( me, cloneME_, h02ProjEta_[2][0] );
00250 
00251   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC size projection phi EE -" );
00252   h02ProjPhi_[2][0] = UtilsClient::getHisto( me, cloneME_, h02ProjPhi_[2][0] );
00253 
00254   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC energy map EE +" );
00255   h04_[0][1] = UtilsClient::getHisto( me, cloneME_, h04_[0][1] );
00256 
00257   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC number map EE +" );
00258   h03_[1] = UtilsClient::getHisto( me, cloneME_, h03_[1] );
00259 
00260   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC ET map EE +" );
00261   h04_[1][1] = UtilsClient::getHisto( me, cloneME_, h04_[1][1] );
00262 
00263   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC size map EE +" );
00264   h04_[2][1] = UtilsClient::getHisto( me, cloneME_, h04_[2][1] );
00265 
00266   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC energy projection eta EE +" );
00267   h02ProjEta_[0][1] = UtilsClient::getHisto( me, cloneME_, h02ProjEta_[0][1] );
00268 
00269   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC energy projection phi EE +" );
00270   h02ProjPhi_[0][1] = UtilsClient::getHisto( me, cloneME_, h02ProjPhi_[0][1] );
00271 
00272   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC number projection eta EE +" );
00273   h03ProjEta_[1] = UtilsClient::getHisto( me, cloneME_, h03ProjEta_[1] );
00274 
00275   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC number projection phi EE +" );
00276   h03ProjPhi_[1] = UtilsClient::getHisto( me, cloneME_, h03ProjPhi_[1] );
00277 
00278   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC ET projection eta EE +" );
00279   h02ProjEta_[1][1] = UtilsClient::getHisto( me, cloneME_, h02ProjEta_[1][1] );
00280 
00281   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC ET projection phi EE +" );
00282   h02ProjPhi_[1][1] = UtilsClient::getHisto( me, cloneME_, h02ProjPhi_[1][1] );
00283 
00284   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC size projection eta EE +" );
00285   h02ProjEta_[2][1] = UtilsClient::getHisto( me, cloneME_, h02ProjEta_[2][1] );
00286 
00287   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT BC size projection phi EE +" );
00288   h02ProjPhi_[2][1] = UtilsClient::getHisto( me, cloneME_, h02ProjPhi_[2][1] );
00289 
00290   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT SC energy" );
00291   i01_[0] = UtilsClient::getHisto( me, cloneME_, i01_[0] );
00292 
00293   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT SC size" );
00294   i01_[1] = UtilsClient::getHisto( me, cloneME_, i01_[1] );
00295 
00296   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT SC number" );
00297   i01_[2] = UtilsClient::getHisto( me, cloneME_, i01_[2] );
00298 
00299   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT s1s9" );
00300   s01_[0] = UtilsClient::getHisto( me, cloneME_, s01_[0] );
00301 
00302   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT s9s25" );
00303   s01_[1] = UtilsClient::getHisto( me, cloneME_, s01_[1] );
00304 
00305   me = dqmStore_->get( prefixME_ + "/EEClusterTask/EECLT dicluster invariant mass Pi0" );
00306   s01_[2] = UtilsClient::getHisto( me, cloneME_, s01_[2] );
00307 
00308 }
00309