49 counterClientOperation = 0;
55 monitorName_ = parameters_.getUntrackedParameter<
string>(
"monitorName",
"YourSubsystemName");
56 cout <<
"DQMClientExample: Monitor name = " << monitorName_ << endl;
57 if (!monitorName_.empty())
58 monitorName_ = monitorName_ +
"/";
61 prescaleLS_ = parameters_.getUntrackedParameter<
int>(
"prescaleLS", -1);
62 cout <<
"DQMClientExample: DQM lumi section prescale = " << prescaleLS_ <<
" lumi section(s)" << endl;
63 prescaleEvt_ = parameters_.getUntrackedParameter<
int>(
"prescaleEvt", -1);
64 cout <<
"DQMClientExample: DQM event prescale = " << prescaleEvt_ <<
" events(s)" << endl;
67 QTestName_ = parameters_.getUntrackedParameter<
string>(
"QTestName",
"exampleQTest");
68 cout <<
"DQMClientExample: QTest name to be ran on clientHisto = " << QTestName_ << endl;
70 clientOnEachEvent = parameters_.getUntrackedParameter<
bool>(
"clientOnEachEvent",
false);
71 if (clientOnEachEvent)
72 cout <<
"DQMClientExample: run Client on each event" << endl;
73 clientOnEndLumi = parameters_.getUntrackedParameter<
bool>(
"clientOnEndLumi",
true);
75 cout <<
"DQMClientExample: run Client at the end of each lumi section" << endl;
76 clientOnEndRun = parameters_.getUntrackedParameter<
bool>(
"clientOnEndRun",
false);
78 cout <<
"DQMClientExample: run Client at the end of each run" << endl;
79 clientOnEndJob = parameters_.getUntrackedParameter<
bool>(
"clientOnEndJob",
false);
81 cout <<
"DQMClientExample: run Client at the end of the job" << endl;
91 dbe_->setCurrentFolder(monitorName_ +
"DQMclient");
92 clientHisto =
dbe_->book1D(
"clientHisto",
"Guassian fit results.", 2, 0, 1);
113 if (clientOnEachEvent) {
114 if (prescaleEvt_ > 0 && counterEvt_ % prescaleEvt_ == 0)
124 if (!clientOnEachEvent && clientOnEndLumi) {
125 if (prescaleLS_ > 0 && counterLS_ % prescaleLS_ == 0)
141 std::cout <<
"DQMSourceClient::endJob()" << std::endl;
150 std::cout <<
"***** run Client operations as defined in: *****" << std::endl;
151 std::cout <<
"***** DQMClientExample::performClient ********" << std::endl;
161 string histoName = monitorName_ +
"DQMsource/C1/histo2";
166 if (TH1F *rootHisto = meHisto->
getTH1F()) {
167 if (counterClientOperation < 1)
168 std::cout <<
"=== DQMClientExample::performClient => the histo is " 170 << rootHisto->GetEntries() <<
"\n" 171 <<
" mean=" << rootHisto->GetMean() <<
" rms=" << rootHisto->GetRMS() << std::endl;
174 TF1 *
f1 =
new TF1(
"f1",
"gaus", 1, 3);
176 mean = f1->GetParameter(1);
177 rms = f1->GetParameter(2);
179 clientHisto->setBinContent(1, mean);
180 clientHisto->setBinContent(2, rms);
184 clientHisto->setBinContent(1, -1);
185 clientHisto->setBinContent(2, -1);
186 if (counterClientOperation < 1)
187 edm::LogError(
"DQMClientExample") <<
"--- The following ME :" << histoName <<
" cannot be found\n" 188 <<
"--- on the DQM source side !\n";
196 const QReport *theQReport = clientHisto->getQReport(QTestName_);
198 if (counterClientOperation < 1)
199 edm::LogWarning(
"DQMClientExample") <<
"*** Summary of Quality Test for clientHisto: \n" 201 <<
"--- status =" << theQReport->
getStatus() <<
"\n" 202 <<
"--- message =" << theQReport->
getMessage() <<
"\n";
204 vector<dqm::me_util::Channel> badChannels = theQReport->
getBadChannels();
205 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
207 if (counterClientOperation < 1)
209 <<
" Bad channels: " << (*channel).getBin() <<
" " << (*channel).getContents();
212 if (counterClientOperation < 1)
213 edm::LogError(
"DQMClientExample") <<
"--- No QReport is found for clientHisto!\n" 214 <<
"--- Please check your XML and config files -> QTestName ( " << QTestName_
215 <<
" )must be the same!\n";
218 counterClientOperation++;
static AlgebraicMatrix initialize()
void endRun(const edm::Run &r, const edm::EventSetup &c) override
const std::vector< DQMChannel > & getBadChannels() const
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
~DQMClientExample() override
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
const std::string & getMessage() const
get message attached to test
void analyze(const edm::Event &e, const edm::EventSetup &c) override
DQMClientExample(const edm::ParameterSet &ps)
int getStatus() const
get test status (see Core/interface/QTestStatus.h)
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override