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