52 counterEvt_=0; counterLS_ = 0;
53 counterClientOperation = 0;
59 monitorName_ = parameters_.getUntrackedParameter<
string>(
"monitorName",
"YourSubsystemName");
60 cout <<
"DQMClientExample: Monitor name = " << monitorName_ << endl;
61 if (monitorName_ !=
"" ) monitorName_ = monitorName_+
"/" ;
64 prescaleLS_ = parameters_.getUntrackedParameter<
int>(
"prescaleLS", -1);
65 cout <<
"DQMClientExample: DQM lumi section prescale = " << prescaleLS_ <<
" lumi section(s)"<< endl;
66 prescaleEvt_ = parameters_.getUntrackedParameter<
int>(
"prescaleEvt", -1);
67 cout <<
"DQMClientExample: DQM event prescale = " << prescaleEvt_ <<
" events(s)"<< endl;
70 QTestName_ = parameters_.getUntrackedParameter<
string>(
"QTestName",
"exampleQTest");
71 cout <<
"DQMClientExample: QTest name to be ran on clientHisto = " << QTestName_ << endl;
73 clientOnEachEvent = parameters_.getUntrackedParameter<
bool>(
"clientOnEachEvent",
false);
74 if(clientOnEachEvent)
cout <<
"DQMClientExample: run Client on each event" << endl;
75 clientOnEndLumi = parameters_.getUntrackedParameter<
bool>(
"clientOnEndLumi",
true);
76 if(clientOnEndLumi)
cout <<
"DQMClientExample: run Client at the end of each lumi section" << endl;
77 clientOnEndRun = parameters_.getUntrackedParameter<
bool>(
"clientOnEndRun",
false);
78 if(clientOnEndRun)
cout <<
"DQMClientExample: run Client at the end of each run" << endl;
79 clientOnEndJob = parameters_.getUntrackedParameter<
bool>(
"clientOnEndJob",
false);
80 if(clientOnEndJob)
cout <<
"DQMClientExample: run Client at the end of the job" << endl;
92 dbe_->setCurrentFolder(monitorName_+
"DQMclient");
93 clientHisto =
dbe_->book1D(
"clientHisto",
"Guassian fit results.", 2, 0, 1);
115 if(clientOnEachEvent){
116 if (prescaleEvt_>0 && counterEvt_ % prescaleEvt_ == 0) performClient();
125 if(!clientOnEachEvent && clientOnEndLumi){
126 if( prescaleLS_ > 0 && counterLS_ % prescaleLS_ == 0) performClient();
133 if(clientOnEndRun) performClient();
140 std::cout <<
"DQMSourceClient::endJob()" << std::endl;
141 if(clientOnEndJob) performClient();
150 std::cout <<
"***** run Client operations as defined in: *****" << std::endl;
151 std::cout <<
"***** DQMClientExample::performClient ********" << std::endl;
159 string histoName = monitorName_ +
"DQMsource/C1/histo2";
164 if (TH1F *rootHisto = meHisto->
getTH1F()) {
165 if(counterClientOperation<1)
166 std::cout<<
"=== DQMClientExample::performClient => the histo is found: entries="<< rootHisto->GetEntries() <<
"\n" 167 <<
" mean=" << rootHisto->GetMean() <<
" rms=" << rootHisto->GetRMS() << std::endl;
170 TF1 *
f1 =
new TF1(
"f1",
"gaus",1,3);
172 mean = f1->GetParameter(1);
173 rms = f1->GetParameter(2);
175 clientHisto->setBinContent(1,mean);
176 clientHisto->setBinContent(2,rms);
180 clientHisto->setBinContent(1,-1);
181 clientHisto->setBinContent(2,-1);
182 if(counterClientOperation<1)
edm::LogError (
"DQMClientExample") <<
"--- The following ME :"<< histoName <<
" cannot be found\n" 183 <<
"--- on the DQM source side !\n";
191 const QReport * theQReport = clientHisto->getQReport(QTestName_);
193 if(counterClientOperation<1)
194 edm::LogWarning (
"DQMClientExample") <<
"*** Summary of Quality Test for clientHisto: \n" 196 <<
"--- status ="<< theQReport->
getStatus() <<
"\n" 197 <<
"--- message ="<< theQReport->
getMessage() <<
"\n";
199 vector<dqm::me_util::Channel> badChannels = theQReport->
getBadChannels();
200 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
201 channel != badChannels.end(); channel++) {
202 if(counterClientOperation<1)
203 edm::LogError (
"DQMClientExample") <<
" Bad channels: "<<(*channel).getBin()<<
" "<<(*channel).getContents();
207 if(counterClientOperation<1)
edm::LogError (
"DQMClientExample") <<
"--- No QReport is found for clientHisto!\n" 208 <<
"--- Please check your XML and config files -> QTestName ( " << QTestName_ <<
" )must be the same!\n";
211 counterClientOperation++;
static AlgebraicMatrix initialize()
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)
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)