Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-28 03:09:37

0001 /****************************************************************************
0002  *
0003  * This is a part of TOTEM/PPS offline software.
0004  * Author:
0005  *   Laurent Forthomme (laurent.forthomme@cern.ch)
0006  *
0007  ****************************************************************************/
0008 
0009 #include "FWCore/Framework/interface/Frameworkfwd.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/Framework/interface/ESHandle.h"
0014 #include "FWCore/Framework/interface/ESWatcher.h"
0015 #include "FWCore/Framework/interface/MakerMacros.h"
0016 
0017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0018 #include "FWCore/ServiceRegistry/interface/Service.h"
0019 
0020 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0021 
0022 #include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h"
0023 #include "CondFormats/DataRecord/interface/PPSTimingCalibrationRcd.h"
0024 
0025 #include <memory>
0026 
0027 class PPSTimingCalibrationAnalyzer : public edm::one::EDAnalyzer<> {
0028 public:
0029   explicit PPSTimingCalibrationAnalyzer(const edm::ParameterSet&)
0030       : tokenCalibration_(esConsumes<PPSTimingCalibration, PPSTimingCalibrationRcd>()) {}
0031 
0032 private:
0033   void beginJob() override {}
0034   void analyze(const edm::Event&, const edm::EventSetup&) override;
0035   void endJob() override {}
0036 
0037   edm::ESWatcher<PPSTimingCalibrationRcd> calibWatcher_;
0038 
0039   edm::ESGetToken<PPSTimingCalibration, PPSTimingCalibrationRcd> tokenCalibration_;
0040 };
0041 
0042 void PPSTimingCalibrationAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0043   // get timing calibration parameters
0044   if (calibWatcher_.check(iSetup)) {
0045     edm::LogInfo("PPSTimingCalibrationAnalyzer") << "Calibrations retrieved:\n" << iSetup.getData(tokenCalibration_);
0046   }
0047 }
0048 
0049 DEFINE_FWK_MODULE(PPSTimingCalibrationAnalyzer);