Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:18

0001 #include <iostream>
0002 #include <map>
0003 
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 #include "Geometry/MuonNumbering/interface/MuonGeometryConstants.h"
0010 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0011 
0012 class MuonGeometryConstantsTester : public edm::one::EDAnalyzer<> {
0013 public:
0014   explicit MuonGeometryConstantsTester(const edm::ParameterSet&);
0015 
0016   void beginJob() override {}
0017   void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
0018   void endJob() override {}
0019 
0020 private:
0021   edm::ESGetToken<MuonGeometryConstants, IdealGeometryRecord> token_;
0022 };
0023 
0024 MuonGeometryConstantsTester::MuonGeometryConstantsTester(const edm::ParameterSet&) {
0025   token_ = esConsumes<MuonGeometryConstants, IdealGeometryRecord>(edm::ESInputTag{});
0026 }
0027 
0028 void MuonGeometryConstantsTester::analyze(const edm::Event&, const edm::EventSetup& iS) {
0029   const auto& par = iS.getData(token_);
0030   const MuonGeometryConstants* parMuon = &par;
0031   if (parMuon != nullptr) {
0032     edm::LogVerbatim("MuonNumbering") << "\n\nMuonDDDConstants found with " << parMuon->size() << " contents";
0033     for (unsigned int k = 0; k < parMuon->size(); ++k) {
0034       auto entry = parMuon->getEntry(k);
0035       edm::LogVerbatim("MuonNumbering") << " [" << k << "] " << entry.first << " = " << entry.second;
0036     }
0037   } else {
0038     edm::LogVerbatim("MuonNumbering") << "\n\nMuonDDDConstants not found in Event Setup";
0039   }
0040 }
0041 
0042 DEFINE_FWK_MODULE(MuonGeometryConstantsTester);