Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-10-02 22:46:28

0001 #include "FWCore/Framework/interface/Frameworkfwd.h"
0002 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0003 #include "FWCore/Framework/interface/Event.h"
0004 #include "FWCore/Framework/interface/EventSetup.h"
0005 #include "FWCore/Framework/interface/ESWatcher.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 
0008 #include "CondFormats/RunInfo/interface/LHCInfoPerLS.h"
0009 #include "CondFormats/DataRecord/interface/LHCInfoPerLSRcd.h"
0010 
0011 #include <memory>
0012 #include <iostream>
0013 #include <cassert>
0014 
0015 class LHCInfoPerLSAnalyzer : public edm::one::EDAnalyzer<> {
0016 public:
0017   explicit LHCInfoPerLSAnalyzer(const edm::ParameterSet&)
0018       : tokenInfoPerLS_(esConsumes<LHCInfoPerLS, LHCInfoPerLSRcd>()) {}
0019 
0020 private:
0021   void beginJob() override {}
0022   void analyze(const edm::Event&, const edm::EventSetup&) override;
0023   void endJob() override {}
0024 
0025   edm::ESWatcher<LHCInfoPerLSRcd> infoPerLSWatcher_;
0026 
0027   edm::ESGetToken<LHCInfoPerLS, LHCInfoPerLSRcd> tokenInfoPerLS_;
0028 };
0029 
0030 void LHCInfoPerLSAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0031   // get InfoPerLS
0032   assert(infoPerLSWatcher_.check(iSetup));
0033   const LHCInfoPerLS& infoPerLS = iSetup.getData(tokenInfoPerLS_);
0034 
0035   assert(infoPerLS.fillNumber() == 7066);
0036   assert(infoPerLS.lumiSection() == 1);
0037   assert(infoPerLS.crossingAngleX() == 170);
0038   assert(infoPerLS.crossingAngleY() == 170);
0039   assert(infoPerLS.betaStarX() == 11);
0040   assert(infoPerLS.betaStarY() == 11);
0041   assert(infoPerLS.runNumber() == 301765);
0042   edm::LogInfo("LHCInfoPerLSAnalyzer") << "LHCInfoPerLS retrieved:\n" << infoPerLS;
0043 }
0044 
0045 DEFINE_FWK_MODULE(LHCInfoPerLSAnalyzer);