CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/EcalBarrelMonitorClient/src/EBClusterClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file EBClusterClient.cc
00003  *
00004  * $Date: 2012/04/27 13:45:58 $
00005  * $Revision: 1.80 $
00006  * \author G. Della Ricca
00007  * \author F. Cossutti
00008  * \author E. Di Marco
00009  *
00010 */
00011 
00012 #include <memory>
00013 #include <iostream>
00014 #include <fstream>
00015 #include <math.h>
00016 
00017 #include "FWCore/ServiceRegistry/interface/Service.h"
00018 
00019 #include "DQMServices/Core/interface/DQMStore.h"
00020 #include "DQMServices/Core/interface/MonitorElement.h"
00021 
00022 #include "DQM/EcalCommon/interface/UtilsClient.h"
00023 
00024 #include "DQM/EcalBarrelMonitorClient/interface/EBClusterClient.h"
00025 
00026 EBClusterClient::EBClusterClient(const edm::ParameterSet& ps) {
00027 
00028   // cloneME switch
00029   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00030 
00031   // verbose switch
00032   verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00033 
00034   // debug switch
00035   debug_ = ps.getUntrackedParameter<bool>("debug", false);
00036 
00037   // prefixME path
00038   prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00039 
00040   // enableCleanup_ switch
00041   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00042 
00043   // vector of selected Super Modules (Defaults to all 36).
00044   superModules_.reserve(36);
00045   for ( unsigned int i = 1; i <= 36; i++ ) superModules_.push_back(i);
00046   superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
00047 
00048   h01_[0] = 0;
00049   h01_[1] = 0;
00050   h01_[2] = 0;
00051 
00052   h02_[0] = 0;
00053   h02ProjEta_[0] = 0;
00054   h02ProjPhi_[0] = 0;
00055   h02_[1] = 0;
00056   h02ProjEta_[1] = 0;
00057   h02ProjPhi_[1] = 0;
00058 
00059   h03_ = 0;
00060   h03ProjEta_ = 0;
00061   h03ProjPhi_ = 0;
00062 
00063   h04_ = 0;
00064   h04ProjEta_ = 0;
00065   h04ProjPhi_ = 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 EBClusterClient::~EBClusterClient() {
00078 
00079 }
00080 
00081 void EBClusterClient::beginJob(void) {
00082 
00083   dqmStore_ = edm::Service<DQMStore>().operator->();
00084 
00085   if ( debug_ ) std::cout << "EBClusterClient: beginJob" << std::endl;
00086 
00087   ievt_ = 0;
00088   jevt_ = 0;
00089 
00090 }
00091 
00092 void EBClusterClient::beginRun(void) {
00093 
00094   if ( debug_ ) std::cout << "EBClusterClient: beginRun" << std::endl;
00095 
00096   jevt_ = 0;
00097 
00098   this->setup();
00099 
00100 }
00101 
00102 void EBClusterClient::endJob(void) {
00103 
00104   if ( debug_ ) std::cout << "EBClusterClient: endJob, ievt = " << ievt_ << std::endl;
00105 
00106   this->cleanup();
00107 
00108 }
00109 
00110 void EBClusterClient::endRun(void) {
00111 
00112   if ( debug_ ) std::cout << "EBClusterClient: endRun, jevt = " << jevt_ << std::endl;
00113 
00114   this->cleanup();
00115 
00116 }
00117 
00118 void EBClusterClient::setup(void) {
00119 
00120   dqmStore_->setCurrentFolder( prefixME_ + "/EBClusterClient" );
00121 
00122 }
00123 
00124 void EBClusterClient::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     if ( h02_[0] ) delete h02_[0];
00134     if ( h02ProjEta_[0] ) delete h02ProjEta_[0];
00135     if ( h02ProjPhi_[0] ) delete h02ProjPhi_[0];
00136     if ( h02_[1] ) delete h02_[1];
00137     if ( h02ProjEta_[1] ) delete h02ProjEta_[1];
00138     if ( h02ProjPhi_[1] ) delete h02ProjPhi_[1];
00139 
00140     if ( h03_ ) delete h03_;
00141     if ( h03ProjEta_ ) delete h03ProjEta_;
00142     if ( h03ProjPhi_ ) delete h03ProjPhi_;
00143     if ( h04_ ) delete h04_;
00144     if ( h04ProjEta_ ) delete h04ProjEta_;
00145     if ( h04ProjPhi_ ) delete h04ProjPhi_;
00146 
00147     if ( i01_[0] ) delete i01_[0];
00148     if ( i01_[1] ) delete i01_[1];
00149     if ( i01_[2] ) delete i01_[2];
00150 
00151     if ( s01_[0] ) delete s01_[0];
00152     if ( s01_[1] ) delete s01_[1];
00153     if ( s01_[2] ) delete s01_[2];
00154 
00155   }
00156 
00157   h01_[0] = 0;
00158   h01_[1] = 0;
00159   h01_[2] = 0;
00160 
00161   h02_[0] = 0;
00162   h02ProjEta_[0] = 0;
00163   h02ProjPhi_[0] = 0;
00164   h02_[1] = 0;
00165   h02ProjEta_[1] = 0;
00166   h02ProjPhi_[1] = 0;
00167 
00168   h03_ = 0;
00169   h03ProjEta_ = 0;
00170   h03ProjPhi_ = 0;
00171   h04_ = 0;
00172   h04ProjEta_ = 0;
00173   h04ProjPhi_ = 0;
00174 
00175   i01_[0] = 0;
00176   i01_[1] = 0;
00177   i01_[2] = 0;
00178 
00179   s01_[0] = 0;
00180   s01_[1] = 0;
00181   s01_[2] = 0;
00182 
00183 }
00184 
00185 #ifdef WITH_ECAL_COND_DB
00186 bool EBClusterClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
00187 
00188   status = true;
00189 
00190   return true;
00191 
00192 }
00193 #endif
00194 
00195 void EBClusterClient::analyze(void) {
00196 
00197   ievt_++;
00198   jevt_++;
00199   if ( ievt_ % 10 == 0 ) {
00200     if ( debug_ ) std::cout << "EBClusterClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
00201   }
00202 
00203   MonitorElement* me;
00204 
00205   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC energy" );
00206   h01_[0] = UtilsClient::getHisto( me, cloneME_, h01_[0] );
00207 
00208   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC size" );
00209   h01_[1] = UtilsClient::getHisto( me, cloneME_, h01_[1] );
00210 
00211   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC number" );
00212   h01_[2] = UtilsClient::getHisto( me, cloneME_, h01_[2] );
00213 
00214   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC energy map" );
00215   h02_[0] = UtilsClient::getHisto( me, cloneME_, h02_[0] );
00216 
00217   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC ET map" );
00218   h02_[1] = UtilsClient::getHisto( me, cloneME_, h02_[1] );
00219 
00220   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC number map" );
00221   h03_ = UtilsClient::getHisto( me, cloneME_, h03_ );
00222 
00223   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC size map" );
00224   h04_ = UtilsClient::getHisto( me, cloneME_, h04_ );
00225 
00226   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC energy projection eta" );
00227   h02ProjEta_[0] = UtilsClient::getHisto( me, cloneME_, h02ProjEta_[0] );
00228 
00229   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC energy projection phi" );
00230   h02ProjPhi_[0] = UtilsClient::getHisto( me, cloneME_, h02ProjPhi_[0] );
00231 
00232   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC ET projection eta" );
00233   h02ProjEta_[1] = UtilsClient::getHisto( me, cloneME_, h02ProjEta_[1] );
00234 
00235   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC ET projection phi" );
00236   h02ProjPhi_[1] = UtilsClient::getHisto( me, cloneME_, h02ProjPhi_[1] );
00237 
00238   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC number projection eta" );
00239   h03ProjEta_ = UtilsClient::getHisto( me, cloneME_, h03ProjEta_ );
00240 
00241   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC number projection phi" );
00242   h03ProjPhi_ = UtilsClient::getHisto( me, cloneME_, h03ProjPhi_ );
00243 
00244   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC size projection eta" );
00245   h04ProjEta_ = UtilsClient::getHisto( me, cloneME_, h04ProjEta_ );
00246 
00247   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT BC size projection phi" );
00248   h04ProjPhi_ = UtilsClient::getHisto( me, cloneME_, h04ProjPhi_ );
00249 
00250   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT SC energy" );
00251   i01_[0] = UtilsClient::getHisto( me, cloneME_, i01_[0] );
00252 
00253   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT SC size" );
00254   i01_[1] = UtilsClient::getHisto( me, cloneME_, i01_[1] );
00255 
00256   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT SC number" );
00257   i01_[2] = UtilsClient::getHisto( me, cloneME_, i01_[2] );
00258 
00259   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT s1s9" );
00260   s01_[0] = UtilsClient::getHisto( me, cloneME_, s01_[0] );
00261 
00262   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT s9s25" );
00263   s01_[1] = UtilsClient::getHisto( me, cloneME_, s01_[1] );
00264 
00265   me = dqmStore_->get( prefixME_ + "/EBClusterTask/EBCLT dicluster invariant mass Pi0" );
00266   s01_[2] = UtilsClient::getHisto( me, cloneME_, s01_[2] );
00267 
00268 }
00269