CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 /*
00002  * \file EBCosmicClient.cc
00003  *
00004  * $Date: 2010/08/08 08:46:02 $
00005  * $Revision: 1.125 $
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 #include <vector>
00016 
00017 #include "FWCore/ServiceRegistry/interface/Service.h"
00018 
00019 #include "DQMServices/Core/interface/DQMStore.h"
00020 
00021 #ifdef WITH_ECAL_COND_DB
00022 #include "OnlineDB/EcalCondDB/interface/MonOccupancyDat.h"
00023 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
00024 #include "DQM/EcalCommon/interface/LogicID.h"
00025 #endif
00026 
00027 #include "DQM/EcalCommon/interface/UtilsClient.h"
00028 #include "DQM/EcalCommon/interface/Numbers.h"
00029 
00030 #include "DQM/EcalBarrelMonitorClient/interface/EBCosmicClient.h"
00031 
00032 EBCosmicClient::EBCosmicClient(const edm::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<std::string>("prefixME", "");
00045 
00046   // enableCleanup_ switch
00047   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00048 
00049   // vector of selected Super Modules (Defaults to all 36).
00050   superModules_.reserve(36);
00051   for ( unsigned int i = 1; i <= 36; i++ ) superModules_.push_back(i);
00052   superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
00053 
00054   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00055 
00056     int ism = superModules_[i];
00057 
00058     h01_[ism-1] = 0;
00059     h02_[ism-1] = 0;
00060     h03_[ism-1] = 0;
00061 
00062     meh01_[ism-1] = 0;
00063     meh02_[ism-1] = 0;
00064     meh03_[ism-1] = 0;
00065 
00066   }
00067 
00068 }
00069 
00070 EBCosmicClient::~EBCosmicClient() {
00071 
00072 }
00073 
00074 void EBCosmicClient::beginJob(void) {
00075 
00076   dqmStore_ = edm::Service<DQMStore>().operator->();
00077 
00078   if ( debug_ ) std::cout << "EBCosmicClient: beginJob" << std::endl;
00079 
00080   ievt_ = 0;
00081   jevt_ = 0;
00082 
00083 }
00084 
00085 void EBCosmicClient::beginRun(void) {
00086 
00087   if ( debug_ ) std::cout << "EBCosmicClient: beginRun" << std::endl;
00088 
00089   jevt_ = 0;
00090 
00091   this->setup();
00092 
00093 }
00094 
00095 void EBCosmicClient::endJob(void) {
00096 
00097   if ( debug_ ) std::cout << "EBCosmicClient: endJob, ievt = " << ievt_ << std::endl;
00098 
00099   this->cleanup();
00100 
00101 }
00102 
00103 void EBCosmicClient::endRun(void) {
00104 
00105   if ( debug_ ) std::cout << "EBCosmicClient: endRun, jevt = " << jevt_ << std::endl;
00106 
00107   this->cleanup();
00108 
00109 }
00110 
00111 void EBCosmicClient::setup(void) {
00112 
00113 }
00114 
00115 void EBCosmicClient::cleanup(void) {
00116 
00117   if ( ! enableCleanup_ ) return;
00118 
00119   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00120 
00121     int ism = superModules_[i];
00122 
00123     if ( cloneME_ ) {
00124       if ( h01_[ism-1] ) delete h01_[ism-1];
00125       if ( h02_[ism-1] ) delete h02_[ism-1];
00126       if ( h03_[ism-1] ) delete h03_[ism-1];
00127     }
00128 
00129     h01_[ism-1] = 0;
00130     h02_[ism-1] = 0;
00131     h03_[ism-1] = 0;
00132 
00133     meh01_[ism-1] = 0;
00134     meh02_[ism-1] = 0;
00135     meh03_[ism-1] = 0;
00136 
00137   }
00138 
00139 }
00140 
00141 #ifdef WITH_ECAL_COND_DB
00142 bool EBCosmicClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
00143 
00144   status = true;
00145 
00146   return true;
00147 
00148 }
00149 #endif
00150 
00151 void EBCosmicClient::analyze(void) {
00152 
00153   ievt_++;
00154   jevt_++;
00155   if ( ievt_ % 10 == 0 ) {
00156     if ( debug_ ) std::cout << "EBCosmicClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
00157   }
00158 
00159   char histo[200];
00160 
00161   MonitorElement* me;
00162 
00163   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00164 
00165     int ism = superModules_[i];
00166 
00167     sprintf(histo, (prefixME_ + "/EBCosmicTask/Sel/EBCT energy sel %s").c_str(), Numbers::sEB(ism).c_str());
00168     me = dqmStore_->get(histo);
00169     h01_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h01_[ism-1] );
00170     meh01_[ism-1] = me;
00171 
00172     sprintf(histo, (prefixME_ + "/EBCosmicTask/Spectrum/EBCT 1x1 energy spectrum %s").c_str(), Numbers::sEB(ism).c_str());
00173     me = dqmStore_->get(histo);
00174     h02_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h02_[ism-1] );
00175     meh02_[ism-1] = me;
00176 
00177     sprintf(histo, (prefixME_ + "/EBCosmicTask/Spectrum/EBCT 3x3 energy spectrum %s").c_str(), Numbers::sEB(ism).c_str());
00178     me = dqmStore_->get(histo);
00179     h03_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h03_[ism-1] );
00180     meh03_[ism-1] = me;
00181 
00182   }
00183 
00184 }
00185