Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:24

0001 // system includes
0002 #include <cstdio>
0003 #include <iostream>
0004 #include <sys/time.h>
0005 
0006 // user includes
0007 #include "FWCore/Framework/interface/MakerMacros.h"
0008 #include "FWCore/Framework/interface/Frameworkfwd.h"
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0011 #include "FWCore/Framework/interface/Event.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "FWCore/ServiceRegistry/interface/Service.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "CondFormats/SiPixelObjects/interface/SiPixelPerformanceSummary.h"
0016 #include "CondFormats/DataRecord/interface/SiPixelPerformanceSummaryRcd.h"
0017 
0018 using namespace cms;
0019 using namespace std;
0020 
0021 namespace cms {
0022   class SiPixelPerformanceSummaryReader : public edm::one::EDAnalyzer<> {
0023   public:
0024     explicit SiPixelPerformanceSummaryReader(const edm::ParameterSet&);
0025     ~SiPixelPerformanceSummaryReader() override;
0026 
0027     void analyze(const edm::Event&, const edm::EventSetup&) override;
0028 
0029   private:
0030     const edm::ESGetToken<SiPixelPerformanceSummary, SiPixelPerformanceSummaryRcd> perfSummaryToken_;
0031     const bool printdebug_;
0032   };
0033 }  // namespace cms
0034 
0035 SiPixelPerformanceSummaryReader::SiPixelPerformanceSummaryReader(const edm::ParameterSet& iConfig)
0036     : perfSummaryToken_(esConsumes()), printdebug_(iConfig.getUntrackedParameter<bool>("printDebug", false)) {}
0037 
0038 SiPixelPerformanceSummaryReader::~SiPixelPerformanceSummaryReader() = default;
0039 
0040 void SiPixelPerformanceSummaryReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) {
0041   edm::LogInfo("SiPixelPerformanceSummaryReader") << "start reading SiPixelPerformanceSummary" << endl;
0042   const SiPixelPerformanceSummary* SiPixelPerformanceSummary_ = &iSetup.getData(perfSummaryToken_);
0043   edm::LogInfo("SiPixelPerformanceSummaryReader") << "end reading SiPixelPerformanceSummary" << endl;
0044 
0045   SiPixelPerformanceSummary_->print();
0046   vector<uint32_t> allDetIds = SiPixelPerformanceSummary_->getAllDetIds();
0047   if (!allDetIds.empty())
0048     SiPixelPerformanceSummary_->print(allDetIds[0]);
0049   SiPixelPerformanceSummary_->printAll();
0050 }
0051 DEFINE_FWK_MODULE(SiPixelPerformanceSummaryReader);