#include <EBTrendClient.h>
Public Member Functions | |
EBTrendClient (const edm::ParameterSet &ps) | |
virtual | ~EBTrendClient () |
Protected Member Functions | |
void | analyze (const edm::Event &e, const edm::EventSetup &c) |
void | beginJob (void) |
void | beginRun (const edm::Run &r, const edm::EventSetup &c) |
void | cleanup (void) |
void | endJob (void) |
void | endRun (const edm::Run &r, const edm::EventSetup &c) |
void | reset (void) |
void | setup (void) |
void | updateTime (void) |
Private Attributes | |
int | current_time_ |
TObject * | currentHist_ [nHists_] |
DQMStore * | dqmStore_ |
bool | enableCleanup_ |
std::string | histTitles_ [nHists_] |
int | ievt_ |
bool | init_ |
int | last_time_ |
double | mean_ [nHists_] |
MonitorElement * | meanHourly_ [nHists_] |
MonitorElement * | meanMinutely_ [nHists_] |
bool | mergeRuns_ |
std::string | moduleNames_ [nHists_] |
std::string | prefixME_ |
TObject * | previousHist_ [nHists_] |
double | rms_ [nHists_] |
MonitorElement * | sigmaHourly_ [nHists_] |
MonitorElement * | sigmaMinutely_ [nHists_] |
int | start_time_ |
bool | verbose_ |
Definition at line 27 of file EBTrendClient.h.
EBTrendClient::EBTrendClient | ( | const edm::ParameterSet & | ps | ) |
Definition at line 24 of file EBTrendClient.cc.
References currentHist_, dqmStore_, enableCleanup_, edm::ParameterSet::getUntrackedParameter(), i, init_, meanHourly_, meanMinutely_, mergeRuns_, nHists_, cppFunctionSkipper::operator, prefixME_, previousHist_, sigmaHourly_, sigmaMinutely_, AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.
{ init_ = false; dqmStore_ = edm::Service<DQMStore>().operator->(); prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", ""); enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false); mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false); verbose_ = ps.getUntrackedParameter<bool>("verbose", false); // histograms... for(int i=0; i<nHists_; i++) { meanMinutely_[i] = 0; sigmaMinutely_[i] = 0; meanHourly_[i] = 0; sigmaHourly_[i] = 0; previousHist_[i] = 0; currentHist_[i] = 0; } // for }
EBTrendClient::~EBTrendClient | ( | ) | [virtual] |
Definition at line 53 of file EBTrendClient.cc.
{ }
void EBTrendClient::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Implements edm::EDAnalyzer.
Definition at line 218 of file EBTrendClient.cc.
References ecaldqm::calcBins(), ecaldqm::cloneIt(), gather_cfg::cout, current_time_, currentHist_, dqmStore_, MonitorElement::Fill(), DQMStore::get(), ecaldqm::getMeanRms(), getTProfile(), timingPdfMaker::histo, histTitles_, i, ievt_, init_, last_time_, mean_, meanHourly_, meanMinutely_, moduleNames_, nHists_, prefixME_, previousHist_, rms_, setup(), ecaldqm::shift2Right(), sigmaHourly_, sigmaMinutely_, start_time_, AlCaHLTBitMon_QueryRunRegistry::string, updateTime(), and verbose_.
{ if ( ! init_ ) this->setup(); ievt_++; // -------------------------------------------------- // Collect time information // -------------------------------------------------- updateTime(); // long int diff_time = (current_time_ - start_time_)/60; long int minuteBinDiff = -1; long int minuteDiff = -1; // ecaldqm::calcBins(5,1,start_time_,last_time_,current_time_,minuteBinDiff,minuteDiff); ecaldqm::calcBins(5,60,start_time_,last_time_,current_time_,minuteBinDiff,minuteDiff); if(minuteBinDiff <= 0) return; long int hourBinDiff = -1; long int hourDiff = -1; ecaldqm::calcBins(1,3600,start_time_,last_time_,current_time_,hourBinDiff,hourDiff); for(int i=0; i<nHists_; i++){ mean_[i] = rms_[i] = 0; // delete previous hists if any if(previousHist_[i]) delete previousHist_[i]; // assign currentHists to previousHists previousHist_[i] = currentHist_[i]; } // for i std::string histo; MonitorElement* me; // get clones of histograms from other tasks or clients // assign cloned histogrmas to currentHist_[i] for(int i=0; i<nHists_; i++) { histo = prefixME_ + "/" + moduleNames_[i] + "/" + histTitles_[i]; me = dqmStore_->get(histo.c_str()); currentHist_[i] = ecaldqm::cloneIt(me,histo); } // Get mean and rms and fill Profile for(int i=0; i<nHists_; i++){ ecaldqm::getMeanRms(previousHist_[i],currentHist_[i],mean_[i],rms_[i]); if(verbose_) { std::cout << std::scientific; std::cout << "EBTrendClient mean["<<i<<"] = " << mean_[i] << ", \t rms["<<i<<"] = " << rms_[i] << std::endl; } ecaldqm::shift2Right(meanMinutely_[i]->getTProfile(), minuteBinDiff); meanMinutely_[i]->Fill(minuteDiff,mean_[i]); ecaldqm::shift2Right(sigmaMinutely_[i]->getTProfile(), minuteBinDiff); sigmaMinutely_[i]->Fill(minuteDiff,rms_[i]); ecaldqm::shift2Right(meanHourly_[i]->getTProfile(), hourBinDiff); meanHourly_[i]->Fill(hourDiff,mean_[i]); ecaldqm::shift2Right(sigmaHourly_[i]->getTProfile(), hourBinDiff); sigmaHourly_[i]->Fill(hourDiff,rms_[i]); } // for i }
void EBTrendClient::beginJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 57 of file EBTrendClient.cc.
References dqmStore_, histTitles_, ievt_, getHLTprescales::index, moduleNames_, prefixME_, DQMStore::rmdir(), and DQMStore::setCurrentFolder().
{ ievt_ = 0; if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EBTrendClient"); dqmStore_->rmdir(prefixME_ + "/EBTrendClient"); } // noise, // entries of EBOT rec hit thr occupancy // entries of EBOT tp digi occupancy // rec hit energy // ebtmt timing mean ID summary // ebtmt timing RMS ID summary // int index = 0; moduleNames_[index] = "EBClusterTask"; // TH1 histTitles_[index] = "EBCLT BC energy"; index++; moduleNames_[index] = "EBClusterTask"; // TH1 histTitles_[index] = "EBCLT SC energy"; index++; moduleNames_[index] = "EBSummaryClient"; // TProfile histTitles_[index] = "EBPOT pedestal G12 mean"; index++; moduleNames_[index] = "EBSummaryClient"; // TProfile histTitles_[index] = "EBPOT pedestal G12 rms"; index++; moduleNames_[index] = "EBOccupancyTask"; // TH2 histTitles_[index] = "EBOT rec hit thr occupancy"; index++; moduleNames_[index] = "EBOccupancyTask"; // TH2 histTitles_[index] = "EBOT TP digi thr occupancy"; index++; }
void EBTrendClient::beginRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 103 of file EBTrendClient.cc.
References mergeRuns_, NULL, reset(), start_time_, and cond::rpcobgas::time.
{ if ( ! mergeRuns_ ) this->reset(); start_time_ = time(NULL); }
void EBTrendClient::cleanup | ( | void | ) | [protected] |
Definition at line 177 of file EBTrendClient.cc.
References currentHist_, dqmStore_, i, init_, meanHourly_, meanMinutely_, nHists_, prefixME_, previousHist_, DQMStore::removeElement(), DQMStore::setCurrentFolder(), sigmaHourly_, and sigmaMinutely_.
Referenced by endJob().
{ if ( ! init_ ) return; if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EBTrendClient"); for(int i=0; i<nHists_; i++) { if(meanMinutely_[i]) dqmStore_->removeElement( meanMinutely_[i]->getName()); meanMinutely_[i] = 0; if(sigmaMinutely_[i]) dqmStore_->removeElement( sigmaMinutely_[i]->getName()); sigmaMinutely_[i] = 0; if(meanHourly_[i]) dqmStore_->removeElement( meanHourly_[i]->getName()); meanHourly_[i] = 0; if(sigmaHourly_[i]) dqmStore_->removeElement( sigmaHourly_[i]->getName()); sigmaHourly_[i] = 0; if(previousHist_[i]) delete previousHist_[i]; previousHist_[i] = 0; if(currentHist_[i]) delete currentHist_[i]; currentHist_[i] = 0; }// for } init_ = false; }
void EBTrendClient::endJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 209 of file EBTrendClient.cc.
References cleanup(), enableCleanup_, and ievt_.
{ edm::LogInfo("EBTrendClient") << "analyzed " << ievt_ << " events"; if ( enableCleanup_ ) this->cleanup(); }
void EBTrendClient::endRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
void EBTrendClient::reset | ( | void | ) | [protected] |
Definition at line 117 of file EBTrendClient.cc.
References i, meanHourly_, meanMinutely_, nHists_, MonitorElement::Reset(), sigmaHourly_, and sigmaMinutely_.
Referenced by beginRun().
{ for(int i=0; i<nHists_; i++) { if(meanMinutely_[i]) meanMinutely_[i]->Reset(); if(sigmaMinutely_[i]) sigmaMinutely_[i]->Reset(); if(meanHourly_[i]) meanHourly_[i]->Reset(); if(sigmaHourly_[i]) sigmaHourly_[i]->Reset(); }// for }
void EBTrendClient::setup | ( | void | ) | [protected] |
Definition at line 130 of file EBTrendClient.cc.
References DQMStore::bookProfile(), dqmStore_, timingPdfMaker::histo, histTitles_, i, init_, meanHourly_, meanMinutely_, nHists_, prefixME_, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), sigmaHourly_, sigmaMinutely_, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by analyze().
{ init_ = true; std::string histo; if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EBTrendClient"); for(int i=0; i<nHists_; i++) { // minutely histo = "Average of " + histTitles_[i] + " Vs 5Minutes"; meanMinutely_[i] = dqmStore_->bookProfile(histo.c_str(), histo.c_str(), 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s"); meanMinutely_[i]->setAxisTitle("Minutes", 1); histo = "Average of " + histTitles_[i] + " / 5 minutes"; meanMinutely_[i]->setAxisTitle(histo.c_str(), 2); histo = "RMS of " + histTitles_[i] + " Vs 5Minutes"; sigmaMinutely_[i] = dqmStore_->bookProfile(histo.c_str(), histo.c_str(), 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s"); sigmaMinutely_[i]->setAxisTitle("Minutes", 1); histo = "RMS of " + histTitles_[i] + " / 5 minutes"; sigmaMinutely_[i]->setAxisTitle(histo.c_str(), 2); // hourly histo = "Average of " + histTitles_[i] + " Vs 1Hour"; meanHourly_[i] = dqmStore_->bookProfile(histo.c_str(), histo.c_str(), 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s"); meanHourly_[i]->setAxisTitle("Hours", 1); histo = "Average of " + histTitles_[i] + " / hour"; meanHourly_[i]->setAxisTitle(histo.c_str(), 2); histo = "RMS of " + histTitles_[i] + " Vs 1Hour"; sigmaHourly_[i] = dqmStore_->bookProfile(histo.c_str(), histo.c_str(), 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s"); sigmaHourly_[i]->setAxisTitle("Hours", 1); histo = "RMS of " + histTitles_[i] + " / hour"; sigmaHourly_[i]->setAxisTitle(histo.c_str(), 2); }// for i }// if }
void EBTrendClient::updateTime | ( | void | ) | [protected] |
Definition at line 299 of file EBTrendClient.cc.
References current_time_, last_time_, NULL, and cond::rpcobgas::time.
Referenced by analyze().
{ last_time_ = current_time_; current_time_ = time(NULL); }
int EBTrendClient::current_time_ [private] |
Definition at line 90 of file EBTrendClient.h.
Referenced by analyze(), and updateTime().
TObject* EBTrendClient::currentHist_[nHists_] [private] |
Definition at line 100 of file EBTrendClient.h.
Referenced by analyze(), cleanup(), and EBTrendClient().
DQMStore* EBTrendClient::dqmStore_ [private] |
Definition at line 71 of file EBTrendClient.h.
Referenced by analyze(), beginJob(), cleanup(), EBTrendClient(), and setup().
bool EBTrendClient::enableCleanup_ [private] |
Definition at line 75 of file EBTrendClient.h.
Referenced by EBTrendClient(), and endJob().
std::string EBTrendClient::histTitles_[nHists_] [private] |
Definition at line 94 of file EBTrendClient.h.
Referenced by analyze(), beginJob(), and setup().
int EBTrendClient::ievt_ [private] |
Definition at line 69 of file EBTrendClient.h.
Referenced by analyze(), beginJob(), and endJob().
bool EBTrendClient::init_ [private] |
Definition at line 87 of file EBTrendClient.h.
Referenced by analyze(), cleanup(), EBTrendClient(), and setup().
int EBTrendClient::last_time_ [private] |
Definition at line 91 of file EBTrendClient.h.
Referenced by analyze(), and updateTime().
double EBTrendClient::mean_[nHists_] [private] |
Definition at line 96 of file EBTrendClient.h.
Referenced by analyze().
MonitorElement* EBTrendClient::meanHourly_[nHists_] [private] |
Definition at line 84 of file EBTrendClient.h.
Referenced by analyze(), cleanup(), EBTrendClient(), reset(), and setup().
MonitorElement* EBTrendClient::meanMinutely_[nHists_] [private] |
Definition at line 81 of file EBTrendClient.h.
Referenced by analyze(), cleanup(), EBTrendClient(), reset(), and setup().
bool EBTrendClient::mergeRuns_ [private] |
Definition at line 77 of file EBTrendClient.h.
Referenced by beginRun(), and EBTrendClient().
std::string EBTrendClient::moduleNames_[nHists_] [private] |
Definition at line 93 of file EBTrendClient.h.
Referenced by analyze(), and beginJob().
std::string EBTrendClient::prefixME_ [private] |
Definition at line 73 of file EBTrendClient.h.
Referenced by analyze(), beginJob(), cleanup(), EBTrendClient(), and setup().
TObject* EBTrendClient::previousHist_[nHists_] [private] |
Definition at line 99 of file EBTrendClient.h.
Referenced by analyze(), cleanup(), and EBTrendClient().
double EBTrendClient::rms_[nHists_] [private] |
Definition at line 97 of file EBTrendClient.h.
Referenced by analyze().
MonitorElement* EBTrendClient::sigmaHourly_[nHists_] [private] |
Definition at line 85 of file EBTrendClient.h.
Referenced by analyze(), cleanup(), EBTrendClient(), reset(), and setup().
MonitorElement* EBTrendClient::sigmaMinutely_[nHists_] [private] |
Definition at line 82 of file EBTrendClient.h.
Referenced by analyze(), cleanup(), EBTrendClient(), reset(), and setup().
int EBTrendClient::start_time_ [private] |
Definition at line 89 of file EBTrendClient.h.
Referenced by analyze(), and beginRun().
bool EBTrendClient::verbose_ [private] |
Definition at line 79 of file EBTrendClient.h.
Referenced by analyze(), and EBTrendClient().