Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-23 04:28:38

0001 // -*- C++ -*-
0002 //
0003 // Class:      DQMRootFileReader
0004 //
0005 /**\class DQMRootFileReader
0006 
0007 Description: Simple example showing how to read MonitorElements from a DQM plain
0008 ROOT file
0009 
0010 Implementation:
0011 <Notes on implementation>
0012 */
0013 //
0014 //
0015 //
0016 
0017 // system include files
0018 #include <iostream>
0019 #include <string>
0020 #include <vector>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0024 #include "FWCore/Framework/interface/MakerMacros.h"
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026 #include "DQMServices/Core/interface/DQMStore.h"
0027 #include "FWCore/ServiceRegistry/interface/Service.h"
0028 
0029 using std::cout;
0030 using std::endl;
0031 
0032 //
0033 // class declaration
0034 //
0035 class DQMRootFileReader : public edm::one::EDAnalyzer<> {
0036 public:
0037   typedef dqm::legacy::DQMStore DQMStore;
0038   explicit DQMRootFileReader(const edm::ParameterSet &);
0039   ~DQMRootFileReader() override = default;
0040 
0041   void analyze(const edm::Event &, const edm::EventSetup &) override;
0042 
0043 private:
0044   // ----------member data ---------------------------
0045   // back-end interface
0046   DQMStore *dbe;
0047   std::string filename;
0048 };
0049 
0050 //
0051 // constructors and destructor
0052 //
0053 DQMRootFileReader::DQMRootFileReader(const edm::ParameterSet &iConfig) {
0054   // get hold of back-end interface
0055   dbe = edm::Service<DQMStore>().operator->();
0056   filename = iConfig.getUntrackedParameter<std::string>("RootFileName", "test_playback.root");
0057 }
0058 
0059 //
0060 // member functions
0061 //
0062 
0063 // ------------ method called to produce the data  ------------
0064 void DQMRootFileReader::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
0065   // NOTE: this is here just because we need it after the beginRun of
0066   // MEtoEDMCoverter which calls a Reset on all MEs.
0067   dbe->open(filename, false, "", "", DQMStore::OpenRunDirs::StripRunDirs);
0068 }
0069 
0070 // define this as a plug-in
0071 DEFINE_FWK_MODULE(DQMRootFileReader);