#include <EETrendClient.h>
Public Member Functions | |
EETrendClient (const edm::ParameterSet &ps) | |
virtual | ~EETrendClient () |
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 EETrendClient.h.
EETrendClient::EETrendClient | ( | const edm::ParameterSet & | ps | ) |
Definition at line 24 of file EETrendClient.cc.
References currentHist_, dqmStore_, enableCleanup_, edm::ParameterSet::getUntrackedParameter(), i, init_, meanHourly_, meanMinutely_, mergeRuns_, nHists_, cppFunctionSkipper::operator, prefixME_, previousHist_, sigmaHourly_, sigmaMinutely_, 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 }
EETrendClient::~EETrendClient | ( | ) | [virtual] |
Definition at line 53 of file EETrendClient.cc.
{ }
void EETrendClient::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Implements edm::EDAnalyzer.
Definition at line 226 of file EETrendClient.cc.
References ecaldqm::calcBins(), ecaldqm::cloneIt(), gather_cfg::cout, current_time_, currentHist_, dqmStore_, MonitorElement::Fill(), DQMStore::get(), ecaldqm::getMeanRms(), getTProfile(), interpolateCardsSimple::histo, histTitles_, i, ievt_, init_, last_time_, mean_, meanHourly_, meanMinutely_, moduleNames_, nHists_, prefixME_, previousHist_, rms_, setup(), ecaldqm::shift2Right(), sigmaHourly_, sigmaMinutely_, start_time_, 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 << "EETrendClient 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 EETrendClient::beginJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 57 of file EETrendClient.cc.
References dqmStore_, histTitles_, ievt_, getHLTprescales::index, moduleNames_, prefixME_, DQMStore::rmdir(), and DQMStore::setCurrentFolder().
{ ievt_ = 0; if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EETrendClient"); dqmStore_->rmdir(prefixME_ + "/EETrendClient"); } // 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] = "EEClusterTask"; // TH1 histTitles_[index] = "EECLT BC energy"; index++; moduleNames_[index] = "EEClusterTask"; // TH1 histTitles_[index] = "EECLT SC energy"; index++; moduleNames_[index] = "EESummaryClient"; // TProfile histTitles_[index] = "EEPOT pedestal G12 mean"; index++; moduleNames_[index] = "EESummaryClient"; // TProfile histTitles_[index] = "EEPOT pedestal G12 rms"; index++; moduleNames_[index] = "EEOccupancyTask"; // TH2 histTitles_[index] = "EEOT rec hit thr occupancy EE -"; index++; moduleNames_[index] = "EEOccupancyTask"; // TH2 histTitles_[index] = "EEOT rec hit thr occupancy EE +"; index++; moduleNames_[index] = "EEOccupancyTask"; // TH2 histTitles_[index] = "EEOT TP digi thr occupancy EE -"; index++; moduleNames_[index] = "EEOccupancyTask"; // TH2 histTitles_[index] = "EEOT TP digi thr occupancy EE +"; index++; }
void EETrendClient::beginRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 111 of file EETrendClient.cc.
References mergeRuns_, NULL, reset(), start_time_, and cond::rpcobgas::time.
{ if ( ! mergeRuns_ ) this->reset(); start_time_ = time(NULL); }
void EETrendClient::cleanup | ( | void | ) | [protected] |
Definition at line 185 of file EETrendClient.cc.
References currentHist_, dqmStore_, edm::getName(), 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_ + "/EETrendClient"); 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 EETrendClient::endJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 217 of file EETrendClient.cc.
References cleanup(), enableCleanup_, and ievt_.
{ edm::LogInfo("EETrendClient") << "analyzed " << ievt_ << " events"; if ( enableCleanup_ ) this->cleanup(); }
void EETrendClient::endRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
void EETrendClient::reset | ( | void | ) | [protected] |
Definition at line 125 of file EETrendClient.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 EETrendClient::setup | ( | void | ) | [protected] |
Definition at line 138 of file EETrendClient.cc.
References DQMStore::bookProfile(), dqmStore_, interpolateCardsSimple::histo, histTitles_, i, init_, meanHourly_, meanMinutely_, nHists_, prefixME_, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), sigmaHourly_, and sigmaMinutely_.
Referenced by analyze().
{ init_ = true; std::string histo; if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EETrendClient"); 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 EETrendClient::updateTime | ( | void | ) | [protected] |
Definition at line 307 of file EETrendClient.cc.
References current_time_, last_time_, NULL, and cond::rpcobgas::time.
Referenced by analyze().
{ last_time_ = current_time_; current_time_ = time(NULL); }
int EETrendClient::current_time_ [private] |
Definition at line 90 of file EETrendClient.h.
Referenced by analyze(), and updateTime().
TObject* EETrendClient::currentHist_[nHists_] [private] |
Definition at line 100 of file EETrendClient.h.
Referenced by analyze(), cleanup(), and EETrendClient().
DQMStore* EETrendClient::dqmStore_ [private] |
Definition at line 71 of file EETrendClient.h.
Referenced by analyze(), beginJob(), cleanup(), EETrendClient(), and setup().
bool EETrendClient::enableCleanup_ [private] |
Definition at line 75 of file EETrendClient.h.
Referenced by EETrendClient(), and endJob().
std::string EETrendClient::histTitles_[nHists_] [private] |
Definition at line 94 of file EETrendClient.h.
Referenced by analyze(), beginJob(), and setup().
int EETrendClient::ievt_ [private] |
Definition at line 69 of file EETrendClient.h.
Referenced by analyze(), beginJob(), and endJob().
bool EETrendClient::init_ [private] |
Definition at line 87 of file EETrendClient.h.
Referenced by analyze(), cleanup(), EETrendClient(), and setup().
int EETrendClient::last_time_ [private] |
Definition at line 91 of file EETrendClient.h.
Referenced by analyze(), and updateTime().
double EETrendClient::mean_[nHists_] [private] |
Definition at line 96 of file EETrendClient.h.
Referenced by analyze().
MonitorElement* EETrendClient::meanHourly_[nHists_] [private] |
Definition at line 84 of file EETrendClient.h.
Referenced by analyze(), cleanup(), EETrendClient(), reset(), and setup().
MonitorElement* EETrendClient::meanMinutely_[nHists_] [private] |
Definition at line 81 of file EETrendClient.h.
Referenced by analyze(), cleanup(), EETrendClient(), reset(), and setup().
bool EETrendClient::mergeRuns_ [private] |
Definition at line 77 of file EETrendClient.h.
Referenced by beginRun(), and EETrendClient().
std::string EETrendClient::moduleNames_[nHists_] [private] |
Definition at line 93 of file EETrendClient.h.
Referenced by analyze(), and beginJob().
std::string EETrendClient::prefixME_ [private] |
Definition at line 73 of file EETrendClient.h.
Referenced by analyze(), beginJob(), cleanup(), EETrendClient(), and setup().
TObject* EETrendClient::previousHist_[nHists_] [private] |
Definition at line 99 of file EETrendClient.h.
Referenced by analyze(), cleanup(), and EETrendClient().
double EETrendClient::rms_[nHists_] [private] |
Definition at line 97 of file EETrendClient.h.
Referenced by analyze().
MonitorElement* EETrendClient::sigmaHourly_[nHists_] [private] |
Definition at line 85 of file EETrendClient.h.
Referenced by analyze(), cleanup(), EETrendClient(), reset(), and setup().
MonitorElement* EETrendClient::sigmaMinutely_[nHists_] [private] |
Definition at line 82 of file EETrendClient.h.
Referenced by analyze(), cleanup(), EETrendClient(), reset(), and setup().
int EETrendClient::start_time_ [private] |
Definition at line 89 of file EETrendClient.h.
Referenced by analyze(), and beginRun().
bool EETrendClient::verbose_ [private] |
Definition at line 79 of file EETrendClient.h.
Referenced by analyze(), and EETrendClient().