Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <memory>
00011 #include <iostream>
00012 #include <fstream>
00013 #include <iomanip>
00014
00015 #include "FWCore/ServiceRegistry/interface/Service.h"
00016
00017 #include "DQMServices/Core/interface/DQMStore.h"
00018
00019 #ifdef WITH_ECAL_COND_DB
00020 #include "OnlineDB/EcalCondDB/interface/RunTTErrorsDat.h"
00021 #include "DQM/EcalCommon/interface/LogicID.h"
00022 #endif
00023
00024 #include "DQM/EcalCommon/interface/Masks.h"
00025
00026 #include "DQM/EcalCommon/interface/UtilsClient.h"
00027 #include "DQM/EcalCommon/interface/Numbers.h"
00028
00029 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00030
00031 #include "DQM/EcalEndcapMonitorClient/interface/EEStatusFlagsClient.h"
00032
00033 EEStatusFlagsClient::EEStatusFlagsClient(const edm::ParameterSet& ps) {
00034
00035
00036 cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00037
00038
00039 verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00040
00041
00042 debug_ = ps.getUntrackedParameter<bool>("debug", false);
00043
00044
00045 prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00046
00047
00048 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00049
00050
00051 superModules_.reserve(18);
00052 for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
00053 superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
00054
00055 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00056
00057 int ism = superModules_[i];
00058
00059 h01_[ism-1] = 0;
00060
00061 meh01_[ism-1] = 0;
00062
00063 h02_[ism-1] = 0;
00064
00065 meh02_[ism-1] = 0;
00066
00067 h03_[ism-1] = 0;
00068
00069 meh03_[ism-1] = 0;
00070
00071 }
00072
00073 }
00074
00075 EEStatusFlagsClient::~EEStatusFlagsClient() {
00076
00077 }
00078
00079 void EEStatusFlagsClient::beginJob(void) {
00080
00081 dqmStore_ = edm::Service<DQMStore>().operator->();
00082
00083 if ( debug_ ) std::cout << "EEStatusFlagsClient: beginJob" << std::endl;
00084
00085 ievt_ = 0;
00086 jevt_ = 0;
00087
00088 }
00089
00090 void EEStatusFlagsClient::beginRun(void) {
00091
00092 if ( debug_ ) std::cout << "EEStatusFlagsClient: beginRun" << std::endl;
00093
00094 jevt_ = 0;
00095
00096 this->setup();
00097
00098 }
00099
00100 void EEStatusFlagsClient::endJob(void) {
00101
00102 if ( debug_ ) std::cout << "EEStatusFlagsClient: endJob, ievt = " << ievt_ << std::endl;
00103
00104 this->cleanup();
00105
00106 }
00107
00108 void EEStatusFlagsClient::endRun(void) {
00109
00110 if ( debug_ ) std::cout << "EEStatusFlagsClient: endRun, jevt = " << jevt_ << std::endl;
00111
00112 this->cleanup();
00113
00114 }
00115
00116 void EEStatusFlagsClient::setup(void) {
00117
00118 dqmStore_->setCurrentFolder( prefixME_ + "/EEStatusFlagsClient" );
00119
00120 }
00121
00122 void EEStatusFlagsClient::cleanup(void) {
00123
00124 if ( ! enableCleanup_ ) return;
00125
00126 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00127
00128 int ism = superModules_[i];
00129
00130 if ( cloneME_ ) {
00131 if ( h01_[ism-1] ) delete h01_[ism-1];
00132 if ( h02_[ism-1] ) delete h02_[ism-1];
00133 if ( h03_[ism-1] ) delete h03_[ism-1];
00134 }
00135
00136 h01_[ism-1] = 0;
00137 h02_[ism-1] = 0;
00138 h03_[ism-1] = 0;
00139
00140 meh01_[ism-1] = 0;
00141 meh02_[ism-1] = 0;
00142 meh03_[ism-1] = 0;
00143
00144 }
00145
00146 dqmStore_->setCurrentFolder( prefixME_ + "/EEStatusFlagsClient" );
00147
00148 }
00149
00150 #ifdef WITH_ECAL_COND_DB
00151 bool EEStatusFlagsClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
00152
00153 status = true;
00154
00155 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00156
00157 int ism = superModules_[i];
00158
00159 if ( verbose_ ) {
00160 std::cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00161 std::cout << std::endl;
00162 UtilsClient::printBadChannels(meh01_[ism-1], UtilsClient::getHisto<TH2F*>(meh01_[ism-1]), true);
00163 }
00164
00165 if ( meh01_[ism-1] ) {
00166 if ( meh01_[ism-1]->getEntries() != 0 ) status = false;
00167 }
00168
00169 }
00170
00171 return true;
00172
00173 }
00174 #endif
00175
00176 void EEStatusFlagsClient::analyze(void) {
00177
00178 ievt_++;
00179 jevt_++;
00180 if ( ievt_ % 10 == 0 ) {
00181 if ( debug_ ) std::cout << "EEStatusFlagsClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
00182 }
00183
00184 uint32_t bits01 = 0;
00185 bits01 |= 1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR;
00186
00187 char histo[200];
00188
00189 MonitorElement* me;
00190
00191 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00192
00193 int ism = superModules_[i];
00194
00195 sprintf(histo, (prefixME_ + "/EEStatusFlagsTask/FEStatus/EESFT front-end status %s").c_str(), Numbers::sEE(ism).c_str());
00196 me = dqmStore_->get(histo);
00197 h01_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h01_[ism-1] );
00198 meh01_[ism-1] = me;
00199
00200 sprintf(histo, (prefixME_ + "/EEStatusFlagsTask/FEStatus/EESFT front-end status bits %s").c_str(), Numbers::sEE(ism).c_str());
00201 me = dqmStore_->get(histo);
00202 h02_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h02_[ism-1] );
00203 meh02_[ism-1] = me;
00204
00205 sprintf(histo, (prefixME_ + "/EEStatusFlagsTask/FEStatus/EESFT MEM front-end status %s").c_str(), Numbers::sEE(ism).c_str());
00206 me = dqmStore_->get(histo);
00207 h03_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h01_[ism-1] );
00208 meh03_[ism-1] = me;
00209
00210 for ( int ix = 1; ix <= 50; ix++ ) {
00211 for ( int iy = 1; iy <= 50; iy++ ) {
00212 if ( Masks::maskChannel(ism, ix, iy, bits01, EcalEndcap) ) {
00213 if ( meh01_[ism-1] ) meh01_[ism-1]->setBinError( ix, iy, 0.01 );
00214 }
00215 }
00216 }
00217
00218 for ( int i = 1; i <= 10; i++ ) {
00219 if ( Masks::maskPn(ism, i, bits01, EcalEndcap) ) {
00220 int it = (i-1)/5 + 1;
00221 if ( meh03_[ism-1] ) meh03_[ism-1]->setBinError( it, 1, 0.01 );
00222 }
00223 }
00224
00225 }
00226
00227 }
00228