CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQM/EcalBarrelMonitorClient/src/EBClusterClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file EBClusterClient.cc
00003  *
00004  * $Date: 2010/08/08 08:46:02 $
00005  * $Revision: 1.75 $
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 
00021 #include "DQM/EcalCommon/interface/UtilsClient.h"
00022 
00023 #include "DQM/EcalBarrelMonitorClient/interface/EBClusterClient.h"
00024 
00025 EBClusterClient::EBClusterClient(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 36).
00043   superModules_.reserve(36);
00044   for ( unsigned int i = 1; i <= 36; 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   h02_[0] = 0;
00052   h02ProjEta_[0] = 0;
00053   h02ProjPhi_[0] = 0;
00054   h02_[1] = 0;
00055   h02ProjEta_[1] = 0;
00056   h02ProjPhi_[1] = 0;
00057 
00058   h03_ = 0;
00059   h03ProjEta_ = 0;
00060   h03ProjPhi_ = 0;
00061 
00062   h04_ = 0;
00063   h04ProjEta_ = 0;
00064   h04ProjPhi_ = 0;
00065 
00066   i01_[0] = 0;
00067   i01_[1] = 0;
00068   i01_[2] = 0;
00069 
00070   s01_[0] = 0;
00071   s01_[1] = 0;
00072   s01_[2] = 0;
00073 
00074 }
00075 
00076 EBClusterClient::~EBClusterClient() {
00077 
00078 }
00079 
00080 void EBClusterClient::beginJob(void) {
00081 
00082   dqmStore_ = edm::Service<DQMStore>().operator->();
00083 
00084   if ( debug_ ) std::cout << "EBClusterClient: beginJob" << std::endl;
00085 
00086   ievt_ = 0;
00087   jevt_ = 0;
00088 
00089 }
00090 
00091 void EBClusterClient::beginRun(void) {
00092 
00093   if ( debug_ ) std::cout << "EBClusterClient: beginRun" << std::endl;
00094 
00095   jevt_ = 0;
00096 
00097   this->setup();
00098 
00099 }
00100 
00101 void EBClusterClient::endJob(void) {
00102 
00103   if ( debug_ ) std::cout << "EBClusterClient: endJob, ievt = " << ievt_ << std::endl;
00104 
00105   this->cleanup();
00106 
00107 }
00108 
00109 void EBClusterClient::endRun(void) {
00110 
00111   if ( debug_ ) std::cout << "EBClusterClient: endRun, jevt = " << jevt_ << std::endl;
00112 
00113   this->cleanup();
00114 
00115 }
00116 
00117 void EBClusterClient::setup(void) {
00118 
00119   dqmStore_->setCurrentFolder( prefixME_ + "/EBClusterClient" );
00120 
00121 }
00122 
00123 void EBClusterClient::cleanup(void) {
00124 
00125   if ( ! enableCleanup_ ) return;
00126 
00127   if ( cloneME_ ) {
00128     if ( h01_[0] ) delete h01_[0];
00129     if ( h01_[1] ) delete h01_[1];
00130     if ( h01_[2] ) delete h01_[2];
00131 
00132     if ( h02_[0] ) delete h02_[0];
00133     if ( h02ProjEta_[0] ) delete h02ProjEta_[0];
00134     if ( h02ProjPhi_[0] ) delete h02ProjPhi_[0];
00135     if ( h02_[1] ) delete h02_[1];
00136     if ( h02ProjEta_[1] ) delete h02ProjEta_[1];
00137     if ( h02ProjPhi_[1] ) delete h02ProjPhi_[1];
00138 
00139     if ( h03_ ) delete h03_;
00140     if ( h03ProjEta_ ) delete h03ProjEta_;
00141     if ( h03ProjPhi_ ) delete h03ProjPhi_;
00142     if ( h04_ ) delete h04_;
00143     if ( h04ProjEta_ ) delete h04ProjEta_;
00144     if ( h04ProjPhi_ ) delete h04ProjPhi_;
00145 
00146     if ( i01_[0] ) delete i01_[0];
00147     if ( i01_[1] ) delete i01_[1];
00148     if ( i01_[2] ) delete i01_[2];
00149 
00150     if ( s01_[0] ) delete s01_[0];
00151     if ( s01_[1] ) delete s01_[1];
00152     if ( s01_[2] ) delete s01_[2];
00153 
00154   }
00155 
00156   h01_[0] = 0;
00157   h01_[1] = 0;
00158   h01_[2] = 0;
00159 
00160   h02_[0] = 0;
00161   h02ProjEta_[0] = 0;
00162   h02ProjPhi_[0] = 0;
00163   h02_[1] = 0;
00164   h02ProjEta_[1] = 0;
00165   h02ProjPhi_[1] = 0;
00166 
00167   h03_ = 0;
00168   h03ProjEta_ = 0;
00169   h03ProjPhi_ = 0;
00170   h04_ = 0;
00171   h04ProjEta_ = 0;
00172   h04ProjPhi_ = 0;
00173 
00174   i01_[0] = 0;
00175   i01_[1] = 0;
00176   i01_[2] = 0;
00177 
00178   s01_[0] = 0;
00179   s01_[1] = 0;
00180   s01_[2] = 0;
00181 
00182 }
00183 
00184 #ifdef WITH_ECAL_COND_DB
00185 bool EBClusterClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
00186 
00187   status = true;
00188 
00189   return true;
00190 
00191 }
00192 #endif
00193 
00194 void EBClusterClient::analyze(void) {
00195 
00196   ievt_++;
00197   jevt_++;
00198   if ( ievt_ % 10 == 0 ) {
00199     if ( debug_ ) std::cout << "EBClusterClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
00200   }
00201 
00202   char histo[200];
00203 
00204   MonitorElement* me;
00205 
00206   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC energy").c_str());
00207   me = dqmStore_->get(histo);
00208   h01_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h01_[0] );
00209 
00210   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC size").c_str());
00211   me = dqmStore_->get(histo);
00212   h01_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h01_[1] );
00213 
00214   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC number").c_str());
00215   me = dqmStore_->get(histo);
00216   h01_[2] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h01_[2] );
00217 
00218   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC energy map").c_str());
00219   me = dqmStore_->get(histo);
00220   h02_[0] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h02_[0] );
00221 
00222   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC ET map").c_str());
00223   me = dqmStore_->get(histo);
00224   h02_[1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h02_[1] );
00225 
00226   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC number map").c_str());
00227   me = dqmStore_->get(histo);
00228   h03_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, h03_ );
00229 
00230   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC size map").c_str());
00231   me = dqmStore_->get(histo);
00232   h04_ = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h04_ );
00233 
00234   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC energy projection eta").c_str());
00235   me = dqmStore_->get(histo);
00236   h02ProjEta_[0] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjEta_[0] );
00237 
00238   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC energy projection phi").c_str());
00239   me = dqmStore_->get(histo);
00240   h02ProjPhi_[0] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjPhi_[0] );
00241 
00242   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC ET projection eta").c_str());
00243   me = dqmStore_->get(histo);
00244   h02ProjEta_[1] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjEta_[1] );
00245 
00246   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC ET projection phi").c_str());
00247   me = dqmStore_->get(histo);
00248   h02ProjPhi_[1] = UtilsClient::getHisto<TProfile*>( me, cloneME_, h02ProjPhi_[1] );
00249 
00250   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC number projection eta").c_str());
00251   me = dqmStore_->get(histo);
00252   h03ProjEta_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, h03ProjEta_ );
00253 
00254   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC number projection phi").c_str());
00255   me = dqmStore_->get(histo);
00256   h03ProjPhi_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, h03ProjPhi_ );
00257 
00258   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC size projection eta").c_str());
00259   me = dqmStore_->get(histo);
00260   h04ProjEta_ = UtilsClient::getHisto<TProfile*>( me, cloneME_, h04ProjEta_ );
00261 
00262   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT BC size projection phi").c_str());
00263   me = dqmStore_->get(histo);
00264   h04ProjPhi_ = UtilsClient::getHisto<TProfile*>( me, cloneME_, h04ProjPhi_ );
00265 
00266   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT SC energy").c_str());
00267   me = dqmStore_->get(histo);
00268   i01_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, i01_[0] );
00269 
00270   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT SC size").c_str());
00271   me = dqmStore_->get(histo);
00272   i01_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, i01_[1] );
00273 
00274   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT SC number").c_str());
00275   me = dqmStore_->get(histo);
00276   i01_[2] = UtilsClient::getHisto<TH1F*>( me, cloneME_, i01_[2] );
00277 
00278   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT s1s9").c_str());
00279   me = dqmStore_->get(histo);
00280   s01_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, s01_[0] );
00281 
00282   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT s9s25").c_str());
00283   me = dqmStore_->get(histo);
00284   s01_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, s01_[1] );
00285 
00286   sprintf(histo, (prefixME_ + "/EBClusterTask/EBCLT dicluster invariant mass Pi0").c_str());
00287   me = dqmStore_->get(histo);
00288   s01_[2] = UtilsClient::getHisto<TH1F*>( me, cloneME_, s01_[2] );
00289 
00290 }
00291