CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ZDCMonitorClient Class Reference

#include <ZDCMonitorClient.h>

Inheritance diagram for ZDCMonitorClient:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (void)
 Analyze. More...
 
void analyze (const edm::Event &evt, const edm::EventSetup &es)
 
void beginJob ()
 BeginJob. More...
 
void beginLuminosityBlock (const edm::LuminosityBlock &l, const edm::EventSetup &c)
 BeginLumiBlock. More...
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun. More...
 
void createTests (void)
 Create tests. More...
 
void dumpHistograms (int &runNum, std::vector< TH1F * > &hist1d, std::vector< TH2F * > &hist2d)
 
void endJob (void)
 EndJob. More...
 
void endLuminosityBlock (const edm::LuminosityBlock &l, const edm::EventSetup &c)
 EndLumiBlock. More...
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 EndRun. More...
 
void errorSummary ()
 Generate error summary. More...
 
void htmlOutput (void)
 HtmlOutput. More...
 
void initialize (const edm::ParameterSet &ps)
 
void loadHistograms (TFile *infile, const char *fname)
 
void offlineSetup ()
 
bool prescale ()
 Boolean prescale test for this event. More...
 
void report (bool update)
 Create reports. More...
 
void resetAllME (void)
 reset all monitor elements More...
 
 ZDCMonitorClient ()
 Constructors. More...
 
 ZDCMonitorClient (const edm::ParameterSet &ps)
 
 ~ZDCMonitorClient ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void removeAllME (void)
 
void writeDBfile ()
 

Private Attributes

std::string baseHtmlDir_
 
edm::CPUTimer cpu_timer
 
DQMStoredbe_
 Connection to the DQM backend. More...
 
int debug_
 Verbosity switch used for debugging or informational output. More...
 
bool enableMonitorDaemon_
 
int ievent_
 
int ievt_
 
int ilumisec_
 
std::string inputFile_
 
int irun_
 
int itime_
 
int maxlumisec_
 
int minlumisec_
 
std::string monitorName_
 units of "updates", TBD More...
 
time_t mytime_
 
int nlumisecs_
 counters and flags More...
 
bool Online_
 
int prescaleEvt_
 
int prescaleLS_
 units of events More...
 
int prescaleTime_
 units of lumi sections More...
 
int prescaleUpdate_
 units of minutes More...
 
struct {
   double   elapsedTime
 
   double   startTime
 
   timeval   startTV
 
   double   updateTime
 
   timeval   updateTV
 
psTime_
 
int resetEvents_
 
int resetLS_
 
std::string rootFolder_
 
bool runningStandalone_
 
bool saved_
 
bool showTiming_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 18 of file ZDCMonitorClient.h.

Constructor & Destructor Documentation

ZDCMonitorClient::ZDCMonitorClient ( )

Constructors.

Definition at line 41 of file ZDCMonitorClient.cc.

41 {}
ZDCMonitorClient::ZDCMonitorClient ( const edm::ParameterSet ps)

Definition at line 37 of file ZDCMonitorClient.cc.

References initialize().

37  {
38  initialize(ps);
39 }
void initialize(const edm::ParameterSet &ps)
ZDCMonitorClient::~ZDCMonitorClient ( )

Destructor.

Definition at line 44 of file ZDCMonitorClient.cc.

References gather_cfg::cout, and debug_.

44  {
45 
46  if (debug_>0) std::cout << "ZDCMonitorClient: Exit ..." << std::endl;
47 }
int debug_
Verbosity switch used for debugging or informational output.
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

void ZDCMonitorClient::analyze ( void  )

Analyze.

Definition at line 399 of file ZDCMonitorClient.cc.

References gather_cfg::cout, createTests(), dbe_, debug_, errorSummary(), and DQMStore::runQTests().

Referenced by analyze(), endLuminosityBlock(), and endRun().

399  {
400  if (debug_>0)
401  std::cout <<"<ZDCMonitorClient> Entered ZDCMonitorClient::analyze()"<<std::endl;
402  if(debug_>1) std::cout<<"\nZDC Monitor Client heartbeat...."<<std::endl;
403 
404  createTests();
405  //mui_->doMonitoring();
406  dbe_->runQTests();
407  errorSummary();
408 
409 
410  return;
411  }
int debug_
Verbosity switch used for debugging or informational output.
void errorSummary()
Generate error summary.
DQMStore * dbe_
Connection to the DQM backend.
void runQTests(void)
Definition: DQMStore.cc:3198
void createTests(void)
Create tests.
tuple cout
Definition: gather_cfg.py:121
void ZDCMonitorClient::analyze ( const edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 362 of file ZDCMonitorClient.cc.

References analyze(), gather_cfg::cout, debug_, edm::EventID::event(), edm::EventBase::id(), ievent_, ievt_, ilumisec_, irun_, itime_, edm::EventBase::luminosityBlock(), max(), maxlumisec_, bookConverter::min, minlumisec_, mytime_, prescale(), prescaleEvt_, resetAllME(), resetEvents_, resetLS_, edm::EventID::run(), runningStandalone_, edm::EventBase::time(), and edm::Timestamp::value().

362  {
363 
364  if (debug_>1)
365  std::cout <<"Entered ZDCMonitorClient::analyze(const Evt...)"<<std::endl;
366 
367  if(resetEvents_>0 && (ievt_%resetEvents_)==0) resetAllME(); // use ievt_ here, not ievent_, since ievent is the event #, not the # of events processed
368  if(resetLS_>0 && (ilumisec_%resetLS_)==0) resetAllME();
369 
370  // environment datamembers
371 
372  // Don't process out-of-order lumi block information in online running
373  //if (Online_ && (int)e.luminosityBlock()<ilumisec_) return;
374  irun_ = e.id().run();
375  ilumisec_ = e.luminosityBlock();
376  ievent_ = e.id().event();
377  itime_ = e.time().value();
378  mytime_ = (e.time().value())>>32;
379 
380  if (minlumisec_==0)
384 
385  if (debug_>1)
386  std::cout << "ZDCMonitorClient: evts: "<< ievt_ << ", run: " << irun_ << ", LS: " << ilumisec_ << ", evt: " << ievent_ << ", time: " << itime_ << std::endl;
387 
388  ievt_++;
389 
390  if ( runningStandalone_) return;
391 
392  // run if we want to check individual events, and if this event isn't prescaled
393  if (prescaleEvt_>0 && !prescale())
394  analyze();
395 }
bool prescale()
Boolean prescale test for this event.
int debug_
Verbosity switch used for debugging or informational output.
const T & max(const T &a, const T &b)
void analyze(void)
Analyze.
void resetAllME(void)
reset all monitor elements
tuple cout
Definition: gather_cfg.py:121
void ZDCMonitorClient::beginJob ( void  )
virtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 154 of file ZDCMonitorClient.cc.

References gather_cfg::cout, debug_, and ievt_.

154  {
155 
156  if( debug_>0 ) std::cout << "ZDCMonitorClient: beginJob" << std::endl;
157 
158  ievt_ = 0;
159 
160  return;
161 }
int debug_
Verbosity switch used for debugging or informational output.
tuple cout
Definition: gather_cfg.py:121
void ZDCMonitorClient::beginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup c 
)
virtual

BeginLumiBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 336 of file ZDCMonitorClient.cc.

References gather_cfg::cout, debug_, ilumisec_, and edm::LuminosityBlockBase::luminosityBlock().

337 {
338  // don't allow 'backsliding' across lumi blocks in online running
339  // This still won't prevent some lumi blocks from being evaluated multiple times. Need to think about this.
340  //if (Online_ && (int)l.luminosityBlock()<ilumisec_) return;
341  if (debug_>0) std::cout <<"Entered Monitor Client beginLuminosityBlock for LS = "<<l.luminosityBlock()<<std::endl;
343  if( debug_>0 ) std::cout << "ZDCMonitorClient: beginLuminosityBlock" << std::endl;
344 }
int debug_
Verbosity switch used for debugging or informational output.
LuminosityBlockNumber_t luminosityBlock() const
tuple cout
Definition: gather_cfg.py:121
void ZDCMonitorClient::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
virtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 164 of file ZDCMonitorClient.cc.

References DQMStore::book2D(), DQMStore::bookFloat(), gather_cfg::cout, dbe_, debug_, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getName(), MonitorElement::getTH2F(), edm::RunBase::id(), DQMStore::removeElement(), rootFolder_, edm::RunID::run(), DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

164  {
165 
166  if (debug_>0)
167  std::cout << std::endl<<"ZDCMonitorClient: Standard beginRun() for run " << r.id().run() << std::endl<<std::endl;
168 
169  // Get current channel quality
170  /*
171  edm::ESHandle<HcalChannelQuality> p;
172  c.get<HcalChannelQualityRcd>().get(p);
173  chanquality_= new HcalChannelQuality(*p.product());
174  */
175 
176  std::string eventinfo="EventInfo";
177  if (rootFolder_!="ZDC")
178  eventinfo+="DUMMY";
179 
180  // Setup histograms -- this is all we will do for ZDC Monitor at the moment!
181  MonitorElement* me; //JEFF
182  dbe_->setCurrentFolder(rootFolder_+eventinfo.c_str()+"/");
183  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/reportSummary");
184  if (me)
185  dbe_->removeElement(me->getName());
186  me = dbe_->bookFloat("reportSummary");
187  me->Fill(-1); // set status to unknown at startup
188  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/reportSummaryMap");
189  if (me)
190  dbe_->removeElement(me->getName());
191  me = dbe_->book2D("reportSummaryMap","ZDC Report Summary Map",4,0,4,1,0,1);
192  TH2F* myhist=me->getTH2F();
193  myhist->GetXaxis()->SetBinLabel(1,"HAD-");
194  myhist->GetXaxis()->SetBinLabel(2,"EM-");
195  myhist->GetXaxis()->SetBinLabel(3,"EM+");
196  myhist->GetXaxis()->SetBinLabel(4,"HAD+");
197  // Set all values to -1
198  myhist->SetBinContent(1,1,-1);
199  myhist->SetBinContent(2,1,-1);
200  myhist->SetBinContent(3,1,-1);
201  myhist->SetBinContent(4,1,-1);
202 
203 
204  dbe_->setCurrentFolder(rootFolder_+eventinfo.c_str()+"/reportSummaryContents/");
205  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/reportSummary/reportSummaryContents/ZDC_HADMinus");
206  if (me)
207  dbe_->removeElement(me->getName());
208  me = dbe_->bookFloat("ZDC_HADMinus");
209  me->Fill(-1); // set status to unknown at startup
210  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/reportSummary/reportSummaryContents/ZDC_EMMinus");
211  if (me)
212  dbe_->removeElement(me->getName());
213  me = dbe_->bookFloat("ZDC_EMMinus");
214  me->Fill(-1); // set status to unknown at startup
215  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/reportSummary/reportSummaryContents/ZDC_EMPlus");
216  if (me)
217  dbe_->removeElement(me->getName());
218  me = dbe_->bookFloat("ZDC_EMPlus");
219  me->Fill(-1); // set status to unknown at startup
220  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/reportSummary/reportSummaryContents/ZDC_HADPlus");
221  if (me)
222  dbe_->removeElement(me->getName());
223  me = dbe_->bookFloat("ZDC_HADPlus");
224  me->Fill(-1); // set status to unknown at startup
225 
226  // Add dummy DAQ Summary, DCS Summary
227  dbe_->setCurrentFolder(rootFolder_+eventinfo.c_str());
228  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/DAQSummary");
229  if (me)
230  dbe_->removeElement(me->getName());
231  me = dbe_->bookFloat("DAQSummary");
232  me->Fill(-1); // set status to unknown at startup
233 
234  dbe_->setCurrentFolder(rootFolder_+eventinfo.c_str()+"/DAQContents");
235  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/DAQSummary/DAQContents/ZDC_HADPlus");
236  if (me)
237  dbe_->removeElement(me->getName());
238  me = dbe_->bookFloat("ZDC_HADPlus");
239  me->Fill(-1); // set status to unknown at startup
240 
241  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/DAQSummary/DAQContents/ZDC_HADMinus");
242  if (me)
243  dbe_->removeElement(me->getName());
244  me = dbe_->bookFloat("ZDC_HADMinus");
245  me->Fill(-1); // set status to unknown at startup
246 
247  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/DAQSummary/DAQContents/ZDC_EMPlus");
248  if (me)
249  dbe_->removeElement(me->getName());
250  me = dbe_->bookFloat("ZDC_EMPlus");
251  me->Fill(-1); // set status to unknown at startup
252 
253  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/DAQSummary/DAQContents/ZDC_EMMinus");
254  if (me)
255  dbe_->removeElement(me->getName());
256  me = dbe_->bookFloat("ZDC_EMMinus");
257  me->Fill(-1); // set status to unknown at startup
258 
259  // DCS Summary
260  dbe_->setCurrentFolder(rootFolder_+eventinfo.c_str());
261  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/DCSSummary");
262  if (me)
263  dbe_->removeElement(me->getName());
264  me = dbe_->bookFloat("DCSSummary");
265  me->Fill(-1); // set status to unknown at startup
266 
267  dbe_->setCurrentFolder(rootFolder_+eventinfo.c_str()+"/DCSContents");
268  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/DCSSummary/DCSContents/ZDC_HADPlus");
269  if (me)
270  dbe_->removeElement(me->getName());
271  me = dbe_->bookFloat("ZDC_HADPlus");
272  me->Fill(-1); // set status to unknown at startup
273 
274  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/DCSSummary/DCSContents/ZDC_HADMinus");
275  if (me)
276  dbe_->removeElement(me->getName());
277  me = dbe_->bookFloat("ZDC_HADMinus");
278  me->Fill(-1); // set status to unknown at startup
279 
280  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/DCSSummary/DCSContents/ZDC_EMPlus");
281  if (me)
282  dbe_->removeElement(me->getName());
283  me = dbe_->bookFloat("ZDC_EMPlus");
284  me->Fill(-1); // set status to unknown at startup
285 
286  me=dbe_->get(rootFolder_+eventinfo.c_str()+"/DCSSummary/DCSContents/ZDC_EMMinus");
287  if (me)
288  dbe_->removeElement(me->getName());
289  me = dbe_->bookFloat("ZDC_EMMinus");
290  me->Fill(-1); // set status to unknown at startup
291 
292 }
const std::string & getName(void) const
get name of ME
RunID const & id() const
Definition: RunBase.h:41
RunNumber_t run() const
Definition: RunID.h:43
int debug_
Verbosity switch used for debugging or informational output.
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:879
std::string rootFolder_
void Fill(long long x)
DQMStore * dbe_
Connection to the DQM backend.
void removeElement(const std::string &name)
Definition: DQMStore.cc:3088
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1693
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1070
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
void ZDCMonitorClient::createTests ( void  )

Create tests.

Definition at line 414 of file ZDCMonitorClient.cc.

References gather_cfg::cout, and debug_.

Referenced by analyze(), and report().

414  {
415 
416  if( debug_>0 ) std::cout << "ZDCMonitorClient: creating all tests" << std::endl;
417  return;
418 }
int debug_
Verbosity switch used for debugging or informational output.
tuple cout
Definition: gather_cfg.py:121
void ZDCMonitorClient::dumpHistograms ( int &  runNum,
std::vector< TH1F * > &  hist1d,
std::vector< TH2F * > &  hist2d 
)

Definition at line 474 of file ZDCMonitorClient.cc.

475 {
476  hist1d.clear();
477  hist2d.clear();
478  return;
479 }
void ZDCMonitorClient::endJob ( void  )
virtual

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 296 of file ZDCMonitorClient.cc.

References gather_cfg::cout, debug_, and ievt_.

296  {
297 
298  if( debug_>0 )
299  std::cout << "ZDCMonitorClient: endJob, ievt = " << ievt_ << std::endl;
300 
301  return;
302 }
int debug_
Verbosity switch used for debugging or informational output.
tuple cout
Definition: gather_cfg.py:121
void ZDCMonitorClient::endLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup c 
)
virtual

EndLumiBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 347 of file ZDCMonitorClient.cc.

References analyze(), gather_cfg::cout, debug_, Online_, prescale(), and prescaleLS_.

347  {
348 
349  // don't allow backsliding in online running
350  //if (Online_ && (int)l.luminosityBlock()<ilumisec_) return;
351  if( debug_>0 ) std::cout << "ZDCMonitorClient: std::endluminosityBlock" << std::endl;
352  if(prescaleLS_>0 && !prescale()){
353  // do scheduled tasks...
354  if (Online_)
355  analyze();
356  }
357 
358  return;
359 }
bool prescale()
Boolean prescale test for this event.
int prescaleLS_
units of events
int debug_
Verbosity switch used for debugging or informational output.
void analyze(void)
Analyze.
tuple cout
Definition: gather_cfg.py:121
void ZDCMonitorClient::endRun ( const edm::Run r,
const edm::EventSetup c 
)
virtual

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 305 of file ZDCMonitorClient.cc.

References analyze(), gather_cfg::cout, debug_, edm::RunBase::id(), ievt_, inputFile_, irun_, Online_, report(), and edm::RunID::run().

305  {
306 
307  if (debug_>0)
308  std::cout << std::endl<<"<ZDCMonitorClient> Standard endRun() for run " << r.id().run() << std::endl<<std::endl;
309 
310  if (!Online_)
311  analyze();
312 
313  if( debug_ >0) std::cout <<"ZDCMonitorClient: processed events: "<<ievt_<<std::endl;
314 
315  if (debug_>0) std::cout <<"==>Creating report after run end condition"<<std::endl;
316  if(irun_>1){
317  if(inputFile_.size()!=0) report(true);
318  else report(false);
319  }
320 
321  // dumping to database
322 
323  // need to add separate function to do this!!!
324 
325  return;
326 }
RunID const & id() const
Definition: RunBase.h:41
RunNumber_t run() const
Definition: RunID.h:43
std::string inputFile_
int debug_
Verbosity switch used for debugging or informational output.
void analyze(void)
Analyze.
void report(bool update)
Create reports.
tuple cout
Definition: gather_cfg.py:121
void ZDCMonitorClient::errorSummary ( )

Generate error summary.

Definition at line 438 of file ZDCMonitorClient.cc.

References dbe_, MonitorElement::Fill(), DQMStore::get(), and rootFolder_.

Referenced by analyze(), and report().

438  {
439 
440 
441  float errorSummary = 1.0;
442 
443  char meTitle[256];
444  sprintf(meTitle,"%sEventInfo/errorSummary",rootFolder_.c_str() );
445  MonitorElement* me = dbe_->get(meTitle);
446  if(me) me->Fill(errorSummary);
447 
448  return;
449 }
std::string rootFolder_
void errorSummary()
Generate error summary.
void Fill(long long x)
DQMStore * dbe_
Connection to the DQM backend.
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1693
void ZDCMonitorClient::htmlOutput ( void  )

HtmlOutput.

Definition at line 452 of file ZDCMonitorClient.cc.

Referenced by report().

452  {
453  return;
454 }
void ZDCMonitorClient::initialize ( const edm::ParameterSet ps)

Definition at line 50 of file ZDCMonitorClient.cc.

References baseHtmlDir_, gather_cfg::cout, dbe_, debug_, enableMonitorDaemon_, edm::ParameterSet::getUntrackedParameter(), ievent_, ilumisec_, inputFile_, irun_, itime_, maxlumisec_, minlumisec_, NULL, Online_, DQMStore::open(), cppFunctionSkipper::operator, prescaleEvt_, prescaleLS_, resetEvents_, resetLS_, rootFolder_, runningStandalone_, DQMStore::showDirStructure(), showTiming_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ZDCMonitorClient().

50  {
51 
52  irun_=0; ilumisec_=0; ievent_=0; itime_=0;
53 
55 
56 
57  debug_ = ps.getUntrackedParameter<int>("debug", 0);
58  if (debug_>0)
59  std::cout << std::endl<<" *** ZDC Monitor Client ***" << std::endl<<std::endl;
60 
61  if(debug_>1) std::cout << "ZDCMonitorClient: constructor...." << std::endl;
62 
63  Online_ = ps.getUntrackedParameter<bool>("Online",false);
64  // timing switch
65  showTiming_ = ps.getUntrackedParameter<bool>("showTiming",false);
66 
67  // MonitorDaemon switch
68  enableMonitorDaemon_ = ps.getUntrackedParameter<bool>("enableMonitorDaemon", true);
69  if (debug_>0)
70  {
71  if ( enableMonitorDaemon_ ) std::cout << "-->enableMonitorDaemon switch is ON" << std::endl;
72  else std::cout << "-->enableMonitorDaemon switch is OFF" << std::endl;
73  }
74 
75  // get hold of back-end interface
77  if (debug_>1) dbe_->showDirStructure();
78 
79  // DQM ROOT input
80  inputFile_ = ps.getUntrackedParameter<std::string>("inputFile", "");
81  if(inputFile_.size()!=0 && debug_>0) std::cout << "-->reading DQM input from " << inputFile_ << std::endl;
82 
83  if( ! enableMonitorDaemon_ ) {
84  if( inputFile_.size() != 0 && dbe_!=NULL){
87  }
88  }
89 
90  //histogram reset freqency, update frequency, timeout
91  resetEvents_ = ps.getUntrackedParameter<int>("resetFreqEvents",-1); //number of real events
92  if(resetEvents_!=-1 && debug_>0) std::cout << "-->Will reset histograms every " << resetEvents_ <<" events." << std::endl;
93  resetLS_ = ps.getUntrackedParameter<int>("resetFreqLS",-1); //number of lumisections
94  if(resetLS_!=-1 && debug_>0) std::cout << "-->Will reset histograms every " << resetLS_ <<" lumi sections." << std::endl;
95 
96  // base Html output directory
97  baseHtmlDir_ = ps.getUntrackedParameter<std::string>("baseHtmlDir", "");
98  if (debug_>0)
99  {
100  if( baseHtmlDir_.size() != 0)
101  std::cout << "-->HTML output will go to baseHtmlDir = '" << baseHtmlDir_ << "'" << std::endl;
102  else std::cout << "-->HTML output is disabled" << std::endl;
103  }
104 
105  runningStandalone_ = ps.getUntrackedParameter<bool>("runningStandalone", false); // unnecessary? Or use for offline client processing?
106  if (debug_>1)
107  {
108  if( runningStandalone_ ) std::cout << "-->standAlone switch is ON" << std::endl;
109  else std::cout << "-->standAlone switch is OFF" << std::endl;
110  }
111 
112  // set parameters
113  prescaleEvt_ = ps.getUntrackedParameter<int>("diagnosticPrescaleEvt", -1);
114  if (debug_>0)
115  std::cout << "===>DQM event prescale = " << prescaleEvt_ << " event(s)"<< std::endl;
116 
117  prescaleLS_ = ps.getUntrackedParameter<int>("diagnosticPrescaleLS", -1);
118  if (debug_>0) std::cout << "===>DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< std::endl;
119 
120  // Base folder for the contents of this job
121  std::string subsystemname = ps.getUntrackedParameter<std::string>("subSystemFolder", "ZDC") ;
122  if (debug_>0) std::cout << "===>ZDCMonitor name = " << subsystemname << std::endl;
123  rootFolder_ = subsystemname + "/";
124 
125  return;
126 }
T getUntrackedParameter(std::string const &, T const &) const
std::string inputFile_
#define NULL
Definition: scimark2.h:8
int prescaleLS_
units of events
int debug_
Verbosity switch used for debugging or informational output.
std::string rootFolder_
DQMStore * dbe_
Connection to the DQM backend.
std::string baseHtmlDir_
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2840
tuple cout
Definition: gather_cfg.py:121
void showDirStructure(void) const
Definition: DQMStore.cc:3277
void ZDCMonitorClient::loadHistograms ( TFile *  infile,
const char *  fname 
)

Definition at line 463 of file ZDCMonitorClient.cc.

References edm::hlt::Exception.

464 {
465  if(!infile){
466  throw cms::Exception("Incomplete configuration") <<
467  "ZDCMonitorClient: this histogram file is bad! " <<std::endl;
468  return;
469  }
470  return;
471 }
void ZDCMonitorClient::offlineSetup ( )

Definition at line 456 of file ZDCMonitorClient.cc.

456  {
457  // std::cout << std::endl;
458  // std::cout << " *** Hcal Generic Monitor Client, for offline operation***" << std::endl;
459  // std::cout << std::endl;
460  return;
461 }
bool ZDCMonitorClient::prescale ( )

Boolean prescale test for this event.

Return true if this event should be skipped according to the prescale condition...

Accommodate a logical "OR" of the possible tests

Definition at line 482 of file ZDCMonitorClient.cc.

References gather_cfg::cout, debug_, ievt_, ilumisec_, prescaleEvt_, and prescaleLS_.

Referenced by analyze(), and endLuminosityBlock().

482  {
484 
486  if (debug_>1) std::cout <<"ZDCMonitorClient::prescale"<<std::endl;
487 
488  // If no prescales are set, return 'false'. (This means that we should process the event.)
489  if(prescaleEvt_<=0 && prescaleLS_<=0) return false;
490 
491  // Now check whether event should be kept. Assume that it should not by default
492 
493  bool keepEvent=false;
494 
495  // Keep event if prescaleLS test is met or if prescaleEvt test is met
496  if(prescaleLS_>0 && (ilumisec_%prescaleLS_)==0) keepEvent = true; // check on ls prescale;
497  if (prescaleEvt_>0 && (ievt_%prescaleEvt_)==0) keepEvent = true; //
498 
499  // if any criteria wants to keep the event, do so
500  if (keepEvent) return false; // event should be kept; don't apply prescale
501  return true; // apply prescale by default
502 }
int prescaleLS_
units of events
int debug_
Verbosity switch used for debugging or informational output.
tuple cout
Definition: gather_cfg.py:121
void ZDCMonitorClient::removeAllME ( void  )
private

Definition at line 130 of file ZDCMonitorClient.cc.

References DQMStore::cd(), gather_cfg::cout, dbe_, debug_, DQMStore::dirExists(), NULL, DQMStore::removeContents(), and DQMStore::rmdir().

130  {
131  if (debug_>0) std::cout <<"<ZDCMonitorClient>removeAllME()"<<std::endl;
132  if(dbe_==NULL) return;
133 
134  // go to top directory
135  dbe_->cd();
136  // remove MEs at top directory
137  dbe_->removeContents();
138  // remove directory (including subdirectories recursively)
139  if(dbe_->dirExists("Collector"))
140  dbe_->rmdir("Collector");
141  if(dbe_->dirExists("Summary"))
142  dbe_->rmdir("Summary");
143  return;
144 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:3046
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:632
#define NULL
Definition: scimark2.h:8
int debug_
Verbosity switch used for debugging or informational output.
void removeContents(void)
erase all monitoring elements in current directory (not including subfolders);
Definition: DQMStore.cc:3080
DQMStore * dbe_
Connection to the DQM backend.
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:720
tuple cout
Definition: gather_cfg.py:121
void ZDCMonitorClient::report ( bool  update)

Create reports.

Definition at line 421 of file ZDCMonitorClient.cc.

References baseHtmlDir_, gather_cfg::cout, createTests(), dbe_, debug_, errorSummary(), htmlOutput(), ievt_, and DQMStore::runQTests().

Referenced by endRun().

421  {
422 
423  if( debug_>0 )
424  std::cout << "ZDCMonitorClient: creating report, ievt = " << ievt_ << std::endl;
425 
426  if(doUpdate){
427  createTests();
428  dbe_->runQTests();
429  }
430  errorSummary();
431 
432  //create html output if specified...
433  if( baseHtmlDir_.size() != 0 && ievt_>0)
434  htmlOutput();
435  return;
436 }
int debug_
Verbosity switch used for debugging or informational output.
void errorSummary()
Generate error summary.
DQMStore * dbe_
Connection to the DQM backend.
void runQTests(void)
Definition: DQMStore.cc:3198
std::string baseHtmlDir_
void createTests(void)
Create tests.
tuple cout
Definition: gather_cfg.py:121
void htmlOutput(void)
HtmlOutput.
void ZDCMonitorClient::resetAllME ( void  )

reset all monitor elements

do a reset of all monitor elements...

Definition at line 148 of file ZDCMonitorClient.cc.

References gather_cfg::cout, and debug_.

Referenced by analyze().

148  {
149  if (debug_>0) std::cout <<"<ZDCMonitorClient> resetAllME()"<<std::endl;
150  return;
151 }
int debug_
Verbosity switch used for debugging or informational output.
tuple cout
Definition: gather_cfg.py:121
void ZDCMonitorClient::writeDBfile ( )
private

Definition at line 328 of file ZDCMonitorClient.cc.

330 {
331  return; // not used for ZDC
332 
333 } // ZDCMonitorClient::writeDBfile()

Member Data Documentation

std::string ZDCMonitorClient::baseHtmlDir_
private

Definition at line 133 of file ZDCMonitorClient.h.

Referenced by initialize(), and report().

edm::CPUTimer ZDCMonitorClient::cpu_timer
private

Definition at line 98 of file ZDCMonitorClient.h.

DQMStore* ZDCMonitorClient::dbe_
private

Connection to the DQM backend.

Definition at line 114 of file ZDCMonitorClient.h.

Referenced by analyze(), beginRun(), errorSummary(), initialize(), removeAllME(), and report().

int ZDCMonitorClient::debug_
private

Verbosity switch used for debugging or informational output.

Definition at line 94 of file ZDCMonitorClient.h.

Referenced by analyze(), beginJob(), beginLuminosityBlock(), beginRun(), createTests(), endJob(), endLuminosityBlock(), endRun(), initialize(), prescale(), removeAllME(), report(), resetAllME(), and ~ZDCMonitorClient().

double ZDCMonitorClient::elapsedTime

Definition at line 109 of file ZDCMonitorClient.h.

bool ZDCMonitorClient::enableMonitorDaemon_
private

Definition at line 130 of file ZDCMonitorClient.h.

Referenced by initialize().

int ZDCMonitorClient::ievent_
private

Definition at line 117 of file ZDCMonitorClient.h.

Referenced by analyze(), and initialize().

int ZDCMonitorClient::ievt_
private

Definition at line 125 of file ZDCMonitorClient.h.

Referenced by analyze(), beginJob(), endJob(), endRun(), prescale(), and report().

int ZDCMonitorClient::ilumisec_
private

Definition at line 118 of file ZDCMonitorClient.h.

Referenced by analyze(), beginLuminosityBlock(), initialize(), and prescale().

std::string ZDCMonitorClient::inputFile_
private

Definition at line 132 of file ZDCMonitorClient.h.

Referenced by endRun(), and initialize().

int ZDCMonitorClient::irun_
private

Definition at line 117 of file ZDCMonitorClient.h.

Referenced by analyze(), endRun(), and initialize().

int ZDCMonitorClient::itime_
private

Definition at line 117 of file ZDCMonitorClient.h.

Referenced by analyze(), and initialize().

int ZDCMonitorClient::maxlumisec_
private

Definition at line 119 of file ZDCMonitorClient.h.

Referenced by analyze(), and initialize().

int ZDCMonitorClient::minlumisec_
private

Definition at line 119 of file ZDCMonitorClient.h.

Referenced by analyze(), and initialize().

std::string ZDCMonitorClient::monitorName_
private

units of "updates", TBD

The name of the monitoring process which derives from this class, used to standardize filename and file structure

Definition at line 91 of file ZDCMonitorClient.h.

time_t ZDCMonitorClient::mytime_
private

Definition at line 121 of file ZDCMonitorClient.h.

Referenced by analyze().

int ZDCMonitorClient::nlumisecs_
private

counters and flags

Definition at line 102 of file ZDCMonitorClient.h.

bool ZDCMonitorClient::Online_
private

Definition at line 104 of file ZDCMonitorClient.h.

Referenced by endLuminosityBlock(), endRun(), and initialize().

int ZDCMonitorClient::prescaleEvt_
private

Prescale variables for restricting the frequency of analyzer behavior. The base class does not implement prescales. Set to -1 to be ignored.

Definition at line 84 of file ZDCMonitorClient.h.

Referenced by analyze(), initialize(), and prescale().

int ZDCMonitorClient::prescaleLS_
private

units of events

Definition at line 85 of file ZDCMonitorClient.h.

Referenced by endLuminosityBlock(), initialize(), and prescale().

int ZDCMonitorClient::prescaleTime_
private

units of lumi sections

Definition at line 86 of file ZDCMonitorClient.h.

int ZDCMonitorClient::prescaleUpdate_
private

units of minutes

Definition at line 87 of file ZDCMonitorClient.h.

struct { ... } ZDCMonitorClient::psTime_
int ZDCMonitorClient::resetEvents_
private

Definition at line 126 of file ZDCMonitorClient.h.

Referenced by analyze(), and initialize().

int ZDCMonitorClient::resetLS_
private

Definition at line 127 of file ZDCMonitorClient.h.

Referenced by analyze(), and initialize().

std::string ZDCMonitorClient::rootFolder_
private

Definition at line 123 of file ZDCMonitorClient.h.

Referenced by beginRun(), errorSummary(), and initialize().

bool ZDCMonitorClient::runningStandalone_
private

Definition at line 129 of file ZDCMonitorClient.h.

Referenced by analyze(), and initialize().

bool ZDCMonitorClient::saved_
private

Definition at line 103 of file ZDCMonitorClient.h.

bool ZDCMonitorClient::showTiming_
private

Definition at line 97 of file ZDCMonitorClient.h.

Referenced by initialize().

double ZDCMonitorClient::startTime

Definition at line 108 of file ZDCMonitorClient.h.

timeval ZDCMonitorClient::startTV

Definition at line 107 of file ZDCMonitorClient.h.

double ZDCMonitorClient::updateTime

Definition at line 110 of file ZDCMonitorClient.h.

timeval ZDCMonitorClient::updateTV

Definition at line 107 of file ZDCMonitorClient.h.