#include <DQM/EcalBarrelMonitorClient/interface/EBPedestalOnlineClient.h>
Public Member Functions | |
void | analyze (void) |
Analyze. | |
void | beginJob (DQMStore *dqmStore) |
BeginJob. | |
void | beginRun (void) |
BeginRun. | |
void | cleanup (void) |
Cleanup. | |
EBPedestalOnlineClient (const edm::ParameterSet &ps) | |
Constructor. | |
void | endJob (void) |
EndJob. | |
void | endRun (void) |
EndRun. | |
int | getEvtPerJob () |
Get Functions. | |
int | getEvtPerRun () |
Returns the number of processed events in this Run. | |
void | htmlOutput (int run, std::string &htmlDir, std::string &htmlName) |
HtmlOutput. | |
void | setup (void) |
Setup. | |
void | softReset (bool flag) |
SoftReset. | |
bool | writeDb (EcalCondDBInterface *econn, RunIOV *runiov, MonRunIOV *moniov, bool &status, bool flag) |
WriteDB. | |
virtual | ~EBPedestalOnlineClient () |
Destructor. | |
Private Attributes | |
bool | cloneME_ |
bool | debug_ |
float | discrepancyMean_ |
DQMStore * | dqmStore_ |
bool | enableCleanup_ |
float | expectedMean_ |
TProfile2D * | h03_ [36] |
int | ievt_ |
int | jevt_ |
MonitorElement * | meg03_ [36] |
MonitorElement * | mep03_ [36] |
MonitorElement * | mer03_ [36] |
std::string | prefixME_ |
float | RMSThreshold_ |
std::vector< int > | superModules_ |
bool | verbose_ |
Friends | |
class | EBSummaryClient |
Definition at line 31 of file EBPedestalOnlineClient.h.
EBPedestalOnlineClient::EBPedestalOnlineClient | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 41 of file EBPedestalOnlineClient.cc.
References cloneME_, debug_, discrepancyMean_, enableCleanup_, expectedMean_, edm::ParameterSet::getUntrackedParameter(), h03_, i, meg03_, mep03_, mer03_, prefixME_, RMSThreshold_, superModules_, and verbose_.
00041 { 00042 00043 // cloneME switch 00044 cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true); 00045 00046 // verbose switch 00047 verbose_ = ps.getUntrackedParameter<bool>("verbose", true); 00048 00049 // debug switch 00050 debug_ = ps.getUntrackedParameter<bool>("debug", false); 00051 00052 // prefixME path 00053 prefixME_ = ps.getUntrackedParameter<string>("prefixME", ""); 00054 00055 // enableCleanup_ switch 00056 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false); 00057 00058 // vector of selected Super Modules (Defaults to all 36). 00059 superModules_.reserve(36); 00060 for ( unsigned int i = 1; i <= 36; i++ ) superModules_.push_back(i); 00061 superModules_ = ps.getUntrackedParameter<vector<int> >("superModules", superModules_); 00062 00063 for ( unsigned int i=0; i<superModules_.size(); i++ ) { 00064 00065 int ism = superModules_[i]; 00066 00067 h03_[ism-1] = 0; 00068 00069 } 00070 00071 for ( unsigned int i=0; i<superModules_.size(); i++ ) { 00072 00073 int ism = superModules_[i]; 00074 00075 meg03_[ism-1] = 0; 00076 00077 mep03_[ism-1] = 0; 00078 00079 mer03_[ism-1] = 0; 00080 00081 } 00082 00083 expectedMean_ = 200.0; 00084 discrepancyMean_ = 25.0; 00085 RMSThreshold_ = 2.0; 00086 00087 }
EBPedestalOnlineClient::~EBPedestalOnlineClient | ( | ) | [virtual] |
Analyze.
Implements EBClient.
Definition at line 299 of file EBPedestalOnlineClient.cc.
References cloneME_, GenMuonPlsPt100GeV_cfg::cout, debug_, discrepancyMean_, dqmStore_, EcalBarrel, lat::endl(), expectedMean_, EcalErrorMask::fetchDataSet(), MonitorElement::Fill(), DQMStore::get(), UtilsClient::getBinStatistics(), LogicID::getEcalLogicID(), EcalLogicID::getLogicID(), EcalErrorDictionary::getMask(), h03_, histo, i, ievt_, Numbers::indexEB(), Numbers::iSM(), Numbers::iTT(), jevt_, m, UtilsClient::maskBinContent(), me, meg03_, mep03_, mer03_, prefixME_, MonitorElement::Reset(), RMSThreshold_, Numbers::sEB(), MonitorElement::setBinContent(), and superModules_.
00299 { 00300 00301 ievt_++; 00302 jevt_++; 00303 if ( ievt_ % 10 == 0 ) { 00304 if ( debug_ ) cout << "EBPedestalOnlineClient: ievt/jevt = " << ievt_ << "/" << jevt_ << endl; 00305 } 00306 00307 uint64_t bits03 = 0; 00308 bits03 |= EcalErrorDictionary::getMask("PEDESTAL_ONLINE_HIGH_GAIN_MEAN_WARNING"); 00309 bits03 |= EcalErrorDictionary::getMask("PEDESTAL_ONLINE_HIGH_GAIN_RMS_WARNING"); 00310 bits03 |= EcalErrorDictionary::getMask("PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR"); 00311 bits03 |= EcalErrorDictionary::getMask("PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR"); 00312 00313 map<EcalLogicID, RunCrystalErrorsDat> mask1; 00314 map<EcalLogicID, RunTTErrorsDat> mask2; 00315 00316 EcalErrorMask::fetchDataSet(&mask1); 00317 EcalErrorMask::fetchDataSet(&mask2); 00318 00319 char histo[200]; 00320 00321 MonitorElement* me; 00322 00323 for ( unsigned int i=0; i<superModules_.size(); i++ ) { 00324 00325 int ism = superModules_[i]; 00326 00327 sprintf(histo, (prefixME_ + "/EBPedestalOnlineTask/Gain12/EBPOT pedestal %s G12").c_str(), Numbers::sEB(ism).c_str()); 00328 me = dqmStore_->get(histo); 00329 h03_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h03_[ism-1] ); 00330 if ( meg03_[ism-1] ) meg03_[ism-1]->Reset(); 00331 if ( mep03_[ism-1] ) mep03_[ism-1]->Reset(); 00332 if ( mer03_[ism-1] ) mer03_[ism-1]->Reset(); 00333 00334 for ( int ie = 1; ie <= 85; ie++ ) { 00335 for ( int ip = 1; ip <= 20; ip++ ) { 00336 00337 if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent(ie, ip, 2.); 00338 00339 bool update03; 00340 00341 float num03; 00342 float mean03; 00343 float rms03; 00344 00345 update03 = UtilsClient::getBinStatistics(h03_[ism-1], ie, ip, num03, mean03, rms03); 00346 00347 if ( update03 ) { 00348 00349 float val; 00350 00351 val = 1.; 00352 if ( fabs(mean03 - expectedMean_) > discrepancyMean_ ) 00353 val = 0.; 00354 if ( rms03 > RMSThreshold_ ) 00355 val = 0.; 00356 if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent(ie, ip, val); 00357 00358 if ( mep03_[ism-1] ) mep03_[ism-1]->Fill(mean03); 00359 if ( mer03_[ism-1] ) mer03_[ism-1]->Fill(rms03); 00360 00361 } 00362 00363 // masking 00364 00365 if ( mask1.size() != 0 ) { 00366 map<EcalLogicID, RunCrystalErrorsDat>::const_iterator m; 00367 for (m = mask1.begin(); m != mask1.end(); m++) { 00368 00369 EcalLogicID ecid = m->first; 00370 00371 int ic = Numbers::indexEB(ism, ie, ip); 00372 00373 if ( ecid.getLogicID() == LogicID::getEcalLogicID("EB_crystal_number", Numbers::iSM(ism, EcalBarrel), ic).getLogicID() ) { 00374 if ( (m->second).getErrorBits() & bits03 ) { 00375 UtilsClient::maskBinContent( meg03_[ism-1], ie, ip ); 00376 } 00377 } 00378 00379 } 00380 } 00381 00382 // TT masking 00383 00384 if ( mask2.size() != 0 ) { 00385 map<EcalLogicID, RunTTErrorsDat>::const_iterator m; 00386 for (m = mask2.begin(); m != mask2.end(); m++) { 00387 00388 EcalLogicID ecid = m->first; 00389 00390 int itt = Numbers::iTT(ism, EcalBarrel, ie, ip); 00391 00392 if ( ecid.getLogicID() == LogicID::getEcalLogicID("EB_trigger_tower", Numbers::iSM(ism, EcalBarrel), itt).getLogicID() ) { 00393 if ( (m->second).getErrorBits() & bits03 ) { 00394 UtilsClient::maskBinContent( meg03_[ism-1], ie, ip ); 00395 } 00396 } 00397 00398 } 00399 } 00400 00401 } 00402 } 00403 00404 } 00405 00406 }
BeginJob.
Implements EBClient.
Definition at line 93 of file EBPedestalOnlineClient.cc.
References GenMuonPlsPt100GeV_cfg::cout, debug_, dqmStore_, lat::endl(), ievt_, and jevt_.
00093 { 00094 00095 dqmStore_ = dqmStore; 00096 00097 if ( debug_ ) cout << "EBPedestalOnlineClient: beginJob" << endl; 00098 00099 ievt_ = 0; 00100 jevt_ = 0; 00101 00102 }
BeginRun.
Implements EBClient.
Definition at line 104 of file EBPedestalOnlineClient.cc.
References GenMuonPlsPt100GeV_cfg::cout, debug_, lat::endl(), jevt_, and setup().
00104 { 00105 00106 if ( debug_ ) cout << "EBPedestalOnlineClient: beginRun" << endl; 00107 00108 jevt_ = 0; 00109 00110 this->setup(); 00111 00112 }
Cleanup.
Implements EBClient.
Definition at line 179 of file EBPedestalOnlineClient.cc.
References cloneME_, dqmStore_, enableCleanup_, edm::getName(), h03_, i, meg03_, mep03_, mer03_, prefixME_, DQMStore::removeElement(), DQMStore::setCurrentFolder(), and superModules_.
Referenced by endJob(), and endRun().
00179 { 00180 00181 if ( ! enableCleanup_ ) return; 00182 00183 for ( unsigned int i=0; i<superModules_.size(); i++ ) { 00184 00185 int ism = superModules_[i]; 00186 00187 if ( cloneME_ ) { 00188 if ( h03_[ism-1] ) delete h03_[ism-1]; 00189 } 00190 00191 h03_[ism-1] = 0; 00192 00193 } 00194 00195 dqmStore_->setCurrentFolder( prefixME_ + "/EBPedestalOnlineClient" ); 00196 00197 for ( unsigned int i=0; i<superModules_.size(); i++ ) { 00198 00199 int ism = superModules_[i]; 00200 00201 if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() ); 00202 meg03_[ism-1] = 0; 00203 00204 if ( mep03_[ism-1] ) dqmStore_->removeElement( mep03_[ism-1]->getName() ); 00205 mep03_[ism-1] = 0; 00206 00207 if ( mer03_[ism-1] ) dqmStore_->removeElement( mer03_[ism-1]->getName() ); 00208 mer03_[ism-1] = 0; 00209 00210 } 00211 00212 }
EndJob.
Implements EBClient.
Definition at line 114 of file EBPedestalOnlineClient.cc.
References cleanup(), GenMuonPlsPt100GeV_cfg::cout, debug_, lat::endl(), and ievt_.
00114 { 00115 00116 if ( debug_ ) cout << "EBPedestalOnlineClient: endJob, ievt = " << ievt_ << endl; 00117 00118 this->cleanup(); 00119 00120 }
EndRun.
Implements EBClient.
Definition at line 122 of file EBPedestalOnlineClient.cc.
References cleanup(), GenMuonPlsPt100GeV_cfg::cout, debug_, lat::endl(), and jevt_.
00122 { 00123 00124 if ( debug_ ) cout << "EBPedestalOnlineClient: endRun, jevt = " << jevt_ << endl; 00125 00126 this->cleanup(); 00127 00128 }
Get Functions.
Implements EBClient.
Definition at line 74 of file EBPedestalOnlineClient.h.
References ievt_.
00074 { return ievt_; }
Setup.
Implements EBClient.
Definition at line 130 of file EBPedestalOnlineClient.cc.
References DQMStore::book1D(), DQMStore::book2D(), dqmStore_, edm::getName(), histo, i, meg03_, mep03_, mer03_, prefixME_, DQMStore::removeElement(), MonitorElement::Reset(), Numbers::sEB(), MonitorElement::setAxisTitle(), MonitorElement::setBinContent(), DQMStore::setCurrentFolder(), and superModules_.
Referenced by beginRun().
00130 { 00131 00132 char histo[200]; 00133 00134 dqmStore_->setCurrentFolder( prefixME_ + "/EBPedestalOnlineClient" ); 00135 00136 for ( unsigned int i=0; i<superModules_.size(); i++ ) { 00137 00138 int ism = superModules_[i]; 00139 00140 if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() ); 00141 sprintf(histo, "EBPOT pedestal quality G12 %s", Numbers::sEB(ism).c_str()); 00142 meg03_[ism-1] = dqmStore_->book2D(histo, histo, 85, 0., 85., 20, 0., 20.); 00143 meg03_[ism-1]->setAxisTitle("ieta", 1); 00144 meg03_[ism-1]->setAxisTitle("iphi", 2); 00145 00146 if ( mep03_[ism-1] ) dqmStore_->removeElement( mep03_[ism-1]->getName() ); 00147 sprintf(histo, "EBPOT pedestal mean G12 %s", Numbers::sEB(ism).c_str()); 00148 mep03_[ism-1] = dqmStore_->book1D(histo, histo, 100, 150., 250.); 00149 mep03_[ism-1]->setAxisTitle("mean", 1); 00150 00151 if ( mer03_[ism-1] ) dqmStore_->removeElement( mer03_[ism-1]->getName() ); 00152 sprintf(histo, "EBPOT pedestal rms G12 %s", Numbers::sEB(ism).c_str()); 00153 mer03_[ism-1] = dqmStore_->book1D(histo, histo, 100, 0., 10.); 00154 mer03_[ism-1]->setAxisTitle("rms", 1); 00155 00156 } 00157 00158 for ( unsigned int i=0; i<superModules_.size(); i++ ) { 00159 00160 int ism = superModules_[i]; 00161 00162 if ( meg03_[ism-1] ) meg03_[ism-1]->Reset(); 00163 00164 for ( int ie = 1; ie <= 85; ie++ ) { 00165 for ( int ip = 1; ip <= 20; ip++ ) { 00166 00167 meg03_[ism-1]->setBinContent( ie, ip, 2. ); 00168 00169 } 00170 } 00171 00172 if ( mep03_[ism-1] ) mep03_[ism-1]->Reset(); 00173 if ( mer03_[ism-1] ) mer03_[ism-1]->Reset(); 00174 00175 } 00176 00177 }
SoftReset.
Implements EBClient.
Definition at line 408 of file EBPedestalOnlineClient.cc.
References dqmStore_, DQMStore::get(), histo, i, me, prefixME_, Numbers::sEB(), DQMStore::softReset(), and superModules_.
Referenced by writeDb().
00408 { 00409 00410 char histo[200]; 00411 00412 for ( unsigned int i=0; i<superModules_.size(); i++ ) { 00413 00414 int ism = superModules_[i]; 00415 00416 sprintf(histo, (prefixME_ + "/EBPedestalOnlineTask/Gain12/EBPOT pedestal %s G12").c_str(), Numbers::sEB(ism).c_str()); 00417 MonitorElement* me = dqmStore_->get(histo); 00418 00419 if ( flag ) { 00420 if ( me ) dqmStore_->softReset(me); 00421 } else { 00422 // if ( me ) dqmStore_->disableSoftReset(me); 00423 } 00424 00425 } 00426 00427 }
bool EBPedestalOnlineClient::writeDb | ( | EcalCondDBInterface * | econn, | |
RunIOV * | runiov, | |||
MonRunIOV * | moniov, | |||
bool & | status, | |||
bool | flag | |||
) | [virtual] |
WriteDB.
Implements EBClient.
Definition at line 214 of file EBPedestalOnlineClient.cc.
References TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, ttbarGen_cfg::dataset, e, EcalBarrel, lat::endl(), UtilsClient::getBinQuality(), UtilsClient::getBinStatistics(), UtilsClient::getBinStatus(), LogicID::getEcalLogicID(), h03_, i, Numbers::icEB(), Numbers::indexEB(), EcalCondDBInterface::insertDataArraySet(), Numbers::iSM(), meg03_, p, UtilsClient::printBadChannels(), Numbers::sEB(), MonPedestalsOnlineDat::setADCMeanG12(), MonPedestalsOnlineDat::setADCRMSG12(), MonPedestalsOnlineDat::setTaskStatus(), softReset(), superModules_, and verbose_.
00214 { 00215 00216 status = true; 00217 00218 if ( flag ) this->softReset(false); 00219 00220 EcalLogicID ecid; 00221 00222 MonPedestalsOnlineDat p; 00223 map<EcalLogicID, MonPedestalsOnlineDat> dataset; 00224 00225 for ( unsigned int i=0; i<superModules_.size(); i++ ) { 00226 00227 int ism = superModules_[i]; 00228 00229 if ( verbose_ ) { 00230 cout << " " << Numbers::sEB(ism) << " (ism=" << ism << ")" << endl; 00231 cout << endl; 00232 UtilsClient::printBadChannels(meg03_[ism-1], h03_[ism-1]); 00233 } 00234 00235 float num03; 00236 float mean03; 00237 float rms03; 00238 00239 for ( int ie = 1; ie <= 85; ie++ ) { 00240 for ( int ip = 1; ip <= 20; ip++ ) { 00241 00242 bool update03; 00243 00244 update03 = UtilsClient::getBinStatistics(h03_[ism-1], ie, ip, num03, mean03, rms03); 00245 00246 if ( update03 ) { 00247 00248 if ( Numbers::icEB(ism, ie, ip) == 1 ) { 00249 00250 if ( verbose_ ) { 00251 cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << endl; 00252 cout << "G12 (" << ie << "," << ip << ") " << num03 << " " << mean03 << " " << rms03 << endl; 00253 cout << endl; 00254 } 00255 00256 } 00257 00258 p.setADCMeanG12(mean03); 00259 p.setADCRMSG12(rms03); 00260 00261 if ( UtilsClient::getBinStatus(meg03_[ism-1], ie, ip) ) { 00262 p.setTaskStatus(true); 00263 } else { 00264 p.setTaskStatus(false); 00265 } 00266 00267 status = status && UtilsClient::getBinQuality(meg03_[ism-1], ie, ip); 00268 00269 int ic = Numbers::indexEB(ism, ie, ip); 00270 00271 if ( econn ) { 00272 ecid = LogicID::getEcalLogicID("EB_crystal_number", Numbers::iSM(ism, EcalBarrel), ic); 00273 dataset[ecid] = p; 00274 } 00275 00276 } 00277 00278 } 00279 } 00280 00281 } 00282 00283 if ( econn ) { 00284 try { 00285 if ( verbose_ ) cout << "Inserting MonPedestalsOnlineDat ..." << endl; 00286 if ( dataset.size() != 0 ) econn->insertDataArraySet(&dataset, moniov); 00287 if ( verbose_ ) cout << "done." << endl; 00288 } catch (runtime_error &e) { 00289 cerr << e.what() << endl; 00290 } 00291 } 00292 00293 if ( ! flag ) this->softReset(true); 00294 00295 return true; 00296 00297 }
friend class EBSummaryClient [friend] |
Definition at line 33 of file EBPedestalOnlineClient.h.
bool EBPedestalOnlineClient::cloneME_ [private] |
Definition at line 82 of file EBPedestalOnlineClient.h.
Referenced by analyze(), cleanup(), and EBPedestalOnlineClient().
bool EBPedestalOnlineClient::debug_ [private] |
Definition at line 85 of file EBPedestalOnlineClient.h.
Referenced by analyze(), beginJob(), beginRun(), EBPedestalOnlineClient(), endJob(), and endRun().
float EBPedestalOnlineClient::discrepancyMean_ [private] |
Definition at line 106 of file EBPedestalOnlineClient.h.
Referenced by analyze(), and EBPedestalOnlineClient().
DQMStore* EBPedestalOnlineClient::dqmStore_ [private] |
Definition at line 93 of file EBPedestalOnlineClient.h.
Referenced by analyze(), beginJob(), cleanup(), setup(), and softReset().
bool EBPedestalOnlineClient::enableCleanup_ [private] |
Definition at line 89 of file EBPedestalOnlineClient.h.
Referenced by cleanup(), and EBPedestalOnlineClient().
float EBPedestalOnlineClient::expectedMean_ [private] |
Definition at line 105 of file EBPedestalOnlineClient.h.
Referenced by analyze(), and EBPedestalOnlineClient().
TProfile2D* EBPedestalOnlineClient::h03_[36] [private] |
Definition at line 95 of file EBPedestalOnlineClient.h.
Referenced by analyze(), cleanup(), EBPedestalOnlineClient(), and writeDb().
int EBPedestalOnlineClient::ievt_ [private] |
Definition at line 79 of file EBPedestalOnlineClient.h.
Referenced by analyze(), beginJob(), endJob(), and getEvtPerJob().
int EBPedestalOnlineClient::jevt_ [private] |
Definition at line 80 of file EBPedestalOnlineClient.h.
Referenced by analyze(), beginJob(), beginRun(), endRun(), and getEvtPerRun().
MonitorElement* EBPedestalOnlineClient::meg03_[36] [private] |
Definition at line 97 of file EBPedestalOnlineClient.h.
Referenced by EBSummaryClient::analyze(), analyze(), cleanup(), EBPedestalOnlineClient(), setup(), and writeDb().
MonitorElement* EBPedestalOnlineClient::mep03_[36] [private] |
Definition at line 99 of file EBPedestalOnlineClient.h.
Referenced by analyze(), cleanup(), EBPedestalOnlineClient(), and setup().
MonitorElement* EBPedestalOnlineClient::mer03_[36] [private] |
Definition at line 101 of file EBPedestalOnlineClient.h.
Referenced by analyze(), cleanup(), EBPedestalOnlineClient(), and setup().
std::string EBPedestalOnlineClient::prefixME_ [private] |
Definition at line 87 of file EBPedestalOnlineClient.h.
Referenced by analyze(), cleanup(), EBPedestalOnlineClient(), setup(), and softReset().
float EBPedestalOnlineClient::RMSThreshold_ [private] |
Definition at line 107 of file EBPedestalOnlineClient.h.
Referenced by analyze(), and EBPedestalOnlineClient().
std::vector<int> EBPedestalOnlineClient::superModules_ [private] |
Definition at line 91 of file EBPedestalOnlineClient.h.
Referenced by analyze(), cleanup(), EBPedestalOnlineClient(), setup(), softReset(), and writeDb().
bool EBPedestalOnlineClient::verbose_ [private] |
Definition at line 84 of file EBPedestalOnlineClient.h.
Referenced by EBPedestalOnlineClient(), and writeDb().