Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-15 01:25:11

0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/MakerMacros.h"
0003 #include "FWCore/Framework/interface/ESTransientHandle.h"
0004 #include "FWCore/Framework/interface/EventSetup.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0007 #include "DetectorDescription/DDCMS/interface/DDCompactView.h"
0008 
0009 #include <iostream>
0010 
0011 using namespace std;
0012 using namespace cms;
0013 using namespace edm;
0014 
0015 class DDTestCompactView : public one::EDAnalyzer<> {
0016 public:
0017   explicit DDTestCompactView(const ParameterSet& iConfig)
0018       : m_tag(iConfig.getParameter<ESInputTag>("DDDetector")), m_token(esConsumes(m_tag)) {}
0019 
0020   void beginJob() override {}
0021   void analyze(Event const& iEvent, EventSetup const&) override;
0022   void endJob() override {}
0023 
0024 private:
0025   const ESInputTag m_tag;
0026   const ESGetToken<DDCompactView, IdealGeometryRecord> m_token;
0027 };
0028 
0029 void DDTestCompactView::analyze(const Event&, const EventSetup& iEventSetup) {
0030   LogVerbatim("Geometry") << "DDTestCompactView::analyze: " << m_tag;
0031   ESTransientHandle<DDCompactView> cpv = iEventSetup.getTransientHandle(m_token);
0032 
0033   std::cout << "Get trackerParameters:detIdShifts:\n";
0034   auto const& vec = cpv->getVector<int>("detIdShifts");
0035   for (const auto& i : vec)
0036     std::cout << i << ", ";
0037   std::cout << ";\ndone\n";
0038 
0039   auto const& v = cpv->detector()->vectors().at("trackerParameters:detIdShifts");
0040   for (const auto& i : v)
0041     std::cout << i << ", ";
0042   std::cout << ";\ndone\n";
0043 
0044   LogVerbatim("Geometry") << "DDTestCompactView::analyze done.";
0045 }
0046 
0047 DEFINE_FWK_MODULE(DDTestCompactView);