55 counterEvt_=0; counterLS_ = 0;
56 counterClientOperation = 0;
62 monitorName_ = parameters_.getUntrackedParameter<
string>(
"monitorName",
"YourSubsystemName");
63 cout <<
"DQMClientExample: Monitor name = " << monitorName_ << endl;
64 if (monitorName_ !=
"" ) monitorName_ = monitorName_+
"/" ;
67 prescaleLS_ = parameters_.getUntrackedParameter<
int>(
"prescaleLS", -1);
68 cout <<
"DQMClientExample: DQM lumi section prescale = " << prescaleLS_ <<
" lumi section(s)"<< endl;
69 prescaleEvt_ = parameters_.getUntrackedParameter<
int>(
"prescaleEvt", -1);
70 cout <<
"DQMClientExample: DQM event prescale = " << prescaleEvt_ <<
" events(s)"<< endl;
73 QTestName_ = parameters_.getUntrackedParameter<
string>(
"QTestName",
"exampleQTest");
74 cout <<
"DQMClientExample: QTest name to be ran on clientHisto = " << QTestName_ << endl;
76 clientOnEachEvent = parameters_.getUntrackedParameter<
bool>(
"clientOnEachEvent",
false);
77 if(clientOnEachEvent)
cout <<
"DQMClientExample: run Client on each event" << endl;
78 clientOnEndLumi = parameters_.getUntrackedParameter<
bool>(
"clientOnEndLumi",
true);
79 if(clientOnEndLumi)
cout <<
"DQMClientExample: run Client at the end of each lumi section" << endl;
80 clientOnEndRun = parameters_.getUntrackedParameter<
bool>(
"clientOnEndRun",
false);
81 if(clientOnEndRun)
cout <<
"DQMClientExample: run Client at the end of each run" << endl;
82 clientOnEndJob = parameters_.getUntrackedParameter<
bool>(
"clientOnEndJob",
false);
83 if(clientOnEndJob)
cout <<
"DQMClientExample: run Client at the end of the job" << endl;
96 clientHisto =
dbe_->
book1D(
"clientHisto",
"Guassian fit results.", 2, 0, 1);
118 if(clientOnEachEvent){
119 if (prescaleEvt_>0 && counterEvt_ % prescaleEvt_ == 0) performClient();
128 if(!clientOnEachEvent && clientOnEndLumi){
129 if( prescaleLS_ > 0 && counterLS_ % prescaleLS_ == 0) performClient();
136 if(clientOnEndRun) performClient();
143 std::cout <<
"DQMSourceClient::endJob()" << std::endl;
144 if(clientOnEndJob) performClient();
153 std::cout <<
"***** run Client operations as defined in: *****" << std::endl;
154 std::cout <<
"***** DQMClientExample::performClient ********" << std::endl;
162 string histoName = monitorName_ +
"DQMsource/C1/histo2";
167 if (TH1F *rootHisto = meHisto->
getTH1F()) {
168 if(counterClientOperation<1)
169 std::cout<<
"=== DQMClientExample::performClient => the histo is found: entries="<< rootHisto->GetEntries() <<
"\n"
170 <<
" mean=" << rootHisto->GetMean() <<
" rms=" << rootHisto->GetRMS() << std::endl;
173 TF1 *
f1 =
new TF1(
"f1",
"gaus",1,3);
174 rootHisto->Fit(
"f1");
175 mean = f1->GetParameter(1);
176 rms = f1->GetParameter(2);
178 clientHisto->setBinContent(1,mean);
179 clientHisto->setBinContent(2,rms);
183 clientHisto->setBinContent(1,-1);
184 clientHisto->setBinContent(2,-1);
185 if(counterClientOperation<1)
edm::LogError (
"DQMClientExample") <<
"--- The following ME :"<< histoName <<
" cannot be found\n"
186 <<
"--- on the DQM source side !\n";
194 const QReport * theQReport = clientHisto->getQReport(QTestName_);
196 if(counterClientOperation<1)
197 edm::LogWarning (
"DQMClientExample") <<
"*** Summary of Quality Test for clientHisto: \n"
199 <<
"--- status ="<< theQReport->
getStatus() <<
"\n"
200 <<
"--- message ="<< theQReport->
getMessage() <<
"\n";
202 vector<dqm::me_util::Channel> badChannels = theQReport->
getBadChannels();
203 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
204 channel != badChannels.end(); channel++) {
205 if(counterClientOperation<1)
206 edm::LogError (
"DQMClientExample") <<
" Bad channels: "<<(*channel).getBin()<<
" "<<(*channel).getContents();
210 if(counterClientOperation<1)
edm::LogError (
"DQMClientExample") <<
"--- No QReport is found for clientHisto!\n"
211 <<
"--- Please check your XML and config files -> QTestName ( " << QTestName_ <<
" )must be the same!\n";
214 counterClientOperation++;
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
const std::string & getMessage(void) const
get message attached to test
virtual ~DQMClientExample()
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
int getStatus(void) const
get test status (see Core/interface/QTestStatus.h)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
const std::vector< DQMChannel > & getBadChannels(void) const
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
void beginRun(const edm::Run &r, const edm::EventSetup &c)
DQMClientExample(const edm::ParameterSet &ps)
TH1F * getTH1F(void) const
void endRun(const edm::Run &r, const edm::EventSetup &c)
void analyze(const edm::Event &e, const edm::EventSetup &c)
void setCurrentFolder(const std::string &fullpath)