00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <memory>
00012 #include <iostream>
00013 #include <sstream>
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 #include "DQM/EcalCommon/interface/UtilsClient.h"
00022 #include "DQM/EcalCommon/interface/Numbers.h"
00023
00024 #include "DQM/EcalEndcapMonitorClient/interface/EEBeamHodoClient.h"
00025
00026 EEBeamHodoClient::EEBeamHodoClient(const edm::ParameterSet& ps) {
00027
00028
00029 cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00030
00031
00032 verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00033
00034
00035 debug_ = ps.getUntrackedParameter<bool>("debug", false);
00036
00037
00038 prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00039
00040
00041 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00042
00043
00044 superModules_.reserve(18);
00045 for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
00046 superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
00047
00048 for (int i=0; i<4; i++) {
00049
00050 ho01_[i] = 0;
00051 hr01_[i] = 0;
00052
00053 }
00054
00055 hp01_[0] = 0;
00056 hp01_[1] = 0;
00057
00058 hp02_ = 0;
00059
00060 hs01_[0] = 0;
00061 hs01_[1] = 0;
00062
00063 hq01_[0] = 0;
00064 hq01_[1] = 0;
00065
00066 ht01_ = 0;
00067
00068 hc01_[0] = 0;
00069 hc01_[1] = 0;
00070 hc01_[2] = 0;
00071
00072 hm01_ = 0;
00073
00074 he01_[0] = 0;
00075 he01_[1] = 0;
00076
00077 he02_[0] = 0;
00078 he02_[1] = 0;
00079
00080 he03_[0] = 0;
00081 he03_[1] = 0;
00082 he03_[2] = 0;
00083
00084 }
00085
00086 EEBeamHodoClient::~EEBeamHodoClient() {
00087
00088 }
00089
00090 void EEBeamHodoClient::beginJob(void) {
00091
00092 dqmStore_ = edm::Service<DQMStore>().operator->();
00093
00094 if ( debug_ ) std::cout << "EEBeamHodoClient: beginJob" << std::endl;
00095
00096 ievt_ = 0;
00097 jevt_ = 0;
00098
00099 }
00100
00101 void EEBeamHodoClient::beginRun(void) {
00102
00103 if ( debug_ ) std::cout << "EEBeamHodoClient: beginRun" << std::endl;
00104
00105 jevt_ = 0;
00106
00107 this->setup();
00108
00109 }
00110
00111 void EEBeamHodoClient::endJob(void) {
00112
00113 if ( debug_ ) std::cout << "EEBeamHodoClient: endJob, ievt = " << ievt_ << std::endl;
00114
00115 this->cleanup();
00116
00117 if ( cloneME_ ) {
00118
00119 for (int i=0; i<4; i++) {
00120
00121 if ( ho01_[i] ) delete ho01_[i];
00122 if ( hr01_[i] ) delete hr01_[i];
00123
00124 }
00125
00126 if ( hp01_[0] ) delete hp01_[0];
00127 if ( hp01_[1] ) delete hp01_[1];
00128
00129 if ( hp02_ ) delete hp02_;
00130
00131 if ( hs01_[0] ) delete hs01_[0];
00132 if ( hs01_[1] ) delete hs01_[1];
00133
00134 if ( hq01_[0] ) delete hq01_[0];
00135 if ( hq01_[1] ) delete hq01_[1];
00136
00137 if ( ht01_ ) delete ht01_;
00138
00139 if ( hc01_[0] ) delete hc01_[0];
00140 if ( hc01_[1] ) delete hc01_[1];
00141 if ( hc01_[2] ) delete hc01_[2];
00142
00143 if ( hm01_ ) delete hm01_;
00144
00145 if ( he01_[0] ) delete he01_[0];
00146 if ( he01_[1] ) delete he01_[1];
00147
00148 if ( he02_[0] ) delete he02_[0];
00149 if ( he02_[1] ) delete he02_[1];
00150
00151 if ( he03_[0] ) delete he03_[0];
00152 if ( he03_[1] ) delete he03_[1];
00153 if ( he03_[2] ) delete he03_[2];
00154
00155 }
00156
00157 for (int i=0; i<4; i++) {
00158
00159 ho01_[i] = 0;
00160 hr01_[i] = 0;
00161
00162 }
00163
00164 hp01_[0] = 0;
00165 hp01_[1] = 0;
00166
00167 hp02_ = 0;
00168
00169 hs01_[0] = 0;
00170 hs01_[1] = 0;
00171
00172 hq01_[0] = 0;
00173 hq01_[1] = 0;
00174
00175 ht01_ = 0;
00176
00177 hc01_[0] = 0;
00178 hc01_[1] = 0;
00179 hc01_[2] = 0;
00180
00181 hm01_ = 0;
00182
00183 he01_[0] = 0;
00184 he01_[1] = 0;
00185
00186 he02_[0] = 0;
00187 he02_[1] = 0;
00188
00189 he03_[0] = 0;
00190 he03_[1] = 0;
00191 he03_[2] = 0;
00192
00193 }
00194
00195 void EEBeamHodoClient::endRun(void) {
00196
00197 if ( debug_ ) std::cout << "EEBeamHodoClient: endRun, jevt = " << jevt_ << std::endl;
00198
00199 this->cleanup();
00200
00201 }
00202
00203 void EEBeamHodoClient::setup(void) {
00204
00205 dqmStore_->setCurrentFolder( prefixME_ + "/EEBeamHodoClient" );
00206
00207 }
00208
00209 void EEBeamHodoClient::cleanup(void) {
00210
00211 if ( ! enableCleanup_ ) return;
00212
00213 dqmStore_->setCurrentFolder( prefixME_ + "/EEBeamHodoClient" );
00214
00215 }
00216
00217 #ifdef WITH_ECAL_COND_DB
00218 bool EEBeamHodoClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
00219
00220 status = true;
00221
00222 return true;
00223
00224 }
00225 #endif
00226
00227 void EEBeamHodoClient::analyze(void) {
00228
00229 ievt_++;
00230 jevt_++;
00231 if ( ievt_ % 10 == 0 ) {
00232 if ( debug_ ) std::cout << "EEBeamHodoClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
00233 }
00234
00235 int smId = 1;
00236
00237 MonitorElement* me;
00238
00239 std::stringstream ss;
00240
00241 for (int i=0; i<4; i++) {
00242
00243 ss.str("");
00244 ss << prefixME_ << "/EEBeamHodoTask/EEBHT occup " << Numbers::sEE(smId).c_str() << " " << std::setfill('0') << std::setw(2) << i+1;
00245 me = dqmStore_->get( ss.str() );
00246 ho01_[i] = UtilsClient::getHisto( me, cloneME_, ho01_[i] );
00247
00248 ss.str("");
00249 ss << prefixME_ << "/EEBeamHodoTask/EEBHT raw " << Numbers::sEE(smId) << " " << std::setfill('0') << std::setw(2) << i+1;
00250 me = dqmStore_->get(ss.str());
00251 hr01_[i] = UtilsClient::getHisto( me, cloneME_, hr01_[i] );
00252
00253 }
00254
00255 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT PosX rec " + Numbers::sEE(smId) );
00256 hp01_[0] = UtilsClient::getHisto( me, cloneME_, hp01_[0] );
00257
00258 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT PosY rec " + Numbers::sEE(smId) );
00259 hp01_[1] = UtilsClient::getHisto( me, cloneME_, hp01_[1] );
00260
00261 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT PosYX rec " + Numbers::sEE(smId) );
00262 hp02_ = UtilsClient::getHisto( me, cloneME_, hp02_ );
00263
00264 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT SloX " + Numbers::sEE(smId) );
00265 hs01_[0] = UtilsClient::getHisto( me, cloneME_, hs01_[0] );
00266
00267 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT SloY " + Numbers::sEE(smId) );
00268 hs01_[1] = UtilsClient::getHisto( me, cloneME_, hs01_[1] );
00269
00270 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT QualX " + Numbers::sEE(smId) );
00271 hq01_[0] = UtilsClient::getHisto( me, cloneME_, hq01_[0] );
00272
00273 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT QualY " + Numbers::sEE(smId) );
00274 hq01_[1] = UtilsClient::getHisto( me, cloneME_, hq01_[1] );
00275
00276 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT TDC rec " + Numbers::sEE(smId) );
00277 ht01_ = UtilsClient::getHisto( me, cloneME_, ht01_ );
00278
00279 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT Hodo-Calo X vs Cry " + Numbers::sEE(smId) );
00280 hc01_[0] = UtilsClient::getHisto( me, cloneME_, hc01_[0] );
00281
00282 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT Hodo-Calo Y vs Cry " + Numbers::sEE(smId) );
00283 hc01_[1] = UtilsClient::getHisto( me, cloneME_, hc01_[1] );
00284
00285 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT TDC-Calo vs Cry " + Numbers::sEE(smId) );
00286 hc01_[2] = UtilsClient::getHisto( me, cloneME_, hc01_[2] );
00287
00288 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT Missing Collections " + Numbers::sEE(smId) );
00289 hm01_ = UtilsClient::getHisto( me, cloneME_, hm01_ );
00290
00291 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT prof E1 vs X " + Numbers::sEE(smId) );
00292 he01_[0] = UtilsClient::getHisto( me, cloneME_, he01_[0] );
00293
00294 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT prof E1 vs Y " + Numbers::sEE(smId) );
00295 he01_[1] = UtilsClient::getHisto( me, cloneME_, he01_[1] );
00296
00297 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT his E1 vs X " + Numbers::sEE(smId) );
00298 he02_[0] = UtilsClient::getHisto( me, cloneME_, he02_[0] );
00299
00300 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT his E1 vs Y " + Numbers::sEE(smId) );
00301 he02_[1] = UtilsClient::getHisto( me, cloneME_, he02_[1] );
00302
00303 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT PosX Hodo-Calo " + Numbers::sEE(smId) );
00304 he03_[0] = UtilsClient::getHisto( me, cloneME_, he03_[0] );
00305
00306 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT PosY Hodo-Calo " + Numbers::sEE(smId) );
00307 he03_[1] = UtilsClient::getHisto( me, cloneME_, he03_[1] );
00308
00309 me = dqmStore_->get( prefixME_ + "/EEBeamHodoTask/EEBHT TimeMax TDC-Calo " + Numbers::sEE(smId) );
00310 he03_[2] = UtilsClient::getHisto( me, cloneME_, he03_[2] );
00311
00312 }
00313