#include <DQMClientExample.h>
Public Member Functions | |
DQMClientExample (const edm::ParameterSet &ps) | |
virtual | ~DQMClientExample () |
Protected Member Functions | |
void | analyze (const edm::Event &e, const edm::EventSetup &c) |
void | beginJob () |
void | beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) |
void | beginRun (const edm::Run &r, const edm::EventSetup &c) |
void | endJob () |
void | endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) |
void | endRun (const edm::Run &r, const edm::EventSetup &c) |
void | performClient () |
Private Member Functions | |
void | initialize () |
Private Attributes | |
MonitorElement * | clientHisto |
bool | clientOnEachEvent |
bool | clientOnEndJob |
bool | clientOnEndLumi |
bool | clientOnEndRun |
int | counterClientOperation |
int | counterEvt_ |
int | counterLS_ |
DQMStore * | dbe_ |
std::string | monitorName_ |
edm::ParameterSet | parameters_ |
int | prescaleEvt_ |
int | prescaleLS_ |
std::string | QTestName_ |
* DQM Test Client
Definition at line 33 of file DQMClientExample.h.
DQMClientExample::DQMClientExample | ( | const edm::ParameterSet & | ps | ) |
Definition at line 40 of file DQMClientExample.cc.
{ parameters_=ps; initialize(); }
DQMClientExample::~DQMClientExample | ( | ) | [virtual] |
Definition at line 46 of file DQMClientExample.cc.
{ }
void DQMClientExample::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Implements edm::EDAnalyzer.
Definition at line 116 of file DQMClientExample.cc.
{ counterEvt_++; if(clientOnEachEvent){ if (prescaleEvt_>0 && counterEvt_ % prescaleEvt_ == 0) performClient(); } }
void DQMClientExample::beginJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 89 of file DQMClientExample.cc.
References DQMStore::book1D(), dbe_, cppFunctionSkipper::operator, and DQMStore::setCurrentFolder().
{ dbe_ = Service<DQMStore>().operator->(); dbe_->setCurrentFolder(monitorName_+"DQMclient"); clientHisto = dbe_->book1D("clientHisto", "Guassian fit results.", 2, 0, 1); }
void DQMClientExample::beginLuminosityBlock | ( | const edm::LuminosityBlock & | lumiSeg, |
const edm::EventSetup & | context | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 108 of file DQMClientExample.cc.
{ // optionally reset histograms here // clientHisto->Reset(); }
void DQMClientExample::beginRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
void DQMClientExample::endJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 142 of file DQMClientExample.cc.
References gather_cfg::cout.
{ std::cout << "DQMSourceClient::endJob()" << std::endl; if(clientOnEndJob) performClient(); }
void DQMClientExample::endLuminosityBlock | ( | const edm::LuminosityBlock & | lumiSeg, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 126 of file DQMClientExample.cc.
{ counterLS_ ++; if(!clientOnEachEvent && clientOnEndLumi){ if( prescaleLS_ > 0 && counterLS_ % prescaleLS_ == 0) performClient(); } }
void DQMClientExample::endRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 135 of file DQMClientExample.cc.
{ if(clientOnEndRun) performClient(); }
void DQMClientExample::initialize | ( | ) | [private] |
Definition at line 52 of file DQMClientExample.cc.
References gather_cfg::cout, dbe_, and cppFunctionSkipper::operator.
{ counterEvt_=0; counterLS_ = 0; counterClientOperation = 0; dbe_ = Service<DQMStore>().operator->(); monitorName_ = parameters_.getUntrackedParameter<string>("monitorName","YourSubsystemName"); cout << "DQMClientExample: Monitor name = " << monitorName_ << endl; if (monitorName_ != "" ) monitorName_ = monitorName_+"/" ; prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1); cout << "DQMClientExample: DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< endl; prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1); cout << "DQMClientExample: DQM event prescale = " << prescaleEvt_ << " events(s)"<< endl; //-- QTestName that is going to bu run on clienHisto, as defined in XML file QTestName_ = parameters_.getUntrackedParameter<string>("QTestName","exampleQTest"); cout << "DQMClientExample: QTest name to be ran on clientHisto = " << QTestName_ << endl; //-- define where to run the Client clientOnEachEvent = parameters_.getUntrackedParameter<bool>("clientOnEachEvent",false); if(clientOnEachEvent) cout << "DQMClientExample: run Client on each event" << endl; clientOnEndLumi = parameters_.getUntrackedParameter<bool>("clientOnEndLumi",true); if(clientOnEndLumi) cout << "DQMClientExample: run Client at the end of each lumi section" << endl; clientOnEndRun = parameters_.getUntrackedParameter<bool>("clientOnEndRun",false); if(clientOnEndRun) cout << "DQMClientExample: run Client at the end of each run" << endl; clientOnEndJob = parameters_.getUntrackedParameter<bool>("clientOnEndJob",false); if(clientOnEndJob) cout << "DQMClientExample: run Client at the end of the job" << endl; }
void DQMClientExample::performClient | ( | ) | [protected] |
Definition at line 151 of file DQMClientExample.cc.
References gather_cfg::cout, dbe_, python::connectstrParser::f1, DQMStore::get(), QReport::getBadChannels(), QReport::getMessage(), QReport::getStatus(), MonitorElement::getTH1F(), timingPdfMaker::mean, and plotscripts::rms().
{ std::cout << "***** run Client operations as defined in: *****" << std::endl; std::cout << "***** DQMClientExample::performClient ********" << std::endl; //---------------------------------------------------------------------------------------------- // example how to retrieve a ME created by the DQM producer (in Examples/src/DQMSourceExample.cc) //--------------------------------------------------------------------------------------------- float mean =0; float rms = 0; string histoName = monitorName_ + "DQMsource/C1/histo2"; MonitorElement * meHisto = dbe_->get(histoName); if (meHisto) { if (TH1F *rootHisto = meHisto->getTH1F()) { if(counterClientOperation<1) std::cout<<"=== DQMClientExample::performClient => the histo is found: entries="<< rootHisto->GetEntries() << "\n" <<" mean=" << rootHisto->GetMean() << " rms=" << rootHisto->GetRMS() << std::endl; TF1 *f1 = new TF1("f1","gaus",1,3); rootHisto->Fit("f1"); mean = f1->GetParameter(1); rms = f1->GetParameter(2); } clientHisto->setBinContent(1,mean); clientHisto->setBinContent(2,rms); } else { //when it is not found ! clientHisto->setBinContent(1,-1); clientHisto->setBinContent(2,-1); if(counterClientOperation<1) edm::LogError ("DQMClientExample") <<"--- The following ME :"<< histoName <<" cannot be found\n" <<"--- on the DQM source side !\n"; } //---------------------------------------------------------------------------------------------- // example how to access the Quality test result for clientHisto //--------------------------------------------------------------------------------------------- // qtest to be ran on clientHisto is defined in Examples/test/QualityTests.xml const QReport * theQReport = clientHisto->getQReport(QTestName_); if(theQReport) { if(counterClientOperation<1) edm::LogWarning ("DQMClientExample") <<"*** Summary of Quality Test for clientHisto: \n" //<<"--- value ="<< theQReport->getQTresult()<<"\n" <<"--- status ="<< theQReport->getStatus() << "\n" <<"--- message ="<< theQReport->getMessage() << "\n"; vector<dqm::me_util::Channel> badChannels = theQReport->getBadChannels(); for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end(); channel++) { if(counterClientOperation<1) edm::LogError ("DQMClientExample") <<" Bad channels: "<<(*channel).getBin()<<" "<<(*channel).getContents(); } } else { if(counterClientOperation<1) edm::LogError ("DQMClientExample") <<"--- No QReport is found for clientHisto!\n" << "--- Please check your XML and config files -> QTestName ( " << QTestName_ << " )must be the same!\n"; } counterClientOperation++; }
MonitorElement* DQMClientExample::clientHisto [private] |
Definition at line 91 of file DQMClientExample.h.
bool DQMClientExample::clientOnEachEvent [private] |
Definition at line 85 of file DQMClientExample.h.
bool DQMClientExample::clientOnEndJob [private] |
Definition at line 88 of file DQMClientExample.h.
bool DQMClientExample::clientOnEndLumi [private] |
Definition at line 86 of file DQMClientExample.h.
bool DQMClientExample::clientOnEndRun [private] |
Definition at line 87 of file DQMClientExample.h.
int DQMClientExample::counterClientOperation [private] |
Definition at line 80 of file DQMClientExample.h.
int DQMClientExample::counterEvt_ [private] |
Definition at line 81 of file DQMClientExample.h.
int DQMClientExample::counterLS_ [private] |
Definition at line 82 of file DQMClientExample.h.
DQMStore* DQMClientExample::dbe_ [private] |
Definition at line 77 of file DQMClientExample.h.
std::string DQMClientExample::monitorName_ [private] |
Definition at line 78 of file DQMClientExample.h.
Definition at line 75 of file DQMClientExample.h.
int DQMClientExample::prescaleEvt_ [private] |
Definition at line 83 of file DQMClientExample.h.
int DQMClientExample::prescaleLS_ [private] |
Definition at line 84 of file DQMClientExample.h.
std::string DQMClientExample::QTestName_ [private] |
Definition at line 79 of file DQMClientExample.h.