Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:37:37

0001 // -*- C++ -*-
0002 //
0003 // Class:      RetrieveCTPPSBeamParameters
0004 //
0005 // Description: Test analyzer for reading CTPPS beam parameters condition data
0006 //
0007 //              Simple analyzer that retrieves CTTPSBeamParameters record from a sql
0008 //              database file, as a test of offline conditions implementation.
0009 //
0010 // Original Author:  Wagner De Paula Carvalho
0011 //         Created:  Wed, 21 Nov 2018 17:35:07 GMT
0012 //
0013 //==================================================================================
0014 
0015 #include <memory>
0016 
0017 #include "FWCore/Framework/interface/Frameworkfwd.h"
0018 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0019 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0020 
0021 #include "FWCore/Framework/interface/Event.h"
0022 #include "FWCore/Framework/interface/EventSetup.h"
0023 #include "FWCore/Framework/interface/MakerMacros.h"
0024 
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026 #include "FWCore/Framework/interface/ESHandle.h"
0027 #include "FWCore/ServiceRegistry/interface/Service.h"
0028 
0029 #include "CondFormats/PPSObjects/interface/CTPPSBeamParameters.h"
0030 #include "CondFormats/DataRecord/interface/CTPPSBeamParametersRcd.h"
0031 
0032 #include <cstdint>
0033 
0034 class RetrieveCTPPSBeamParameters : public edm::one::EDAnalyzer<> {
0035 public:
0036   explicit RetrieveCTPPSBeamParameters(const edm::ParameterSet& ps)
0037       : label_(ps.getParameter<std::string>("label")),
0038         tokenBeamParameters_(esConsumes<CTPPSBeamParameters, CTPPSBeamParametersRcd>(edm::ESInputTag("", label_))) {}
0039 
0040   ~RetrieveCTPPSBeamParameters() override = default;
0041 
0042 private:
0043   void analyze(const edm::Event&, const edm::EventSetup&) override;
0044   std::string label_;
0045 
0046   edm::ESGetToken<CTPPSBeamParameters, CTPPSBeamParametersRcd> tokenBeamParameters_;
0047 };
0048 
0049 //---------------------------------------------------------------------------------------
0050 
0051 void RetrieveCTPPSBeamParameters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0052   edm::LogInfo("CTPPSBeamParameters") << "\n" << iSetup.getData(tokenBeamParameters_) << "\n";
0053 }
0054 
0055 DEFINE_FWK_MODULE(RetrieveCTPPSBeamParameters);