CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/Validation/RecoTau/plugins/DQMSimpleFileSaver.cc

Go to the documentation of this file.
00001 #include "Validation/RecoTau/plugins/DQMSimpleFileSaver.h"
00002 
00003 // framework & common header files
00004 #include "FWCore/Framework/interface/Frameworkfwd.h"
00005 #include "FWCore/Framework/interface/MakerMacros.h"
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 
00008 //DQM services
00009 #include "DQMServices/Core/interface/DQMStore.h"
00010 #include "FWCore/ServiceRegistry/interface/Service.h"
00011 #include "DQMServices/Core/interface/MonitorElement.h"
00012 
00013 #include <iostream>
00014 
00015 TauDQMSimpleFileSaver::TauDQMSimpleFileSaver(const edm::ParameterSet& cfg)
00016 {
00017   //std::cout << "<TauDQMSimpleFileSaver::TauDQMSimpleFileSaver>:" << std::endl;
00018 
00019   cfgError_ = 0;
00020 
00021   outputFileName_ = cfg.getParameter<std::string>("outputFileName");
00022   if ( outputFileName_ == "" ) {
00023     edm::LogError("TauDQMSimpleFileSaver") << " No outputFileName specified --> histograms will NOT be saved !!";
00024     cfgError_ = 1;
00025   } else if ( outputFileName_.find(".root") == std::string::npos ) {
00026     edm::LogError("TauDQMSimpleFileSaver") << " Invalid outputFileName = " << outputFileName_ << " --> histograms will NOT be saved !!";
00027     cfgError_ = 1;
00028   }
00029 }
00030 
00031 TauDQMSimpleFileSaver::~TauDQMSimpleFileSaver() 
00032 {
00033 // nothing to be done yet...
00034 }
00035 
00036 void TauDQMSimpleFileSaver::analyze(const edm::Event&, const edm::EventSetup&)
00037 {
00038 // nothing to be done yet...
00039 }
00040 
00041 void TauDQMSimpleFileSaver::endJob()
00042 {
00043   std::cout << "<TauDQMSimpleFileSaver::endJob>:" << std::endl;
00044 
00045 //--- check that configuration parameters contain no errors
00046   if ( cfgError_ ) {
00047     edm::LogError ("endJob") << " Error in Configuration ParameterSet --> histograms will NOT be saved !!";
00048     return;
00049   }
00050 
00051 //--- check that DQMStore service is available
00052   if ( !edm::Service<DQMStore>().isAvailable() ) {
00053     edm::LogError ("endJob") << " Failed to access dqmStore --> histograms will NOT be saved !!";
00054     return;
00055   }  
00056 
00057   DQMStore& dqmStore = (*edm::Service<DQMStore>());
00058   dqmStore.save(outputFileName_);      
00059 }
00060 
00061 #include "FWCore/Framework/interface/MakerMacros.h"
00062 
00063 DEFINE_FWK_MODULE(TauDQMSimpleFileSaver);