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 "DQM/EcalBarrelMonitorClient/interface/EBStatusFlagsClient.h"
00030
00031 EBStatusFlagsClient::EBStatusFlagsClient(const edm::ParameterSet& ps) {
00032
00033
00034 cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00035
00036
00037 verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00038
00039
00040 debug_ = ps.getUntrackedParameter<bool>("debug", false);
00041
00042
00043 prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00044
00045
00046 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00047
00048
00049 superModules_.reserve(36);
00050 for ( unsigned int i = 1; i <= 36; i++ ) superModules_.push_back(i);
00051 superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
00052
00053 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00054
00055 int ism = superModules_[i];
00056
00057 h01_[ism-1] = 0;
00058
00059 meh01_[ism-1] = 0;
00060
00061 h02_[ism-1] = 0;
00062
00063 meh02_[ism-1] = 0;
00064
00065 h03_[ism-1] = 0;
00066
00067 meh03_[ism-1] = 0;
00068
00069 }
00070
00071 }
00072
00073 EBStatusFlagsClient::~EBStatusFlagsClient() {
00074
00075 }
00076
00077 void EBStatusFlagsClient::beginJob(void) {
00078
00079 dqmStore_ = edm::Service<DQMStore>().operator->();
00080
00081 if ( debug_ ) std::cout << "EBStatusFlagsClient: beginJob" << std::endl;
00082
00083 ievt_ = 0;
00084 jevt_ = 0;
00085
00086 }
00087
00088 void EBStatusFlagsClient::beginRun(void) {
00089
00090 if ( debug_ ) std::cout << "EBStatusFlagsClient: beginRun" << std::endl;
00091
00092 jevt_ = 0;
00093
00094 this->setup();
00095
00096 }
00097
00098 void EBStatusFlagsClient::endJob(void) {
00099
00100 if ( debug_ ) std::cout << "EBStatusFlagsClient: endJob, ievt = " << ievt_ << std::endl;
00101
00102 this->cleanup();
00103
00104 }
00105
00106 void EBStatusFlagsClient::endRun(void) {
00107
00108 if ( debug_ ) std::cout << "EBStatusFlagsClient: endRun, jevt = " << jevt_ << std::endl;
00109
00110 this->cleanup();
00111
00112 }
00113
00114 void EBStatusFlagsClient::setup(void) {
00115
00116 dqmStore_->setCurrentFolder( prefixME_ + "/EBStatusFlagsClient" );
00117
00118 }
00119
00120 void EBStatusFlagsClient::cleanup(void) {
00121
00122 if ( ! enableCleanup_ ) return;
00123
00124 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00125
00126 int ism = superModules_[i];
00127
00128 if ( cloneME_ ) {
00129 if ( h01_[ism-1] ) delete h01_[ism-1];
00130 if ( h02_[ism-1] ) delete h02_[ism-1];
00131 if ( h03_[ism-1] ) delete h03_[ism-1];
00132 }
00133
00134 h01_[ism-1] = 0;
00135 h02_[ism-1] = 0;
00136 h03_[ism-1] = 0;
00137
00138 meh01_[ism-1] = 0;
00139 meh02_[ism-1] = 0;
00140 meh03_[ism-1] = 0;
00141
00142 }
00143
00144 dqmStore_->setCurrentFolder( prefixME_ + "/EBStatusFlagsClient" );
00145
00146 }
00147
00148 #ifdef WITH_ECAL_COND_DB
00149 bool EBStatusFlagsClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
00150
00151 status = true;
00152
00153 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00154
00155 int ism = superModules_[i];
00156
00157 if ( verbose_ ) {
00158 std::cout << " " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
00159 std::cout << std::endl;
00160 UtilsClient::printBadChannels(meh01_[ism-1], UtilsClient::getHisto<TH2F*>(meh01_[ism-1]), true);
00161 }
00162
00163 if ( meh01_[ism-1] ) {
00164 if ( meh01_[ism-1]->getEntries() != 0 ) status = false;
00165 }
00166
00167 }
00168
00169 return true;
00170
00171 }
00172 #endif
00173
00174 void EBStatusFlagsClient::analyze(void) {
00175
00176 ievt_++;
00177 jevt_++;
00178 if ( ievt_ % 10 == 0 ) {
00179 if ( debug_ ) std::cout << "EBStatusFlagsClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
00180 }
00181
00182 uint32_t bits01 = 0;
00183 bits01 |= 1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR;
00184
00185 char histo[200];
00186
00187 MonitorElement* me;
00188
00189 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00190
00191 int ism = superModules_[i];
00192
00193 sprintf(histo, (prefixME_ + "/EBStatusFlagsTask/FEStatus/EBSFT front-end status %s").c_str(), Numbers::sEB(ism).c_str());
00194 me = dqmStore_->get(histo);
00195 h01_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h01_[ism-1] );
00196 meh01_[ism-1] = me;
00197
00198 sprintf(histo, (prefixME_ + "/EBStatusFlagsTask/FEStatus/EBSFT front-end status bits %s").c_str(), Numbers::sEB(ism).c_str());
00199 me = dqmStore_->get(histo);
00200 h02_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h02_[ism-1] );
00201 meh02_[ism-1] = me;
00202
00203 sprintf(histo, (prefixME_ + "/EBStatusFlagsTask/FEStatus/EBSFT MEM front-end status %s").c_str(), Numbers::sEB(ism).c_str());
00204 me = dqmStore_->get(histo);
00205 h03_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h01_[ism-1] );
00206 meh03_[ism-1] = me;
00207
00208 for ( int ie = 1; ie <= 85; ie++ ) {
00209 for ( int ip = 1; ip <= 20; ip++ ) {
00210 if ( Masks::maskChannel(ism, ie, ip, bits01, EcalBarrel) ) {
00211 int iet = (ie-1)/5 + 1;
00212 int ipt = (ip-1)/5 + 1;
00213 if ( meh01_[ism-1] ) meh01_[ism-1]->setBinError( iet, ipt, 0.01 );
00214 }
00215 }
00216 }
00217
00218 for ( int i = 1; i <= 10; i++ ) {
00219 if ( Masks::maskPn(ism, i, bits01, EcalBarrel) ) {
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