CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQM/EcalEndcapMonitorClient/src/EECosmicClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file EECosmicClient.cc
00003  *
00004  * $Date: 2011/09/02 13:55:02 $
00005  * $Revision: 1.74 $
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 "FWCore/ServiceRegistry/interface/Service.h"
00017 
00018 #include "DQMServices/Core/interface/DQMStore.h"
00019 #include "DQMServices/Core/interface/MonitorElement.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/EcalEndcapMonitorClient/interface/EECosmicClient.h"
00031 
00032 EECosmicClient::EECosmicClient(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 18).
00050   superModules_.reserve(18);
00051   for ( unsigned int i = 1; i <= 18; 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 EECosmicClient::~EECosmicClient() {
00071 
00072 }
00073 
00074 void EECosmicClient::beginJob(void) {
00075 
00076   dqmStore_ = edm::Service<DQMStore>().operator->();
00077 
00078   if ( debug_ ) std::cout << "EECosmicClient: beginJob" << std::endl;
00079 
00080   ievt_ = 0;
00081   jevt_ = 0;
00082 
00083 }
00084 
00085 void EECosmicClient::beginRun(void) {
00086 
00087   if ( debug_ ) std::cout << "EECosmicClient: beginRun" << std::endl;
00088 
00089   jevt_ = 0;
00090 
00091   this->setup();
00092 
00093 }
00094 
00095 void EECosmicClient::endJob(void) {
00096 
00097   if ( debug_ ) std::cout << "EECosmicClient: endJob, ievt = " << ievt_ << std::endl;
00098 
00099   this->cleanup();
00100 
00101 }
00102 
00103 void EECosmicClient::endRun(void) {
00104 
00105   if ( debug_ ) std::cout << "EECosmicClient: endRun, jevt = " << jevt_ << std::endl;
00106 
00107   this->cleanup();
00108 
00109 }
00110 
00111 void EECosmicClient::setup(void) {
00112 
00113 }
00114 
00115 void EECosmicClient::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 EECosmicClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
00143 
00144   status = true;
00145 
00146   return true;
00147 
00148 }
00149 #endif
00150 
00151 void EECosmicClient::analyze(void) {
00152 
00153   ievt_++;
00154   jevt_++;
00155   if ( ievt_ % 10 == 0 ) {
00156     if ( debug_ ) std::cout << "EECosmicClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
00157   }
00158 
00159   MonitorElement* me;
00160 
00161   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00162 
00163     int ism = superModules_[i];
00164 
00165     me = dqmStore_->get( prefixME_ + "/EECosmicTask/Sel/EECT energy sel " + Numbers::sEE(ism) );
00166     h01_[ism-1] = UtilsClient::getHisto( me, cloneME_, h01_[ism-1] );
00167     meh01_[ism-1] = me;
00168 
00169     me = dqmStore_->get( prefixME_ + "/EECosmicTask/Spectrum/EECT 1x1 energy spectrum " + Numbers::sEE(ism) );
00170     h02_[ism-1] = UtilsClient::getHisto( me, cloneME_, h02_[ism-1] );
00171     meh02_[ism-1] = me;
00172 
00173     me = dqmStore_->get( prefixME_ + "/EECosmicTask/Spectrum/EECT 3x3 energy spectrum " + Numbers::sEE(ism) );
00174     h03_[ism-1] = UtilsClient::getHisto( me, cloneME_, h03_[ism-1] );
00175     meh03_[ism-1] = me;
00176 
00177   }
00178 
00179 }
00180